More Spring Rules for Java Developers

Hello Java developers,

We know that Spring continues to be the dominant framework for Java developers so we’ve extended our support with 9 new rules. The rules are now available on SonarQube Cloud and in the upcoming SonarQube Server (2025.2) and SonarQube IDE releases.

  • S7177: Use appropriate @DirtiesContext modes
  • S7178: Injecting data into static fields is not supported by Spring
  • S7179: @Cacheable and @CachePut should not be combined
  • S7180: “@Cache*” annotations should only be applied on concrete classes
  • S7183: @InitBinder methods should have void return type
  • S7184: “@Scheduled” annotation should only be applied to no-arg methods
  • S7185: @EventListener methods should have one parameter at most
  • S7186: Methods returning “Page” or “Slice” must take “Pageable” as an input parameter
  • S7190: Methods annotated with “@BeforeTransaction” or “@AfterTransaction” must respect the contract

We welcome your feedback on these rules below.

Jean