Spring @PreAuthorize hasAuthority Exception Failed to convert from type [java.lang.String] to type [java.lang.Boolean] for value 'hasAuthority
问题 So I created a class with two simple public strings public final class Right { private Right() { super(); } public static final String AUTH = "hasAuthority('admin') or hasAuthority('mod')"; } When I used it together with the @PreAuthorize annotation at my controllers it works like a charm. I do not like that it is hardcoded. For this reason I've put the roles in the properties and I tried to use it as a component: @Component("authRule") public class AuthRule { @Value("${role.administrator}")