当前位置: 首页 > 编程日记 > 正文

java避免使用orderby_java – Spring安全配置@Order不是唯一的例外

我试图在我的Spring Security配置中注册多个过滤器,但是我总是得到相同的异常:

04-Nov-2015 14:35:23.792 WARNING [RMI TCP Connection(3)-127.0.0.1]

org.springframework.web.context.support.AnnotationConfigWebApplicationContext.refresh

Exception encountered during context initialization – cancelling

refresh attempt

org.springframework.beans.factory.BeanCreationException: Error

creating bean with name

‘org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration’:

Injection of autowired dependencies failed; nested exception is

java.lang.IllegalStateException: @Order on WebSecurityConfigurers must

be unique. Order of 100 was already used, so it cannot be used on

com.payment21.webapp.MultiHttpSecurityConfig$ApiWebSecurityConfigurationAdapter$$EnhancerBySpringCGLIB$$35c79fe4@1d381684

too.

由于我自己的尝试不起作用,我尝试了完全相同的代码,如Spring Security reference所示:

@EnableWebSecurity

public class MultiHttpSecurityConfig {

@Autowired

public void configureGlobal(AuthenticationManagerBuilder auth) {

auth

.inMemoryAuthentication()

.withUser("user").password("password").roles("USER").and()

.withUser("admin").password("password").roles("USER", "ADMIN");

}

@Configuration

@Order(1)

public static class ApiWebSecurityConfigurationAdapter extends WebSecurityConfigurerAdapter {

protected void configure(HttpSecurity http) throws Exception {

http

.antMatcher("/api/**")

.authorizeRequests()

.anyRequest().hasRole("ADMIN")

.and()

.httpBasic();

}

}

@Configuration

public static class FormLoginWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter {

@Override

protected void configure(HttpSecurity http) throws Exception {

http

.authorizeRequests()

.anyRequest().authenticated()

.and()

.formLogin();

}

}

}

为了隔离错误,我尝试用基于Java的方法替换web.xml,但它也没有用.我不知道出了什么问题,这是错误的吗?我的应用程序中的某些东西可以搞乱配置吗?系统正常启动,除非我注册了第二个WebSecurityConfigAdapter.

这些是我的依赖:

compile 'org.springframework:spring-webmvc:4.2.2.RELEASE'

compile 'org.springframework:spring-messaging:4.2.2.RELEASE'

compile 'org.springframework:spring-websocket:4.2.2.RELEASE'

compile 'org.springframework:spring-aop:4.2.2.RELEASE'

compile'javax.servlet:javax.servlet-api:3.0.1'

compile 'org.springframework.security:spring-security-web:4.0.3.RELEASE'

compile 'org.springframework.security:spring-security-config:4.0.3.RELEASE'

相关文章:

es 启动问题

max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536] vim /etc/security/limits.conf 文件末尾添加: mst hard nofile 65536 mst soft nofile 65536 mst是es启动用户 max virtual memory areas vm.max_map_count [65…

imrot matlab,Matlabtuxiangpipei

文件名大小更新时间Matlab图像匹配的都可以用的到做三维重建\matlabcode\examples-code\11.jpg.......................................\..........\.............\addons\rectifData.mat.......................................\..........\.............\......\shelves.jp…

mysql 5.7 full_MySQL5.7默认打开ONLY_FULL_GROUP_BY 解决方案

MySQL5.7后将sql_mode的ONLY_FULL_GROUP_BY模式默认设置为打开状态,这样一来,很多之前的sql语句可能会出现错误,错误信息如下:Error Code: 1055. Expression #3 of SELECT list is not in GROUP BY clause and contains nonaggreg…

通过web sql实现增删查改

<!DOCTYPE html><html><head lang"en"> <meta charset"UTF-8"> <title></title></head><body><h3>***添加学生***</h3>学号&#xff1a;<input type"text" id"id&qu…

java发送苹果消息慢_Spring-boot JMS 发送消息慢的解决方法

Spring-boot JMS 发送消息慢的问题解决Servicepublic class Producer {Autowiredprivate JmsMessagingTemplate jmsTemplate;public void sendMessage(Destination destination, final String message){jmsTemplate.convertAndSend(destination, message);}}经使用JMeter进行压…

快速幂 + 矩阵快速幂

快速幂 1 #include<iostream>2 #include<algorithm>3 #include<cstring>4 #define LL long long5 using namespace std;6 7 LL Pow(LL a, LL b)8 {9 LL ans 1; 10 while(b ! 0){ 11 if(b&1) 12 ans * a; 13 a …

【Ctsc2011】幸福路径

题目链接&#xff1a;http://www.lydsy.com/JudgeOnline/problem.php?id2306 给定一张有向图&#xff0c;每个点有权值&#xff0c;蚂蚁从某个节点出发&#xff0c;初始体力值为$1$&#xff0c;每走一条边$体力值*p$&#xff0c;每经过一个点会获得幸福值为$点权*体力值$&…

mysql 去重con_python 爬虫 实现增量去重和定时爬取实例

前言&#xff1a; 在爬虫过程中&#xff0c;我们可能需要重复的爬取同一个网站&#xff0c;为了避免重复的数据存入我们的数据库中 通过实现增量去重 去解决这一问题 本文还针对了那些需要实时更新的网站 增加了一个定时爬取的功能&#xff1b;本文作者同开源中国(殊途同归_)&a…

oracle数据导出方法,oracle多种导入导出数据方法

dmp格式:1.dmp格式的导出可以通过客户端工具(PL/SQL)操作来完成,通过菜单栏---->Tools---->Export Tables&#xff0c;然后设置勾选相应参数即可,rows代表是否连同数据一起导出2.导出还可以用cmd工具,速度也更快:exp [email protected] filed:\***.dmp fullyfully表示全导…

java 枚举转byte_如何在java中将一个枚举转换为另一个枚举?

一种方法是在您的详细枚举中定义一个方法asSimple()&#xff1a;public enum Detailed {PASSED {OverrideSimple asSimple() {return PASSED;}},INPROCESS {OverrideSimple asSimple() {return RUNNING;}},ERROR1,ERROR2,ERROR3;public Simple asSimple() {return Simple.ERROR…

BZOJ4566: [Haoi2016]找相同字符

BZOJ4566: [Haoi2016]找相同字符 Description 给定两个字符串&#xff0c;求出在两个字符串中各取出一个子串使得这两个子串相同的方案数。两个方案不同当且仅当这两个子串中有一个位置不同。Input 两行&#xff0c;两个字符串s1&#xff0c;s2&#xff0c;长度分别为n1&#x…

mysql索引空间太大_MySQL优化索引

1. MySQL如何使用索引索引用于快速查找具有特定列值的行。如果没有索引&#xff0c;MySQL必须从第一行开始&#xff0c;然后遍历整个表以找到相关的行。表越大&#xff0c;花费越多。如果表中有相关列的索引&#xff0c;MySQL可以快速确定要在数据文件中间查找的位置&#xff…

Mac-sublime text 3破解版

在史蒂芬周下载破解版安装package controlimport urllib.request,os,hashlib; h df21e130d211cfc94d9b0905775a7c0f 1e3d39e33b79698005270310898eea76; pf Package Control.sublime-package; ipp sublime.installed_packages_path(); urllib.request.install_opener( urll…

oracle library cache lock,【案例】Oracle等待事件library cache lock产生原因和解决办法...

【案例】Oracle等待事件library cache lock产生原因和解决办法时间:2016-12-07 18:56 来源:Oracle研究中心 作者:网络 点击:次天萃荷净Oracle研究中心案例分析&#xff1a;运维DBA发现Oracle数据库出现library cache lock等待事件导致cpu使用非常高&#xff0c;结合案例来…

python uiautomation选择list内容_使用python UIAutomation从QQ2017(v8.9)群界面获取所有群成员详细资料,...

首先安装pip install uiautomation, 再运行本文代码。或者下载https://github.com/yinkaisheng/Python-UIAutomation-for-Windows代码(包含了uiautomation module)&#xff0c;直接运行demos目录里的脚本get_qq_group_members.pyuiautomation.py是我写的一个python封装微软UIAu…

【BZOJ】2734: [HNOI2012]集合选数

题目链接&#xff1a;http://www.lydsy.com/JudgeOnline/problem.php?id2734 考虑$N4$的情况&#xff1a; \begin{bmatrix} 1&3 &X \\ 2&X &X \\ 4&X &X \end{bmatrix} 其实就是吧最小值丢在了矩阵中${(0,0)}$的位置上&#xff0c;对于矩阵中的任意…

Linux命令:tar命令批量解压方法总结

tar命令批量解压方法总结 (2010-05-24 17:48:46) 转载▼标签&#xff1a; tar 批量解压 杂谈 分类&#xff1a; linux学习 由于linux的tar命令不支持批量解压&#xff0c;所以很多网友编写了好多支持批量解压的shell命令&#xff0c;收集了一下&#xff0c;供大家分享&#xff…

php column not found,java.sql.SQLException: Column 'cloumn name' not found.

Hi,My system configuration:Mandrake 9.0 Tomcat 4.1.24 MySQL 4.0.12. Apache[問題]我有一隻Servlet app. 如果 Tomcat MySQL APache IBM JDK 1.3 or SUN JDK 1.4.1_02在一開機時就起動. 我在http://localhost:8080/servlet/myApp 是可以看到Servlet run 起來. 可是如…

批量新建文件夹并命名_dos命令实现批量新建文件夹

1、批量新建文件夹&#xff08;使用命令&#xff1a;MD&#xff09;实现案例&#xff1a;假如我们要新建10个文件夹&#xff0c;这10个文件夹的名称分别是数字1-10来命名。以下详细步骤&#xff1a;1&#xff09;在excel表里面把需要批量新建的文件夹名字放到一列&#xff08;假…

java去掉mongodb日志_如何禁用mongoDB java驱动程序日志记录?

我试图禁用mongo-java-driver-3.0.0的日志输出.我试图在我的应用程序开始之前设置它们,然后加载mongo驱动程序,但它没有帮助.// Enable MongoDB logging in generalSystem.setProperty("DEBUG.MONGO", "false");// Enable DB operation tracingSystem.setP…

5793. 【NOIP2008模拟】小S练跑步

Description 小S是一个爱锻炼的孩子&#xff0c;他在放假期间坚持在A公园练习跑步。但不久后&#xff0c;他就开始为在重复的地点练习感到厌烦了&#xff0c;他就打算去B公园跑步。但是小S由于没有去过B公园&#xff0c;他不知道B公园是否适合练习跑步&#xff0c;又不知道在B公…

spring访问oracle数据库表,Spring访问oracle数据库配置步骤

1.spring 对数据库访问的支持当我们开发持久层的时候&#xff0c;我们面临着多种选择&#xff0c;比如使用JDBC、Hibernate、java持久化API或其它持久化框架。幸好的是spring能够支持所有这些持久化机制。DAO(data access boject)数据访问对象&#xff0c;这个名字就很形象描述…

wamp的mysql单独使用_Windows 7+8.1+10 单独安装配置 PHP+Apache+MySQL(不使用 WAMP)

Windows 8.1 单独安装配置 PHPApacheMySQL(不使用 WAMP)本文同样适用于Windows7和100x00 PHP【下载】http://www.doczj.com/doc/b3aef488f18583d048645937.html/downloads.php注&#xff1a;选择线程安全的版本&#xff0c;留意 VC 支持库的版本&#xff0c;9、11、14 分别对应…

【bzoj3209】 花神的数论题

http://www.lydsy.com/JudgeOnline/problem.php?id3209 (题目链接) 题意 ${sum(i)}$表示${i}$的二进制表示中${1}$的个数。求${\prod^n sum(i)}$ Solution ${f_{i,s}}$表示dp到第${i}$位&#xff0c;已经有${s}$个${1}$时的乘积。然后一路dfs就可以了。 细节 LL&#xff0c;返…

html 复选框 mysql_Html:实现带复选框的下拉框(一)

概述项目中要用到可多选的下拉框(select)&#xff0c;发现HTML中无此控件&#xff0c;故手动模拟实现一下。模拟所用元素&#xff1a;input&#xff0c;ul&#xff0c;li代码模拟实现带复选框的下拉列表body{margin: 20px;}input{width: 150px;height: 30px;}ul{display: none;…

oracle date 转换 timestamp,Oracle timestamp类型转换成date类型

今天需要根据时间判断&#xff0c;统一修改某一个字段的数据。然后打开数据库发现&#xff0c;时间类型为timestamp类型。如下&#xff1a;然后呢&#xff0c;这对我不是喝口水就可以解决的问题吗&#xff1f;解决方案如下&#xff1a;我需要改这张表某个字段的内容&#xff0c…

项目微管理29 - 转正

说起来&#xff0c;考核其实是一类活动的统称了&#xff0c;中国的历史上也由来已久&#xff0c;大家非常熟悉的各种选拔人才的制度中非常关键的一项就是“考核”&#xff0c;还有现在大家熟知的“考试”、“考证”、“考评”&#xff0c;其实都是属于这个范畴&#xff0c;它们…

mysql中3张表如何关联查询_mysql三张表关联查询

三张表&#xff0c;需要得到的数据是标红色部分的。sql如下&#xff1a;select a.uid,a.uname,a.upsw,a.urealname,a.utel,a.uremark, b.rid,b.rname,b.rremark,c.deptid,c.deptname,c.deptremarkfrom table1 a,table2 b,table3 c where a.sems_role_ridb.rid and a.udeptidc.d…

20170215学习计划

1.Springboot框架 http://blog.csdn.net/isea533/article/details/50278205 http://jinnianshilongnian.iteye.com/blog/1997192 2.docker百度云视频 3.jsp基础教程-菜鸟教程看完 4.使用springboot、mybatis框架开始houji项目 5.ssh免密码 6.java中enum枚举的使用方法htt…

java map prefix_从键以特定表达式开头的Map中获取所有值的最快方法

小编典典如果您使用NavigableMap(例如TreeMap)&#xff0c;则可以利用基础树数据结构的好处&#xff0c;并执行以下操作(非常O(lg(N))复杂)&#xff1a;public SortedMap getByPrefix(NavigableMap myMap,String prefix ) {return myMap.subMap( prefix, prefix Character.MAX…