spring mvc - Could not autowire field Injection of autowired dependencies failed -
spring mvc - Could not autowire field Injection of autowired dependencies failed -
may question title seems duplicate i'm getting same error , couldnt find reply in stackoverflow.
i have controller
@controller public class mycontroller{ @autowired beana beana; @requestmapping(value="/home") public string showhomescreen(){ homecoming "home"; } } my beana class:
public class beana { private map<object, object> maps; //setters,getters } i've configure beana in spring config in way
<bean id="beana" class="com.mycompany.beans.beana"> <property name="maps"> <map> <entry key="key 1" value="1" /> <entry key="key 2" value="2" /> </map> </property> </bean> updated:
stacktrace:
org.springframework.beans.factory.beancreationexception: error creating bean name 'mycontroller': injection of autowired dependencies failed; nested exception org.springframework.beans.factory.beancreationexception: not autowire field: com.mycompany.beans.beana com.mycompany.controller.mycontroller.beana ; nested exception org.springframework.beans.factory.nosuchbeandefinitionexception: no qualifying bean of type [com.mycompany.beans.beana] found dependency: expected @ to the lowest degree 1 bean qualifies autowire candidate dependency. dependency annotations: {@org.springframework.beans.factory.annotation.autowired(required=true)} @ org.springframework.beans.factory.annotation.autowiredannotationbeanpostprocessor.postprocesspropertyvalues(autowiredannotationbeanpostprocessor.java:289) i registered context base of operations package
<context:component-scan base-package="com.mycompany.*"/> now when deploy application error not autowire field "beana" injection of autowired dependencies failed.
can please help me out of issue....
the stacktrace says :
controllermycontroller correctly scanned spring there dependancies errors bean beana not exist same application context possible causes :
the config file inbeana declared not processed spring (most probable) there's typo somewhere (it looks there none, write autowire without ending d ...) the context in beana declared neither same context mycontroller one, nor parent context spring-mvc autowired
Comments
Post a Comment