默认是禁用注解的,要想开启注解,需要继承 WebSecurityConfigurerAdapter并且加上@EnableGlobalMethodSecurity注解
WebSecurityConfigurerAdapter
@EnableGlobalMethodSecurity