本文整理匯總了Java中org.springframework.context.support.GenericApplicationContext.setClassLoader方法的典型用法代碼示例。如果您正苦於以下問題:Java GenericApplicationContext.setClassLoader方法的具體用法?Java GenericApplicationContext.setClassLoader怎麽用?Java GenericApplicationContext.setClassLoader使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.context.support.GenericApplicationContext
的用法示例。
在下文中一共展示了GenericApplicationContext.setClassLoader方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setUp
import org.springframework.context.support.GenericApplicationContext; //導入方法依賴的package包/類
protected void setUp() throws Exception {
bundleContext = new MockBundleContext();
context = new GenericApplicationContext();
context.setClassLoader(getClass().getClassLoader());
context.getBeanFactory().setConversionService(
new SpringBlueprintConverterService(null, context.getBeanFactory()));
context.getBeanFactory().addBeanPostProcessor(new BundleContextAwareProcessor(bundleContext));
reader = new XmlBeanDefinitionReader(context);
reader.setDocumentLoader(new PublicBlueprintDocumentLoader());
reader.loadBeanDefinitions(new ClassPathResource(CONFIG, getClass()));
context.refresh();
blueprintContainer = new SpringBlueprintContainer(context);
}
示例2: setUp
import org.springframework.context.support.GenericApplicationContext; //導入方法依賴的package包/類
protected void setUp() throws Exception {
bundleContext = new MockBundleContext();
context = new GenericApplicationContext();
context.setClassLoader(getClass().getClassLoader());
context.getBeanFactory().addBeanPostProcessor(new BundleContextAwareProcessor(bundleContext));
context.addBeanFactoryPostProcessor(new BeanFactoryPostProcessor() {
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
beanFactory.addPropertyEditorRegistrar(new BlueprintEditorRegistrar());
}
});
reader = new XmlBeanDefinitionReader(context);
reader.setDocumentLoader(new PublicBlueprintDocumentLoader());
reader.loadBeanDefinitions(new ClassPathResource(CONFIG, getClass()));
context.refresh();
blueprintContainer = new SpringBlueprintContainer(context);
}
示例3: setUp
import org.springframework.context.support.GenericApplicationContext; //導入方法依賴的package包/類
protected void setUp() throws Exception {
BundleContext bundleContext = new MockBundleContext() {
// service reference already registered
public ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException {
return new ServiceReference[0];
}
};
appContext = new GenericApplicationContext();
appContext.getBeanFactory().addBeanPostProcessor(new BundleContextAwareProcessor(bundleContext));
appContext.setClassLoader(getClass().getClassLoader());
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(appContext);
// reader.setEventListener(this.listener);
reader.loadBeanDefinitions(new ClassPathResource("osgiReferenceNestedBeans.xml", getClass()));
appContext.refresh();
}
示例4: setUp
import org.springframework.context.support.GenericApplicationContext; //導入方法依賴的package包/類
protected void setUp() throws Exception {
BundleContext bundleContext = new MockBundleContext() {
// service reference already registered
public ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException {
return new ServiceReference[] { new MockServiceReference(new String[] { Serializable.class.getName() }) };
}
};
appContext = new GenericApplicationContext();
appContext.getBeanFactory().addBeanPostProcessor(new BundleContextAwareProcessor(bundleContext));
appContext.setClassLoader(getClass().getClassLoader());
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(appContext);
reader.loadBeanDefinitions(new ClassPathResource("osgiDefaults.xml", getClass()));
appContext.refresh();
}
示例5: setUp
import org.springframework.context.support.GenericApplicationContext; //導入方法依賴的package包/類
protected void setUp() throws Exception {
bundleContext = new MockBundleContext();
applicationContext = new GenericApplicationContext();
applicationContext.setClassLoader(getClass().getClassLoader());
applicationContext.getBeanFactory().addBeanPostProcessor(new BundleContextAwareProcessor(bundleContext));
applicationContext.addBeanFactoryPostProcessor(new BeanFactoryPostProcessor() {
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
beanFactory.addPropertyEditorRegistrar(new BlueprintEditorRegistrar());
}
});
reader = new XmlBeanDefinitionReader(applicationContext);
reader.setDocumentLoader(new PublicBlueprintDocumentLoader());
reader.loadBeanDefinitions(new ClassPathResource(getConfig(), getClass()));
applicationContext.refresh();
blueprintContainer = new SpringBlueprintContainer(applicationContext);
}
示例6: setUp
import org.springframework.context.support.GenericApplicationContext; //導入方法依賴的package包/類
protected void setUp() throws Exception {
bundleContext = new MockBundleContext();
context = new GenericApplicationContext();
context.setClassLoader(getClass().getClassLoader());
context.getBeanFactory().addBeanPostProcessor(new BundleContextAwareProcessor(bundleContext));
SpringBlueprintConverterService converterService =
new SpringBlueprintConverterService(null, context.getBeanFactory());
converterService.add(new GenericConverter());
context.getBeanFactory().setConversionService(converterService);
reader = new XmlBeanDefinitionReader(context);
reader.setDocumentLoader(new PublicBlueprintDocumentLoader());
reader.loadBeanDefinitions(new ClassPathResource(CONFIG, getClass()));
context.refresh();
blueprintContainer = new SpringBlueprintContainer(context);
}
示例7: setUp
import org.springframework.context.support.GenericApplicationContext; //導入方法依賴的package包/類
protected void setUp() throws Exception {
BundleContext bundleContext = new MockBundleContext() {
// service reference already registered
public ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException {
return new ServiceReference[] { new MockServiceReference(new String[] { Cloneable.class.getName() }) };
}
};
context = new GenericApplicationContext();
context.getBeanFactory().addBeanPostProcessor(new BundleContextAwareProcessor(bundleContext));
context.setClassLoader(getClass().getClassLoader());
reader = new XmlBeanDefinitionReader(context);
reader.loadBeanDefinitions(new ClassPathResource(CONFIG, getClass()));
context.refresh();
}
示例8: setUp
import org.springframework.context.support.GenericApplicationContext; //導入方法依賴的package包/類
protected void setUp() throws Exception {
final Configuration cfg = createMock(Configuration.class);
expect(cfg.getProperties()).andReturn(new Hashtable<String, Object>());
replay(cfg);
BundleContext bundleContext = new MockBundleContext() {
// always return a ConfigurationAdmin
public Object getService(ServiceReference reference) {
return new MockConfigurationAdmin() {
public Configuration getConfiguration(String pid) throws IOException {
return cfg;
}
};
}
};
appContext = new GenericApplicationContext();
appContext.getBeanFactory().addBeanPostProcessor(new BundleContextAwareProcessor(bundleContext));
appContext.setClassLoader(getClass().getClassLoader());
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(appContext);
reader.loadBeanDefinitions(new ClassPathResource("managedServiceFactory.xml", getClass()));
appContext.refresh();
}
示例9: setUp
import org.springframework.context.support.GenericApplicationContext; //導入方法依賴的package包/類
protected void setUp() throws Exception {
// reset counter just to be sure
DummyListener.BIND_CALLS = 0;
DummyListener.UNBIND_CALLS = 0;
DummyListenerServiceSignature.BIND_CALLS = 0;
DummyListenerServiceSignature.UNBIND_CALLS = 0;
DummyListenerServiceSignature2.BIND_CALLS = 0;
DummyListenerServiceSignature2.UNBIND_CALLS = 0;
BundleContext bundleContext = new MockBundleContext() {
// service reference already registered
public ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException {
return new ServiceReference[0];
}
};
appContext = new GenericApplicationContext();
appContext.getBeanFactory().addBeanPostProcessor(new BundleContextAwareProcessor(bundleContext));
appContext.setClassLoader(getClass().getClassLoader());
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(appContext);
// reader.setEventListener(this.listener);
reader.loadBeanDefinitions(new ClassPathResource("osgiReferenceCollectionNamespaceHandlerTests.xml", getClass()));
appContext.refresh();
}
示例10: setUp
import org.springframework.context.support.GenericApplicationContext; //導入方法依賴的package包/類
protected void setUp() throws Exception {
BundleContext bundleContext = new MockBundleContext() {
// service reference already registered
public ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException {
return new ServiceReference[0];
}
};
appContext = new GenericApplicationContext();
appContext.getBeanFactory().addBeanPostProcessor(new BundleContextAwareProcessor(bundleContext));
appContext.setClassLoader(getClass().getClassLoader());
}
示例11: setUp
import org.springframework.context.support.GenericApplicationContext; //導入方法依賴的package包/類
protected void setUp() throws Exception {
BundleContext bundleContext = new MockBundleContext() {
// service reference already registered
public ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException {
return new ServiceReference[] { new MockServiceReference(new String[] { Serializable.class.getName() }) };
}
};
appContext = new GenericApplicationContext();
appContext.getBeanFactory().addBeanPostProcessor(new BundleContextAwareProcessor(bundleContext));
appContext.setClassLoader(getClass().getClassLoader());
}
示例12: setUp
import org.springframework.context.support.GenericApplicationContext; //導入方法依賴的package包/類
protected void setUp() throws Exception {
context = new GenericApplicationContext();
context.setClassLoader(getClass().getClassLoader());
reader = new XmlBeanDefinitionReader(context);
reader.setDocumentLoader(new PublicBlueprintDocumentLoader());
reader.loadBeanDefinitions(new ClassPathResource(CONFIG, getClass()));
context.getBeanFactory().setConversionService(new SpringBlueprintConverterService(null, context.getBeanFactory()));
context.refresh();
container = new SpringBlueprintContainer(context);
}
示例13: setUp
import org.springframework.context.support.GenericApplicationContext; //導入方法依賴的package包/類
protected void setUp() throws Exception {
context = new GenericApplicationContext();
context.setClassLoader(getClass().getClassLoader());
reader = new XmlBeanDefinitionReader(context);
reader.loadBeanDefinitions(new ClassPathResource(CONFIG, getClass()));
context.refresh();
}
示例14: setUp
import org.springframework.context.support.GenericApplicationContext; //導入方法依賴的package包/類
protected void setUp() throws Exception {
context = new GenericApplicationContext();
context.setClassLoader(getClass().getClassLoader());
ConfigurableListableBeanFactory beanFactory = context.getBeanFactory();
beanFactory.registerCustomEditor(ServiceReference.class, ServiceReferenceEditor.class);
beanFactory.addPropertyEditorRegistrar(new BlueprintEditorRegistrar());
reader = new XmlBeanDefinitionReader(context);
reader.loadBeanDefinitions(new ClassPathResource(CONFIG, getClass()));
context.refresh();
}
示例15: setUp
import org.springframework.context.support.GenericApplicationContext; //導入方法依賴的package包/類
protected void setUp() throws Exception {
bundleContext = new MockBundleContext();
context = new GenericApplicationContext();
context.setClassLoader(getClass().getClassLoader());
context.getBeanFactory().addBeanPostProcessor(new BundleContextAwareProcessor(bundleContext));
context.addBeanFactoryPostProcessor(new CycleOrderingProcessor());
reader = new XmlBeanDefinitionReader(context);
reader.setDocumentLoader(new PublicBlueprintDocumentLoader());
reader.loadBeanDefinitions(new ClassPathResource(CONFIG, getClass()));
context.refresh();
blueprintContainer = new SpringBlueprintContainer(context);
}