org.springframework.beans.factory.BeanCreationException

来源:互联网 发布:篮球队logo设计软件 编辑:程序博客网 时间:2024/06/06 19:21
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>
0 0
原创粉丝点击