第1个回答 推荐于2016-06-09
需要实现一个接口
org.springframework.beans.factory.InitializingBean;
这个这个接口有一个afterPropertiesSet 方法需要实现
然后配置bean 的时候指定 init-method="afterPropertiesSet" 如下示例
<bean id="config" class="com.chinapowerit.cmcc.config.Config" init-method="afterPropertiesSet">本回答被提问者和网友采纳