Enum
public enum Property {
A,
AB,
ABC;
}
Field
@Value("${custom.property}")
protected Property property;
application.properties (lower case)
custom.property=abc
When I'm running application I have an error:
Cannot convert value of type [java.lang.String] to required type [com.xxx.Property]: no matching editors or conversion strategy found.
Whereas (upper case):
custom.property=ABC
Works fine.
Is there a way to bind the value case insensitive? Like ABC, Abc, AbC, abc any pattern should work.
NOTE: I saw this question - Spring 3.0 MVC binding Enums Case Sensitive but in my case I have over 10 enums/values (and expect to have more) classes and to implement 10 different custom property binders would be painful, I need some generic solution.