Reputation: 1039
I have a follow up question to this solution to extending java enums.
How do I inject the extended enums via Spring config when a bean has the interface as property. For example,
class Foo {
Day dayProp;
public setDayProp(Day day) {
this.dayProp = day;
}
}
This gives an error 'failed to convert java.lang.String to interface Day'. I've also tried specifying the entire path.
<bean id="foo1" class="Foo">
<property name="dayProp" value="SAT" />
</bean>
Upvotes: 2
Views: 902
Reputation: 1220
Spring uses reflection to determine the type of property anyway. Have you tried just "SAT"?
Upvotes: -1
Reputation: 1039
With a bit of experimentation, I got this working using SpEL
<property name="dayProp" value="#{ T(path.for.WeekendDay).SAT }" />
But I would love to hear of alternative solutions.
Upvotes: 4