關於Spring框架,@Runwith報紅問題


父項目中有

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
子項目中有
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>5.3.13</version>
</dependency>

而使用注解@RunWith和@Test報紅
我的理解是沒有引入到父項目的依賴,所以我的解決辦法是加<parent></parent>
<parent>
<groupId>Com.Ren</groupId>
<artifactId>SpringExercise02</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

當然也可以在子項目中重新添加依賴


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM