Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

@PostConstruct may be final?

 
Tridib Samanta
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to Java EE API (java doc), a method annotated with @PostConstruct may be final. But, according to EJB 3.0 specification (page 305)
A lifecycle callback interceptor method must not be declared as final or static
. Which one is correct?
 
Mikalai Zaikin
Ranch Hand
Posts: 3371
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're right. There is some inconsistency.

I would use EJB 3.0 specification as the trusted source
 
Lawrence Johnbosco
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I can say both are right, since @PostConstruct is part of "javax.annotation" -- it means it can be used for any kind of callback implementation (not just for EJB). But when to comes to EJB, the specification further restricts the callback by saying it should not be final.


Regards..Lawrence J
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic