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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:29:48+00:00 2026-05-19T04:29:48+00:00

I’m having a tough time understanding how the two interact and where the boundary

  • 0

I’m having a tough time understanding how the two interact and where the boundary between them lies. Do they overlap? Are there redundancies between them?

I know there are annotations associated with both, but I haven’t been able to find a complete list for both with brief descriptions. Not sure if this would help clear up how they differ or where they overlap.

Really just confused. I (think I) understand EJB reasonably well, I guess I’m having a hard time understanding exactly what CDI brings to the table and how it supplants or enhances what EJB already offers.

  • 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-19T04:29:49+00:00Added an answer on May 19, 2026 at 4:29 am

    CDI: it is about dependency injection. It means that you can inject interface implementation anywhere. This object can be anything, it can be not related to EJB. Here is an example of how to inject random generator using CDI. There is nothing about EJB. You are going to use CDI when you want to inject non-EJB services, different implementations or algorithms (so you don’t need EJB there at all).
    EJB: you do understand, and probably you are confused by @EJB annotation – it allows you to inject implementation into your service or whatever. The main idea is that class, where you inject, should be managed by EJB container.
    Seems that CDI does understand what EJB is, so in Java EE 6 compliant server, in your servlet you can write both

    @EJB EJBService ejbService;
    

    and

    @Inject EJBService ejbService;
    

    that’s what can make you confusing, but that’s probably the only thing which is the bridge between EJB and CDI.

    When we are talking about CDI, you can inject other objects into CDI managed classes (they just should be created by CDI aware frameworks).

    What else CDI offers… For instance, you use Struts 2 as MVC framework (just example), and you are limited here, even using EJB 3.1 – you can’t use @EJB annotation in Struts action, it is not managed by container. But when you add Struts2-CDI plugin, you can write there @Inject annotation for the same thing (so no more JNDI lookup needed). This way it enhances EJB power, but as I mentioned before, what you inject with CDI – it does not matter if it is related to EJB or not, and that’s its power.

    PS. updated link to the example

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I am using Paperclip to handle profile photo uploads in my app. They upload
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string

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.