Convert managed property JSF to CDI

We have a very complex configuration file for JSF managed beans, which looks like this.
Is there a way to convert this to some kind of CDI configuration?
Now that we use @Injecton AbcConfigFactory, it does not initialize the values โ€‹โ€‹from the configuration file. I think this is because we use CDI to initialize it, not JSF ... or something like that. :)

<?xml version="1.0" encoding="UTF-8"?>
<faces-config version="1.2"
   xmlns="http://java.sun.com/xml/ns/javaee"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">

   <managed-bean>
      <managed-bean-name>AbcConfig</managed-bean-name>
      <managed-bean-class>com.a.b.c.AbcConfigFactory</managed-bean-class>
      <managed-bean-scope>application</managed-bean-scope>
      <managed-property>
         <property-name>abcSites</property-name>
         <list-entries>
            <value-class>com.a.b.c.SiteConfigBean</value-class>
            <value>#{SiteConfig$A}</value>
            <value>#{SiteConfig$B}</value>
         </list-entries>
      </managed-property>
   </managed-bean>


   <managed-bean>
      <managed-bean-name>SiteConfig$A</managed-bean-name>
      <managed-bean-class>com.a.b.c.SiteConfigBean</managed-bean-class>
      <managed-bean-scope>none</managed-bean-scope>
      <managed-property>
         <property-name>siteName</property-name>
         <value>A</value>
      </managed-property>

      <managed-property>
         <property-name>starConfig</property-name>
         <property-class>com.a.b.c.StarConfigBean</property-class>
         <value>#{StarConfig$A}</value>
      </managed-property>
   </managed-bean>

   <managed-bean>
      <managed-bean-name>SiteConfig$B</managed-bean-name>
      <managed-bean-class>com.a.b.c.SiteConfigBean</managed-bean-class>
      <managed-bean-scope>none</managed-bean-scope>
      <managed-property>
         <property-name>siteName</property-name>
         <value>B</value>
      </managed-property>

      <managed-property>
         <property-name>starConfig</property-name>
         <property-class>com.a.b.c.StarConfigBean</property-class>
         <value>#{StarConfig$A}</value>
      </managed-property>
   </managed-bean>

   <managed-bean>
      <managed-bean-name>StarConfig$A</managed-bean-name>
      <managed-bean-class>com.a.b.c.StarConfigBean</managed-bean-class>
      <managed-bean-scope>none</managed-bean-scope>
      <managed-property>
         <property-name>siteName</property-name>
         <value>A</value>
      </managed-property>
   </managed-bean>
</faces-config>
+3
source share
1 answer

The original version of the CDI specification contained the beans XML configuration, but it was removed later, just to be included in future versions of the specification recently (AFAIK).

, : , XML CDI beans ( CDI JSF - , JSF - ).

Seam Solder, CDI ( ). , CDI- beans.

:

XML- - , (, ), XML , CDI, (, ), "" XML.

( ) XML, Seam Solder - .

+1

All Articles