Multiple setters for a bean and a Spring warning

Rod Widdowson rdw at steadingsoftware.com
Fri Mar 28 06:20:12 EDT 2014


This is mostly for Brent (I think).

The HTTPMetadataResolver used to get its BASIC authentication via a method
with three parameters (username, password,optional  AuthScope).  After some
discussion we have changed this to be

setBasicCredentials(UsernamePasswordCredentials)

but also leaving in a method:

setBasicCredentials(UsernamePasswordCredentials, AuthScope)

I have wired up the parser to pass a UsernamePasswordCredentials as the
parameter to set the property "basicCredentials".

It all appears to work, but Spring emits the following warning.

WARN [org.springframework.beans.GenericTypeAwarePropertyDescriptor:116] -
Invalid JavaBean property 'basicCredentials' being accessed! Ambiguous write
methods found next to actually used [public void
org.opensaml.saml.metadata.resolver.impl.HTTPMetadataResolver.setBasicCreden
tials(org.apache.http.auth.UsernamePasswordCredentials)]: [public void
org.opensaml.saml.metadata.resolver.impl.HTTPMetadataResolver.setBasicCreden
tials(org.apache.http.auth.UsernamePasswordCredentials,org.apache.http.auth.
AuthScope)]

Not particularly coherent, but it appears to indicate that it has taken
umbrage to the setter with two parameters.  

My question is whether there is an easy way to supress this warning without
having to change the name of the second method and if not do we want to do
that.  Remember that this is in OpenSAML and we would sooner avoid any
spring annotations.  

Rod



More information about the dev mailing list