use of org.springframework.context.support.GenericXmlApplicationContext in project spring-security-oauth by spring-projects.
the class ResourceServerBeanDefinitionParserTests method testDefaults.
@Test
public void testDefaults() {
GenericXmlApplicationContext context = new GenericXmlApplicationContext(getClass(), "resource-server-context.xml");
assertTrue(context.containsBeanDefinition("oauth2ProviderFilter"));
assertTrue(context.containsBeanDefinition("anotherProviderFilter"));
assertTrue(context.containsBeanDefinition("thirdProviderFilter"));
context.close();
}
use of org.springframework.context.support.GenericXmlApplicationContext in project webservices-axiom by apache.
the class ScenarioTestCase method setUp.
@Override
protected void setUp() throws Exception {
server = new Server();
// Set up a custom thread pool to improve thread names (for logging purposes)
QueuedThreadPool threadPool = new QueuedThreadPool();
threadPool.setName("jetty");
server.setThreadPool(threadPool);
Connector connector = new SelectChannelConnector();
connector.setPort(0);
server.setConnectors(new Connector[] { connector });
ServletContextHandler handler = new ServletContextHandler(server, "/");
MessageDispatcherServlet servlet = new MessageDispatcherServlet();
servlet.setContextClass(GenericWebApplicationContext.class);
servlet.setContextInitializers(new ApplicationContextInitializer<ConfigurableApplicationContext>() {
public void initialize(ConfigurableApplicationContext applicationContext) {
configureContext((GenericWebApplicationContext) applicationContext, config.getServerMessageFactoryConfigurator(), new ClassPathResource("server.xml", ScenarioTestCase.this.getClass()));
}
});
ServletHolder servletHolder = new ServletHolder(servlet);
servletHolder.setName("spring-ws");
servletHolder.setInitOrder(1);
handler.addServlet(servletHolder, "/*");
server.start();
context = new GenericXmlApplicationContext();
MockPropertySource propertySource = new MockPropertySource("client-properties");
propertySource.setProperty("port", connector.getLocalPort());
context.getEnvironment().getPropertySources().replace(StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME, propertySource);
configureContext(context, config.getClientMessageFactoryConfigurator(), new ClassPathResource("client.xml", getClass()));
context.refresh();
}
use of org.springframework.context.support.GenericXmlApplicationContext in project ignite by apache.
the class GridSpringTransactionManagerSelfTest method beforeTest.
/**
* {@inheritDoc}
*/
@Override
protected void beforeTest() throws Exception {
ApplicationContext applicationContext = new GenericXmlApplicationContext("config/spring-transactions.xml");
service = (GridSpringTransactionService) applicationContext.getBean("gridSpringTransactionService");
}
use of org.springframework.context.support.GenericXmlApplicationContext in project coprhd-controller by CoprHD.
the class StorageOsPlugin method onApplicationStart.
/**
* Called at application start (and at each reloading) Time to start stateful things.
*/
@Override
public void onApplicationStart() {
// NOSONAR
instance = this;
// ("Suppressing Sonar violation of Lazy initialization of static fields should be synchronized for field instance")
if (!isEnabled()) {
return;
}
try {
Logger.info("Connecting to Coordinator Service");
// To using Spring profile feature
context = new GenericXmlApplicationContext();
context.getEnvironment().setActiveProfiles(System.getProperty("buildType"));
context.load(getContextFiles());
context.refresh();
Logger.info("Connected to Coordinator Service");
zkConnection = getBean("zkconn", ZkConnection.class);
coordinatorClient = getBean("coordinator", CoordinatorClient.class);
encryptionProvider = getBean("encryptionProvider", EncryptionProvider.class);
authSvcEndPointLocator = getBean("authSvcEndpointLocator", AuthSvcEndPointLocator.class);
Validator.setAuthSvcEndPointLocator(authSvcEndPointLocator);
Validator.setCoordinator(coordinatorClient);
// need reference to local-security-conf.xml to load this
Validator.setStorageOSUserRepository(null);
coordinatorClient.start();
encryptionProvider.start();
Logger.info("Started ViPR connection, version: %s", version);
KeyStoreExporter keystoreExporter = getBean("keystoreExporter", KeyStoreExporter.class);
keystoreExporter.export();
// register node listener for catalog acl change
coordinatorClient.addNodeListener(new CatalogAclListener());
Logger.info("added CatalogAclListener");
} catch (Exception e) {
Logger.error(e, "Error initializing ViPR Connection");
shutdown();
}
}
use of org.springframework.context.support.GenericXmlApplicationContext in project spring-integration-samples by spring-projects.
the class CafeDemoAppUtilities method loadProfileContext.
/**
* @param path path to the file
* @param targetClass the class who's classloader we will use to laod the context file
* @param profile a profile name
* @return the spring context
*/
public static AbstractApplicationContext loadProfileContext(String path, Class<?> targetClass, String profile) {
GenericXmlApplicationContext ctx = new GenericXmlApplicationContext();
ctx.getEnvironment().setActiveProfiles(profile);
ctx.setClassLoader(targetClass.getClassLoader());
ctx.load(path);
ctx.refresh();
return ctx;
}
Aggregations