Prevents AI coding agents from defaulting to Java 8 and Spring Boot 2.x legacy patterns (javax.*, WebSecurityConfigurerAdapter, RestTemplate, @Autowired field injection, Executors.newFixedThreadPool(), list.get(list.size() - 1)). Unlike general persona skills such as java-pro, this skill pairs lightweight instructions with version-gated CLI scanning (mjg detect, mjg check, mjg search, mjg retrieve) and respects older Java 8/11 and Spring Boot 2.x codebases without forcing upgrades.
java-pro for broader JVM/GraalVM tuning topics not covered by this skill's rules.pom.xml, build.gradle, build.gradle.kts, or .java-version).mjg CLI (https://github.com/wkd09/modern-java-guidance) for automated version detection and scanning. Everything runs 100% offline with zero external network calls or credentials.Inspect pom.xml, build.gradle(.kts), gradle/libs.versions.toml, or .java-version (or run mjg detect . if installed).
jakarta.* unless explicitly asked to migrate.record, sealed interface, SecurityFilterChain Lambda DSL with CSRF enabled by default, jakarta.*, constructor injection, java.time). Keep WebClient or RestTemplate (RestClient requires Boot 3.2+).RestClient / @HttpExchange over RestTemplate.switch, SequencedCollection.getLast(), and Executors.newVirtualThreadPerTaskExecutor() for blocking I/O.Use references/java-21-25-core.md and references/spring-boot-3x.md (or mjg search / mjg retrieve) when writing or updating Java classes. Preserve public/legacy APIs and keep bounded thread pools for CPU-bound tasks.
Run mjg check src/ (if installed) and the project's build/test command (./mvnw test or ./gradlew test). Report any remaining warnings or unexecuted build checks explicitly.
User request: Add a Spring Security configuration for a Spring Boot 3.3 + Java 21 REST API.
Inputs: pom.xml specifying spring-boot-starter-parent 3.3.4 and java.version 21.
Expected result: Generates a @Bean SecurityFilterChain using Lambda DSL (authorizeHttpRequests, requestMatchers) with CSRF protection preserved by default, without WebSecurityConfigurerAdapter or antMatchers(), and passes `mjg check` with 0 findings.
mjg relies on static source scanning rather than full javac AST resolution; always run the project's compiler and test suite (./mvnw test / ./gradlew test).record types for JPA @Entity classes, which require mutable state and no-arg constructors.risk: safe).mjg detect and mjg check perform read-only local filesystem reads and never transmit source code over the network.java-pro