Example usage for org.springframework.context.annotation AnnotationConfigApplicationContext AnnotationConfigApplicationContext

List of usage examples for org.springframework.context.annotation AnnotationConfigApplicationContext AnnotationConfigApplicationContext

Introduction

In this page you can find the example usage for org.springframework.context.annotation AnnotationConfigApplicationContext AnnotationConfigApplicationContext.

Prototype

public AnnotationConfigApplicationContext(String... basePackages) 

Source Link

Document

Create a new AnnotationConfigApplicationContext, scanning for bean definitions in the given packages and automatically refreshing the context.

Usage

From source file:services.PhotographsByPhotographerTest.java

@BeforeClass
public static void setUpClass() throws Exception {
    ctx = new AnnotationConfigApplicationContext(ConnectionConfig.class);
    photographer1 = new Photographer.Builder().firstName("Max").lastName("Smith").build();
    photographer2 = new Photographer.Builder().firstName("Jon").lastName("Cane").build();
}

From source file:ConfigTest.java

/** Create the client test. */
public ConfigTest() {
    this.applicationContext = new AnnotationConfigApplicationContext(ConfigA2.class);

    this.logger.info("Default timezone is {}", TimeZone.getDefault().getID());
}

From source file:com.graphaware.runtime.spring.SpringIntegrationTest.java

@Test
public void changeFeedShouldWorkWithSpring() {
    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(Config.class);

    assertNotNull(context.getBean(GraphDatabaseService.class));
    assertNotNull(context.getBean(UuidReader.class));

    context.destroy();//from  ww  w. j a v a 2  s. c o  m
}

From source file:fr.javatronic.damapping.test.injectable.SpringHotelControllerTest.java

@BeforeClass
public void setup() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(
            SpringHotelControllerConfiguration.class);
    this.hotelController = ctx.getAutowireCapableBeanFactory().getBean(HotelController.class);
    ctx.start();//from w ww. j a  v  a2  s .  c o m
}

From source file:net.slkdev.swagger.confluence.gradle.plugin.SwaggerConfluenceGradleTask.java

@TaskAction
public void swaggerConfluence() {
    final AnnotationConfigApplicationContext annotationConfigApplicationContext = new AnnotationConfigApplicationContext(
            SwaggerConfluenceContextConfig.class);
    final SwaggerToConfluenceService swaggerToConfluenceService = annotationConfigApplicationContext
            .getBean(SwaggerToConfluenceService.class);
    final SwaggerConfluenceConfig swaggerConfluenceConfig = getProject().getExtensions()
            .findByType(SwaggerConfluenceConfig.class);
    swaggerToConfluenceService.convertSwaggerToConfluence(swaggerConfluenceConfig);
    annotationConfigApplicationContext.close();
}

From source file:com.mycompany.hcsparta_web.StartListener.java

@Override
public void contextInitialized(ServletContextEvent ev) {
    log.info("webov aplikace inicializovna");
    ServletContext servletContext = ev.getServletContext();
    ApplicationContext springContext = new AnnotationConfigApplicationContext(SpringConfig.class);

    servletContext.setAttribute("playerManager",
            springContext.getBean("playerManager", PlayerManagerImpl.class));
    PlayerManagerImpl pl = (PlayerManagerImpl) servletContext.getAttribute("playerManager");
    pl.initFunction();//from  w  w w .j a  v a2s  . c  o  m

    servletContext.setAttribute("matchManager", springContext.getBean("matchManager", MatchManagerImpl.class));

    log.info("vytvoeny manaery");

}

From source file:com.tpg.tmjug.springdata.demo.jpa.ApplicationConfigTest.java

@Test
public void bootstrapAppFromJavaConfig() {

    ApplicationContext context = new AnnotationConfigApplicationContext(ApplicationConfig.class);
    assertThat(context, is(notNullValue()));
    assertThat(context.getBean(CrudCustomerRepository.class), is(notNullValue()));
}

From source file:com.abdul.onlinemobi.repository.OrderItemRepositoryTest.java

@BeforeClass
public static void setUpClass() throws Exception {

    ctx = new AnnotationConfigApplicationContext(ConnectionConfig.class);
}

From source file:org.kordamp.javatrove.example04.Launcher.java

@Override
public void init() throws Exception {
    ApplicationContext applicationContext = new AnnotationConfigApplicationContext(
            "org.kordamp.javatrove.example04");
    applicationContext.getAutowireCapableBeanFactory().autowireBean(this);
}

From source file:org.kordamp.javatrove.example05.Launcher.java

@Override
public void init() throws Exception {
    ApplicationContext applicationContext = new AnnotationConfigApplicationContext(
            "org.kordamp.javatrove.example05");
    applicationContext.getAutowireCapableBeanFactory().autowireBean(this);
}