使用spring官网 SPRING INITIALIZR 来构建项目结构(地址:http://start.spring.io/)
搭建步骤:
1.使用上述方法构建项目
2.将下载的压缩包解压
3.将解压之后的压缩包作为一个maven项目导入eclipse中
4.然后在pom.xml文件中将下面的依赖进行修改
<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>
5.通过运行带有@SpringbootApplication注解的主程序类,便可运行项目。
6.成功运行之后的效果如下
7.通过本机ip地址:8080或者localhost:8080在浏览器地址栏进行访问,如果出现以下界面,说明项目成功启动运行没有问题