List of usage examples for org.springframework.context.annotation AnnotationConfigApplicationContext stop
@Override public void stop()
From source file:example.helloworld.HelloWorldApplication.java
public static void main(String[] args) { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( VaultConfiguration.class); context.start();// w w w. j a v a 2 s . com VaultTemplate vaultTemplate = context.getBean(VaultTemplate.class); MySecretData mySecretData = new MySecretData(); mySecretData.setUsername("walter"); mySecretData.setPassword("white"); vaultTemplate.write("secret/myapplication/user/3128", mySecretData); log.info("Wrote data to Vault"); VaultResponseSupport<MySecretData> response = vaultTemplate.read("secret/myapplication/user/3128", MySecretData.class); log.info("Retrieved data {} from Vault", response.getData().getUsername()); context.stop(); }
From source file:org.springframework.remoting.jbr.TestJbossRemotingExporter.java
@Test public void testRetreivingDataFromRpc() throws Throwable { AnnotationConfigApplicationContext client = null, server = null; try {/*from ww w. j a v a 2 s .c o m*/ server = new AnnotationConfigApplicationContext(ServerConfiguration.class); client = new AnnotationConfigApplicationContext(ClientConfiguration.class); Crm clientBean = client.getBean(Crm.class); long id = 8709; Customer customer = clientBean.getCustomerById(id); Assert.assertNotNull(customer); Assert.assertEquals(customer.getId(), id); if (log.isDebugEnabled()) { log.debug(customer.toString()); } } finally { if (null != client) { client.stop(); } if (null != server) { server.stop(); } } }