spring boot 学习-创建方式

spring boot是什么

spring boot 是一个快速开发框架,适合小白快速上手开发,它集成了很多优秀的和常用的第三方框架,它简化了xml配置,完全采用注解方式,内部集成了Tomcat、Jetty等http 服务器,最终以java应用程序的方式运行。

spring boot的三种创建方式和目录结构

1.springboot 的创建方式

  •  通过spring.io官网创建  https://spring.io/projects/spring-boot
  •  通过IDE的maven创建  
  •  通过idea、eclipse创建

2.springboot 项目结构,如果通过maven创建,则需要在resource目录下手动创建以下目录结构

  • static文件夹
  • templates文件夹
  • application.properties文件

 3.以下是pom.xml仅供参考

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 3          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 4     <modelVersion>4.0.0</modelVersion>
 5     <parent>
 6         <groupId>org.springframework.boot</groupId>
 7         <artifactId>spring-boot-starter-parent</artifactId>
 8         <version>2.1.4.RELEASE</version>
 9         <relativePath/> 
10     </parent>
11     <groupId>com.study</groupId>
12     <artifactId>springboot</artifactId>
13     <version>0.0.1-SNAPSHOT</version>
14     <name>springboot</name>
15     <description>Demo project for Spring Boot</description>
16     <dependencies>
17         <dependency>
18             <groupId>org.springframework.boot</groupId>
19             <artifactId>spring-boot-starter-web</artifactId>
20         </dependency>
21         <dependency>
22             <groupId>org.springframework.boot</groupId>
23             <artifactId>spring-boot-starter-test</artifactId>
24             <scope>test</scope>
25         </dependency>
26     <build>
27         <plugins>
28             <plugin>
29                 <groupId>org.springframework.boot</groupId>
30                 <artifactId>spring-boot-maven-plugin</artifactId>
31                 <configuration>
32                  <mainClass>com.study.UserApplication</mainClass>
33                 </configuration>
34                 <executions>
35                     <execution>
36                         <goals>
37                             <goal>repackage</goal>
38                         </goals>
39                     </execution>
40                 </executions>
41             </plugin>
42         </plugins>
43     </build>
44     <properties>
45         <java.version>1.8</java.version>
46     </properties>
47 </project>
pom.xml

猜你喜欢

转载自www.cnblogs.com/escapeplan/p/10873059.html