本文整理汇总了Java中org.springframework.web.context.ServletConfigAware类的典型用法代码示例。如果您正苦于以下问题:Java ServletConfigAware类的具体用法?Java ServletConfigAware怎么用?Java ServletConfigAware使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ServletConfigAware类属于org.springframework.web.context包,在下文中一共展示了ServletConfigAware类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: postProcessBeanFactory
import org.springframework.web.context.ServletConfigAware; //导入依赖的package包/类
/**
* Register request/session scopes, a {@link ServletContextAwareProcessor}, etc.
*/
@Override
protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
beanFactory.addBeanPostProcessor(new ServletContextAwareProcessor(this.servletContext, this.servletConfig));
beanFactory.ignoreDependencyInterface(ServletContextAware.class);
beanFactory.ignoreDependencyInterface(ServletConfigAware.class);
WebApplicationContextUtils.registerWebApplicationScopes(beanFactory, this.servletContext);
WebApplicationContextUtils.registerEnvironmentBeans(beanFactory, this.servletContext, this.servletConfig);
}
示例2: postProcessBeforeInitialization
import org.springframework.web.context.ServletConfigAware; //导入依赖的package包/类
@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
if (getServletContext() != null && bean instanceof ServletContextAware) {
((ServletContextAware) bean).setServletContext(getServletContext());
}
if (getServletConfig() != null && bean instanceof ServletConfigAware) {
((ServletConfigAware) bean).setServletConfig(getServletConfig());
}
return bean;
}
示例3: postProcessBeanFactory
import org.springframework.web.context.ServletConfigAware; //导入依赖的package包/类
@Override
protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
SdcctServletConfig servletConfig = new SdcctServletConfig();
this.setServletConfig(servletConfig);
beanFactory.registerSingleton(AbstractRefreshableWebApplicationContext.SERVLET_CONFIG_BEAN_NAME, servletConfig);
beanFactory.ignoreDependencyInterface(ServletConfigAware.class);
super.postProcessBeanFactory(beanFactory);
}
示例4: postProcessBeanFactory
import org.springframework.web.context.ServletConfigAware; //导入依赖的package包/类
@Override
protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
CrigttServletConfig servletConfig = new CrigttServletConfig();
this.setServletConfig(servletConfig);
beanFactory.registerSingleton(AbstractRefreshableWebApplicationContext.SERVLET_CONFIG_BEAN_NAME, servletConfig);
beanFactory.ignoreDependencyInterface(ServletConfigAware.class);
super.postProcessBeanFactory(beanFactory);
}
示例5: postProcessBeforeInitialization
import org.springframework.web.context.ServletConfigAware; //导入依赖的package包/类
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
if (this.servletContext != null && bean instanceof ServletContextAware) {
((ServletContextAware) bean).setServletContext(this.servletContext);
}
if (this.servletConfig != null && bean instanceof ServletConfigAware) {
((ServletConfigAware) bean).setServletConfig(this.servletConfig);
}
return bean;
}
示例6: postProcessBeanFactory
import org.springframework.web.context.ServletConfigAware; //导入依赖的package包/类
/**
* {@inheritDoc}
*
* Registers request/session scopes, a {@link ServletContextAwareProcessor},
* etc.
*/
protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
super.postProcessBeanFactory(beanFactory);
beanFactory.addBeanPostProcessor(new ServletContextAwareProcessor(this.servletContext, this.servletConfig));
beanFactory.ignoreDependencyInterface(ServletContextAware.class);
beanFactory.ignoreDependencyInterface(ServletConfigAware.class);
beanFactory.registerResolvableDependency(ServletContext.class, this.servletContext);
beanFactory.registerResolvableDependency(ServletConfig.class, this.servletConfig);
WebApplicationContextUtils.registerWebApplicationScopes(beanFactory);
}
示例7: testPostProcessBeanFactoryConfigurableListableBeanFactory
import org.springframework.web.context.ServletConfigAware; //导入依赖的package包/类
public void testPostProcessBeanFactoryConfigurableListableBeanFactory() {
ConfigurableListableBeanFactory mock = new DefaultListableBeanFactory() {
public void ignoreDependencyInterface(Class ifc) {
ignored.add(ifc);
}
public void addBeanPostProcessor(BeanPostProcessor beanPostProcessor) {
super.addBeanPostProcessor(beanPostProcessor);
bpp.add(beanPostProcessor.getClass());
}
public void registerResolvableDependency(Class dependencyType, Object autowiredValue) {
super.registerResolvableDependency(dependencyType, autowiredValue);
resolved.add(dependencyType);
}
};
context.postProcessBeanFactory(mock);
assertTrue(ignored.contains(ServletConfigAware.class));
assertTrue(ignored.contains(ServletContextAware.class));
assertTrue(resolved.contains(ServletContext.class));
assertTrue(resolved.contains(ServletConfig.class));
assertTrue(bpp.contains(ServletContextAwareProcessor.class));
}