news 2026/4/20 12:33:21

Spring Security Java Configuration 1.0.0.M1(Milestone 1)是 Spring Security 项目早期发布的**里程碑版本*

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
Spring Security Java Configuration 1.0.0.M1(Milestone 1)是 Spring Security 项目早期发布的**里程碑版本*

Spring Security Java Configuration 1.0.0.M1(Milestone 1)是 Spring Security 项目早期发布的里程碑版本,于2013年左右推出,标志着 Spring Security 正式支持纯 Java 配置方式(即无需 XML),与 Spring 3.2+ 的@Configuration@EnableWebSecurity等注解深度集成。该版本引入了核心的 Java DSL 雏形,例如:

  • @EnableWebSecurity启用 Web 安全配置
  • 继承WebSecurityConfigurerAdapter(已在 Spring Security 5.7+ 中弃用,6.0+ 中移除
  • 通过HttpSecurity进行链式配置(如.authorizeRequests(),.formLogin()
  • 支持基于AuthenticationManagerBuilder的认证配置

⚠️ 注意:1.0.0.M1 是非常早期的预发布版本,不适用于生产环境;现代开发应使用 Spring Security 6.x(基于 Jakarta EE 9+、无 XML、无 WebSecurityConfigurerAdapter,采用SecurityFilterChainBean 方式)。

示例(M1 风格,已过时):

@Configuration@EnableWebSecuritypublicclassSecurityConfigextendsWebSecurityConfigurerAdapter{@Overrideprotectedvoidconfigure(HttpSecurityhttp)throwsException{http.authorizeRequests().anyRequest().authenticated().and().formLogin();}}

✅ 当前推荐方式(Spring Security 6.2+):

@BeanpublicSecurityFilterChainfilterChain(HttpSecurityhttp)throwsException{http.authorizeHttpRequests(auth->auth.anyRequest().authenticated()).formLogin(withDefaults());returnhttp.build();}

Spring Security Java Configuration 1.0.0.M1 Released
I’m pleased to announce the release of Spring Security Java Configuration as a stand alone module. The milestone is compatible with Spring 3.2.3.RELEASE+ and Spring Security 3.1.4.RELEASE.

This code has been merged into Spring Security 3.2.0.M2 release and will be maintained within the Spring Security code base going forward. We hope that by making the release available for stable versions of Spring and Spring Security it will encourage you to try it sooner and provide us feedback before the final release.

Stay tuned to the SpringSource blog for an article that walks you through how to use Spring Security Java Configuration. In the mean time, you can find out how to obtain spring-security-javaconfig, documentation, and samples at http://github.com/SpringSource/spring-security-javaconfig.
comments powered by Disqus

版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/4/20 12:29:29

AI斗地主助手:从零开始的智能出牌实战日记

AI斗地主助手:从零开始的智能出牌实战日记 【免费下载链接】DouZero_For_HappyDouDiZhu 基于DouZero定制AI实战欢乐斗地主 项目地址: https://gitcode.com/gh_mirrors/do/DouZero_For_HappyDouDiZhu 你是否曾经在欢乐斗地主中犹豫不决,不知道下一…

作者头像 李华
网站建设 2026/4/20 12:17:18

vue-axios-github源码解析:手把手教你实现401错误自动跳转登录页

vue-axios-github源码解析:手把手教你实现401错误自动跳转登录页 【免费下载链接】vue-axios-github Vue 全家桶 axios 前端实现登录拦截、登出、拦截器等功能 项目地址: https://gitcode.com/gh_mirrors/vu/vue-axios-github vue-axios-github是一个基于Vu…

作者头像 李华