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 7805593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T02:16:35+00:00 2026-06-02T02:16:35+00:00

I need to inject Spring beans into a JSF (Primefaces) converter. I tried to

  • 0

I need to inject Spring beans into a JSF (Primefaces) converter. I tried to inject beans by using EL resolver. However, the beans are null inside the converters.

My JSF converter:

public class DepartmentConverter implements Converter  {
    private DepartmentService departmentService;
    //getter setter for this property

    @Override
    public Object getAsObject(FacesContext arg0, UIComponent arg1, String arg2) {
        //codes
    }

    @Override
    public String getAsString(FacesContext arg0, UIComponent arg1, Object arg2) {
        //Codes
    }
}

faces-config.xml:

<converter>
    <converter-id>DepartmentConverter</converter-id>
    <converter-class>com.studinfo.jsf.converter.DepartmentConverter</converter-class>
    <property>
        <property-name>departmentService</property-name>
        <property-class>com.studinfo.services.DepartmentService</property-class>
        <default-value>#{DepartmentService}</default-value>
    </property>
</converter>

EL resolver:

<application>
    <el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
</application>

When I debug my code, the departmentService property is null. I can access the Spring beans inside a managed JSF bean the same way.

  • 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-02T02:16:36+00:00Added an answer on June 2, 2026 at 2:16 am

    Until JSF 2.3, converters are no injection targets. Make the converter a JSF or Spring managed bean instead. The below example makes it a JSF managed bean:

    @ManagedBean
    @RequestScoped
    public class DepartmentConverter implements Converter  {
        // ...
    }
    

    And use it as #{departmentConverter} instead of DepartmentConverter.

    E.g.

    <h:inputSome ... converter="#{departmentConverter}" />
    

    or

    <h:someComponent>
        <f:converter binding="#{departmentConverter}" />
    </h:someComponent>
    

    Don’t forget to remove the <converter> from faces-config.xml (which was at its own already unnecessary if you used the @FacesConverter annotation, but that aside).

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

Sidebar

Related Questions

Is it possible to inject Spring beans into an RestEasy @Path class? I managed
I need to inject a java.utils.Properties instance into one of my beans. Is there
I've been using the Spring.Net IoC container and can use it to inject properties
I need a custom mapping using ibatis-sqlmap 2.3.4.726 and spring 2.5.6.SEC01. class: public class
Using Spring mvc-3. I am writing a custom Converter which needs access to other
I need to inject a custom, unique, static string into my .NET based EXE.
Need to parse a Class declaration line in Java using regular expression e.g. String
need some help with retrieving information+Profile pic from twitter using php , i wanted
I have a bunch of java custom tags that use spring managed beans.. since
I have noticed from several web pages that apparently Spring 3.0 supports @Inject from

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.