on 01-13-2012 4:36 PM
Hi developers,
In NW 7.3 we have two EJB annotations with identical meaning:
javax.annotation.PostConstruct
and
com.sap.ejb.annotations.AppStartup
A method annotated like this is invoked by the container right before the EJB is made available to clients.
Can anyone explain the difference between the two annotations?
Thanks, regards
Vincenzo
Hi
PostConstruct = EJB standard, AppStartup = SAP proprietary.
As far as I understand the descriptions, the AppStartup callback invocation occur for all EJBs immediately when the application is starting (no matter if the EJB is called or not) whereas "The PostConstruct callback invocations occur before the first business method invocation on the bean. This is at a point after which any dependency injection has been performed by the container." (see EJB spec).
So the PostConstruct has nothing to do with application life cycle but with the lifecycle of a single bean instance. PostConstruct may be called later on first client invocation) and in AppStartup, you probably do not have dependency injection performed but have to lookup using java:comp/env.
Regards
Rolf
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.