For example I have
public enum ID { CODEC1, CODEC2 }
and a bean
public class Bean {
private ID id;
public ID getId() { return id; }
public void setId(ID value) { this.id = value; }
}
Is it possible to use symbolic names in Spring config somehow? For instance
<bean id="bean" class="Bean">
<parameter name="id" value="CODEC1"/>
</bean>
If you’re using Spring 3.1, the code that you wrote should work. When using a previous version, try defining
valueOfof the enum as factory method:and