-
1. Re: Seam @Startup and @AutoCreate equivalents in JSR-299
dan.j.allen May 12, 2009 12:19 AM (in response to viviansteller.vivian.steller.uni-ulm.de)@AutoCreate is no longer necessary since a bean will always be created when needed. The @AutoCreate was really introduced to avoid ambiguity problems. Since there is rarely any ambiguity problems in Web Beans (meaning you can only possibly be requesting one instance at any injection point) there is no need for it.
The only equivalent to @Startup is that you can watch for the @Deployed Manager event and your bean will end up being instantiated (a dummy observer). However, I'm thinking this would be a good idea for an extension in Seam or Web Beans to just be able to annotate your class.
-
2. Re: Seam @Startup and @AutoCreate equivalents in JSR-299
gavin.king May 12, 2009 9:55 AM (in response to viviansteller.vivian.steller.uni-ulm.de)In the current rev:
void onStartup(@Observes @Deployed Manager mgr) { .... }
In the next rev, probably:
void onStartup(@Observes AfterDeploymentValidation event) { .... }
But this change is still under discussion in the EG.
-
3. Re: Seam @Startup and @AutoCreate equivalents in JSR-299
fortega Apr 15, 2011 4:08 PM (in response to viviansteller.vivian.steller.uni-ulm.de)You can observe an event which is triggered when the application is initialized:
void onStartup(@Observes @Initialized WebApplication webApplication){ ... }
If you have multiple beans which need to be started up: I wrote some code which makes it a lot cleaner: http://blog.fortega.be/2011/04/seam-3-weld-alternative-for-startup.html
-
4. Re: Seam @Startup and @AutoCreate equivalents in JSR-299
pgmjsd Jun 14, 2011 3:40 PM (in response to viviansteller.vivian.steller.uni-ulm.de)@Bart - In case anyone wanders across your post (I did), the @Initialized annotation and the WebApplication class come from Seam Servlet. Took me a little while to find that. :)