Co-exclude UserDetailsServiceAutoConfiguration on auto-configuration exclusion annotations
ProprietaryAppends ServletWebSecurityAutoConfiguration and UserDetailsServiceAutoConfiguration to any exclude / excludeAutoConfiguration annotation attribute that already excludes the servlet SecurityAutoConfiguration (for example on @SpringBootApplication, @EnableAutoConfiguration, or a @WebMvcTest slice). Boot 4.0 moved the default security filter chain to ServletWebSecurityAutoConfiguration, and only SecurityAutoConfiguration registers the SecurityProperties bean that UserDetailsServiceAutoConfiguration consumes, so excluding only the former fails at startup, and excluding only those two leaves the application secured. Both are added on their Boot 4 names; the surrounding Spring Boot 4.0 migration relocates SecurityAutoConfiguration itself. The change is annotation-agnostic (matched by the attribute value, not the annotation type), value-precise (it only appends where SecurityAutoConfiguration is actually excluded), and idempotent.
io. moderne. java. spring. boot4. AddUserDetailsServiceAutoConfigurationExclusionToAnnotationsmod run . --recipe= io. moderne. java. spring. boot4. AddUserDetailsServiceAutoConfigurationExclusionToAnnotationsInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.