日期:2014-05-19  浏览次数:20751 次

spring中init-method与BeanPostProcessor问题
如题如果2个并存的话就会报错误 java.lang.NullPointerException.
配置文件如下:
  <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN"
"http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans>
<bean id="theBeanPostProcessor" class="theSpring2.theBeanPostProcessor.TheBeanPostProcessor"> 
</bean>
<bean id="theBeanPostProcessorA" class="theSpring2.theBeanPostProcessor.TheBeanPostProcessorA" init-method="theInitMethod">
<property name="name" value="cuiyaonan"></property>
</bean>
</beans>


test方法如下:

public class TheMainTest {
public static void main(String[] args){
ClassPathXmlApplicationContext act=new ClassPathXmlApplicationContext("applicationContext_spring2.xml");

}
}

------解决方案--------------------
不明白lz的意思。