0
org.springframework.stereotype;

or

org.springframework.web.servlet.mvc;

I had been using the stereotype but just noticed I have another option ?

1 Answer 1

3
org.springframework.stereotype.Controller

Is an annotation. It indicates that the annotated class is a controller as well as a candidate for auto-detection (like a @Component). This is the annotation you want to use.

org.springframework.web.servlet.mvc.Controller

Is an interface for implementing controllers. In most simple cases you probably don't want to be using this.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.