异常内容:

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 异常的更多相关文章

  1. Jetty启动报Error scanning entry META-INF/versions/9/org/apache/logging/log4j/util/ProcessIdUtil.class

    近日在项目中集成Elasticsearch后,Jetty启动报错. 错误日志如下: Suppressed: |java.lang.RuntimeException: Error scanning en ...

  2. SpringBoot项目启动报错:java.lang.RuntimeException: java.lang.reflect.InvocationTargetException

    .   ____          _            __ _ _ /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \( ( )\___ | '_ | '_| | ...

  3. SpringBoot集成MybatisPlus报错

    SpringBoot集成MybatisPlus报错 启动的时候总是报如下错误: java.lang.annotation.AnnotationFormatError: Invalid default: ...

  4. Tomcat启动报错org.springframework.web.context.ContextLoaderListener类配置错误——SHH框架

    SHH框架工程,Tomcat启动报错org.springframework.web.context.ContextLoaderListener类配置错误 1.查看配置文件web.xml中是否配置.or ...

  5. 【原】tomcat 7 启动报错:java.lang.NoSuchMethodError: javax.servlet.ServletContext.getSessionCookieConfig()Ljavax/servlet/SessionCookieConfig的解决

    现象: tomcat 7 启动报错:java.lang.NoSuchMethodError: javax.servlet.ServletContext.getSessionCookieConfig() ...

  6. Oracle启动报错ORA-03113解决

    环境:RHEL6.4 + Oracle 11.2.0.4 步骤摘要:1.启动报错ORA-031132.查看alert日志查找原因3.根据实际情况采取合理的措施,这里我们先增加闪回区大小,把库启动起来4 ...

  7. Oracle启动报错ORA-27102解决

    环境:RHEL5.5 + Oracle 10.2.0.4 此错误一般是因为数据库的初始化参数文件的内存设置不当导致.本例是因为操作系统参数设置问题导致. 当前现象:Oracle启动报错ORA-2710 ...

  8. Tomcat启动报错整理

    1.启动报 Connector attribute SSLCertificateFile must be defined when using SSL with APR conf\server.xml ...

  9. freebsd启动报错:My unqualified host name unkown...Sleeping for retry.

    原文 http://blog.163.com/sujoe_2006/blog/static/335315120111158576591/ 病状:启动报"My unqualified host ...

随机推荐

  1. C# 事件Event(个人整理)

    内容来源:MSN:https://docs.microsoft.com/zh-cn/dotnet/csharp/event-pattern 操作符详解(上)   https://www.youtube ...

  2. linux中ctrl+c、ctrl+z、ctrl+d区别

    转至:https://www.cnblogs.com/jintaoblogs/p/11343623.html 一.ctrl-c 发送 SIGINT 信号(程序终止(interrupt)信号)给前台进程 ...

  3. Qt:自动为class的所有属性生成getter、setter

    在类所在的.h文件中,右键类名,Refactor → Create Getter and Setter

  4. Scrapy(六):Spider

    总结自:Spiders - Scrapy 2.5.0 documentation Spider 1.综述 ①在回调函数Parse及其他自写的回调函数中,必须返回Item对象.Request对象.或前两 ...

  5. js websocket断线重连

    js websocket断开重连实例代码,请根据自己需求做出相应改动Vue中使用websocket $(function() { var lockReconnect = false;//避免重复连接 ...

  6. linux添加串口权限

    通过添加到用户组的方式实现1.由于tty属于"dialout"组别,比如你的用户名是blue, 先命令查看下用户隶属的组别 groups blue 2.如果没有隶属"di ...

  7. JZ-066-机器人的运动范围

    机器人的运动范围 题目描述 地上有一个m行和n列的方格.一个机器人从坐标0,0的格子开始移动,每一次只能向左,右,上,下四个方向移动一格,但是不能进入行坐标和列坐标的数位之和大于k的格子. 例如,当k ...

  8. JZ-050-数组中重复的数字

    数组中重复的数字 题目描述 在一个长度为n的数组里的所有数字都在0到n-1的范围内. 数组中某些数字是重复的,但不知道有几个数字是重复的.也不知道每个数字重复几次.请找出数组中 第一个重复的数字. 例 ...

  9. 进制转换伪代码转python

    运行结果如图 代码如下 a=input("请输入一个十进制数:", ) print("二进制结果为:",bin(int(a))) print("八进制 ...

  10. SQL从零到迅速精通【表连接查询】

    看了这些表连接,个人感觉'左外连接'.'右外连接'和'全外连接'应用好就可以了. 1.外连接 (1)LEFT JOIN(左连接):返回包括左表中的所有记录和右表中连接字段相等的记录. 在student ...