参考了下其它正确的Spring Boot项目,发现是这行配置及代码出错了
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
1
2
3
4
把它改成如下代码,重新install成功了
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
1
2
3
4
spring-boot-starter和spring-boot-starter-web的区别:
spring-boot-starter 是Spring Boot的核心启动器,包含了自动配置、日志和YAML
spring-boot-starter-web 支持全栈式Web开发,包括Tomcat和spring-webmvc
Web开发要用后者。
spring-boot和docker使用:https://www.cnblogs.com/ityouknow/p/8599093.html
这里有两个注意点:ADD demo-0.0.1-SNAPSHOT.jar app.jar 中第一个jar是项目的jar包,pom.xml中<dockerDirectory>./src/main/docker</dockerDirectory>要这样配置