Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/313.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 为没有任何主类的spring项目运行JUnit测试_Java_Spring_Spring Boot_Unit Testing_Junit - Fatal编程技术网

Java 为没有任何主类的spring项目运行JUnit测试

Java 为没有任何主类的spring项目运行JUnit测试,java,spring,spring-boot,unit-testing,junit,Java,Spring,Spring Boot,Unit Testing,Junit,我有一个在SpringBoot上运行的Maven项目。 这里我面临的问题是,有一个maven项目只包括应用程序的业务逻辑。因此,项目中不包括任何主类 我必须在该项目中编写一些测试用例,以便在执行mvn清理安装时作为独立运行。 但是Junit测试失败,因为无法找到Spring启动配置 以下是项目架构 /web-layer (contains the Spring boot Initialier main class) -- pom.xml /service-layer ( Here I hav

我有一个在SpringBoot上运行的Maven项目。 这里我面临的问题是,有一个maven项目只包括应用程序的业务逻辑。因此,项目中不包括任何主类

我必须在该项目中编写一些测试用例,以便在执行
mvn清理安装时作为独立运行。
但是Junit测试失败,因为
无法找到Spring启动配置

以下是项目架构

/web-layer (contains the Spring boot Initialier main class)
  -- pom.xml
/service-layer ( Here I have some unit test case)
  -- pom.xml 
服务层是一个独立的JAR,将作为maven依赖项构建并注入Web层。 我们希望在构建服务层时运行一些要通过的单元测试用例