Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7927859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T19:32:13+00:00 2026-06-03T19:32:13+00:00

We have a very complex config file for JSF managed beans that looks like

  • 0

We have a very complex config file for JSF managed beans that looks like the below.
Is there any way to convert this to some kind of CDI config?
Now when we use @Inject on AbcConfigFactory it doesn’t initialise the values from the config file. I guess this is because we use CDI to initialise it and 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>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T19:32:18+00:00Added an answer on June 3, 2026 at 7:32 pm

    The initial version of the CDI spec had XML-configuration beans in it, but it was removed later, just to be re-included in future versions of the spec recently (AFAIK).

    So, the short answer is: No, you cannot use XML to configure CDI beans (and as CDI and JSF are two different things, you wouldn’t be able to re-use a JSF config file without changes – obviously).

    The solution to your problem comes with Seam Solder which uses the extension mechanism of CDI to add exactly that functionality (and much more). But you will still have to re-work your configuration in order to fit for your CDI-beans.

    Without knowing anything about your problem domain:

    If XML-configuration is some sort of historic relict that is not forced by a real-world requirement (like having different wirings for different deployment scenarios), I strongly recommend to dump the XML and switch to CDI’s typesafe annotation-based approach. There are concepts for all mainstream usecases (like different wiring for testing), and you are freed from the burden of doing your “coding” in XML.

    If you really need (or still want) XML-based configuration, Seam Solder is your way to go.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very complex graph, and there is no way that I can
We have a very complex Oracle package here (over 4,100 lines of code) that's
I have an idea for a web-based service. The implementation is very complex. There
I have a very complex parsing problem. Any thoughts would be appreciated here. I
I have a very complex CTE and I would like to insert the result
I have a very complex Linq to SQL query that returns a result set
I have a very large and complex MySQL query that gets run from a
I have a sql that is not very complex but sufficiently confusion that I
I've worked on projects that have very complex XML configuration, and one problem that's
I have a very complex task - create a software that imports XMl files

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.