问题:
我是在创建SpringBoot项目时候,项目跑不起来,控制台打印的是
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.4.7.RELEASE)
2017-10-02 08:47:16.734 INFO 4048 --- [ main] c.e.demo.SpringBootTestApplication : Starting SpringBootTestApplication on DESKTOP-7O0ES0O with PID 4048 (E:\stsWorkSpace\SpringBoot_Test\target\classes started by 柴火 in E:\stsWorkSpace\SpringBoot_Test)
2017-10-02 08:47:16.734 INFO 4048 --- [ main] c.e.demo.SpringBootTestApplication : No active profile set, falling back to default profiles: default
2017-10-02 08:47:16.812 INFO 4048 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@df27fae: startup date [Mon Oct 02 08:47:16 CST 2017]; root of context hierarchy
2017-10-02 08:47:17.890 INFO 4048 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2017-10-02 08:47:17.921 INFO 4048 --- [ main] c.e.demo.SpringBootTestApplication : Started SpringBootTestApplication in 1.634 seconds (JVM running for 2.256)
2017-10-02 08:47:17.921 INFO 4048 --- [ Thread-1] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@df27fae: startup date [Mon Oct 02 08:47:16 CST 2017]; root of context hierarchy
2017-10-02 08:47:17.937 INFO 4048 --- [ Thread-1] o.s.j.e.a.AnnotationMBeanExporter :Unregistering JMX-exposed beans on shutdown
解决办法:
pom文件中有一个这样的依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
修改为
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>