Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3493620
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:54:19+00:00 2026-05-18T11:54:19+00:00

I have added <mvc:annotation-driven/> to my Spring configuration, and according to the documentation it

  • 0

I have added <mvc:annotation-driven/> to my Spring configuration, and according to the documentation it will provide:

Support for validating @Controller inputs with @Valid, if a JSR-303 Provider is present on the classpath. The validation system can be explicitly configured by setting the validator attribute.

From this and other documents, I have taken it to mean that I no longer need to explicitly inject a validator within my controller classes and it will be done automatically. Is this correct?

Currently I need to have the following in my controller:

@Autowired
private Validator validator;

@InitBinder
public void initBinder(WebDataBinder binder) {
    binder.setValidator(validator);
}

Can anyone clear this up for me? Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T11:54:19+00:00Added an answer on May 18, 2026 at 11:54 am

    Yes, it’s correct. With <mvc:annotation-driven> you don’t need to inject validator explicitly.

    Note that in a typical Spring MVC application you have two application contexts, see here for more details, and <mvc:annotation-driven> must be declared in the DispatcherServlet‘s context.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am preparing a registration page using JSF/Spring webflow&mvc application. I have added two
I have MVC 1.0 app with VS2008. I have added configuration to web.config but
I have created an asp.net mvc 3 razor view and added data annotation attributes
I have just added a Telerik menu to my MVC application. I also have
I have an ASP.NET MVC application with a separate project added for tests. I
I have a ASP.NET MVC page. I Configured a IIS Website and added the
I have implimented the AnitforgeryToken with my asp.net MVC forms, and also added the
Using ASP.NET 4.0 and MVC 2, I have added these suggested modifications: In the
In my Spring MVC webapplication I want to mix xml based configuration with annotations:
I'm using ASP.NET MVC 3 code-first and I have added validation data annotations to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.