Spring Sentinel Logo

Stop Spring Boot Anti-Patterns
Before Production.

A framework-aware static analysis platform for Maven, Gradle, and SpotBugs. It blocks your CI/CD pipeline when it detects dangerous code, hardcoded secrets, or bad architectural practices.

Get Started View Rules

Quick Start

Spring Sentinel supports Maven, Gradle, and SpotBugs integrations. Choose your preferred workflow and run Spring-aware static analysis directly in your CI/CD pipeline.

Maven

<plugin>
    <groupId>io.github.pagano-antonio</groupId>
    <artifactId>spring-sentinel-maven-plugin</artifactId>
    <version>2.0.0</version>
    <executions>
        <execution>
            <phase>verify</phase>
            <goals>
                <goal>audit</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <profile>strict</profile>
        <failOnError>false</failOnError>
    </configuration>
</plugin>

Run the audit:

mvn spring-sentinel:audit

Reports:

target/spring-sentinel-reports/

Gradle

plugins {
    id "io.github.pagano-antonio.spring-sentinel" version "2.0.0"
}

springSentinel {
    profile = "strict"
    failOnError = false
}

Run the audit:

gradle springSentinelAudit

Reports:

build/spring-sentinel-reports/

Upgrading from 1.x?

Spring Sentinel 2.0.0 introduces a new multi-module structure. Existing 1.x users can keep using the old artifact, but when upgrading to 2.0.0 the Maven plugin artifact has changed.

Old 1.x artifact:

io.github.pagano-antonio:SpringSentinel

New 2.0 artifact:

io.github.pagano-antonio:spring-sentinel-maven-plugin

SpotBugs Integration Experimental

Spring Sentinel can now run directly inside existing SpotBugs workflows. The SpotBugs extension provides Spring-specific bytecode analysis while integrating seamlessly with existing CI/CD pipelines.

Currently Supported Rules

Rule ID Description
ARCH-002 Detects field injection using @Autowired and @Inject.

Maven Configuration

<plugin>
    <groupId>com.github.spotbugs</groupId>
    <artifactId>spotbugs-maven-plugin</artifactId>
    <version>4.9.3.0</version>

    <dependencies>
        <dependency>
            <groupId>io.github.pagano-antonio</groupId>
            <artifactId>spring-sentinel-spotbugs-plugin</artifactId>
            <version>2.1.0</version>
        </dependency>
    </dependencies>
</plugin>

Run SpotBugs:

mvn spotbugs:spotbugs

Note: The SpotBugs integration currently supports only rules that can be reliably evaluated from compiled bytecode. Source-based and configuration-based checks remain available through the Maven and Gradle plugins.

Comprehensive Ruleset

Standard linters check syntax. We check your Spring architecture. Here is a taste of what Sentinel catches before your build fails.

🐢

JPA Eager Fetching

Scans JPA entities for FetchType.EAGER to prevent unnecessary loading of complex object graphs, which causes memory overhead and performance degradation.

🔄

N+1 Query Potential

Identifies collection getters called within loops, a common cause of database performance issues.

🛑

Blocking Calls in Transactions

Detects blocking I/O or network calls within @Transactional methods to prevent connection pool exhaustion.

🔑

Hardcoded Secrets

Checks class fields and properties for sensitive variable names that do not use environment variable placeholders.

🔓

Insecure CORS Policy

Reports the use of the wildcard in @CrossOrigin annotations, which poses a significant security risk to production APIs.

💉

Field Injection Anti-Pattern

Reports the use of @Autowired on private fields, encouraging constructor injection for better testability and immutability.

📦

Component Overflow

Monitors the number of dependencies in a class and suggests refactoring into smaller services if the limit is exceeded.

⚙️

Manual Thread Creation

Detects manual thread creation and suggests the use of managed @Async tasks.

🔗

Enforce Kebab-Case URLs

Ensures that endpoint URLs follow the kebab-case convention rather than camelCase or snake_case.

View all 19+ inspection rules on GitHub