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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:13:39+00:00 2026-05-24T13:13:39+00:00

From the CDI tutorial, i’ve discovered various examples and want to use them to

  • 0

From the CDI tutorial, i’ve discovered various examples and want to use them to inject some objects into an EJB (namely, I want to inject a Neo4J connector GraphDatabaseService). So, I have a target EJB :

@Stateless
public class Neo4JEJB implements Neo4JEJBInterface{

private @Inject @Named("the bidule") String bidule = "no bidule injected";
}

And a producer class containing a producer method

public class Producer {
public @Produces @Named("the bidule") String createBidulateur() {
    return "the bidule that should always work";
}
}

But, so far, i’ve been unable to see my bidule field having the correct value.

Is there something i’m doing wrong ?

  • 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-05-24T13:13:39+00:00Added an answer on May 24, 2026 at 1:13 pm

    Firstly, you are using @Named like the old Seam @Name. These two annotations have two different purposes. In CDI, @Named is only used to provide a name that can be used to reference the bean from within a facelet. On injection, a bean is identified by it’s type and optionally using a qualifier. Since you are injecting a String, a qualifier is most likely necessary. You can create a qualifier annotation as described here and annotate your producer and injection point with it:

    If you created the qualifier @Bidule

    @Stateless
    public class Neo4JEJB implements Neo4JEJBInterface{
    
        private @Inject @Bidule String bidule = "no bidule injected";
    }
    
    public class Producer {
        public @Produces @Bidule String createBidulateur() {
            return "the bidule that should always work";
        }
    }
    

    Also, I think (but am not sure) the bean that contains the producer method needs to be scoped (see here).

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

Sidebar

Related Questions

How can I use JSR-299 CDI to inject (not annotated) beans from external libraries?
Currently I am trying to inject a stateless EJB into a CDI managed controller
I am new to CDI and want to use this for a JSF2 application.
In my application, I have an @ApplicationScoped CDI bean to store some information from
I'm trying to inject a bean defined in a Spring context into a CDI
From what I can gather, there are three categories: Never use GET and use
I have some beans for which, in specific injections, I want to add a
Is it possible to use type variance in CDI events? here is the case:
I rode that is recommended to use CDI beans as backing beans instead of
I'm working on a project where I want to use Interceptors to log usage

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.