愿历尽千帆,归来仍是少年
1.基础springBoot框架
编辑工具:IDEA、jdk1.8、tomcat8、maven3.3.9
编码格式:UTF-8
参考文献:https://www.cnblogs.com/zhangbin1989/p/9473292.html
https://blog.csdn.net/fanshukui/article/details/80258793
构建项目:
- 新建springboot项目
new-->Project-->Spring Initralizr
2. 项目结构

3.基础依赖pom.xml
<properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.8</java.version> </properties>
<dependencies> <!-- SpringBoot Web容器 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency>
<!-- SpringBoot 内嵌tomcat --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <scope>provided</scope> </dependency> <!--注意:spring boot对jsp的支持不是很好,在使用spring boot自带tomcat的同时,还需要引入另外的一个tomcat,以来如下所示,且scope属性需要被注释掉 --> <!--注掉的原因是:maven默认scope是compile,表示打包时会把此包打入jar包中,而provided表示打包时不会打如jar包中,因为它默认是jar包中会提供,说白了就是你标注了provided就不会被打入jar包中,项目跑起来就肯定会有问题了 2019/12/4 --> <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-jasper</artifactId> <scope>provided</scope> </dependency>
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> </dependencies>
|
4.测试controller
采用RestFul Api接口

5.启动即可
访问网址:http://localhost:9999
从零搭建springboot服务
原文:https://www.cnblogs.com/hxxgo520/p/14710211.html