The constructor ClassPathXmlApplicationContext(String) refers to the missing type BeansException


“The constructor ClassPathXmlApplicationContext(String) refers to the missing type BeansException”

“構造函數ClassPathXmlApplicationContext(字符串)是指缺失類型BeansException”

出現錯誤的原因:jar沒有正確引入,即使表面上你能import包。

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

如果你用的eclipes解決 方案:

  進入你的maven倉庫,本地的,刪除關於spring-core,spring-context,刪除了之后,讓工具重新下載一下

然后update maven一下  就ok了

 

 

package zy.test;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class TestUser {
    
    @Test
    public void Test(){
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        
    }

}

---哦了

 

 

     

  

 


免責聲明!

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



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