Java 类org.springframework.context.support.SimpleThreadScope 实例源码
项目:jaf-examples
文件:ScopeNamespaceHandler.java
@Override
public BeanDefinition parse(Element element, ParserContext parserContext) {
RootBeanDefinition beanDefinition = new RootBeanDefinition();
beanDefinition.setBeanClass(CustomScopeConfigurer.class);
beanDefinition.setScope("singleton");
Map<String, Object> scopes = new HashMap<>();
scopes.put("thread", new SimpleThreadScope());
beanDefinition.getPropertyValues().add("scopes", scopes);
parserContext.getRegistry().registerBeanDefinition("CustomScopeConfigurer", beanDefinition);
return beanDefinition;
}
项目:businesshorizon2
文件:TestExecutionListener.java
@Override
public void prepareTestInstance(TestContext testContext) throws Exception {
if (testContext.getApplicationContext() instanceof GenericApplicationContext) {
GenericApplicationContext context = (GenericApplicationContext) testContext.getApplicationContext();
ConfigurableListableBeanFactory beanFactory = context.getBeanFactory();
Scope requestScope = new SimpleThreadScope();
beanFactory.registerScope("request", requestScope);
Scope sessionScope = new SimpleThreadScope();
beanFactory.registerScope("session", sessionScope);
}
}
项目:euler-chidi
文件:WebContextTestExecutionListener.java
@Override
public void prepareTestInstance(TestContext testContext) throws Exception {
if (testContext.getApplicationContext() instanceof GenericApplicationContext) {
GenericApplicationContext context = (GenericApplicationContext) testContext.getApplicationContext();
ConfigurableListableBeanFactory beanFactory = context.getBeanFactory();
Scope requestScope = new SimpleThreadScope();
beanFactory.registerScope("request", requestScope);
Scope sessionScope = new SimpleThreadScope();
beanFactory.registerScope("session", sessionScope);
}
}
项目:wte4j
文件:WebContextTestExecutionListener.java
@Override
public void prepareTestInstance(TestContext testContext) {
if (testContext.getApplicationContext() instanceof GenericApplicationContext) {
GenericApplicationContext context = (GenericApplicationContext) testContext.getApplicationContext();
ConfigurableListableBeanFactory beanFactory = context.getBeanFactory();
beanFactory.registerScope(WebApplicationContext.SCOPE_REQUEST,
new SimpleThreadScope());
beanFactory.registerScope(WebApplicationContext.SCOPE_SESSION,
new SimpleThreadScope());
}
}
项目:karaku
文件:BaseTestConfiguration.java
@Bean
public CustomScopeConfigurer configurer() {
CustomScopeConfigurer toRet = new CustomScopeConfigurer();
Map<String, Object> map = new HashMap<String, Object>();
map.put(KarakuBaseConfiguration.SCOPE_CONVERSATION,
new SimpleThreadScope());
map.put(KarakuBaseConfiguration.SCOPE_CONVERSATION_MANUAL,
new SimpleThreadScope());
map.put(WebApplicationContext.SCOPE_SESSION,
new SimpleThreadScope());
toRet.setScopes(map);
return toRet;
}
项目:HAIBA-EPIMIBA-classification
文件:SimpleThreadScopeConfigurer.java
public SimpleThreadScopeConfigurer() {
super();
super.setScopes(new HashMap<String, Object>() {
{
put("thread", new SimpleThreadScope());
}
});
}
项目:arsnova-backend
文件:TestAppConfig.java
@Bean
public CustomScopeConfigurer customScopeConfigurer() {
final CustomScopeConfigurer configurer = new CustomScopeConfigurer();
configurer.addScope("session", new SimpleThreadScope());
return configurer;
}
项目:secure-data-service
文件:WebContextTestExecutionListener.java
@Override
public void prepareTestInstance(TestContext testContext) throws Exception {
if (testContext.getApplicationContext() instanceof GenericApplicationContext) {
GenericApplicationContext context = (GenericApplicationContext) testContext.getApplicationContext();
ConfigurableListableBeanFactory beanFactory = context.getBeanFactory();
Scope requestScope = new SimpleThreadScope();
beanFactory.registerScope("request", requestScope);
Scope sessionScope = new SimpleThreadScope();
beanFactory.registerScope("session", sessionScope);
}
}
项目:spring-autowire-qualified-beans
文件:AutowireTest3.java
@Bean
static CustomScopeConfigurer customScopes() {
final CustomScopeConfigurer configurer = new CustomScopeConfigurer();
final Map<String, Object> scopes = new HashMap<String, Object>();
scopes.put("foobarScope", new SimpleThreadScope());
configurer.setScopes(scopes);
return configurer;
}
项目:spring-autowire-qualified-beans
文件:AutowireTest1.java
@Bean
static CustomScopeConfigurer customScopes() {
final CustomScopeConfigurer configurer = new CustomScopeConfigurer();
final Map<String, Object> scopes = new HashMap<String, Object>();
scopes.put("foobarScope", new SimpleThreadScope());
configurer.setScopes(scopes);
return configurer;
}
项目:spring-autowire-qualified-beans
文件:AutowireTest2.java
@Bean
static CustomScopeConfigurer customScopes() {
final CustomScopeConfigurer configurer = new CustomScopeConfigurer();
final Map<String, Object> scopes = new HashMap<String, Object>();
scopes.put("foobarScope", new SimpleThreadScope());
configurer.setScopes(scopes);
return configurer;
}