严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'MemberServiceImpl' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.InvalidPropertyException: Invalid property 'memberDaoimpl' of bean class [cn.ssh.common.MemberServiceImpl]: No property 'memberDaoimpl' found
Caused by: org.springframework.beans.InvalidPropertyException: Invalid property 'memberDaoimpl' of bean class [cn.ssh.common.MemberServiceImpl]: No property 'memberDaoimpl' found
下面是我的applicationContext.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"></property>
<property name="url" value="jdbc:oracle:thin:@test:1521:orcl"></property>
<property name="username" value="hbyuy"></property>
<property name="password" value="hbyuy"></property>
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource"/>
</property>
<property name="mappingResources">
<list>
<value>cn/struts2/action/Menu.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop>
<prop key="show_sql">true</prop>
</props>
</property>
</bean>
<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<constructor-arg>
<ref local="sessionFactory"/>
</constructor-arg>
</bean>
<bean id="memberDaoimpl" class="cn.ssh.common.MemberDaoImpl">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean id="MemberServiceImpl" class="cn.ssh.common.MemberServiceImpl">
<property name="memberDaoimpl" ref="memberDaoimpl"></property>
</bean>
<bean id="ListMenuAction" class="cn.struts2.action.ListMenuAction">
<property name="MemberServiceImpl" ref="MemberServiceImpl"></property>
</bean>
<bean id="test2" class="cn.ssh.test.IocTest"></bean>
</beans>
------解决方案--------------------------------------------------------
你确定你的名字一样吗?
setMemberDaoImpl
memberDaoimpl
应该是setMemberDaoimpl
注意你的变量i是小写的。
------解决方案--------------------------------------------------------
晕倒了。。。。 你看好你的属性名字。有点像找别扭游戏一样。。
看好你的属性叫:memberDaoimpl
你的set方法叫:setMemberDaoImpl(MemberDaoImpl memberDaoimpl)