java - Error creating bean with name defined in class path resource [application-context.xml] in spring framework -
java - Error creating bean with name defined in class path resource [application-context.xml] in spring framework -
<bean id="mydatasource" class="org.springframework.jdbc.datasource.drivermanagerdatasource"> <property name="driverclassname" value="com.mysql.jdbc.driver"/> <property name="url" value="${url}"/> <property name="username" value="${username}"/> <property name="password" value="${password}"/> </bean> <bean id="template" class="org.springframework.jdbc.core.jdbctemplate"> <constructor-arg value="mydatasource"/> </bean>
error creating bean name 'template' defined in class path resource [application-context.xml]: not resolve matching constructor (hint: specify index/type/name arguments simple parameters avoid type ambiguities)
i not sure doing wrong here above error? have of defined in properties file correctly right variable name. things check ?
change
<bean id="template" class="org.springframework.jdbc.core.jdbctemplate"> <constructor-arg value="mydatasource"/> </bean> to
<bean id="template" class="org.springframework.jdbc.core.jdbctemplate"> <constructor-arg ref="mydatasource"/> </bean> because don't want inject string value want inject referred bean
java xml spring spring-mvc
Comments
Post a Comment