【发布时间】:2013-08-30 05:56:41
【问题描述】:
代码:
import org.springframework.beans.BeansException;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class Hello {
private String s;
public Hello(String str){
s = str;
}
public void sayHi(){
System.out.println(s);
}
public static void main(String []args){
ClassPathXmlApplicationContext ac = null;//
try {
ac = new ClassPathXmlApplicationContext(new String[] {"config.xml"});
Hello h = (Hello) ac.getBean("hello");//
h.sayHi();
} catch (BeansException e) {
e.printStackTrace();
}
}
}
IntelliJ Idea 标记为红色的问题:
这很奇怪,因为 BeansException 从 Throwable 继承: http://static.springsource.org/spring/docs/2.0.2/api/org/springframework/beans/BeansException.html 什么原因以及如何解决?
【问题讨论】:
-
如果你构建你的项目会发生什么?
-
谢谢。这是个好问题。我已经安装了 maven 并进行了全新安装,一切都很好。看来问题只有IntelliJidea IDE了。
-
我发表了我的评论作为答案,因为它解决了您的问题。
标签: java spring intellij-idea