Tuesday, 14 March 2017

What are the JSR-250 Annotations? Explain them ?

Spring has JSR-250 based annotations which include @PostConstruct, @PreDestroy and @Resource annotations.
  • @PostConstruct: This annotation can be used as an alternate of initialization callback.
  • @PreDestroy: This annotation can be used as an alternate of destruction callback.
  • @Resource : This annotation can be used on fields or setter methods. The @Resource annotation takes a 'name' attribute which will be interpreted as the bean name to be injected. You can say, it follows by-name autowiring semantics.

No comments:

Post a Comment