spring设置属性值出错;出现嵌套异常Error setting property values; nested exception is org.springframework.beans.Not

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘userService’ defined in class path resource [spring-sys.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property ‘userDAO’ of bean class [com.zking.login.sys.service.impl.UserService]: Bean property ‘userDAO’ is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
spring设置属性值出错;出现嵌套异常Error setting property values; nested exception is org.springframework.beans.Not_第1张图片

错误写法:
根据org.springframework.beans.NotWritablePropertyExcep tion 初步分析是spring配置文件中配置问题 或配置文件中某个地方写的不对。


	
		
	

而 java类中我写set方法中是这么写的

private IUserDao userdao;

public UserService() {
}
public IUserDao getUserdao() {
return userdao;
}

public void setUserdao(IUserDao userdao) {
this.userdao = userdao;
}

set 中的属性userdao和 property name=“userdao” 写的不一致

解决方法:

	
		
			
		
	

将修改成和set一致 即可。

你可能感兴趣的:(Spring,spring,java,spring,boot,mybatis,maven)