I notice that there is getWebApplicationContext in org.springframework.web.servlet.mvc.AbstractController. This means that spring programmers can use getWebApplicationContext to access beans in the spring IoC container.
However, I never see people use this way to get beans in all the spring MVC tutorials. So here comes my question, in that case would a programmer want to get the WebApplicationContext?
That’s an odd question… are you asking why a method is in the API if none of the tutorials use it? Do you expect every API method to be in the tutorials?
The
getWebApplicationContext()method is rarely used by application code, but it is used internally by Spring for some tasks.