{"id":1363,"date":"2012-06-21T01:00:00","date_gmt":"2012-06-21T01:00:00","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/2012\/10\/how-i-explained-dependency-injection-to-my-team.html"},"modified":"2012-10-22T05:31:22","modified_gmt":"2012-10-22T05:31:22","slug":"how-i-explained-dependency-injection-to","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2012\/06\/how-i-explained-dependency-injection-to.html","title":{"rendered":"How I explained Dependency Injection to My Team"},"content":{"rendered":"<div dir=\"ltr\" style=\"text-align: left\">\n<div style=\"text-align: justify\">Recently our company started developing a new java based web application and after some evaluation process we decided to use Spring.\n<\/div>\n<div style=\"text-align: justify\">But many of the team members are not aware of Spring and Dependency Injection principles. So I was asked to give a crash course on what is Dependency Injection and basics on Spring.                    <\/div>\n<p>Instead of telling all the theory about IOC\/DI I thought of explaining with an example.                    <\/p>\n<p><strong>Requirement:<\/strong> We will get some Customer Address and we need to validate the address.<br \/>\nAfter some evaluation we thought of using Google Address Validation Service.                    <\/p>\n<p><strong>Legacy(Bad) Approach:<\/strong>                   <\/p>\n<p>Just create an AddressVerificationService class and implement the logic.                     <\/p>\n<p>Assume GoogleAddressVerificationService is a service provided by Google which takes Address as a String and Return longitude\/latitude.                     <\/p>\n<pre class=\"brush:java\">class AddressVerificationService \r\n{\r\n   public String validateAddress(String address)\r\n {\r\n GoogleAddressVerificationService gavs = new GoogleAddressVerificationService();\r\n  String result = gavs.validateAddress(address);  \r\n  return result;\r\n }\r\n}\r\n<\/pre>\n<p><strong>Issues with this approach:&nbsp;<\/strong><\/p>\n<p>1. If you want to change your Address Verification Service Provider you need to change the logic.<br \/>\n2. You can&#8217;t Unit Test with some Dummy AddressVerificationService (Using Mock Objects)                    <\/p>\n<p>Due to some reason Client ask us to support multiple AddressVerificationService Providers and we need to determine which service to use at runtime.                    <\/p>\n<p>To accomidate this you may thought of changing the above class as below:                     <\/p>\n<pre class=\"brush:java\">class AddressVerificationService\r\n{\r\n\/\/This method validates the given address and return longitude\/latitude details.\r\n public String validateAddress(String address)\r\n {\r\n  String result = null;\r\n  int serviceCode = 2; \/\/ read this code value from a config file\r\n  if(serviceCode == 1)\r\n  {\r\n   GoogleAddressVerificationService googleAVS = new GoogleAddressVerificationService();\r\n   result = googleAVS.validateAddress(address);\r\n  } else if(serviceCode == 2)\r\n  {\r\n   YahooAddressVerificationService yahooAVS = new YahooAddressVerificationService();\r\n   result = yahooAVS.validateAddress(address);\r\n  }\r\n  return result;\r\n }\r\n}\r\n<\/pre>\n<p><strong>Issues with this approach:&nbsp;<\/strong><br \/>\n<strong>&nbsp;<\/strong><br \/>\n1. Whenever you need to support a new Service Provider you need to add\/change logic using if-else-if.<br \/>\n2. You can&#8217;t Unit Test with some Dummy AddressVerificationService (Using Mock Objects)                    <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> IOC\/DI Approach: <\/strong>                   <\/p>\n<p>In the above approaches AddressVerificationService is taking the control of creating its dependencies.<br \/>\nSo whenever there is a change in its dependencies the AddressVerificationService will change.                    <\/p>\n<p>Now let us rewrite the AddressVerificationService using IOC\/DI pattern.                     <\/p>\n<pre class=\"brush:java\"> class AddressVerificationService\r\n {\r\n  private AddressVerificationServiceProvider serviceProvider;\r\n  \r\n  public AddressVerificationService(AddressVerificationServiceProvider serviceProvider) {\r\n   this.serviceProvider = serviceProvider;\r\n  }\r\n  \r\n  public String validateAddress(String address)\r\n  {\r\n   return this.serviceProvider.validateAddress(address);\r\n  }\r\n }\r\n \r\n interface AddressVerificationServiceProvider\r\n {\r\n  public String validateAddress(String address);\r\n }\r\n<\/pre>\n<p>Here we are injecting the AddressVerificationService dependency AddressVerificationServiceProvider.                    <\/p>\n<p>Now let us implement the AddressVerificationServiceProvider with multiple provider services.                     <\/p>\n<pre class=\"brush:java\"> class YahooAVS implements AddressVerificationServiceProvider\r\n {\r\n  @Override\r\n  public String validateAddress(String address) {\r\n   System.out.println(\"Verifying address using YAHOO AddressVerificationService\");\r\n   return yahooAVSAPI.validate(address);\r\n  }  \r\n }\r\n\r\n class GoogleAVS implements AddressVerificationServiceProvider\r\n {\r\n  @Override\r\n  public String validateAddress(String address) {\r\n   System.out.println(\"Verifying address using Google AddressVerificationService\");\r\n   return googleAVSAPI.validate(address);\r\n  }\r\n }\r\n<\/pre>\n<p>Now the Client can choose which Service Provider&#8217;s service to use as follows:                     <\/p>\n<pre class=\"brush:java\"> AddressVerificationService verificationService = null;\r\n AddressVerificationServiceProvider provider = null;\r\n provider = new YahooAVS();\/\/to use YAHOO AVS\r\n provider = new GoogleAVS();\/\/to use Google AVS\r\n \r\n verificationService = new AddressVerificationService(provider);\r\n String lnl = verificationService.validateAddress(\"HitechCity, Hyderabad\");\r\n System.out.println(lnl);\r\n<\/pre>\n<p>For Unit Testing we can implement a Mock AddressVerificationServiceProvider.                     <\/p>\n<pre class=\"brush:java\"> class MockAVS implements AddressVerificationServiceProvider\r\n {\r\n  @Override\r\n  public String validateAddress(String address) {\r\n   System.out.println(\"Verifying address using MOCK AddressVerificationService\");\r\n   return \"&lt;response&gt;&lt;longitude&gt;123&lt;\/longitude&gt;&lt;latitude&gt;4567&lt;\/latitude&gt;\";\r\n  }\r\n }\r\n \r\n AddressVerificationServiceProvider provider = null;\r\n provider = new MockAVS();\/\/to use MOCK AVS  \r\n AddressVerificationServiceIOC verificationService = new AddressVerificationServiceIOC(provider);\r\n String lnl = verificationService.validateAddress(\"Somajiguda, Hyderabad\");\r\n System.out.println(lnl);\r\n<\/pre>\n<p>With this approach we elemenated the issues with above Non-IOC\/DI based approaches.<br \/>\n1. We can provide support for as many Provides as we wish. Just implement AddressVerificationServiceProvider and inject it.<br \/>\n2. We can unit test using Dummy Data using Mock Implementation.                     <\/p>\n<p><strong><i>So by following Dependency Injection principle we can create interface-based loosely-coupled and easily testable services.<\/i><\/strong> <\/p>\n<p><strong><i>Reference: <\/i><\/strong><a href=\"http:\/\/www.sivalabs.in\/2012\/06\/how-i-explained-dependency-injection-to.html\">How I explained Dependency Injection to My Team <\/a> from our <a href=\"http:\/\/www.javacodegeeks.com\/p\/jcg.html\">JCG partner<\/a> Siva Reddy at the <a href=\"http:\/\/www.sivalabs.in\/\">My Experiments on Technology <\/a> blog.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Recently our company started developing a new java based web application and after some evaluation process we decided to use Spring. But many of the team members are not aware of Spring and Dependency Injection principles. So I was asked to give a crash course on what is Dependency Injection and basics on Spring. Instead &hellip;<\/p>\n","protected":false},"author":15,"featured_media":112,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[124],"class_list":["post-1363","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-dependency-injection"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How I explained Dependency Injection to My Team - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Recently our company started developing a new java based web application and after some evaluation process we decided to use Spring. But many of the team\" \/>\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\/2012\/06\/how-i-explained-dependency-injection-to.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How I explained Dependency Injection to My Team - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Recently our company started developing a new java based web application and after some evaluation process we decided to use Spring. But many of the team\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2012\/06\/how-i-explained-dependency-injection-to.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=\"2012-06-21T01:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2012-10-22T05:31:22+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=\"Siva Reddy\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@http:\/\/twitter.com\/sivalabs\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Siva Reddy\" \/>\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\\\/2012\\\/06\\\/how-i-explained-dependency-injection-to.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/how-i-explained-dependency-injection-to.html\"},\"author\":{\"name\":\"Siva Reddy\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/c4bc16742c140e793e22fe73a1b6f488\"},\"headline\":\"How I explained Dependency Injection to My Team\",\"datePublished\":\"2012-06-21T01:00:00+00:00\",\"dateModified\":\"2012-10-22T05:31:22+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/how-i-explained-dependency-injection-to.html\"},\"wordCount\":394,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/how-i-explained-dependency-injection-to.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"keywords\":[\"Dependency Injection\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/how-i-explained-dependency-injection-to.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/how-i-explained-dependency-injection-to.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/how-i-explained-dependency-injection-to.html\",\"name\":\"How I explained Dependency Injection to My Team - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/how-i-explained-dependency-injection-to.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/how-i-explained-dependency-injection-to.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"datePublished\":\"2012-06-21T01:00:00+00:00\",\"dateModified\":\"2012-10-22T05:31:22+00:00\",\"description\":\"Recently our company started developing a new java based web application and after some evaluation process we decided to use Spring. But many of the team\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/how-i-explained-dependency-injection-to.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/how-i-explained-dependency-injection-to.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/how-i-explained-dependency-injection-to.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\\\/2012\\\/06\\\/how-i-explained-dependency-injection-to.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\":\"How I explained Dependency Injection to My Team\"}]},{\"@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\\\/c4bc16742c140e793e22fe73a1b6f488\",\"name\":\"Siva Reddy\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/57171cbc9a028e211086675fa890ef348d8da6113ee2e16e74aadad2261d21c8?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/57171cbc9a028e211086675fa890ef348d8da6113ee2e16e74aadad2261d21c8?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/57171cbc9a028e211086675fa890ef348d8da6113ee2e16e74aadad2261d21c8?s=96&d=mm&r=g\",\"caption\":\"Siva Reddy\"},\"description\":\"Katamreddy Siva Prasad is a Senior Software Engineer working in E-Commerce domain. His areas of interest include Object Oriented Design, SOLID Design principles, RESTful WebServices and OpenSource softwares including Spring, MyBatis and Jenkins.\",\"sameAs\":[\"http:\\\/\\\/sivalabs.blogspot.com\\\/\",\"https:\\\/\\\/x.com\\\/http:\\\/\\\/twitter.com\\\/sivalabs\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/siva-reddy\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How I explained Dependency Injection to My Team - Java Code Geeks","description":"Recently our company started developing a new java based web application and after some evaluation process we decided to use Spring. But many of the team","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\/2012\/06\/how-i-explained-dependency-injection-to.html","og_locale":"en_US","og_type":"article","og_title":"How I explained Dependency Injection to My Team - Java Code Geeks","og_description":"Recently our company started developing a new java based web application and after some evaluation process we decided to use Spring. But many of the team","og_url":"https:\/\/www.javacodegeeks.com\/2012\/06\/how-i-explained-dependency-injection-to.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2012-06-21T01:00:00+00:00","article_modified_time":"2012-10-22T05:31:22+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":"Siva Reddy","twitter_card":"summary_large_image","twitter_creator":"@http:\/\/twitter.com\/sivalabs","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Siva Reddy","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2012\/06\/how-i-explained-dependency-injection-to.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/06\/how-i-explained-dependency-injection-to.html"},"author":{"name":"Siva Reddy","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/c4bc16742c140e793e22fe73a1b6f488"},"headline":"How I explained Dependency Injection to My Team","datePublished":"2012-06-21T01:00:00+00:00","dateModified":"2012-10-22T05:31:22+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/06\/how-i-explained-dependency-injection-to.html"},"wordCount":394,"commentCount":2,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/06\/how-i-explained-dependency-injection-to.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","keywords":["Dependency Injection"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2012\/06\/how-i-explained-dependency-injection-to.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2012\/06\/how-i-explained-dependency-injection-to.html","url":"https:\/\/www.javacodegeeks.com\/2012\/06\/how-i-explained-dependency-injection-to.html","name":"How I explained Dependency Injection to My Team - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/06\/how-i-explained-dependency-injection-to.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/06\/how-i-explained-dependency-injection-to.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","datePublished":"2012-06-21T01:00:00+00:00","dateModified":"2012-10-22T05:31:22+00:00","description":"Recently our company started developing a new java based web application and after some evaluation process we decided to use Spring. But many of the team","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/06\/how-i-explained-dependency-injection-to.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2012\/06\/how-i-explained-dependency-injection-to.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2012\/06\/how-i-explained-dependency-injection-to.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\/2012\/06\/how-i-explained-dependency-injection-to.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":"How I explained Dependency Injection to My Team"}]},{"@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\/c4bc16742c140e793e22fe73a1b6f488","name":"Siva Reddy","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/57171cbc9a028e211086675fa890ef348d8da6113ee2e16e74aadad2261d21c8?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/57171cbc9a028e211086675fa890ef348d8da6113ee2e16e74aadad2261d21c8?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/57171cbc9a028e211086675fa890ef348d8da6113ee2e16e74aadad2261d21c8?s=96&d=mm&r=g","caption":"Siva Reddy"},"description":"Katamreddy Siva Prasad is a Senior Software Engineer working in E-Commerce domain. His areas of interest include Object Oriented Design, SOLID Design principles, RESTful WebServices and OpenSource softwares including Spring, MyBatis and Jenkins.","sameAs":["http:\/\/sivalabs.blogspot.com\/","https:\/\/x.com\/http:\/\/twitter.com\/sivalabs"],"url":"https:\/\/www.javacodegeeks.com\/author\/siva-reddy"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/1363","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\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=1363"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/1363\/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=1363"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=1363"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=1363"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}