List of usage examples for org.springframework.web.context.request RequestScope RequestScope
RequestScope
From source file:io.neba.core.spring.applicationcontext.configuration.RequestScopeConfigurator.java
public void registerRequestScope(ConfigurableBeanFactory beanFactory) { beanFactory.registerScope(SCOPE_REQUEST, new RequestScope()); }
From source file:de.forsthaus.testutils.BackendGenericXmlContextLoader.java
@Override protected void customizeBeanFactory(DefaultListableBeanFactory factory) { factory.registerScope("session", new SessionScope()); factory.registerScope("request", new RequestScope()); final MockHttpServletRequest request = new MockHttpServletRequest(); ServletRequestAttributes attributes; attributes = new ServletRequestAttributes(request); RequestContextHolder.setRequestAttributes(attributes); super.customizeBeanFactory(factory); }
From source file:com.sourceallies.beanoh.BeanohTestCase.java
private void loadContext() { if (context == null) { String contextLocation = defaultContextLocationBuilder.build(getClass()); context = new BeanohApplicationContext(contextLocation); try {//from w ww. jav a 2 s . c o m context.refresh(); } catch (BeanDefinitionParsingException e) { throw e; } catch (BeanDefinitionStoreException e) { throw new MissingConfigurationException("Unable to locate " + contextLocation + ".", e); } context.getBeanFactory().registerScope("session", new SessionScope()); context.getBeanFactory().registerScope("request", new RequestScope()); MockHttpServletRequest request = new MockHttpServletRequest(); ServletRequestAttributes attributes = new ServletRequestAttributes(request); RequestContextHolder.setRequestAttributes(attributes); } }
From source file:morph.plugin.views.annotation.AnnotationMethodHandlerAdapter.java
public void setBeanFactory(BeanFactory beanFactory) { if (beanFactory instanceof ConfigurableBeanFactory) { this.beanFactory = (ConfigurableBeanFactory) beanFactory; this.expressionContext = new BeanExpressionContext(this.beanFactory, new RequestScope()); }//from w ww .j a v a 2 s . co m }
From source file:org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.java
@Override public void setBeanFactory(BeanFactory beanFactory) { if (beanFactory instanceof ConfigurableBeanFactory) { this.beanFactory = (ConfigurableBeanFactory) beanFactory; this.expressionContext = new BeanExpressionContext(this.beanFactory, new RequestScope()); }/* w w w .ja v a 2s .co m*/ }