{"id":13339,"date":"2013-05-29T16:00:00","date_gmt":"2013-05-29T13:00:00","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/?p=13339"},"modified":"2013-11-11T11:02:38","modified_gmt":"2013-11-11T09:02:38","slug":"java-ee-cdi-dependency-injection-inject-tutorial","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2013\/05\/java-ee-cdi-dependency-injection-inject-tutorial.html","title":{"rendered":"Java EE CDI Dependency Injection (@Inject) tutorial"},"content":{"rendered":"<p>In this tutorial we shall show you how to achieve Dependency Injection in CDI managed Beans. In particular, we shall make use of the <code>@Inject<\/code> annotation provided by the CDI API to inject a CDI bean to another bean. In this way the bean can be used in an application, such as a JavaServer Faces application. <\/p>\n<p>CDI provides several ways to inject a bean to an application. We can inject a CDI bean, using the Field Dependency Injection, the Constructor Dependency Injection, or the Dependency Injection through the <code>setter<\/code> method. We can also inject arguments of producer methods, but this is out of the scope of this tutorial. Let&#8217;s examine all the injection ways provided by CDI: <\/p>\n<p>&nbsp;<\/p>\n<h2>1. Field Dependency Injection<\/h2>\n<p>The easiest way to inject a CDI bean is to add the <code>@Inject<\/code> annotation in the property to be injected. Let&#8217;s take a look at the example below. The <code>GreetingBean<\/code> has an <code>@Inject<\/code> annotated field, which is the <code>helloBean<\/code>. In this way another bean, the <code>HelloBean<\/code> is injected into the <code>GreetingBean<\/code>.<\/p>\n<pre class=\"brush:java\">\r\npackage com.javacodegeeks.snippets.enterprise.cdibeans;\r\n\r\nimport javax.inject.Inject;\r\n\r\npublic class GreetingBean {\r\n\r\n\t@Inject \r\n\tprivate HelloBean helloBean;\r\n\t\r\n}\r\n<\/pre>\n<h2>2. Constructor Dependency Injection<\/h2>\n<p>When a CDI bean is initialized, the container will use its default constructor. When there is another constructor annotated with the <code>@Inject<\/code> annotation, then the container will automatically use this constructor instead, and in this way the argument passed in the constructor will be injected in the bean. A thing to notice here is that we can only have one constructor injection point. If we create another <code>@Inject<\/code> annotated constructor, the behaviour of the container is unpredictable. <div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p>In the code snippet below the <code>GreetingBean<\/code> has a constructor annotated with the <code>@Inject<\/code> annotation and with an argument, that is another bean, <code>HelloBean<\/code>. In this way the injection is achieved. <\/p>\n<pre class=\"brush:java\">\r\npackage com.javacodegeeks.snippets.enterprise.cdibeans;\r\n\r\nimport javax.inject.Inject;\r\n\r\npublic class GreetingBean {\r\n\r\n\t private final HelloBean helloBean;\r\n\r\n\t  @Inject\r\n\t  public GreetingBean(HelloBean helloBean){\r\n\t    this.helloBean = helloBean;\r\n\t  }\r\n\r\n}\r\n<\/pre>\n<h2>3. Dependency Injection through the setter method <\/h2>\n<p>In the example below, the <code>setHelloBean(HelloBean helloBean)<\/code> method is annotated with the <code>@Inject<\/code> annotation. Thus, when the <code>GreetingBean<\/code> is initialized by the container the method will be invoked since it is <code>@Inject<\/code> annotated and the <code>HelloBean<\/code> will be injected. <\/p>\n<pre class=\"brush:java\">\r\npackage com.javacodegeeks.snippets.enterprise.cdibeans;\r\n\r\nimport javax.inject.Inject;\r\n\r\npublic class GreetingBean {\r\n\r\n\t private HelloBean helloBean;\r\n\r\n\t @Inject\r\n\t  public void setHelloBean(HelloBean helloBean) {\r\n\t    this.helloBean = helloBean;\r\n\t  }\r\n}\r\n<\/pre>\n<h2>4. Use of  the @Any qualifier<\/h2>\n<p>The <code>@Any<\/code> qualifier can be used when we have multiple implementations of one interface and we want to inject them all in another bean. Using this annotation the container will inject all implementations of the specified interface. It is used with the <code>javax.enterprise.inject.Instance<\/code> interface provided by the CDI API, as shown in the code snippet below:<\/p>\n<pre class=\"brush:java\">\r\npackage com.javacodegeeks.snippets.enterprise.cdibeans;\r\n\r\nimport javax.enterprise.inject.Any;\r\nimport javax.enterprise.inject.Instance;\r\nimport javax.inject.Inject;\r\n\r\npublic class GreetingBean {\r\n\r\n\t@Inject\r\n\tpublic void getAllBeanImplementations(@Any Instance&lt;HelloBean&gt; beans) {\r\n\r\n\t\tfor (HelloBean helloBean : beans) {\r\n\t\t\tSystem.out.println(helloBean.getClass().getCanonicalName());\r\n\t\t}\r\n\r\n\t}\r\n}\r\n<\/pre>\n<p>Here we must notice that if there are multiple dependencies that satisfy an injection point and we will not make use of the <code>@Any<\/code> qualifier, but try to inject one instead, then the container will fail.<\/p>\n<h2>5. Use of proxies to implement an injection<\/h2>\n<p>In order to inject a managed bean into another bean, (apart form the <code>@Dependent<\/code> annotated beans) the CDI container will not pass a reference to the injected bean itself but will instead pass a reference to a proxy. The proxy handles all calls to the injected bean transparently. For example, when we inject a <code>SessionScoped<\/code> bean to an <code>ApplicationScoped<\/code> bean and many clients access the <code>ApplicationScopedBean<\/code>, then the proxies are used to handle the calls to the injected beans. Each proxy is able to redirect the call to the correct bean. <\/p>\n<p>Finally, note that a CDI proxy is created by extending the bean class and overriding all non pivate methods. Primitive types cannot be injected. The bean class must have a non-private default constructor and must not be final nor have final methods.<br \/>\n&nbsp;<br \/>\nThis was a tutorial of Dependency Injection in CDI managed Beans, using the <code>@Inject<\/code> annotation.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial we shall show you how to achieve Dependency Injection in CDI managed Beans. In particular, we shall make use of the @Inject annotation provided by the CDI API to inject a CDI bean to another bean. In this way the bean can be used in an application, such as a JavaServer Faces &hellip;<\/p>\n","protected":false},"author":472,"featured_media":112,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[290,289],"class_list":["post-13339","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-cdi","tag-java-ee6"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Java EE CDI Dependency Injection (@Inject) tutorial<\/title>\n<meta name=\"description\" content=\"In this tutorial we shall show you how to achieve Dependency Injection in CDI managed Beans. In particular, we shall make use of the @Inject annotation\" \/>\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\/05\/java-ee-cdi-dependency-injection-inject-tutorial.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Java EE CDI Dependency Injection (@Inject) tutorial\" \/>\n<meta property=\"og:description\" content=\"In this tutorial we shall show you how to achieve Dependency Injection in CDI managed Beans. In particular, we shall make use of the @Inject annotation\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2013\/05\/java-ee-cdi-dependency-injection-inject-tutorial.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-05-29T13:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2013-11-11T09:02:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-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=\"Theodora Fragkouli\" \/>\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=\"Theodora Fragkouli\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/05\\\/java-ee-cdi-dependency-injection-inject-tutorial.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/05\\\/java-ee-cdi-dependency-injection-inject-tutorial.html\"},\"author\":{\"name\":\"Theodora Fragkouli\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/6bdf5e6534337198ce06de139e9b617b\"},\"headline\":\"Java EE CDI Dependency Injection (@Inject) tutorial\",\"datePublished\":\"2013-05-29T13:00:00+00:00\",\"dateModified\":\"2013-11-11T09:02:38+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/05\\\/java-ee-cdi-dependency-injection-inject-tutorial.html\"},\"wordCount\":563,\"commentCount\":6,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/05\\\/java-ee-cdi-dependency-injection-inject-tutorial.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"keywords\":[\"CDI\",\"Java EE6\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/05\\\/java-ee-cdi-dependency-injection-inject-tutorial.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/05\\\/java-ee-cdi-dependency-injection-inject-tutorial.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/05\\\/java-ee-cdi-dependency-injection-inject-tutorial.html\",\"name\":\"Java EE CDI Dependency Injection (@Inject) tutorial\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/05\\\/java-ee-cdi-dependency-injection-inject-tutorial.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/05\\\/java-ee-cdi-dependency-injection-inject-tutorial.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"datePublished\":\"2013-05-29T13:00:00+00:00\",\"dateModified\":\"2013-11-11T09:02:38+00:00\",\"description\":\"In this tutorial we shall show you how to achieve Dependency Injection in CDI managed Beans. In particular, we shall make use of the @Inject annotation\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/05\\\/java-ee-cdi-dependency-injection-inject-tutorial.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/05\\\/java-ee-cdi-dependency-injection-inject-tutorial.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/05\\\/java-ee-cdi-dependency-injection-inject-tutorial.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"java-interview-questions-answers\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/05\\\/java-ee-cdi-dependency-injection-inject-tutorial.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\":\"Java EE CDI Dependency Injection (@Inject) tutorial\"}]},{\"@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\\\/6bdf5e6534337198ce06de139e9b617b\",\"name\":\"Theodora Fragkouli\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/50acde9ff30ae7c7473f7581747f7cdc58aa0156e56bf0a578adaa59ca93ae73?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/50acde9ff30ae7c7473f7581747f7cdc58aa0156e56bf0a578adaa59ca93ae73?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/50acde9ff30ae7c7473f7581747f7cdc58aa0156e56bf0a578adaa59ca93ae73?s=96&d=mm&r=g\",\"caption\":\"Theodora Fragkouli\"},\"description\":\"Theodora has graduated from Computer Engineering and Informatics Department in the University of Patras. She also holds a Master degree in Economics from the National and Technical University of Athens. During her studies she has been involved with a large number of projects ranging from programming and software engineering to telecommunications, hardware design and analysis. She works as a junior Software Engineer in the telecommunications sector where she is mainly involved with projects based on Java and Big Data technologies.\",\"sameAs\":[\"http:\\\/\\\/www.javacodegeeks.com\\\/\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/theodora-fragkouli\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Java EE CDI Dependency Injection (@Inject) tutorial","description":"In this tutorial we shall show you how to achieve Dependency Injection in CDI managed Beans. In particular, we shall make use of the @Inject annotation","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\/05\/java-ee-cdi-dependency-injection-inject-tutorial.html","og_locale":"en_US","og_type":"article","og_title":"Java EE CDI Dependency Injection (@Inject) tutorial","og_description":"In this tutorial we shall show you how to achieve Dependency Injection in CDI managed Beans. In particular, we shall make use of the @Inject annotation","og_url":"https:\/\/www.javacodegeeks.com\/2013\/05\/java-ee-cdi-dependency-injection-inject-tutorial.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2013-05-29T13:00:00+00:00","article_modified_time":"2013-11-11T09:02:38+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","type":"image\/jpeg"}],"author":"Theodora Fragkouli","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Theodora Fragkouli","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2013\/05\/java-ee-cdi-dependency-injection-inject-tutorial.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/05\/java-ee-cdi-dependency-injection-inject-tutorial.html"},"author":{"name":"Theodora Fragkouli","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/6bdf5e6534337198ce06de139e9b617b"},"headline":"Java EE CDI Dependency Injection (@Inject) tutorial","datePublished":"2013-05-29T13:00:00+00:00","dateModified":"2013-11-11T09:02:38+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/05\/java-ee-cdi-dependency-injection-inject-tutorial.html"},"wordCount":563,"commentCount":6,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/05\/java-ee-cdi-dependency-injection-inject-tutorial.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","keywords":["CDI","Java EE6"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2013\/05\/java-ee-cdi-dependency-injection-inject-tutorial.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2013\/05\/java-ee-cdi-dependency-injection-inject-tutorial.html","url":"https:\/\/www.javacodegeeks.com\/2013\/05\/java-ee-cdi-dependency-injection-inject-tutorial.html","name":"Java EE CDI Dependency Injection (@Inject) tutorial","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/05\/java-ee-cdi-dependency-injection-inject-tutorial.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/05\/java-ee-cdi-dependency-injection-inject-tutorial.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","datePublished":"2013-05-29T13:00:00+00:00","dateModified":"2013-11-11T09:02:38+00:00","description":"In this tutorial we shall show you how to achieve Dependency Injection in CDI managed Beans. In particular, we shall make use of the @Inject annotation","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/05\/java-ee-cdi-dependency-injection-inject-tutorial.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2013\/05\/java-ee-cdi-dependency-injection-inject-tutorial.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2013\/05\/java-ee-cdi-dependency-injection-inject-tutorial.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","width":150,"height":150,"caption":"java-interview-questions-answers"},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2013\/05\/java-ee-cdi-dependency-injection-inject-tutorial.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":"Java EE CDI Dependency Injection (@Inject) tutorial"}]},{"@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\/6bdf5e6534337198ce06de139e9b617b","name":"Theodora Fragkouli","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/50acde9ff30ae7c7473f7581747f7cdc58aa0156e56bf0a578adaa59ca93ae73?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/50acde9ff30ae7c7473f7581747f7cdc58aa0156e56bf0a578adaa59ca93ae73?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/50acde9ff30ae7c7473f7581747f7cdc58aa0156e56bf0a578adaa59ca93ae73?s=96&d=mm&r=g","caption":"Theodora Fragkouli"},"description":"Theodora has graduated from Computer Engineering and Informatics Department in the University of Patras. She also holds a Master degree in Economics from the National and Technical University of Athens. During her studies she has been involved with a large number of projects ranging from programming and software engineering to telecommunications, hardware design and analysis. She works as a junior Software Engineer in the telecommunications sector where she is mainly involved with projects based on Java and Big Data technologies.","sameAs":["http:\/\/www.javacodegeeks.com\/"],"url":"https:\/\/www.javacodegeeks.com\/author\/theodora-fragkouli"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/13339","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\/472"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=13339"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/13339\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/112"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=13339"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=13339"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=13339"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}