文章詳情頁
Springboot整合junit過程解析
瀏覽:3日期:2023-05-18 18:54:48
對maven項目的pom.xml進行配置
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> <exclusions><!--junit5不需要配置junit-vintage-engine--> <exclusion> <groupId>org.junit.vintage</groupId> <artifactId>junit-vintage-engine</artifactId> </exclusion> </exclusions></dependency>
測試類如圖所示
junit5可直接掃描測試的主啟動類 也不需要加@runwith注解 只需要加@SpringBootTest 注解 也不需要指定主啟動類的class文件
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持好吧啦網。
標簽:
Spring
相關文章:
排行榜