[에러] Error creating bean with name 'springSecurityFilterChain'
nested exception is java.lang.IllegalArgumentException: role should not start with 'ROLE_' since it is automatically inserted.
[원인] http.authorizeRequests().antMatchers("/admin/**").hasRole("ROLEADMIN") 부분에서 role의 값은 'role'로 시작하는 값을 받을 수 없다.
원한다면 "ADMIN" 등의 값을 넣어주면 된다.
[코드]
// ExceptionUrlAuthorizationConfigurer.class
private static String hasRole(String role) {
Assert.notNull(role, "role cannot be null");
if (role.startsWith("ROLE_")) {
throw new IllegalArgumentException("role should not start with 'ROLE_' since it is automatically inserted. Got '" + role + "'");
} else {
return "hasRole('ROLE_" + role + "')";
}
}
[에러] Error creating bean with name 'springSecurityFilterChain' nested exception is java.lang.IllegalArgumentException: role should not start with 'ROLE_' since it is automatically inserted.
[원인] http.authorizeRequests().antMatchers("/admin/**").hasRole("ROLEADMIN") 부분에서 role의 값은 'role'로 시작하는 값을 받을 수 없다. 원한다면 "ADMIN" 등의 값을 넣어주면 된다.
[코드]