1:配置yml文件 server: port: 8080 servlet: context-path: / 2:需要添加有容器,类似tomcat,添加依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency>