java - Why doesn't Autowiring work for this Spring MVC String bean property? -



java - Why doesn't Autowiring work for this Spring MVC String bean property? -

@autowired private string defaultlanguage;

when seek @autowire defaultlanguage field of countrybean class follows:

<beans:bean id="countrybean" class="geoapp.countrybean"> <beans:property name="defaultlanguage" value="english" /> </beans:bean>

i error:

error creating bean name 'countrybean': injection of autowired dependencies failed; nested exception org.springframework.beans.factory.beancreationexception: not autowire field: private java.lang.string geoapp.countrybean.defaultlanguage; nested exception org.springframework.beans.factory.nosuchbeandefinitionexception: no matching bean of type [java.lang.string] found dependency: expected @ to the lowest degree 1 bean qualifies autowire candidate dependency. dependency annotations: {@org.springframework.beans.factory.annotation.autowired(required=true)}:

when says no matching bean of type [java.lang.string] found dependency, wonder if there's else need allow know value english string?

since explicitly specifying property value via xml, there no need have autowired annotation.

java spring spring-mvc autowired

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -