List of usage examples for org.springframework.context.annotation AnnotationConfigApplicationContext AnnotationConfigApplicationContext
public AnnotationConfigApplicationContext()
From source file:com.mesut.springpropertyinjection.App.java
public static void main(String[] args) { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); context.scan("com.mesut"); context.refresh();/* w w w .ja v a 2 s. c om*/ Person person = context.getBean(Person.class); System.out.println("Sonuc: " + person); context.close(); }
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();/*from ww w. ja v a 2s . 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:com.mycompany.spring.propertysource.views.NewMain.java
/** * @param args the command line arguments *///from w ww . j a va 2s. c om public static void main(String[] args) { // TODO code application logic here AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); ctx.register(AppConfig.class); ctx.refresh(); }
From source file:prospring3.ch6.Ch6Main.java
public static void main(String[] args) { AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); ctx.register(Ch6Config.class); ctx.refresh();/*from w ww. j av a 2 s . c om*/ final TwitterServiceClient twitterService = ctx.getBean(TwitterServiceClient.class); twitterService.deassociateAll(); System.out.println("Finish"); }
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);//from w w w. j a va 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(); DiseaseParser diseaseParser = context.getBean(DiseaseParser.class); diseaseParser.parse(args[1]); }
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);// w ww .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.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 ww w . ja v a 2 s . co 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.loadCofactors(); }
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);/*ww w. ja v a 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(); EnzymePortalCompoundParser compoundService = context.getBean(EnzymePortalCompoundParser.class); compoundService.parseIntenzAndLoadCompoundsAndReactions(args[1]); }
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);// w ww .j a v a 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.parseAndLoadChEMBLCompounds(args[1]); }
From source file:org.pieShare.pieShareServer.App.java
public static void main(String[] args) { context = new AnnotationConfigApplicationContext(); context.register(ServiceConfiguration.class); context.refresh();/*from ww w.j a v a 2 s .c o m*/ BeanService beanService = context.getBean(BeanService.class); beanService.setApplicationContext(context); IServerService service = beanService.getBean(ServerService.class); service.startServer(); }