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

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

Introduction

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

Prototype

@Override
public ConfigurableEnvironment getEnvironment() 

Source Link

Document

Return the Environment for this application context in configurable form, allowing for further customization.

Usage

From source file:uk.ac.ebi.ep.parser.main.CofactorParser.java

public static void main(String... args) throws Exception {
    if (args == null || args.length == 0) {
        System.out.println("Please provide required parameters");
        System.exit(0);/*from   w  w  w  .ja va 2s  . c om*/
    }

    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
    context.getEnvironment().setActiveProfiles(args[0]);
    context.scan("uk.ac.ebi.ep.data.dataconfig", "uk.ac.ebi.ep.parser.config");
    context.refresh();

    EnzymePortalCompoundParser compoundService = context.getBean(EnzymePortalCompoundParser.class);
    compoundService.loadCofactors();

}

From source file:uk.ac.ebi.ep.parser.main.ChEBIParser.java

public static void main(String... args) throws Exception {
    if (args == null || args.length == 0) {
        System.out.println("Please provide required parameters");
        System.exit(0);/*www .  j a  v  a 2  s  .c  o m*/
    }

    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
    context.getEnvironment().setActiveProfiles(args[0]);
    context.scan("uk.ac.ebi.ep.data.dataconfig", "uk.ac.ebi.ep.parser.config");
    context.refresh();

    EnzymePortalCompoundParser compoundService = context.getBean(EnzymePortalCompoundParser.class);
    compoundService.loadChEBICompounds();

}

From source file:uk.ac.ebi.ep.parser.main.IntenzXmlParser.java

public static void main(String... args) throws Exception {
    if (args == null || args.length == 0) {
        System.out.println("Please provide required parameters");
        System.exit(0);/* w ww.  j  a  v  a2s  .  c  om*/
    }

    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
    context.getEnvironment().setActiveProfiles(args[0]);
    context.scan("uk.ac.ebi.ep.data.dataconfig", "uk.ac.ebi.ep.parser.config");
    context.refresh();
    EnzymePortalCompoundParser compoundService = context.getBean(EnzymePortalCompoundParser.class);

    compoundService.parseIntenzAndLoadCompoundsAndReactions(args[1]);

}

From source file:com.home.ln_spring.ch5.profile.ProfileJavaConfigExample.java

public static void main(String[] args) {
    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();

    context.getEnvironment().setActiveProfiles("highschool");
    context.register(KindergartenConfig.class, HighschoolConfig.class);
    context.refresh();/*www.j av a 2  s  .  c o m*/

    FoodProviderService foodProviderService = context.getBean("foodProviderService", FoodProviderService.class);

    List<Food> lunchSet = foodProviderService.provideLunchSet();

    for (Food food : lunchSet) {
        System.out.println("Food: " + food.getName());
    }
}

From source file:uk.ac.ebi.ep.parser.main.ChEMBLXmlParser.java

public static void main(String... args) throws Exception {

    if (args == null || args.length == 0) {
        System.out.println("Please provide required parameters");
        System.exit(0);//from   ww w . java2 s . c om
    }

    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
    context.getEnvironment().setActiveProfiles(args[0]);
    context.scan("uk.ac.ebi.ep.data.dataconfig", "uk.ac.ebi.ep.parser.config");
    context.refresh();

    EnzymePortalCompoundParser compoundService = context.getBean(EnzymePortalCompoundParser.class);
    compoundService.parseAndLoadChEMBLCompounds(args[1]);

}

From source file:uk.ac.ebi.ep.parser.main.DiseaseFileParser.java

public static void main(String... args) throws Exception {

    if (args == null || args.length == 0) {
        System.out.println("Please provide required parameters");
        System.exit(0);//  w  w w  .  j ava 2s  . com
    }

    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
    context.getEnvironment().setActiveProfiles(args[0]);
    context.scan("uk.ac.ebi.ep.data.dataconfig", "uk.ac.ebi.ep.parser.config");
    context.refresh();

    DiseaseParser diseaseParser = context.getBean(DiseaseParser.class);

    diseaseParser.parse(args[1]);

}

From source file:uk.ac.ebi.ep.parser.main.PDBeParser.java

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

    String profile = "";

    if (args == null || args.length == 0) {
        System.out.println("Please provide required parameters");
        System.exit(0);/* w w w .  j av a 2  s.  co m*/
    }

    if (args.length == 1) {

        profile = args[0];

        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
        context.getEnvironment().setActiveProfiles(profile);
        context.scan("uk.ac.ebi.ep.data.dataconfig", "uk.ac.ebi.ep.parser.config");
        context.refresh();

        EnzymePortalPDBeParser pdbParser = context.getBean(EnzymePortalPDBeParser.class);

        pdbParser.updatePDBeData();
    }

}

From source file:org.cloudfoundry.workers.stocks.batch.Main.java

public static void main(String[] args) throws Throwable {
    AnnotationConfigApplicationContext annotationConfigApplicationContext = new AnnotationConfigApplicationContext();
    annotationConfigApplicationContext.getEnvironment().setActiveProfiles(isCloudFoundry() ? "cloud" : "local");
    annotationConfigApplicationContext.scan(BatchConfiguration.class.getPackage().getName());
    annotationConfigApplicationContext.refresh();
}

From source file:uk.ac.ebi.ep.parser.main.PathwaysParser.java

public static void main(String args[]) throws Exception {
    String file = "";
    String profile = "";

    if (args == null || args.length == 0) {
        System.out.println("Please provide required parameters");
        System.exit(0);//  w  w w . j a va2  s  .  c  om
    }

    if (args.length == 2) {

        profile = args[0];
        file = args[1];

        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
        context.getEnvironment().setActiveProfiles(profile);
        //context.scan("uk.ac.ebi.ep.data.dataconfig");
        context.scan("uk.ac.ebi.ep.data.dataconfig", "uk.ac.ebi.ep.parser.config");
        context.refresh();

        EnzymePortalPathwaysParser pathwaysParser = context.getBean(EnzymePortalPathwaysParser.class);

        pathwaysParser.parseReactomeFile(file);//Total time: 1:57:24.500s
    }

}

From source file:org.cloudfoundry.workers.stocks.integration.service.Main.java

public static void main(String args[]) throws Throwable {
    AnnotationConfigApplicationContext annotationConfigApplicationContext = new AnnotationConfigApplicationContext();
    annotationConfigApplicationContext.getEnvironment().setActiveProfiles(isCloudFoundry() ? "cloud" : "local");
    annotationConfigApplicationContext.scan(ServiceConfiguration.class.getPackage().getName());
    annotationConfigApplicationContext.refresh();

}