本文整理汇总了Java中org.springframework.web.context.ServletContextAware类的典型用法代码示例。如果您正苦于以下问题:Java ServletContextAware类的具体用法?Java ServletContextAware怎么用?Java ServletContextAware使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ServletContextAware类属于org.springframework.web.context包,在下文中一共展示了ServletContextAware类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: postProcessBeanFactory
import org.springframework.web.context.ServletContextAware; //导入依赖的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.ServletContextAware; //导入依赖的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.ServletContextAware; //导入依赖的package包/类
/**
* Register ServletContextAwareProcessor.
* @see ServletContextAwareProcessor
*/
@Override
protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
beanFactory.addBeanPostProcessor(new ServletContextAwareProcessor(this.servletContext));
beanFactory.ignoreDependencyInterface(ServletContextAware.class);
WebApplicationContextUtils.registerWebApplicationScopes(beanFactory, this.servletContext);
WebApplicationContextUtils.registerEnvironmentBeans(beanFactory, this.servletContext);
}
示例4: postProcessBeanFactory
import org.springframework.web.context.ServletContextAware; //导入依赖的package包/类
/**
* Register request/session scopes, a {@link PortletContextAwareProcessor}, etc.
*/
@Override
protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
beanFactory.addBeanPostProcessor(new ServletContextAwareProcessor(this.servletContext));
beanFactory.addBeanPostProcessor(new PortletContextAwareProcessor(this.portletContext, this.portletConfig));
beanFactory.ignoreDependencyInterface(ServletContextAware.class);
beanFactory.ignoreDependencyInterface(PortletContextAware.class);
beanFactory.ignoreDependencyInterface(PortletConfigAware.class);
PortletApplicationContextUtils.registerPortletApplicationScopes(beanFactory, this.portletContext);
PortletApplicationContextUtils.registerEnvironmentBeans(
beanFactory, this.servletContext, this.portletContext, this.portletConfig);
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:16,代码来源:AbstractRefreshablePortletApplicationContext.java
示例5: setServletContext
import org.springframework.web.context.ServletContextAware; //导入依赖的package包/类
@Override
public void setServletContext(ServletContext servletContext) {
for (ViewResolver viewResolver : this.viewResolvers) {
if (viewResolver instanceof ServletContextAware) {
((ServletContextAware)viewResolver).setServletContext(servletContext);
}
}
}
示例6: setServletContext
import org.springframework.web.context.ServletContextAware; //导入依赖的package包/类
@Override
public void setServletContext(ServletContext servletContext) {
RequestUpgradeStrategy strategy = getRequestUpgradeStrategy();
if (strategy instanceof ServletContextAware) {
((ServletContextAware) strategy).setServletContext(servletContext);
}
}
示例7: initServletContext
import org.springframework.web.context.ServletContextAware; //导入依赖的package包/类
@Override
protected void initServletContext(ServletContext servletContext) {
for (Object handler : getUrlMap().values()) {
if (handler instanceof ServletContextAware) {
((ServletContextAware) handler).setServletContext(servletContext);
}
}
}
示例8: setServletContext
import org.springframework.web.context.ServletContextAware; //导入依赖的package包/类
@Override
public void setServletContext(ServletContext servletContext) {
for (TransportHandler handler : getTransportHandlers().values()) {
if (handler instanceof ServletContextAware) {
((ServletContextAware) handler).setServletContext(servletContext);
}
}
}
示例9: postProcessBeanFactory
import org.springframework.web.context.ServletContextAware; //导入依赖的package包/类
/**
* Register ServletContextAwareProcessor.
* @see ServletContextAwareProcessor
*/
@Override
protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
beanFactory.addBeanPostProcessor(
new WebApplicationContextServletContextAwareProcessor(this));
beanFactory.ignoreDependencyInterface(ServletContextAware.class);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:11,代码来源:EmbeddedWebApplicationContext.java
示例10: servletContextAwareBeansAreInjected
import org.springframework.web.context.ServletContextAware; //导入依赖的package包/类
@Test
public void servletContextAwareBeansAreInjected() throws Exception {
addEmbeddedServletContainerFactoryBean();
ServletContextAware bean = mock(ServletContextAware.class);
this.context.registerBeanDefinition("bean", beanDefinition(bean));
this.context.refresh();
verify(bean).setServletContext(
getEmbeddedServletContainerFactory().getServletContext());
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:10,代码来源:EmbeddedWebApplicationContextTests.java
示例11: postProcessBeforeInitialization
import org.springframework.web.context.ServletContextAware; //导入依赖的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;
}
示例12: postProcessBeanFactory
import org.springframework.web.context.ServletContextAware; //导入依赖的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);
}
示例13: testPostProcessBeanFactoryConfigurableListableBeanFactory
import org.springframework.web.context.ServletContextAware; //导入依赖的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));
}
示例14: setServletContext
import org.springframework.web.context.ServletContextAware; //导入依赖的package包/类
@Override
public void setServletContext(ServletContext servletContext) {
if (this.handshakeHandler instanceof ServletContextAware) {
((ServletContextAware) this.handshakeHandler).setServletContext(servletContext);
}
}
示例15: registerInstanceInterfaces0
import org.springframework.web.context.ServletContextAware; //导入依赖的package包/类
/**
* Registers the {@code Lifecycle}, {@code Phased} and
* {@code ServletContextAware} aspects of the specified instance.
*
* @param instance the object to examine, not null
*/
private void registerInstanceInterfaces0(Object instance) {
if (instance instanceof Lifecycle) {
registerLifecycle0((Lifecycle) instance);
} else {
findAndRegisterLifeCycle(instance);
}
if (instance instanceof ServletContextAware) {
registerServletContextAware0((ServletContextAware) instance);
}
}