spring boot 2.1.1 can not read yml config to LinkedHashMap
this is my class
I've provided get and set functions. But it doesn't work.
@Getter
@Setter
@Configuration
@ConfigurationProperties("shiro")
public class ShiroConfiguration {
private LinkedHashMap<String, String> filterChainDefinitions;
}
this is my config
shiro:
filterChainDefinitions:
/**: origin
this is error message
Description:
Failed to bind properties under 'shiro.filter-chain-definitions' to java.util.LinkedHashMap<java.lang.String, java.lang.String>:
Reason: No converter found capable of converting from type [java.lang.String] to type [java.util.LinkedHashMap<java.lang.String, java.lang.String>]
Action:
Update your application's configuration
@ConfigurationProperties can't map LinkedHashMap from you properties. You have to use SpEL which is not supported as mentioned here
To solve your issue could update the configuration by adding @Value annotation eg.:
@Getter
@Setter
@Component
public class ShiroConfiguration {
@Value("#{${shiro.filter-chain-definitions}}")
private LinkedHashMap<String, String> filterChainDefinitions;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With