新建了一个maven 项目 测试 spring 连接数据库时报错

Exception in thread "main" java.lang.NoSuchMethodError: org.springframework.beans.factory.xml.XmlBean

 

代码为

 

public class Login {
public static void main(String[] args) {
String location="dateSource.xml";
ApplicationContext context=new ClassPathXmlApplicationContext(location);
UserDaoImpl studentDaoImp = (UserDaoImpl)context.getBean("studentDaoImp");

}}

一般来说NoSuchMethodError 的错误为 maven中jar包的版本不一致 或者 maven仓库 中有两个版本的jar包

我的maven仓中spring  jar包为1.2.6的版本其中spring-beans的为1.2.3后来改为1.2.6  在测试不报这个错了

Exception in thread "main" java.lang.NoSuchMethodError: org.springframework.beans.factory.xml.XmlBean

 

相关文章:

  • 2021-10-31
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-12
  • 2021-10-19
  • 2021-06-16
  • 2021-08-31
  • 2021-07-30
相关资源
相似解决方案