Spring Boot中如何使用Jetty作为嵌入式服务器呢?
下文笔者讲述SpringBoot中使用Jetty作为嵌入式服务器的方法分享,如下所示
SpringBoot嵌入Jetty服务器的实现思路
实现思路: 1.spring-boot-starter-web中排除tomcat 2.引入spring-boot-starter-jetty这个启动器例:SpringBoot使用Jetty嵌入式服务器的示例
spring-boot-starter-web pom.xml <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <exclusions> <exclusion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jetty</artifactId> </dependency> //spring-boot-starter-thymeleaf pom.xml <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> <exclusions> <exclusion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jetty</artifactId> </dependency>
版权声明
本文仅代表作者观点,不代表本站立场。
本文系作者授权发表,未经许可,不得转载。