• springboot项目目录结构


    idea新建springboot项目

    按默认下一步至完成,默认目录结构如下

    pom.xml文件内容如下

    <?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>2.1.9.RELEASE</version>
            <relativePath/> <!-- lookup parent from repository -->
        </parent>
        <groupId>com.example</groupId>
        <artifactId>demo</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <name>demo</name>
        <description>Demo project for Spring Boot</description>
    
        <properties>
            <java.version>1.8</java.version>
        </properties>
    
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter</artifactId>
            </dependency>
    
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <scope>test</scope>
            </dependency>
        </dependencies>
    
        <build>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                </plugin>
            </plugins>
        </build>
    
    </project>

     主类如下

    package com.example.demo;
    
    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.SpringBootApplication;
    
    @SpringBootApplication
    public class DemoApplication {
    
        public static void main(String[] args) {
            SpringApplication.run(DemoApplication.class, args);
        }
    
    }

    @SpringBootApplication注解在spring-boot-autoconfigure-2.1.9.RELEASE.jar包下

    SpringApplication类在spring-boot-2.1.9.RELEASE.jar包下 

    主类测试类如下

    package com.example.demo;
    
    import org.junit.Test;
    import org.junit.runner.RunWith;
    import org.springframework.boot.test.context.SpringBootTest;
    import org.springframework.test.context.junit4.SpringRunner;
    
    @RunWith(SpringRunner.class)
    @SpringBootTest
    public class DemoApplicationTests {
    
        @Test
        public void contextLoads() {
        }
    
    }

    @Test和@RunWith注解在junit-4.12.jar包下

    SpringRunner类在spring-test-5.1.10.RELEASE.jar包下

    @SpringBootTest注解在spring-boot-test-2.1.9.RELEASE.jar包下

    application.properties为空

  • 相关阅读:
    hdu 1599 find the mincost route (最小环与floyd算法)
    hdu 3371(prim算法)
    hdu 1598 find the most comfortable road (并查集+枚举)
    hdu 1879 继续畅通工程 (并查集+最小生成树)
    hdu 1272 小希的迷宫(并查集+最小生成树+队列)
    UVA 156 Ananagrams ---map
    POJ 3597 Polygon Division (DP)
    poj 3735 Training little cats 矩阵快速幂+稀疏矩阵乘法优化
    poj 3734 Blocks 快速幂+费马小定理+组合数学
    CodeForces 407B Long Path (DP)
  • 原文地址:https://www.cnblogs.com/yanguobin/p/11625081.html
Copyright © 2020-2023  润新知