3
代碼:BeanException沒有在理念IDE correcte解決
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 inhertis: http://static.springsource.org/spring/docs/2.0.2/api/org/springframework/beans/BeansException.html 什麼原因和熱修復?謝謝。
如果你建立你的項目會發生什麼? – Magnilex
謝謝。這是個好問題。我已經安裝了maven,並進行了乾淨的安裝,一切正常。似乎只有IntelliJ IDE的問題。 – user710818
我發表了我的評論作爲答案,因爲它解決了你的問題。 – Magnilex