我的 Spring Boot 单元测试是否在错误的文件夹中?

问题描述

当我试图为我的控制器生成一个测试时,它被放置在控制器包中而不是 test/java/...所以我手动创建了文件夹,并在项目中,结构设置 java 为主测试文件夹。虽然现在我的测试不会以错误消息开始:

***************************
APPLICATION Failed TO START
***************************

Description:

Field developerCourseRepository in com.alasdoo.developercourseassignment.service.impl.DeveloperCourseServiceImpl required a bean named 'entityManagerFactory' that Could not be found.

The injection point has the following annotations:
    - @org.springframework.beans.factory.annotation.Autowired(required=true)

...

java.lang.IllegalStateException: Failed to load ApplicationContext

我的项目结构:

..src[]
     frontend[]
     main[]
         java[]
             com[]...
     test[]
         java[] - the main test folder
             com[]....

当我尝试在其他文件夹中移动 test[] 时,似乎没有任何变化,所以我想问题不应该出在项目的结构方式上,但再一次没有其他任何意义。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)