This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

PostConstruct and PreDestroy methods can be have any access modifier

 
Deepak Jain
Ranch Hand
Posts: 637
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Page 81 of EJB in action: PostConstruct and PreDestroy methods can be have any access modifier. I can't understand, how is this permitted and how can this work fine. I had a private @PostConstruct method in a stateless session bean and it worked fine. Since PostConstruct is just a method call, how can container which is outside the class invoke a private method.
Please explain.
 
Deepak Jain
Ranch Hand
Posts: 637
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please take time to respond to this question.
 
Joe Harry
Ranch Hand
Posts: 10045
3
Eclipse IDE Mac PPC Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For the container it is the metadata that is required (i.e., the annotations).
 
Deepak Jain
Ranch Hand
Posts: 637
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I understand the metadata part of it, But in the end lifecycle callbacks are just methods, and if a method is marked private, How can it be invoked from a code like the container outside the class.

Experts/Ranchers, Please take time and reply.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic