-
1. Re: Requirements for using @Startup annotation?
modoc May 10, 2007 12:27 PM (in response to tonylmai)Tony,
you may be mixing up @Startup and @Create.
@Startup is a class level/component level annotation which tells Seam to start the component when the ear/war is started. @Create is a method level annotation which tells Seam to execute the method once the component is started.
So if you want the component to load when the app loads, just move the @Startup annotation up to the class level, with the @Scope and @Stateless annotations.
If you also want the init method to run when the component starts, replace the current location @Startup with a @Create, and you should be all set!
I hope that helps!
Regards,
Devon -
2. Re: Requirements for using @Startup annotation?
tonylmai May 10, 2007 12:44 PM (in response to tonylmai)Hi Devon,
I am under the assumption that @Create is called when the component is first referenced by a client (aka the component will not be instantiated until first usage).
What I'd like to do is to initiate the connection as soon as the application is brought online.
Am I wrong?
Thanks -
3. Re: Requirements for using @Startup annotation?
modoc May 10, 2007 12:49 PM (in response to tonylmai)Tony,
you are right. You need to put the @Startup annotation at the class level. This will create the object at the time the app is loaded/deployed, without user interaction.
If when the object is created, at that time, you ALSO want to run the init method, you need to annotate that method with @Create.
Does that make sense?
Devon -
4. Re: Requirements for using @Startup annotation?
tonylmai May 10, 2007 12:53 PM (in response to tonylmai)Got it. Thanks Devon.
-
5. Re: Requirements for using @Startup annotation?
modoc May 10, 2007 1:00 PM (in response to tonylmai)No problem. Let me know if you have any other questions.
Devon -
6. Re: Requirements for using @Startup annotation?
tonylmai May 10, 2007 2:41 PM (in response to tonylmai)What the syntax for specifying a dependency on Seam's Logger for my component with a @Startup annotation?
I tried @Startup(depends={"org.jboss.seam.log.Log"}) but that did not work. The logger specified as @In private Log logger is still null.
Any idea?
Thanks -
7. Re: Requirements for using @Startup annotation?
pmuir May 10, 2007 4:09 PM (in response to tonylmai)@Logger is a special annotation, and cannot be depended on as such (it's not backed by a Seam component).
What exception do you get? -
8. Re: Requirements for using @Startup annotation?
c_eric_ray May 10, 2007 4:27 PM (in response to tonylmai)What's the syntax to make a bean annotated with @Startup depend on a second bean. For example, I have two beans:
1. StartupValidationBean
2. ReleaseLocksBean
I want to do something like this:@Startup(depends={my.package.ReleaseLockBean}) public class StartupValidationBean { @Create public void beginValidation() { // get reference to ReleaseLockBean releaseLockBean.releaseAllLocks(); } }
-
9. Re: Requirements for using @Startup annotation?
pmuir May 10, 2007 4:43 PM (in response to tonylmai)A string specifying the Seam component name
-
10. Re: Requirements for using @Startup annotation?
tonylmai May 10, 2007 4:52 PM (in response to tonylmai)What exception do you get?
No exception. Just that my injection for Seam's Log did not work.@In private Log logger
I got logger == null in my member method. This was with and without (create = true). I have no problem with this kind of injection in other components. -
11. Re: Requirements for using @Startup annotation?
pmuir May 10, 2007 5:44 PM (in response to tonylmai)Dude, that isn't how you inject a Log in seam. RTM.
-
12. Re: Requirements for using @Startup annotation?
c_eric_ray May 10, 2007 6:30 PM (in response to tonylmai)yes, the FQN appears to work just fine. btw, this is a very nice feature of seam. thanks.
-
13. Re: Requirements for using @Startup annotation?
tonylmai May 10, 2007 6:52 PM (in response to tonylmai)Ooppps.... Sorry, mistyped. It was:
@Logger Log logger
This was what I had and it was null.
Thanks