解释afterPropertiesSet
在spring的bean的生命周期中,实例化->生成对象->属性填充后会进行afterPropertiesSet方法,这个方法可以用在一些特殊情况中,也就是某个对象的某个属性需要经过外界得到,比如说查询数据库等方式,这时候可以用到spring的该特性,只需要实现InitializingBean即可:
@Component("a")
public class A implements InitializingBean {
private B b;
public A(B b) {
this.b = b;
}
@Override
public void afterPropertiesSet() throws Exception {
}
}
这样可以在afterPropertiesSet方法中进行你的额外操作。
Thank you for the good writeup. It in fact was a amusement account it. Look advanced to far added agreeable from you! By the way, how can we communicate?
antivert generic order meclizine 25mg for sale antivert 25 mg pills
pharmaceutical online ordering tadalafil online canadian pharmacy
Wow that was unusual. I just wrote an really long comment but after I clicked submit my comment didn't show up. Grrrr... well I'm not writing all that over again. Regardless, just wanted to say great blog!
Thinking of obtaining Accutane RX? Check out Accutane RX for in-depth guides.
After looking over a few of the articles on your web page, I seriously like your technique of blogging. I bookmarked it to my bookmark site list and will be checking back soon. Please visit my website too and let me know how you feel.
Bel article, je l'ai partagé avec mes amis.