List of usage examples for org.springframework.context.annotation AnnotationConfigApplicationContext AnnotationConfigApplicationContext
public AnnotationConfigApplicationContext(String... basePackages)
From source file:com.github.jmnarloch.spring.jaxrs.client.jersey.JerseyClientConfigurationTest.java
/** * Tests the registration of the proxy factory in application context. *//*from w ww . ja v a 2 s . c om*/ @Test public void shouldRegisterClientProxyFactory() { // given final AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( JerseyClientConfiguration.class); // when JaxRsClientProxyFactory factory = context.getBean(JaxRsClientProxyFactory.class); // then assertNotNull(factory); assertTrue(JerseyClientProxyFactory.class.equals(factory.getClass())); }
From source file:com.github.jmnarloch.spring.jaxrs.client.resteasy.RestEasyClientConfigurationTest.java
/** * Tests the registration of the proxy factory in application context. *///from ww w .ja v a 2 s . c om @Test public void shouldRegisterClientProxyFactory() { // given final AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( RestEasyClientConfiguration.class); // when JaxRsClientProxyFactory factory = context.getBean(JaxRsClientProxyFactory.class); // then assertNotNull(factory); assertTrue(RestEasyClientProxyFactory.class.equals(factory.getClass())); }
From source file:lv.javaguru.ee.bookshop.core.ApplicationMongoConfigTest.java
@Test public void bootstrapAppFromJavaConfig() { ApplicationContext context = new AnnotationConfigApplicationContext(MongoConfig.class); assertThat(context, is(notNullValue())); }
From source file:com.karriem.tp.tddassignment.TDDTestNGTest.java
@BeforeClass public static void setUpClass() throws Exception { ctx = new AnnotationConfigApplicationContext(AppConfig.class); service = (TDDService) ctx.getBean("add"); service = (TDDService) ctx.getBean("float"); service = (TDDService) ctx.getBean("integer"); service = (TDDService) ctx.getBean("obj"); service = (TDDService) ctx.getBean("notSame"); service = (TDDService) ctx.getBean("truth"); service = (TDDService) ctx.getBean("falsity"); service = (TDDService) ctx.getBean("null"); }
From source file:com.tracy.test1.CalcTest.java
@org.testng.annotations.BeforeClass public static void setUpClass() throws Exception { ApplicationContext ctx = new AnnotationConfigApplicationContext(AppConfig.class); service = (CalcService) ctx.getBean("cals"); }
From source file:net.cnmconsulting.springbean.JetBeanTest.java
@Test public void testJetBean() { // create the spring container using the AppConfig @Configuration class ApplicationContext ctx = new AnnotationConfigApplicationContext(AppConfig.class); JetBean jetBean = ctx.getBean(JetBean.class); assertThat(jetBean.getName(), equalTo("Gulf Stream G550")); assertThat(jetBean.getPrice(), equalTo(Long.valueOf(60000000))); URL gulfstream;/* w ww . j av a2 s. co m*/ try { gulfstream = new URL("http://www.gulfstream.com/products/g550/"); } catch (MalformedURLException e) { // TODO Auto-generated catch block fail("error creating URL"); throw new RuntimeException("error creating URL"); } assertThat(jetBean.getUrl(), equalTo(gulfstream)); }
From source file:example2.JpaExampleAppConfigTest.java
@Before public void init() { context = new AnnotationConfigApplicationContext(JpaExampleAppConfig.class); Application.setApplicationContext(context); service = context.getBean(DeptService.BEAN_NAME, DeptService.class); }
From source file:com.example.PersistanceTest.java
@Before public void init() { context = new AnnotationConfigApplicationContext(ProjectAppConfig.class); Application.setApplicationContext(context); userDetailsService = Application.lookupBean(UserDetailsService.BEAN_NAME, UserDetailsService.class); sessionLogService = Application.lookupBean(SessionLogService.BEAN_NAME, SessionLogService.class); }
From source file:com.oreilly.springdata.neo4j.ApplicationConfigTest.java
@Test public void bootstrapAppFromJavaConfig() { context = new AnnotationConfigApplicationContext(ApplicationConfig.class); assertThat(context, is(notNullValue())); }
From source file:de.thkoeln.banaccount.dao.ApplicationConfigTest.java
@Test public void bootstrapAppFromJavaConfig() { ApplicationContext context = new AnnotationConfigApplicationContext(Aplication.class); assertThat(context, is(notNullValue())); assertThat(context.getBean(CustomerRepository.class), is(notNullValue())); }