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:net.javacrumbs.codecamp.spring2.Main.java

public static void main(String[] args) {
    try (ConfigurableApplicationContext ctx = new AnnotationConfigApplicationContext(
            LoggerConfiguration.class)) {
        LogStatistics logStatistics = ctx.getBean(LogStatistics.class);
        System.out.println(logStatistics.findLongestMessage());
    }/*from  ww  w  . j  a va 2s .c  om*/
}

From source file:com.art4ul.loadinstead.Main.java

public static void main(String... args) {
    ApplicationContext applicationContext = new AnnotationConfigApplicationContext(Config.class);
    Hello test = applicationContext.getBean(Hello.class);
    test.doSomething();//ww w  . j  a va2 s . c  o  m
}

From source file:org.note.application.NoteApplication.java

public static void main(String[] args) {
    LOGGER.info("Loading the spring boot");
    ApplicationContext context = new AnnotationConfigApplicationContext(NoteConfiguration.class);
    SpringApplication.run(NoteApplication.class, args);
    LOGGER.info("Succesfully started the spring boot");

}

From source file:net.wessendorf.amqp.Main.java

public static void main(String[] args) {
    // get access to the Java based config
    ApplicationContext context = new AnnotationConfigApplicationContext(RabbitConfiguration.class);

    // get our service class
    // could use the @Named "rabbitPublishService" value as well, but this would require a type-cast.......
    RabbitPublishService rps = context.getBean(RabbitPublishService.class);

    // launch it!
    rps.run();/*from  www .  java 2 s. c  o m*/

    // System.exit(0);
}

From source file:br.com.gumga.academia.modulo2.aplicacao.MainService2.java

public static void main(String[] args) {
    ApplicationContext ctx = new AnnotationConfigApplicationContext(Aplicacao.class);
    MainService2 ms = ctx.getBean(MainService2.class);
    ms.run();//  www  .  j a  v a  2 s  .  c om
}

From source file:com.khartec.waltz.jobs.OrgUnitHarness.java

public static void main(String[] args) {

    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);

    OrganisationalUnitDao dao = ctx.getBean(OrganisationalUnitDao.class);

}

From source file:ro.lmn.presos.di.emailsender.impl.spring.EmailSenderApp.java

public static void main(String[] args) {
    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(EmailSenderApp.class);
    context.getBean(EmailSender.class).sendMail("Hello there", "Buy cheap $product");
    context.close();// www . j  a  va 2 s.  c  o m
}

From source file:pl.softech.eav.example.Example.java

public static void main(String[] args) throws Exception {

    try (AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(AppConfig.class)) {

        BootstrapperService bootstrapper = ctx.getBean(BootstrapperService.class);

        bootstrapper.onApplicationStart();

        DocumentManagementService documentManagementService = ctx.getBean(DocumentManagementService.class);

        SymbolTable symbolTable = documentManagementService.loadConfigurationFromFile("cv-scheme.eav");

        MyObject cv = symbolTable.getObject("ssledz-cv");

        System.out.println(cv.toString());

    }//  w  w w.j  a va  2  s  . c  o m

}

From source file:br.com.poc.navigation.NavigationLoader.java

public static void main(String[] args) {

    final AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(
            ApplicationContextNavigation.class);

    NavigationLoader navigationLoader = new NavigationLoader();

    navigationLoader.setNavigationComponent(applicationContext.getBean(NavigationComponent.class));

    navigationLoader.startNavigation();/*  w ww .  java 2 s.  com*/

    applicationContext.close();

}

From source file:org.cellcore.code.exec.db.UpdateAll.java

public static void main(String[] args) {
    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ContextConfig.class);
    GeneralDao dao = context.getBean(GeneralDao.class);
    FetchUpdateData updateData = context.getBean(FetchUpdateData.class);
    List<CardPriceSource> cards = dao.list(CardPriceSource.class);
    for (CardPriceSource card : cards) {
        updateData.update(card.getUrl(), card.getSourceType().getPageDataExtractorClass());
    }//from   w  w  w .  j  a  va 2 s. co m
}