我正试图通过Security @PreAuthorize注释访问当前的活动配置文件,如
@PreAuthorize("hasRole('SOME_' + #{ environment.activeProfiles[0] } + '_ROLE')")
我收到以下例外情况:
EL1043E:意想不到的标记。预期的“标识符”但为“lcurly({)”
是否有一种无需编写自定义表达式处理程序就可以完成此操作的方法?
发布于 2018-02-12 10:40:44
让它以一种复杂的方式运作。看起来应该更直截了当。这感觉像是一次黑客攻击:
@PreAuthorize("hasRole('SOME_' + #profile + '_ROLE')")
public void method(@Value("#{ environment.getActiveProfiles()[0]?.toUpperCase() }") String profile)
https://stackoverflow.com/questions/48710330
复制