I want inject systemProperties into a JSF Managed Bean (jsf 1.2 ).
The only way that this can be done is if I either use a managed property or create a systemProperties bean and inject that into the managed bean I want, correct? I can’t use @Value like; It has to be a spring bean in order for me to do that.
#{systemProperties['databaseName']}
#{systemProperties.databaseName}
Managed Property
<managed-bean>
<managed-bean-name>fooUI</managed-bean-name>
<managed-bean-class>test.foo</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>systemPropertyExample</property-name>
<value>#{systemProperties['systemPropertyExample']}</value>
</managed-property>
</managed-bean>
JSF managed beans can be spring managed. You just have to configure a spring-specific
<el-resolver>in faces-config.xml:It will resolve managed beans within the spring context (of course, you need a
ContextLoaderListenerin web.xml that bootstraps spring, but I assume you have that). Then you can use@Value, dependency injection, etc, in your jsf beans.The only difference is that you will be defining them with
@Controller @Scope("request")rather than with xml.