步骤:IDE点击 NEW -> Maven Project -> Next
在filter中输入web或webapp 选择 maven-archetype-webapp
设置包名(Group Id)与项目名(Artifact Id),点击finish完成项目建立
web
1.pom.xml中添加web支持模块spring
<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.9.RELEASE</version> </parent> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency>
2.编写Spring Boot启动类
3.编写HelloController
4.运行主程序测试
在main主函数入口右键Run as,选择Java Applicationapp
maven运行Spring Boot:选择项目 Run as -> Maven Build
webapp
访问项目不用添加项目名
如:http://localhost:8080/hello
不然会出现Web Error Pagemaven