解决多环境配置信息读取问题

This commit is contained in:
ajaxfan
2021-03-13 11:39:14 +08:00
parent 330d54b0e9
commit c5da52ecbb

View File

@ -111,7 +111,17 @@ public class TokenAuthenticationFilter extends OncePerRequestFilter {
String config = Stream.of(env.getActiveProfiles()).findFirst().map(first -> first).orElseGet(() -> "default");
return env.getProperty(String.format(token_url_config_format, config));
return StringUtils.getIfEmpty(env.getProperty(format(config.toLowerCase())), () -> {
return env.getProperty(format("default"));
});
}
/**
* @param text
* @return
*/
private String format(String text) {
return String.format(token_url_config_format, text);
}
}