Are managed beans with application scopes initialized on startup?

I have the following bean defined in application scope and the code on its constructor is not being executed when tomcat begins, is there something else that needs to be done?

This is my bean

publicclass ServiceLocatorBeanimplements ServiceLocator

{

//the user service bean name

privatestaticfinal String USER_SERVICE_BEAN_NAME ="userService";

privatestaticfinal String ITEM_SERVICE_BEAN_NAME ="itemService";

//the logger for this class

private Log logger = LogFactory.getLog(this.getClass());

//the Spring application context

private ApplicationContext appContext;

//the cached user service

private UserService userService;

private ItemService itemService;

/**

* Constructor.

*

* The following steps being done:

* <ul>

* <li>retrieve Spring application context from servlet context.

* <li>look up Services from Spring application context.

* </ul>

*/

public ServiceLocatorBean(){

ServletContext context = FacesUtils.getServletContext();

this.appContext = WebApplicationContextUtils.getRequiredWebApplicationContext(context);

this.userService = (UserService)this.lookupService(USER_SERVICE_BEAN_NAME);

this.itemService = (ItemService)this.lookupService(ITEM_SERVICE_BEAN_NAME);

this.logger.info("Service locator bean is initialized");

}

/**

* Get the <code>UserService</code>

*

* @return the user service

*/

public UserService getUserService(){

return this.userService;

}

public ItemService getItemService(){

return this.itemService;

}

/**

* Lookup service based on service bean name.

*

* @param serviceBeanName the service bean name

* @return the service bean

*/

public Object lookupService(String serviceBeanName){

return appContext.getBean(serviceBeanName);

}

}

This is my web.xml

<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4"

xsi:schemaLocation="http://java.sun.com/xml/ns/j2eehttp://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

<context-param>

<param-name>javax.faces.CONFIG_FILES</param-name>

<param-value>/WEB-INF/faces-config.xml</param-value>

</context-param>

<context-param>

<param-name>javax.faces.STATE_SAVING_METHOD></param-name>

<param-value>server</param-value>

</context-param>

<listener>

<listener-class>

org.apache.myfaces.webapp.StartupServletContextListener

</listener-class>

</listener>

<servlet>

<servlet-name>Faces Servlet</servlet-name>

<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>

<load-on-startup>1</load-on-startup>

</servlet>

<servlet>

<servlet-name>SpringContextServlet</servlet-name>

<servlet-class>

org.springframework.web.context.ContextLoaderServlet

</servlet-class>

<load-on-startup>1</load-on-startup>

</servlet>

<servlet-mapping>

<servlet-name>Faces Servlet</servlet-name>

<url-pattern>/faces/*</url-pattern>

</servlet-mapping>

<filter>

<filter-name>MyFacesExtensionsFilter</filter-name>

<filter-class>

org.apache.myfaces.component.html.util.ExtensionsFilter

</filter-class>

<init-param>

<param-name>maxFileSize</param-name>

<param-value>20m</param-value>

</init-param>

</filter>

<filter-mapping>

<filter-name>MyFacesExtensionsFilter</filter-name>

<url-pattern>/faces/*</url-pattern>

</filter-mapping>

</web-app>

And this is my faces-config (navigation rules still are on draft):

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE faces-config PUBLIC"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN""http://java.sun.com/dtd/web-facesconfig_1_1.dtd">

<faces-config>

<managed-bean>

<description>

Managed bean that is used as an application scope cache

</description>

<managed-bean-name>applicationBean</managed-bean-name>

<managed-bean-class>

controldeutiles.view.bean.ApplicationBean

</managed-bean-class>

<managed-bean-scope>application</managed-bean-scope>

<managed-property>

<property-name>serviceLocator</property-name>

<value>#{serviceLocatorBean}</value>

</managed-property>

</managed-bean>

<managed-bean>

<description>

Managed bean that is used as a session scope cache

</description>

<managed-bean-name>sessionBean</managed-bean-name>

<managed-bean-class>

controldeutiles.view.bean.SessionBean

</managed-bean-class>

<managed-bean-scope>session</managed-bean-scope>

</managed-bean>

<managed-bean>

<description>

Service locator of the business services

</description>

<managed-bean-name>serviceLocatorbean</managed-bean-name>

<managed-bean-class>

controldeutiles.view.bean.ServiceLocatorBean

</managed-bean-class>

<managed-bean-scope>application</managed-bean-scope>

</managed-bean>

<managed-bean>

<managed-bean-name>userBean</managed-bean-name>

<managed-bean-class>

controldeutiles.view.bean.UserBean

</managed-bean-class>

<managed-bean-scope>session</managed-bean-scope>

<managed-property>

<property-name>serviceLocator</property-name>

<value>#{serviceLocatorBean}</value>

</managed-property>

</managed-bean>

<managed-bean>

<description>

Contains collections ofstatic dropdowns

</description>

<managed-bean-name>staticCollectionsBean</managed-bean-name>

<managed-bean-class>

controldeutiles.view.bean.StaticCollectionsBean

</managed-bean-class>

<managed-bean-scope>application</managed-bean-scope>

</managed-bean>

<managed-bean>

<managed-bean-name>userCollectionBean</managed-bean-name>

<managed-bean-class>

controldeutiles.view.bean.UserCollectionBean

</managed-bean-class>

<managed-bean-scope>request</managed-bean-scope>

<managed-property>

<property-name>serviceLocator</property-name>

<value>#{serviceLocatorBean}</value>

</managed-property>

</managed-bean>

<navigation-rule>

<display-name>Tables/UserMaintenance</display-name>

<from-view-id>/Tables/UserMaintenance.jsp</from-view-id>

<navigation-case>

<from-outcome>success</from-outcome>

<to-view-id>/Tables/UserSearch.jsp</to-view-id>

</navigation-case>

</navigation-rule>

<navigation-rule>

<display-name>Tables/UserSearch</display-name>

<from-view-id>/Tables/UserSearch.jsp</from-view-id>

<navigation-case>

<from-outcome>ItemMaintenance</from-outcome>

<to-view-id>/Tables/UserMaintenance.jsp</to-view-id>

</navigation-case>

</navigation-rule>

<navigation-rule>

<display-name>index</display-name>

<from-view-id>/index.jsp</from-view-id>

<navigation-case>

<to-view-id>/Tables/UserMaintenance.jsp</to-view-id>

</navigation-case>

</navigation-rule>

<navigation-rule>

<display-name>Tables/UserMaintenance</display-name>

<from-view-id>/Tables/UserMaintenance.jsp</from-view-id>

<navigation-case>

<to-view-id>/index.jsp</to-view-id>

</navigation-case>

</navigation-rule>

</faces-config>

[10485 byte] By [magoicocheaa] at [2007-11-27 2:25:53]
# 1
The bean will be initialised the first time it is accessed.
guy.colemana at 2007-7-12 2:34:46 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...