myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aleksei Valikov <vali...@disy.net>
Subject Re: Bean definition question faces-config.xml
Date Wed, 07 Dec 2005 10:43:23 GMT
Hi.

> I wonder if it is possible to declare the constructor of a bean in 
> faces-config.xml similar to using <constructor-arg> in spring's 
> configuration files.
> The idea behind this is, that I'd like to inject a bean into my 
> application and use a referenced bean already in the constructor.
> As far as I know and encountered, first the default constructor is 
> called, then the referenced beans are injected by using the 
> corresponding setters, and finally the bean is used in the application 
> depending of the scope.
> Or is possible to use/reference Spring beans in faces-config.xml?

Of course you can use/reference Spring beans in faces-config.xml. Just 
use Spring's variable resolver.

<variable-resolver>org.springframework.web.jsf.DelegatingVariableResolver</variable-resolver>

If you want to declare your bean in Spring context but make it available 
as a managed bean (for instance, to define bean scoping), use proxies.

Bye.
/lexi

Mime
View raw message