lin*_*org 6 spring yaml spring-boot
spring boot 2.1.1 无法读取 yml 配置到 LinkedHashMap
这是我的班级
我提供了 get 和 set 函数。但它不起作用。
@Getter
@Setter
@Configuration
@ConfigurationProperties("shiro")
public class ShiroConfiguration {
private LinkedHashMap<String, String> filterChainDefinitions;
}
Run Code Online (Sandbox Code Playgroud)
这是我的配置
shiro:
filterChainDefinitions:
/**: origin
Run Code Online (Sandbox Code Playgroud)
这是错误信息
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
Run Code Online (Sandbox Code Playgroud)
您可以使用配置属性。前任
@Component
@EnableConfigurationProperties
@ConfigurationProperties(prefix = "shiro")
class YourComponent {
private HashMap<String, Integer> filterChainDefinitions;
public HashMap<String, Integer> getFilterChainDefinitionsta() {
return filterChainDefinitions;
}
public void setFilterChainDefinitions(HashMap<String, Integer> filterChainDefinitions) {
this.filterChainDefinitions= filterChainDefinitions;
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8424 次 |
| 最近记录: |