{"id":16345,"date":"2013-08-18T10:00:53","date_gmt":"2013-08-18T07:00:53","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/?p=16345"},"modified":"2013-08-17T18:43:03","modified_gmt":"2013-08-17T15:43:03","slug":"di-cdi-basics","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2013\/08\/di-cdi-basics.html","title":{"rendered":"DI \/ CDI \u2013 Basics"},"content":{"rendered":"<h3>Introduction (DI\/CDI Basics)<\/h3>\n<p>First of all, I would assume there is a bit of confusion to this, but the truth of the matter is, they are just the same \u2013 the difference is that usage and its purpose.<\/p>\n<p>DI (Dependency Injection) is the general term \u00a0&#8211; this feature is basically the one doing the bean discovery and bean wiring process on any application. Its not just you use it in your application, you can also use it in your unit tests and mocks.\u00a0Of course, there are a lot of DI frameworks out there, you have: Guice, Seam, Spring (Seam and Spring extended the DI scheme and made their own), EJB 3.x and CDI itself.<\/p>\n<p>CDI on the other hand, combines all this technology and introduce a lifecycle to the components \u2013 this allowed unification of DI technologies to making development of new features straight forward and mostly doable; you can combine Seams lifecycle mappings with Spring MVC with JPA as its persistence layer \u2013 these technologies were all created separately yet with CDI, application developers can combine them to create and development JEE application.<\/p>\n<p>I will need to break down the topics as I would definitely bore everyone with words and letters here so:<\/p>\n<ol>\n<li>DI \/ CDI Basics<\/li>\n<li>Basic Injection<\/li>\n<li>Qualifiers, Scope<\/li>\n<li>DI \/ CDI Advance<\/li>\n<\/ol>\n<p>I will be creating separate posts for each!<\/p>\n<h3>Lets Begin!<\/h3>\n<h3>SPI (Service Programming Interface)<\/h3>\n<p>It also has this so called SPI \u2013 apparently a feature set along with API, but has a different purpose entirely.<\/p>\n<ul>\n<li>The API is the description of classes\/interfaces\/methods\/\u2026 that you\u00a0<em>call and use<\/em>\u00a0to achieve a goal.<\/li>\n<li>The SPI is the description of classes\/interfaces\/methods\/\u2026 that you\u00a0<em>extend and implement<\/em>\u00a0to achieve a goal.<\/li>\n<\/ul>\n<p>With SPI, you can actually extend the JEE6 to create a different framework of your own, showcasing portability, and extensibility. (<strong>But I\u2019ll dive into that later<\/strong>).<\/p>\n<h3>Why CDI for JEE6?<\/h3>\n<p>CDI has been around in JEE5 (J2EE) and has been a major success. A lot of new development benefits from its approach that ultimately simplifies the overall development process. Several reasons why CDI was improved in JEE6.<\/p>\n<ul>\n<li>JEE5 do support resource injection, but it still lacks a general purpose dependency \u2013 it only supports @EJB, @PersistenceContext, @PersistenceUnit, @Resources) \u2013 of course this is with the exception of Spring that introduce different annotations for managing bean lifecycle<\/li>\n<li>Non-type based injection (and weak) \u00a0&#8211; String name and XML injection is really fragile. Improving type-based injetcion enables better tooling in general.<\/li>\n<\/ul>\n<h3>Terminology<\/h3>\n<p><strong>CDI<\/strong> \u2013 Context and Dependency Injection<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p><strong>Weld<\/strong><\/p>\n<ul>\n<li>JSR 299 reference implementation \u2013 reference implementation is the SPI used to etxend a JSR specific implementation.<\/li>\n<li>Provides extended CDI support for Servlet Container.<\/li>\n<li>CDI enhancements for extension writers.<\/li>\n<li>Maven Archetypes for CDI and Java EE (I love maven!).<\/li>\n<\/ul>\n<h3>CDI Theme: Loose Coupling and Strong Typed<\/h3>\n<p><strong>Loose coupling<\/strong> simply means objects is loosely independent to the objects that uses or currently using them. CDI introduces new features for decoupling such as <strong>qualifiers<\/strong>, enhances <strong>interceptors<\/strong>, <strong>decorators<\/strong>, message <strong>producer<\/strong>, <strong>consumer<\/strong> and its underlying <strong>events<\/strong> mechanisms. Will dive further in to each example on the advance topic of CDI.<\/p>\n<p><strong>Strong Typing\u00a0<\/strong>&#8211; simply means that strict declaration of beans by letting the container create and map specific names to objects. This eliminates the need to do string based naming of beans, casting almost not needed since the casting is done by the container (by taking advantage of qualifiers).<\/p>\n<h3>Bean (What is it?)<\/h3>\n<p>There are technically many form of beans, you have: JSF Bean, EJB Bean, Spring, Seam, Guice CDI, Entity Beans, etc \u2013 but ultimately, beans are just POJOs that has special definition \u2013 definition that was defined by the <strong>Managed Bean 1.0<\/strong> \u2013 specification made in Java EE6. What does this mean is that any POJOs can be any type of bean, as long as it complies with the specification standards \u2013 further simplifying the declaration and development process. The container does the work for managing the POJOs and will add support for it by giving \/ introducing common basic services such as:<\/p>\n<ul>\n<li>Lifecycle Management (@PostConstruct, @PreDestory)<\/li>\n<li>Injection of a resource (@Resource)<\/li>\n<li>Interceptor (@Interceptors, @ArounInvoke)<\/li>\n<\/ul>\n<pre class=\" brush:java\">@javax.annotation.ManagedBean\r\npublic class MyPojo {\r\n\r\n@Resource   \/\/ Resource injection\r\nprivate Datasource ds;\r\n\r\n@PostConstruct  \/\/ Life-cycle\r\nprivate void init() {\r\n   ....\r\n}  \r\n@Interceptors(LoggingInterceptor.class)\r\n   public void myMethod() {...}\r\n}<\/pre>\n<p>With this in mind, what about <strong>EJBs<\/strong>, <strong>RESTs<\/strong> and <strong>CDI<\/strong> beans?<\/p>\n<ul>\n<li>EJB bean service \u2013 managed bean, with the common services (above) and support for Transaction, security, thread safety and persistence.<\/li>\n<li>REST bean service \u2013 managed bean with HTTP support<\/li>\n<li>CDI bean \u2013 managed bean with lifecycle supports:\n<ul>\n<li>Auto discovery<\/li>\n<li>Qualifiers<\/li>\n<li>Scope<\/li>\n<li>EL<\/li>\n<li>Interceptors and Decorators<\/li>\n<li>Alternative bean (by Qualifiers at runtime)<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>To put it into perspective, Manage Bean is ultimately an SPI that was extended for specific use. EJBs, Rest, Entity beans are all Managed Beans \u2013 but with additional services from the container. Thus, if you define a POJO with a @Stateless or @Stateful annotation, the container automatically detects that its an EJB bean and it needs container specific support like transactions, security, thread safety, extensions etc.<\/p>\n<pre class=\" brush:java\">package mypackage;\r\nimport javax.ejb.Stateless;\r\n\r\n@Stateless\r\npublic class GreetingBean {\r\n  public String greet(String name){\r\n      return \"Hello \" + name;\r\n   }\r\n}<\/pre>\n<p>A simple POJO class turned into a Stateless bean with just a flick of finger (actually typed in) that resulted to that one liner @Stateless code. Unlike how EJB was defined on the priori 3.x (such a pain).<\/p>\n<p>Download the sample (above) from here: <a href=\"https:\/\/dl.dropboxusercontent.com\/u\/1737239\/inject_ejb_to_field.zip\">Click me<\/a><\/p>\n<h3>Automatic Bean Discovery<\/h3>\n<p>The CDI container is the one responsible for how the beans are discovered, but how does it do it?<\/p>\n<ol>\n<li>It first scan the classpath that contains both application and container archives.\n<ol>\n<li>It tries to scan through the classpath and see what POJOs are tag for discovery \u2013 that is, Managed Bean. You can think of it that it puts in a pool and can readily available when another Managed Bean calls it thru injection (more on that on next blog topic)<\/li>\n<\/ol>\n<\/li>\n<li>Then it detects presence of beans.xml (or any context xml file definition).\n<ol>\n<li>For Spring fans, this is much like an applicationContext.xml (at least thats the convention, but loose) \u2013 you pass that xml on the contextConfiguration listener (thru parameter) and Spring CDI Container will automatically tag objects (beans) in it for discovery \u2013 of course you need to define scanning mechanisms (component-scan).<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<p>Ultimately, DI \/ CDI was introduce to simplify the development process, unify the technologies and overall to produce a more robust, extendible application. Letting all the container do the work in terms of tagging the common services of the bean makes the developer task easier and more over avoiding pitfalls as a result of previous frameworks. SPI \u2013 is really the definition of improvement here, allowing the actually JEE6 framework to be extendible creates a more dynamic nature \u2013 business application architects can now design their own framework and conventions. Put more business specific designs or annotations for their own rules and give the robustness and flexibility that is always required for enterprise application.<\/p>\n<p>Next Topic: <strong>Basic Injection<\/strong> \u2013 I don\u2019t want to put everything in one post, so I\u2019ll leave it up to you to absorb first and check the sample I created. From here on now, I\u2019ll tackle more on the examples of DI and CDI.<\/p>\n<p>&nbsp;<\/p>\n<div style=\"border: 1px solid #D8D8D8; background: #FAFAFA; width: 100%; padding-left: 5px;\"><b><i>Reference: <\/i><\/b><a href=\"http:\/\/alvinjayreyes.com\/2013\/08\/09\/di-cdi-basics\/\">DI \/ CDI \u2013 Basics<\/a> from our <a href=\"http:\/\/www.javacodegeeks.com\/jcg\">JCG partner<\/a> Alvin Reyes at the <a href=\"http:\/\/alvinjayreyes.com\/\">Alvin &#8220;Jay&#8221; Reyes Blog<\/a> blog.<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Introduction (DI\/CDI Basics) First of all, I would assume there is a bit of confusion to this, but the truth of the matter is, they are just the same \u2013 the difference is that usage and its purpose. DI (Dependency Injection) is the general term \u00a0&#8211; this feature is basically the one doing the bean &hellip;<\/p>\n","protected":false},"author":197,"featured_media":148,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[290],"class_list":["post-16345","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-cdi"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>DI \/ CDI \u2013 Basics<\/title>\n<meta name=\"description\" content=\"Introduction (DI\/CDI Basics) First of all, I would assume there is a bit of confusion to this, but the truth of the matter is, they are just the same \u2013\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2013\/08\/di-cdi-basics.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"DI \/ CDI \u2013 Basics\" \/>\n<meta property=\"og:description\" content=\"Introduction (DI\/CDI Basics) First of all, I would assume there is a bit of confusion to this, but the truth of the matter is, they are just the same \u2013\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2013\/08\/di-cdi-basics.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2013-08-18T07:00:53+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/java-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Alvin Reyes\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Alvin Reyes\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/08\\\/di-cdi-basics.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/08\\\/di-cdi-basics.html\"},\"author\":{\"name\":\"Alvin Reyes\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/ac48ce50b2e5027d82ecbe2fa9b455a9\"},\"headline\":\"DI \\\/ CDI \u2013 Basics\",\"datePublished\":\"2013-08-18T07:00:53+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/08\\\/di-cdi-basics.html\"},\"wordCount\":1167,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/08\\\/di-cdi-basics.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/java-logo.jpg\",\"keywords\":[\"CDI\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/08\\\/di-cdi-basics.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/08\\\/di-cdi-basics.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/08\\\/di-cdi-basics.html\",\"name\":\"DI \\\/ CDI \u2013 Basics\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/08\\\/di-cdi-basics.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/08\\\/di-cdi-basics.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/java-logo.jpg\",\"datePublished\":\"2013-08-18T07:00:53+00:00\",\"description\":\"Introduction (DI\\\/CDI Basics) First of all, I would assume there is a bit of confusion to this, but the truth of the matter is, they are just the same \u2013\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/08\\\/di-cdi-basics.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/08\\\/di-cdi-basics.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/08\\\/di-cdi-basics.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/java-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/java-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/08\\\/di-cdi-basics.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"DI \\\/ CDI \u2013 Basics\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/ac48ce50b2e5027d82ecbe2fa9b455a9\",\"name\":\"Alvin Reyes\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/47d55211c650ea320b9932d0c3e848869fbdd0926c68b17382064c1d3ab0d512?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/47d55211c650ea320b9932d0c3e848869fbdd0926c68b17382064c1d3ab0d512?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/47d55211c650ea320b9932d0c3e848869fbdd0926c68b17382064c1d3ab0d512?s=96&d=mm&r=g\",\"caption\":\"Alvin Reyes\"},\"sameAs\":[\"http:\\\/\\\/alvinjayreyes.com\\\/\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/Alvin-Reyes\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"DI \/ CDI \u2013 Basics","description":"Introduction (DI\/CDI Basics) First of all, I would assume there is a bit of confusion to this, but the truth of the matter is, they are just the same \u2013","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2013\/08\/di-cdi-basics.html","og_locale":"en_US","og_type":"article","og_title":"DI \/ CDI \u2013 Basics","og_description":"Introduction (DI\/CDI Basics) First of all, I would assume there is a bit of confusion to this, but the truth of the matter is, they are just the same \u2013","og_url":"https:\/\/www.javacodegeeks.com\/2013\/08\/di-cdi-basics.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2013-08-18T07:00:53+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/java-logo.jpg","type":"image\/jpeg"}],"author":"Alvin Reyes","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Alvin Reyes","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2013\/08\/di-cdi-basics.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/08\/di-cdi-basics.html"},"author":{"name":"Alvin Reyes","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/ac48ce50b2e5027d82ecbe2fa9b455a9"},"headline":"DI \/ CDI \u2013 Basics","datePublished":"2013-08-18T07:00:53+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/08\/di-cdi-basics.html"},"wordCount":1167,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/08\/di-cdi-basics.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/java-logo.jpg","keywords":["CDI"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2013\/08\/di-cdi-basics.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2013\/08\/di-cdi-basics.html","url":"https:\/\/www.javacodegeeks.com\/2013\/08\/di-cdi-basics.html","name":"DI \/ CDI \u2013 Basics","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/08\/di-cdi-basics.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/08\/di-cdi-basics.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/java-logo.jpg","datePublished":"2013-08-18T07:00:53+00:00","description":"Introduction (DI\/CDI Basics) First of all, I would assume there is a bit of confusion to this, but the truth of the matter is, they are just the same \u2013","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/08\/di-cdi-basics.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2013\/08\/di-cdi-basics.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2013\/08\/di-cdi-basics.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/java-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/java-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2013\/08\/di-cdi-basics.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"DI \/ CDI \u2013 Basics"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/ac48ce50b2e5027d82ecbe2fa9b455a9","name":"Alvin Reyes","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/47d55211c650ea320b9932d0c3e848869fbdd0926c68b17382064c1d3ab0d512?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/47d55211c650ea320b9932d0c3e848869fbdd0926c68b17382064c1d3ab0d512?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/47d55211c650ea320b9932d0c3e848869fbdd0926c68b17382064c1d3ab0d512?s=96&d=mm&r=g","caption":"Alvin Reyes"},"sameAs":["http:\/\/alvinjayreyes.com\/"],"url":"https:\/\/www.javacodegeeks.com\/author\/Alvin-Reyes"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/16345","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/197"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=16345"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/16345\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/148"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=16345"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=16345"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=16345"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}