问题:初始搭建springboot maven项目没有引入web 启动报错
Connected to the target VM, address: '127.0.0.1:58926', transport: 'socket'
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.3.RELEASE)
2019-02-20 19:46:56.895 INFO 2502 --- [ main] com.moji.redis.RedisApiApplication : Starting RedisApiApplication on Mirko.local with PID 2502 (/Users/li.liu/workspace2/redis-api/target/classes started by li.liu in /Users/li.liu/workspace2/redis-api)
2019-02-20 19:46:56.900 INFO 2502 --- [ main] com.moji.redis.RedisApiApplication : The following profiles are active: dev
2019-02-20 19:46:57.656 INFO 2502 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2019-02-20 19:46:57.659 INFO 2502 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
2019-02-20 19:46:57.691 INFO 2502 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 15ms. Found 0 repository interfaces.
2019-02-20 19:46:58.519 INFO 2502 --- [ main] com.moji.redis.RedisApiApplication : Started RedisApiApplication in 2.28 seconds (JVM running for 3.741)
Disconnected from the target VM, address: '127.0.0.1:58926', transport: 'socket'
Process finished with exit code 0
解决办法:
pom 引入依赖
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency>