Spring Security Java Configuration 1.0.0.M1Milestone 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 风格已过时ConfigurationEnableWebSecuritypublicclassSecurityConfigextendsWebSecurityConfigurerAdapter{Overrideprotectedvoidconfigure(HttpSecurityhttp)throwsException{http.authorizeRequests().anyRequest().authenticated().and().formLogin();}}✅ 当前推荐方式Spring Security 6.2BeanpublicSecurityFilterChainfilterChain(HttpSecurityhttp)throwsException{http.authorizeHttpRequests(auth-auth.anyRequest().authenticated()).formLogin(withDefaults());returnhttp.build();}Spring Security Java Configuration 1.0.0.M1 ReleasedI’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