SpringSecurity集成启动报 In the composition of all global method configuration, no annotation support was actually activated 异常
异常内容:
Caused by: java.lang.IllegalStateException: In the composition of all global method configuration, no annotation support was actually activated
at org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration.methodSecurityMetadataSource(GlobalMethodSecurityConfiguration.java:373) ~[spring-security-config-5.3.3.RELEASE.jar:5.3.3.RELEASE]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_242]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_242]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_242]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_242]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:650) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
导致的原因是
@EnableGlobalMethodSecurity注解 prePostEnabled 属性,是否开启 PreAuthory 注解功能,类似的还有其他注解,Secured注解等等,这些注解的默认值都是false,也就是不启用

解决方法就是配置以下就可以了:
@EnableGlobalMethodSecurity(prePostEnabled = true)
SpringSecurity集成启动报 In the composition of all global method configuration, no annotation support was actually activated 异常的更多相关文章
- Jetty启动报Error scanning entry META-INF/versions/9/org/apache/logging/log4j/util/ProcessIdUtil.class
近日在项目中集成Elasticsearch后,Jetty启动报错. 错误日志如下: Suppressed: |java.lang.RuntimeException: Error scanning en ...
- SpringBoot项目启动报错:java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
. ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \( ( )\___ | '_ | '_| | ...
- SpringBoot集成MybatisPlus报错
SpringBoot集成MybatisPlus报错 启动的时候总是报如下错误: java.lang.annotation.AnnotationFormatError: Invalid default: ...
- Tomcat启动报错org.springframework.web.context.ContextLoaderListener类配置错误——SHH框架
SHH框架工程,Tomcat启动报错org.springframework.web.context.ContextLoaderListener类配置错误 1.查看配置文件web.xml中是否配置.or ...
- 【原】tomcat 7 启动报错:java.lang.NoSuchMethodError: javax.servlet.ServletContext.getSessionCookieConfig()Ljavax/servlet/SessionCookieConfig的解决
现象: tomcat 7 启动报错:java.lang.NoSuchMethodError: javax.servlet.ServletContext.getSessionCookieConfig() ...
- Oracle启动报错ORA-03113解决
环境:RHEL6.4 + Oracle 11.2.0.4 步骤摘要:1.启动报错ORA-031132.查看alert日志查找原因3.根据实际情况采取合理的措施,这里我们先增加闪回区大小,把库启动起来4 ...
- Oracle启动报错ORA-27102解决
环境:RHEL5.5 + Oracle 10.2.0.4 此错误一般是因为数据库的初始化参数文件的内存设置不当导致.本例是因为操作系统参数设置问题导致. 当前现象:Oracle启动报错ORA-2710 ...
- Tomcat启动报错整理
1.启动报 Connector attribute SSLCertificateFile must be defined when using SSL with APR conf\server.xml ...
- freebsd启动报错:My unqualified host name unkown...Sleeping for retry.
原文 http://blog.163.com/sujoe_2006/blog/static/335315120111158576591/ 病状:启动报"My unqualified host ...
随机推荐
- Java8新特性系列-Lambda
转载自:Java8新特性系列-Lambda – 微爱博客 Lambda Expressions in Java 8 Lambda 表达式是 Java 8 最流行的特性.它们将函数式编程概念引入 Jav ...
- WPF使用MVVM(三)-事件转命令
WPF使用MVVM(三)-事件转命令 上一节介绍了WPF中的命令,可是仅仅介绍的是WPF框架给我们提供的点击命令,也就是用Command属性来绑定一个命令,用来响应按钮的点击行为!显然这是不够的,界面 ...
- 2、CPU是怎么实现运算的 ?
我先来了解一下芯片构造,芯片由晶体管组成的.晶体管组成逻辑运算与或非电路. P型半导体的"P"表示正电的意思,取自英文Positive的第一个字母. N型半导体的"N&q ...
- 解构函数(Deconstruct)
元组的解构是C#内置支持的. var countrInfo = ("Malawi", "Lilongwe", io); (string name, string ...
- linux – 使用find -name命令的通配符和双引号
转至:https://www.icode9.com/content-3-209958.html 双引号(和单引号)是否抑制了通配符扩展?如果是这样,那么为什么以下呢? find -name " ...
- Arava: 写一个控制台风格的Mp3播放器
Mp3播放器 来写一个控制台版的mp3播放器.以前很喜欢 cmd.fm 这种控制台风格的播放器. 播放mp3使用 mp3spi 库:下载mp3spi库文件,解压,拿出根目录下的 mp3spi1.9.5 ...
- 命令行窗口cmd:访问C盘根目录和其他盘
1:访问C盘: cd.. 往前推一个目录 以此类推,多用几次cd..即可退回到根目录 2:访问桌面文件夹 由于cmd命令行中>号的存在我们不能直接访问其他文件,所以用cd将>删去 所以 用 ...
- SyntaxError: keyword can't be an expression
创建字典对象时: D1=dict('name'='Bob','age'=20,'score'=90) SyntaxError: keyword can't be an expression 解决方法: ...
- LeetCode-022-括号生成
括号生成 题目描述:数字 n 代表生成括号的对数,请你设计一个函数,用于能够生成所有可能的并且 有效的 括号组合. 示例说明请见LeetCode官网. 来源:力扣(LeetCode) 链接:https ...
- SQL Server的Linked Servers(链接)
我们在使用SQL Server时,有时会有这种需求,需要从一个SQL Server服务器A中,查询另一个SQL Server服务器B中的表,然后将SQL Server服务器A中的表和SQL Serve ...