コード:
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 理由と修正方法は?