webtier@glassfish.java.net

Problem with Mojarra and Spring integration in Glassfish 3.1

From: <forums_at_java.net>
Date: Fri, 17 Jun 2011 01:39:31 -0500 (CDT)

I'm using Mojarra 2.1(Glassfish 3.1 default) and Spring 3.0.5 on Glassfish
3.1, when I have a JSF managed bean as: @ManagedBean(eager = true)
@ApplicationScoped, which means it shoud be instanciated when application
start up, then I have a property in this bean as @ManagedProperty("#{foo}"),
where 'foo' is a bean managed by Spring, and finally when glassfish starts
up, exception will be thrown indicating the 'foo' property has not been
injected by Spring yet at the time when Mojarra initializes JSF managed
beans.

After digging deeper, I noticed Mojarra registered a
com.sun.faces.config.FacesInitializer which implements
javax.servlet.ServletContainerInitializer, new feature in java EE 6, and it
will be invoked before all servlets and listeners, including
ContextLoaderListener in Spring(which is responsible for initializing Spring
beans), thus when FacesInitializer begin to initialize JSF beans, Spring
beans('foo' bean in above case) will not be ready yet!

I'm not sure if this is the expected behavior of glassfish, or is it a issue
with Mojarra. Any one can help on this?

 

 


--
[Message sent by forum member 'juliankim']
View Post: http://forums.java.net/node/813075