{"id":5457,"date":"2014-03-30T22:16:35","date_gmt":"2014-03-30T22:16:35","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/spring-dynamic-autowire-services-collection-of-common-programming-errors\/"},"modified":"2014-03-30T22:16:35","modified_gmt":"2014-03-30T22:16:35","slug":"spring-dynamic-autowire-services-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/spring-dynamic-autowire-services-collection-of-common-programming-errors\/","title":{"rendered":"Spring dynamic autowire services-Collection of common programming errors"},"content":{"rendered":"<p>I&#8217;ve started to build some kind of a CMS and I&#8217;m stuck over one idea.<\/p>\n<p>The description is:<\/p>\n<p>I have standard MVC Controller (Home) in which I&#8217;m downoading modules settings which will be set in this Controller.<\/p>\n<p>The response is, that I have to implement module with name &#8220;HPModule&#8221;.<\/p>\n<p>So I&#8217;m trying to load this module by <code>Class.forName(\"com.app.something.HPModule\");<\/code> and then call method <code>init();<\/code><\/p>\n<p>My HPModule is:<\/p>\n<pre><code>public class HPModule\n{\n\n    @Resource(name = \"hpModuleService\")\n    private HPModuleService hpModuleService;\n\n    public String init()\n    {\n        SomeObject someObject = hpModuleService.getArticle();\n    }\n}\n<\/code><\/pre>\n<p>And I found that when I&#8217;m trying to do <code>SomeObject someObject = hpModuleService.getArticle();<\/code> Spring is blind for <code>@Resource<\/code> when I&#8217;m calling class by <code>Class.forName<\/code>.<\/p>\n<p>How to solve this issue?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve started to build some kind of a CMS and I&#8217;m stuck over one idea. The description is: I have standard MVC Controller (Home) in which I&#8217;m downoading modules settings which will be set in this Controller. The response is, that I have to implement module with name &#8220;HPModule&#8221;. So I&#8217;m trying to load this [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5457","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5457","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=5457"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5457\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=5457"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=5457"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=5457"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}