本文整理汇总了Java中org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.processInjection方法的典型用法代码示例。如果您正苦于以下问题:Java AutowiredAnnotationBeanPostProcessor.processInjection方法的具体用法?Java AutowiredAnnotationBeanPostProcessor.processInjection怎么用?Java AutowiredAnnotationBeanPostProcessor.processInjection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor
的用法示例。
在下文中一共展示了AutowiredAnnotationBeanPostProcessor.processInjection方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processInjectionBasedOnCurrentContext
import org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor; //导入方法依赖的package包/类
/**
* Process {@code @Autowired} injection for the given target object,
* based on the current web application context.
* <p>Intended for use as a delegate.
* @param target the target object to process
* @see org.springframework.web.context.ContextLoader#getCurrentWebApplicationContext()
*/
public static void processInjectionBasedOnCurrentContext(Object target) {
Assert.notNull(target, "Target object must not be null");
WebApplicationContext cc = ContextLoader.getCurrentWebApplicationContext();
if (cc != null) {
AutowiredAnnotationBeanPostProcessor bpp = new AutowiredAnnotationBeanPostProcessor();
bpp.setBeanFactory(cc.getAutowireCapableBeanFactory());
bpp.processInjection(target);
}
else {
if (logger.isDebugEnabled()) {
logger.debug("Current WebApplicationContext is not available for processing of " +
ClassUtils.getShortName(target.getClass()) + ": " +
"Make sure this class gets constructed in a Spring web application. Proceeding without injection.");
}
}
}
示例2: doAutowireBean
import org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor; //导入方法依赖的package包/类
/**
* Actually autowire the target bean after construction/passivation.
* @param target the target bean to autowire
*/
protected void doAutowireBean(Object target) {
AutowiredAnnotationBeanPostProcessor bpp = new AutowiredAnnotationBeanPostProcessor();
configureBeanPostProcessor(bpp, target);
bpp.setBeanFactory(getBeanFactory(target));
bpp.processInjection(target);
}
示例3: UserRegistrationSteps
import org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor; //导入方法依赖的package包/类
public UserRegistrationSteps() {
super();
SpringApplication application = new SpringApplication(
RegistrationApplication.class);
application.setWebEnvironment(false);
AutowiredAnnotationBeanPostProcessor autowiredAnnotationBeanPostProcessor = new AutowiredAnnotationBeanPostProcessor();
autowiredAnnotationBeanPostProcessor.setBeanFactory(application.run()
.getBeanFactory());
autowiredAnnotationBeanPostProcessor.processInjection(this);
}
示例4: onStart
import org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor; //导入方法依赖的package包/类
@Override
public void onStart(Application application) {
AutowiredAnnotationBeanPostProcessor beanPostProcessor =
new AutowiredAnnotationBeanPostProcessor();
beanPostProcessor.setBeanFactory(getApplicationContext(application).getBeanFactory());
beanPostProcessor.processInjection(this);
}
示例5: onStart
import org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor; //导入方法依赖的package包/类
@Override
public void onStart() {
AutowiredAnnotationBeanPostProcessor beanPostProcessor =
new AutowiredAnnotationBeanPostProcessor();
beanPostProcessor.setBeanFactory(getApplicationContext().getBeanFactory());
beanPostProcessor.processInjection(this);
}
示例6: processInjection
import org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor; //导入方法依赖的package包/类
public void processInjection(Object bean) {
AutowiredAnnotationBeanPostProcessor beanPostProcessor = new AutowiredAnnotationBeanPostProcessor();
beanPostProcessor.setBeanFactory(getApplicationContext().getBeanFactory());
beanPostProcessor.processInjection(bean);
}
示例7: injectMembers
import org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor; //导入方法依赖的package包/类
public final void injectMembers(Object instance) {
final AutowiredAnnotationBeanPostProcessor bpp = new AutowiredAnnotationBeanPostProcessor();
bpp.setBeanFactory(getContext().getAutowireCapableBeanFactory());
bpp.processInjection(instance);
}
示例8: processInjectionBasedOnServletContext
import org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor; //导入方法依赖的package包/类
/**
* 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);
}