Skip to content

Enhancement Request: IDE Warning for Missing @Validated in Non-Controller Components #1773

Closed

Description

@mustafavural

Dear STS/Spring Tools Team,

I would like to propose a new "Spring Linting" or "Validation" feature for STS to improve the developer experience and prevent common configuration pitfalls.

The Problem: When a developer uses the @Valid (JSR-303) annotation on a method parameter within a @Service or @Component class, Spring requires the class itself to be annotated with @Validated to enable the AOP-based method validation. Without @Validated at the class level, @Valid on parameters is silently ignored.

In my case, I spent an entire day debugging and eventually writing a custom Aspect just to handle validation in the Business Layer, simply because the IDE did not provide any hint that a proxy-enabling annotation was missing.

Proposed Feature: Add a "Quick Fix" or "Warning" (similar to the one for @Autowired on private fields) that detects:

A method parameter annotated with @Valid.

Inside a class annotated with @Service, @Component, or @Repository.

Missing @Validated at the class level.

Suggested Message:

"Method-level validation requires @Validated at the class level to be processed by Spring's MethodValidationPostProcessor. Would you like to add @Validated to [ClassName]?"

Impact: This small check would save countless hours for developers transitioning from Controller-level validation to Business-layer validation and reduce unnecessary boilerplate code (like custom aspects) created to solve a problem that Spring already handles.

Best regards, A Passionate Spring Developer

Activity

  1. added
    for: eclipse
    for: vscode
    and removed on Feb 5, 2026
  2. self-assigned this
    on Feb 5, 2026
  3. added this to the 5.1.0.RELEASE milestone on Feb 5, 2026
  4. added a commit that references this issue on Feb 9, 2026
  5. martinlippert commented on Feb 9, 2026

    @martinlippert
    Member

    Thanks for the enhancement request and the detailed description. Will ship as part of the 5.1.0 release.
    Early access builds including this will appear shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

for: eclipsefor: vscodetheme: validationtype: enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions