0

I Come from years with Spring MVC, I'm trying to understand some key differences with Spring boot.

With Spring MVC I used to make a very clear distinction between application context and servlet context(s).

With Spring boot it looks like the servlet context has been pretty much deprecated and all the beans created by means of autoconfig mechanism live in the app context.

you can still create your servlet context of course, you have just to keep in mind the autoconfig is using application context.

so for example one implication of this is that @RestControllers and @Controllers live in the application context and the Spring Boot autoconfig servlet dispatchers will use any @RestController or @Controller annotated beans in the app context.

Can you help me confirm on this or make me understand what I'm missing here ?

1 Answer 1

1

In spring-springMVC system, there are two containers as your mentioned. For springboot-springMVC, debug in your controller and service with implementing ApplicationContextAware

context in service

context in controller

they use the same global applicationContext

org.springframework.boot.web.servlet.contextAnnotationConfigServletWebServerApplicationContext
Sign up to request clarification or add additional context in comments.

2 Comments

thanks for testing it i also did it, I'm more looking for sort of explicit documentation/explaination and best practice reccomendations.
please share :)

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.