“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");
        
    }

}

---哦了

 

 

     

  

 

posted on 2017-09-19 11:27  啷个哩个啷  阅读(4786)  评论(0编辑  收藏  举报