org.springframework.web.context.ContextLoader.getCurrentWebApplicationContext(): 获取的是spring容器
org.springframework.web.context.ContextLoader.getCurrentWebApplicationContext().getServletContext():获取的是servletContext对象
springmvc子容器存储在servletContext的attribute中,key为:org.springframework.web.servlet.FrameworkServlet.SERVLET_CONTEXT_PREFIX + servlet名称
不确定名称为何可以将所有attribute打印出来(需要-c指明classloader的hash值):
ognl -c 567eb32e '@org.apache.commons.collections.EnumerationUtils@toList(@org.springframework.web.context.ContextLoader@getCurrentWebApplicationContext().getServletContext().getAttributeNames())'
获取springmvc子容器:
ognl -c 567eb32e '@org.springframework.web.context.support.WebApplicationContextUtils@getWebApplicationContext(@org.springframework.web.context.ContextLoader@getCurrentWebApplicationContext().getServletContext(), "org.springframework.web.servlet.FrameworkServlet.CONTEXT.spring")'
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)