When using spring injection, the presence of XXX is not writable or have an invalid setter method

Source: Internet
Author: User

Defined in Applicationcontext-redis.xml

<bean id= "Jedisclientpool" class= "Cn.e3mall.common.jedis.JedisClientPool" >
<property name= "Jedispool" ref= "Jedispool" ></property>
</bean>
<bean id= "Jedispool" class= "Redis.clients.jedis.JedisPool" >
<constructor-arg name= "host" value= "192.168.25.128"/>
<constructor-arg name= "Port" value= "6379"/>
</bean>

As a result, a run-time error occurred:

Org.springframework.beans.factory.BeanCreationException:Error creating Bean with Name ' jedisclientpool ' defined in Class path resource [Spring/applicationcontext-redis.xml]: Error setting property values; Nested exception is Org.springframework.beans.NotWritablePropertyException:Invalid property ' Jedispool ' of Bean class [ Cn.e3mall.common.jedis.JedisClientPool]: Bean property ' Jedispool ' was not writable or had an invalid setter method. Does the parameter type of the setter match the return type of the getter?

......

......

......
caused By:org.springframework.beans.NotWritablePropertyException:Invalid property ' Jedispool ' of Bean class [ Cn.e3mall.common.jedis.JedisClientPool]: Bean property ' Jedispool ' was not writable or had an invalid setter method. Does the parameter type of the setter match the return type of the getter?
.......

.......

Where the "Bean property ' Esyerdao ' was not writable or had an invalid setter method" was a critical error

Originally, the Set and get methods need to be defined in Jedisclientpool.

public void Setjedispool (Jedispool jedispool) {
This.jedispool = Jedispool;
}
Public Jedispool Getjedispool () {
return jedispool;
}

Supplementary, case is strictly differentiated, <property name= "Jedispool" ref= "Jedispool"/> and <property name= "Jedispool" ref= "Jedispool"/ > is not the same, for Name= "Jedispool", define set and get methods in Jedisclientpool with lowercase setjedispool and getjedispool:
public void Setjedispool (Jedispool jedispool) {
This.jedispool = Jedispool;
}
Public Jedispool Getjedispool () {
return jedispool;
}

Reference Address: http://deswork.blog.163.com/blog/static/1638466472010910103523736/

When using spring injection, the presence of XXX is not writable or have an invalid setter method

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.