/**
* Process {@code @Autowired} injection for the given target object,
* based on the current root web application context as stored in the ServletContext.
* <p>Intended for use as a delegate.
* @param target the target object to process
* @param servletContext the ServletContext to find the Spring web application context in
* @see WebApplicationContextUtils#getWebApplicationContext(javax.servlet.ServletContext)
*/
public static void processInjectionBasedOnServletContext(Object target, ServletContext servletContext) {
Assert.notNull(target, "Target object must not be null");
WebApplicationContext cc = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
AutowiredAnnotationBeanPostProcessor bpp = new AutowiredAnnotationBeanPostProcessor();
bpp.setBeanFactory(cc.getAutowireCapableBeanFactory());
bpp.processInjection(target);
}
SpringBeanAutowiringSupport.java 文件源码
java
阅读 29
收藏 0
点赞 0
评论 0
项目:class-guard
作者:
评论列表
文章目录