1. 程式人生 > >spring在測試時遇到報錯

spring在測試時遇到報錯

java.lang.NoSuchMethodError: org.springframework.util.Assert.notNull(Ljava/lang/Object;Ljava/util/function/Supplier;)V

    at org.springframework.test.context.support.ContextLoaderUtils.resolveContextConfigurationAttributes(ContextLoaderUtils.java:240)
    at org.springframework.test.context.support.AbstractTestContextBootstrapper.buildMergedContextConfiguration(AbstractTestContextBootstrapper.java:295)
    at org.springframework.test.context.support.AbstractTestContextBootstrapper.buildTestContext(AbstractTestContextBootstrapper.java:108)
    at org.springframework.test.context.TestContextManager.<init>(TestContextManager.java:139)
    at org.springframework.test.context.TestContextManager.<init>(TestContextManager

原因:spring掃描的包中包含帶有@EnableWebMvc這個註解,所以test無法正常測試。

解決:過濾掉相關類,或者在測試類上加上@WebApplicationContext進行配置

相關推薦

Spring測試

Spring測試報錯,反正就是報錯,各種報錯:   我的錯誤過程: 錯誤1 警告報錯: log4j:WARN No appenders could be found for logger (org.springframework.context.supp

spring測試遇到

java.lang.NoSuchMethodError: org.springframework.util.Assert.notNull(Ljava/lang/Object;Ljava/util/function/Supplier;)V     at org.springf

spring測試save方法

leg clas creat ould seq save eth val ble 用test類測試service的save方法時,報錯如下: 2018-08-24 21:52:13,506 - could not read a hi value com.mysql.jdb

Android真機測試ADB解決方案

異常程式碼: Unable to create Debug Bridge: Unable to start adb server: error: could not install *smartso

spring開啟事務啟動SAXParseException

href 問題 ID ssi 聲明 span point 解析xml execution 在啟動項目時報解析xml文件異常: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c ‘aop:config‘......

測試PHP是否安裝成功,nginx:"Primary script unknown"

stderr php pri index known req tde stc 參數 小生博客:http://xsboke.blog.51cto.com 小生 Q Q:1770058260-------謝謝您的參考,如有疑問,歡迎交流 環境php-5.6.36nginx-

spring boot junit測試的時候MockServerContainer does not support addEndpoint

在編寫junit測試spring boot專案的時候報錯MockServerContainer does not support addEndpoint  然自己在@SpringBootTest中加上SpringBootTest.WebEnvironment.RANDOM_PORT成功解決

spring 在Java中定義了變數ischeck,訪問jsp

可能是衝突了,把ischeck改成其他名稱就好了,我這裡把它改為了check package springForm.test; public class TestUser { private String name; private String password;

spring boot啟動未,但是http請求無法連線

新建了一個控制器,並嘗試進行啟動請求,卻提示無連線: @RestController public class DemoController { @RequestMapping("/hello") public String index() {

在搭建微服務平臺測試的時候出現 Spring jpa findOne(Id)

出現搞錯誤的主要原因是poml檔案中spring boot中的版本是2.0.1.RELEASE org.springframework.boot spring-boot-starter-parent 2

Spring整合DubboXML解決

spring整合dubbo時,xml配置檔案也遇到過這種情況。 dubbo配置檔案報錯 在配置dubbo服務的過程中,經常會遇到雖然程式能夠跑起來,但是配置檔案一堆紅叉,雖然不影響功能,但是確實很讓人噁心。 報錯資訊如下: Multiple annotations

spring pom文件:提示no declaration can be found for element 'dubbo:service'.

net 技術 found cnblogs 點擊 找到 inf 提示 src 轉自:http://blog.csdn.net/happylife_haha/article/details/52755425 pom文件報錯:The matching wildcard is st

tomcat部署新的項目啟動出現信息: Invalid byte tag in constant pool: 15

tomcat 啟動報錯 invalid byte tag in constant pool ......org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 15

自動化測試工具TW及解決方法

ima -1 需要 1.2 使用 policy 報錯 span 技術 自動化測試工具TestWriter使用時遇到的環境配置問題及解決方法如下,歡迎大家一起溝通交流~ 1.1 TW環境 1.1.1 Agent無法連接至服務器 1) 如果Agent與服務端不在一個網段,需要

dubbo spring pom文件:提示no declaration can be found for element 'dubbo:service'.

valid windows validate tex file lib window win fcm pom文件報錯:The matching wildcard is strict, but no declaration can be found for element

spring-boot:run啟動

cti filter col mave main -m 報錯 pre shared Intellij Idea中的spring boot項目,使用main方法運行可以啟動,但是使用mvn spring-boot:run啟動總是報錯 大概意思就是找不到類:org/apache

運行用例Unknow Error:Element xxx is not clickable……的解決方法

cut 處理 ebe 將他 最好 executor tro path img 通常這種情況是由於在點擊該元素時,js更換了元素屬性造成的。 所以可以采用js的方式進行處理 方法如下: WebDriver driver = new FirefoxDriver(); Web

SSM 整合 ehcache spring 配置文件

報錯 ehcache ati bat pre xsd 添加 ext con 添加 <!-- end MyBatis使用ehcache緩存 --> <cache:annotation-driven cache-manager="cacheMana

安裝python3提示api-ms-win-crt-runtime-l1-1-0.dll丟失

.dll mage 目錄 -o vpd lob 丟失 pad microsoft 背景: 安裝python3時會報錯,提示api ms win crt runtime l1-1-0.dll 丟失解決辦法 :一、安裝兩個補丁KB2999226 微軟下載鏈接 https://s

iOS打包上傳ipa文件<ERROR ITMS-90096: "Your binary is not optimized for iPhone 5 - New iPhone apps......>的解決方案

splay update 分享圖片 trait tin log .com bmi graphic 很長一段時間習慣了用企業級證書發布,最近的新項目使用Xcode 9.1發布到AppStore時遇到了一個小問題(emm..其實問題跟Xcode版本沒關系,我也不知道為什麽要聲明