Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'weDAO' of bean class [com.service.WeManageServiceImpl]: Bean property 'weDAO' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
applicationContext-service.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="TestAction" class="com.action.TestAction" scope="prototype">
<property name="weManageService" ref="weManageService"> </property>
</bean>
<bean id="weManageService" class="com.service.WeManageServiceImpl">
<property name="weDAO" ref="weDAO"></property>
</bean>
</beans>
struts:
weManageService.getAllBooks();WeManageService.java
package com.service;
import java.util.List;
import com.We;
public interface WeManageService {
public List<We> getAllBooks();
public List<We> getBookByName(String name);
public void updateBook(We book);
}WeManageServiceImpl.java
package com.service;
import java.util.List;
import com.We;
import com.WeDAO;public class WeManageServiceImpl implements WeManageService{
private WeDAO weDAO;
public List<We> getAllBooks(){
System.out.println(">>>>>>>>>>>>>1dddd");
return weDAO.findAll();
}
public List<We> getBookByName(String name) {
return weDAO.findByMc(name);
} public void updateBook(We book) {
weDAO.attachDirty(book);
}
}
applicationContext-service.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="TestAction" class="com.action.TestAction" scope="prototype">
<property name="weManageService" ref="weManageService"> </property>
</bean>
<bean id="weManageService" class="com.service.WeManageServiceImpl">
<property name="weDAO" ref="weDAO"></property>
</bean>
</beans>
struts:
weManageService.getAllBooks();WeManageService.java
package com.service;
import java.util.List;
import com.We;
public interface WeManageService {
public List<We> getAllBooks();
public List<We> getBookByName(String name);
public void updateBook(We book);
}WeManageServiceImpl.java
package com.service;
import java.util.List;
import com.We;
import com.WeDAO;public class WeManageServiceImpl implements WeManageService{
private WeDAO weDAO;
public List<We> getAllBooks(){
System.out.println(">>>>>>>>>>>>>1dddd");
return weDAO.findAll();
}
public List<We> getBookByName(String name) {
return weDAO.findByMc(name);
} public void updateBook(We book) {
weDAO.attachDirty(book);
}
}
解决方案 »
- tomcat把8080端口占了,安装了resin怎样修改resin.conf端口号,能看到resin的log
- 达内校企合作调查
- linux环境下java如何调用命令实现oracle数据库的备份和恢复
- JPA打包war的问题
- HTTP Status 503 - Servlet action is currently unavailable
- ORA-00923: 未找到预期 FROM 关键字 的问题,求助
- 求助!关于JSP页面跳转。。。。。
- 传值问题求教
- 如何通过POI获取Excel文件中合并单元格的边框?
- decimalbox输入框限制大小问题
- 郁闷我一天的错误,JSTL1.2+TOMCAT5.5+myeclipse6.0
- 新手入门,关于WEBSERVICE中将数据库连接写成服务。。在线等回复
com.WeDAO weDAO = null;
public void setWeDAO(com.WeDAO weDAO) {
this.weDAO=weDAO;
}
private WeDAO weDAO;
这个变量需要get/set方法