org.springframework.beans.factory.BeanCreationException

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDao' defined in file [F:\apache-tomcat-7.0.65\webapps\SMVCSH2\WEB-INF\classes\config\springAnnotation-beans.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file [F:\apache-tomcat-7.0.65\webapps\SMVCSH2\WEB-INF\classes\config\springAnnotation-hibernate.xml]: Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in file [F:\apache-tomcat-7.0.65\webapps\SMVCSH2\WEB-INF\classes\config\springAnnotation-hibernate.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'userName' of bean class [org.springframework.jdbc.datasource.DriverManagerDataSource]: Bean property 'userName' is not writable or has an invalid setter method. Did you mean 'username'?
 
这是因为
<!-- 配置数据源 -->
   <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
 <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
 <property name="url" value="jdbc:mysql://localhost:3306/springmvc"/>
 <property name="userName" value="root"/>这里应该小写  <property name="password" value="541711153"/>  </bean> 

你可能感兴趣的:(org.springframework.beans.factory.BeanCreationException)