一区二区三区在线-一区二区三区亚洲视频-一区二区三区亚洲-一区二区三区午夜-一区二区三区四区在线视频-一区二区三区四区在线免费观看

服務器之家:專注于服務器技術及軟件下載分享
分類導航

PHP教程|ASP.NET教程|Java教程|ASP教程|編程技術|正則表達式|C/C++|IOS|C#|Swift|Android|VB|R語言|JavaScript|易語言|vb.net|

服務器之家 - 編程語言 - Java教程 - 聊聊springboot2.2.3升級到2.4.0單元測試的區別

聊聊springboot2.2.3升級到2.4.0單元測試的區別

2022-02-20 11:49小瑞 Java教程

這篇文章主要介紹了springboot 2.2.3 升級到 2.4.0單元測試的區別,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教

springboot2.2.3升級到2.4.0單元測試區別

原先單元測試 import org.junit.Test; 然后運行正常,現在運行報錯,

聊聊springboot2.2.3升級到2.4.0單元測試的區別

?
1
import org.junit.Test;

換成

?
1
import org.junit.jupiter.api.Test;

后運行正常。

單個單元測試的這樣沒有問題了,但是我批量執行的還是會報上面的錯誤

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
@Suite.SuiteClasses({
        //dao層測試類
    
        //service層測試類
        CheckConfigServiceTest.class,
        AfterCheckConfigServiceTest.class,
        
        //control層測試類
        //WebTestControllerTest.class      
        //util測試類      
    })
@RunWith(Suite.class
public class BatchTest {
}

最后確實沒有解決整合測試也稱 打包測試的@Suite.SuiteClasses方法,不過找到了別的批量執行單元測試的方法,

在src/test/java 文件夾右鍵,run as -> junit test 一樣可以批量執行!!!

springboot2.4降級到boot2.2.x

最近在做一個springcloud的整合項目,但是springcloud-alibaba的nacos只支持2.2.x版本,而項目開始也沒注意,直接用的2.4版本,所以這里記錄下降級踩下的坑。

這里直接把boot版本號改成2.2.6然后去啟動主啟動類會出現

?
1
2
3
4
5
6
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.2.6.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

以下提示:我的spring和我的boot不兼容,我boot版本太低,讓我改成2.3或者是2.4

***************************
APPLICATION FAILED TO START
***************************

Description:

Your project setup is incompatible with our requirements due to following reasons:

- Spring Boot [2.2.6.RELEASE] is not compatible with this Spring Cloud release train


Action:

Consider applying the following actions:

- Change Spring Boot version to one of the following versions [2.3.x, 2.4.x] .
You can find the latest Spring Boot versions here [https://spring.io/projects/spring-boot#learn].
If you want to learn more about the Spring Cloud Release train compatibility, you can visit this page [https://spring.io/projects/spring-cloud#overview] and check the [Release Trains] section.
If you want to disable this check, just set the property [spring.cloud.compatibility-verifier.enabled=false]

Process finished with exit code 1

我這邊直接把springcloud版本一起降低改成H版本

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<properties>
      <java.version>1.8</java.version>
      <spring-cloud.version>Hoxton.SR9</spring-cloud.version>
  </properties>
  <dependencyManagement>
      <dependencies>
          <dependency>
              <groupId>org.springframework.cloud</groupId>
              <artifactId>spring-cloud-dependencies</artifactId>
              <version>${spring-cloud.version}</version>
              <type>pom</type>
              <scope>import</scope>
          </dependency>
      </dependencies>
  </dependencyManagement>

再次啟動,發現可以了,好了不多bb了,我要去改接下去其他模塊了

聊聊springboot2.2.3升級到2.4.0單元測試的區別

以上為個人經驗,希望能給大家一個參考,也希望大家多多支持服務器之家。

原文鏈接:https://blog.csdn.net/xiaxiaorui2003/article/details/110147666

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 韩国悲惨事件30无删减在线 | 国产高清在线精品一区 | 黑人巨| 久久香蕉电影 | 亚偷熟乱区视频在线观看 | 亚洲国产成人资源在线桃色 | 亚洲 日韩经典 中文字幕 | 四虎影院永久网址 | 国产精品啪啪 | 免费在线观看中文字幕 | 深夜成人 | 亚洲国产在线视频中文字 | 国内视频一区二区 | 99re最新网址 | 插鸡视频在线观看 | 精品99在线观看 | 放荡女小洁的性日记 | 日本aaaa级| 四虎永久免费地址在线观看 | 欧美黑人性 | 91精品天美精东蜜桃传媒免费 | 男人网站视频 | 女人把扒开给男人爽的 | 天美影视传媒mv直接看 | 午夜影视免费 | 视频一区二区 村上凉子 | 2020国产精品视频免费 | 91短视频在线播放 | 美女黑人做受xxxxxⅹ | 国产自产一区c | 小寡妇水真多好紧 | 国产午夜精品一区二区三区 | 无码中文字幕热热久久 | 成人免费播放 | 激情三级做爰在线观看激情 | 咪咪爱小说 | 九九精品免费视频 | 韩国三级视频网站 | 日韩版码免费福利视频 | 午夜AV亚洲一码二中文字幕青青 | 午夜AV内射一区二区三区红桃视 |