• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

@PostConstruct ,@Preestroy

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
Can anyone please explain me the use of @PostConstruct ,@Preestroy in JSF with an example.
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think that these are part of JSF - they're part of the JSR-250 lifecycle spec.

Spring supports these annotations, I believe.
 
Ranch Hand
Posts: 36
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Tim Holloway:
I don't think that these are part of JSF - they're part of the JSR-250 lifecycle spec.

Spring supports these annotations, I believe.



The JSF 1.2 spec requires support of these annotations in a Java EE 5 environment. That said Mojarra (the RI) supports these two annotations
outside of an EE environment if the annotations are present in the classpath.

As to their explanation, it's pretty straight forward.
Methods marked with the @PostConstruct annotation will be invoked after the bean has been created, any resources have been injected, and any managed properties set, but *before* the bean is actually pushed into scope.

Methods marked with @PreDestroy will be called before the bean has been
removed from scope.

This blog has some examples -> http://weblogs.java.net/blog/jhook/archive/2007/05/jsf_12_ri_backi.html
[ January 22, 2008: Message edited by: Ryan Lubke ]
 
It's never done THAT before. Explain it to me tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic