jjzjj

WebApplicationContextUtils

全部标签

java - 如何获取默认的 WebApplicationContext?

我需要ApplicationContext.xml的上下文,我在web.xml中将其提供为org.springframework.web.context.ContextLoaderListener但是我需要在Controller类中对此进行控制。我尝试了很多东西,包括WebApplicationContextctx=ContextLoader.getCurrentWebApplicationContext();但这并没有帮助。 最佳答案 最简单的解决方案是使用getWebApplicationContext()WebApplicat