PDA

View Full Version : Resin 3.1 - Host level beans


edhager
11-23-2009, 09:04 PM
Hi,

I am using Resin 3.1. I want to define a <bean> in a <host>. I want the bean to be initialized before the web apps are loaded.

<host>
<bean ...>
<web-app-deploy ...>

When I try this, the bean's init method is called after the web apps are deployed. I expected the bean to be initialized first.

Are my expectations incorrect? Is there an attribute that controls when the bean is initialized?

Ed

emil
11-25-2009, 05:11 PM
Hi Ed,

That's true, but beans in the webapps are initialized after beans in the host, which might help for your application. In other words, the order is:


Initialize webapps
Initialize host beans
Initialize webapp beans


So you should see the @PostConstruct/init() method of your host bean executed first. You can then inject the bean into a webapp bean.

Does that help? If not, can you give me more information about what you're trying to achieve?

Best,
Emil

edhager
11-25-2009, 05:31 PM
Yes, that helps. Thanks.