基于Maven创建SpringBoot工程

基础1-创建SpringBoot工程

基础1-创建SpringBoot工程

基础1-创建SpringBoot工程

POM文件配置如下:

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0"

         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>com.springboot</groupId>

    <artifactId>springboot.test</artifactId>

    <version>1.0-SNAPSHOT</version>

    <parent>

        <groupId>org.springframework.boot</groupId>

        <artifactId>spring-boot-starter-parent</artifactId>

        <version>2.2.2.RELEASE</version>

        <relativePath/>

    </parent>

    <dependencies>

        <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>

    </dependencies>

    <build>

        <plugins>

            <plugin>

                <groupId>org.springframework.boot</groupId>

                <artifactId>spring-boot-maven-plugin</artifactId>

                <version>2.2.2.RELEASE</version>

                <executions>

                    <execution>

                        <goals>

                            <goal>repackage</goal>

                        </goals>

                    </execution>

                </executions>

            </plugin>

        </plugins>

    </build>

</project>

基于SpringBoot创建向导来创建SpringBoot工程

基础1-创建SpringBoot工程

然后一直下一步即可,这种方式的优点在于,你不用去配置POM文件,当前是你选择的是Maven来作为管理工具;

注意:需要时刻保持联网状态;

主程序已经生成好了,只需编写具体的业务逻辑;

resources文件夹的目录结构:

①static:保存所有的静态资源,例如:js、css、图片等;

②templates:保存所有的模板页面,由于SpringBoot默认使用嵌入式的Tomcat,默认不支持JSP页面,可以使用其他模板引擎,例如:freemarker、thymeleaf等

③application.properties:SpringBoot的应用配置文件,可以修改默认设置;

相关文章: