我正在使用spring-boot-starter-jetty替换spring-boot-starter-tomcat。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>
但是当我使用mvn spring-boot:run
运行时,我得到了:
2019-04-15 11:39:54,583 INFO (MBeanExporter.java:433)- Registering beans for JMX exposure on startup
2019-04-15 11:39:54,585 INFO (MBeanExporter.java:895)- Bean with name 'dataSource' has been autodetected for JMX exposure
2019-04-15 11:39:54,592 INFO (MBeanExporter.java:668)- Located MBean 'dataSource': registering with JMX server as MBean [com.alibaba.druid.spring.boot.autoconfigure:name=dataSource,type=DruidDataSourceWrapper]
2019-04-15 11:39:54,601 INFO (DefaultLifecycleProcessor.java:351)- Starting beans in phase 2147483647
2019-04-15 11:39:54,615 INFO (StartupInfoLogger.java:59)- Started Application in 10.888 seconds (JVM running for 16.338)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.971 s
[INFO] Finished at: 2019-04-15T11:39:54+08:00
[INFO] Final Memory: 72M/383M
[INFO] ------------------------------------------------------------------------
[WARNING] The requested profile "offical" could not be activated because it does not exist.
2019-04-15 11:39:55,073 INFO (AbstractApplicationContext.java:993)- Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@16af2879: startup date [Mon Apr 15 11:39:44 CST 2019]; root of context hierarchy
2019-04-15 11:39:55,073 INFO (DefaultLifecycleProcessor.java:366)- Stopping beans in phase 2147483647
2019-04-15 11:39:55,073 INFO (MBeanExporter.java:451)- Unregistering JMX-exposed beans on shutdown
2019-04-15 11:39:55,081 INFO (MBeanRegistrationSupport.java:183)- Unregistering JMX-exposed beans
2019-04-15 11:39:55,086 INFO (DruidDataSource.java:1885)- {dataSource-1} closing ...
2019-04-15 11:39:55,095 INFO (DruidDataSource.java:1955)- {dataSource-1} closed
可能的原因是什么?
答案 0 :(得分:0)
我已通过删除-C
中的spring.main.web-application-type
解决了这个问题: