Maven本身并不是一个单元测试框架,Java世界中主流的单元测试框架为JUnit和TestNG。Maven所做的只是在构建执行到特定生命周期阶段的时候,通过插件来执行JUnit或者TestNG的测试用例。这一插件就是maven-surefire-plugin,可以称之为测试运行器(Test Runner),他能很好的兼容JUnit 3、JUnit 4以及TestNG。
5.父级项目pom文件6.子项目,license ,pom文件4.0.0 pom license uploadData starter org.springframework.boot spring-boot-starter-parent2.5.5 cn.lyu complete0.0.1-SNAPSHOT complete The project is complete 1.8 org.springframework.boot spring-boot-starter-weborg.springframework.boot spring-boot-starter-testtest org.apache.maven.plugins maven-compiler-plugin3.8.1 1.8 1.8 org.apache.maven.plugins maven-surefire-plugin2.22.2 true
7.子项目,uploadData,pom文件4.0.0 complete cn.lyu 0.0.1-SNAPSHOT jar com.example license0.0.1-SNAPSHOT license Demo project for Spring Boot 1.8 org.springframework.boot spring-boot-starterorg.springframework.boot spring-boot-starter-testtest org.springframework.boot spring-boot-starter-webde.schlichtherle.truelicense truelicense-core1.33 net.sourceforge.nekohtml nekohtml1.9.18 org.projectlombok lombokorg.apache.commons commons-lang33.7 cn.hutool hutool-all5.0.6 org.apache.maven.plugins maven-resources-plugin2.4.3 org.apache.maven.plugins maven-surefire-plugin2.22.2 true
8.starter ,pom文件4.0.0 complete cn.lyu 0.0.1-SNAPSHOT jar com.lyu uploadData0.0.1-SNAPSHOT uploadData Demo project for Spring Boot 1.8 org.springframework.boot spring-boot-starterorg.springframework.boot spring-boot-starter-weborg.springframework.boot spring-boot-starter-testtest mysql mysql-connector-javaorg.springframework.boot spring-boot-starter-jdbccom.alibaba druid1.1.14 log4j log4j1.2.17 org.projectlombok lomboktrue mysql mysql-connector-java8.0.21 org.mybatis.spring.boot mybatis-spring-boot-starter1.3.2 com.example license0.0.1-SNAPSHOT org.apache.maven.plugins maven-surefire-plugin2.22.2 true
9.至此,所有模块之间的依赖关系就搞定了,现在将配置文件合并complete cn.lyu 0.0.1-SNAPSHOT 4.0.0 jar starterorg.springframework.boot spring-boot-starterorg.springframework.boot spring-boot-starter-weborg.springframework.boot spring-boot-starter-testtest com.example license0.0.1-SNAPSHOT com.lyu uploadData0.0.1-SNAPSHOT org.springframework.boot spring-boot-maven-plugin2.5.5 cn.lyu.MyApp ZIP repackage org.apache.maven.plugins maven-resources-plugin2.4.3
server.port=80 #启用优雅关机 server.shutdown=graceful #缓冲10秒 spring.lifecycle.timeout-per-shutdown-phase=10s #License相关配置 license.subject=license_demo license.publicAlias=publicCert license.storePass=public_password12345 license.licensePath=D:/workspace/gitee/spring-boot2-license/license/license.lic license.publicKeysStorePath=D:/workspace/gitee/spring-boot2-license/license/publicCerts.keystore json.class.type=jackson spring.datasource.url=jdbc:mysql://119.45.61.44:3306/demo?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&useSSL=false&allowPublicKeyRetrieval=true spring.sql.init.username=root spring.sql.init.password=123456 spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver10.启动类上加上注解@ComponentScan
package cn.lyu;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
@ComponentScan("com.lyu.demo")
@ComponentScan("com.example")
@SpringBootApplication
public class MyApp {
public static void main(String[] args) {
SpringApplication.run(MyApp.class, args);
}
}



