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 8996323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:44:21+00:00 2026-06-15T23:44:21+00:00

Which do you prefer? In spring mvc, they use @Controller for all Controller classes.

  • 0

Which do you prefer? In spring mvc, they use @Controller for all Controller classes. Could they have used some marker interface? Why did they select the annotation approach?
Better yet, they can have something similar to controller-scan similar to component-scan so any classes in the package can be assumed to a Controller class. Similarly service-scan and repository-scan can be defined in xml.

  • 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-06-15T23:44:22+00:00Added an answer on June 15, 2026 at 11:44 pm

    I think technically the same effect would be possible with marker interfaces. The problem is that marker interfaces are limited to classes and cannot be used for attributes or methods.

    Spring is using annotations for adding meta data to attributes (e.g. @Autowired) or methods (e.g. @RequestMapping or @Transactional). So it is consistent to use the same approach for adding meta data to classes (like @Controller or @Service)

    Note that Spring does not force you to use the provided annotations. @Controller and @RequestMapping are just the default way to define handler mappings. In theory you can come up with your own way of mapping incoming requests to method calls.

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

Sidebar

Related Questions

I have some data in a database which i need to use to generate
I have an XMPP server (likely — python, twisted, wokkel), which I prefer not
Which version would you prefer? #!/usr/bin/env perl use warnings; use strict; use 5.010; my
Here's the situation I have a webpage which has one drop down called prefer.
Is there an easy way to use Spring IoC for a factory which returns
Context: creating a jsonP service with mvc controller methods which provides a definition of
Telerik ASP.NET MVC Q2 2011 I have a grid which is Ajax bound: @(Html.Telerik().Grid<IUser>()
I am running a Spring MVC application, backed by a MySQL database which I
I have to start a new Spring MVC project and I've been reading about
We have some shopping cart pages which work with both guest and user paths.

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.