I have default methods, such as setXxx(X x)
and X getXxx()
, but spring won't recoginze those as properties. Is it possible to somehow avoid method duplication if I want to use this interface in different classes?
Example:
public class Type {... }
public interface TypeSupport {
Type getType();
default String getTypeName(){
return getType().getName();
}
default void setTypeName(String name){
getType().setName(name);
}
}
public class TypedVariable implements TypeSupport {
private Type type = new Type();
@Override public Type getType() {
return type;
}
}
I want to define TypedVariable
bean in xml configuration:
<bean id="typedVariable" class="com.example.TypedVariable">
<property name="typeName" value="string"/>
</bean>
When running, Spring fails with an error indicating that TypedVariable
has no writeable property typeName
.