List of usage examples for org.springframework.context.annotation AnnotationConfigApplicationContext scan
public void scan(String... basePackages)
From source file:com.mesut.springpropertyinjection.App.java
public static void main(String[] args) { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); context.scan("com.mesut"); context.refresh();//from ww w . jav a2 s.c o m Person person = context.getBean(Person.class); System.out.println("Sonuc: " + person); context.close(); }
From source file:uk.ac.ebi.ep.sitemap.main.SiteMapMain.java
public static void main(String... args) throws Exception { //////////////comment here /////////////////////// // args = new String[4]; // //String dbConfig = "ep-mm-db-enzdev"; // //String dbConfig = "ep-mm-db-enzprel"; // String userHome = System.getProperty("user.home"); // String filename = "SiteMap"; // String testing = "true"; // /*w w w . j av a 2 s. c o m*/ // // args[0] = "vezpdev"; // args[1] = userHome; // args[2] = filename; // args[3] = testing; //////////////uncomment for testing parameters only /////////////////////// if (args == null) { System.out.println("Please provide required parameters"); System.exit(0); } AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); context.getEnvironment().setActiveProfiles(args[0]); context.scan("uk.ac.ebi.ep.data.dataconfig"); context.refresh(); UniprotEntryService service = context.getBean(UniprotEntryService.class); SiteMapGenerator siteMapGenerator = new EnzymePortalSiteMap(service); boolean testMode = Boolean.parseBoolean(args[3]); siteMapGenerator.generateSitemap(args[1], args[2], testMode); }
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: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(); }
From source file:org.cloudfoundry.workers.stocks.integration.client.Main.java
public static void main(String args[]) throws Throwable { AnnotationConfigApplicationContext annotationConfigApplicationContext = new AnnotationConfigApplicationContext(); annotationConfigApplicationContext.getEnvironment().setActiveProfiles(isCloudFoundry() ? "cloud" : "local"); annotationConfigApplicationContext.scan(ClientConfiguration.class.getPackage().getName()); annotationConfigApplicationContext.refresh(); StockClientGateway clientGateway = annotationConfigApplicationContext.getBean(StockClientGateway.class); Logger log = Logger.getLogger(Main.class.getName()); String symbol = "VMW"; StockSymbolLookup lookup = clientGateway.lookup(symbol); log.info("client: retrieved stock information: " + ToStringBuilder.reflectionToString(lookup)); }
From source file:com.rytis.oot2.AppJavaConfig.java
public static void run(String[] args) throws Throwable { SpringApplication.run(AppJavaConfig.class, args); AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(); applicationContext.scan("com.rytis.oot2"); applicationContext.refresh();/* w w w . j ava2 s . c o m*/ Device device; device = applicationContext.getBean("device1", Device.class); device.Boot(); device = applicationContext.getBean("device2", Device.class); device.Boot(); device = applicationContext.getBean("device3", Device.class); device.Boot(); device = applicationContext.getBean("device4", Device.class); device.Boot(); device = applicationContext.getBean("device5", Device.class); device.Boot(); device = applicationContext.getBean("device7", Device.class); device.Boot(); device = applicationContext.getBean("device8", Device.class); device.Boot(); ((AbstractApplicationContext) applicationContext).close(); }
From source file:org.wicketTutorial.springinjection.WicketApplication.java
/** * @see org.apache.wicket.Application#init() *///from ww w . j a va 2 s. c o m @Override public void init() { super.init(); AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); ctx.scan("org.wicketTutorial.springinjection.ejbBean"); ctx.refresh(); getComponentInstantiationListeners().add(new SpringComponentInjector(this, ctx)); }
From source file:org.wicketTutorial.WicketApplication.java
/** * @see org.apache.wicket.Application#init() *///from w w w . j av a 2 s . c o m @Override public void init() { super.init(); AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); ctx.scan("org.wicketTutorial.ejbBean"); ctx.refresh(); getComponentInstantiationListeners().add(new SpringComponentInjector(this, ctx)); }
From source file:org.jboss.arquillian.spring.integration.javaconfig.utils.AnnotationApplicationContextProducer.java
/** * <p>Creates instance of {@link AnnotationConfigApplicationContext} class.</p> * * @param classes the annotated classes to register * @param packages the packages containing the annotated classes * * @return the created instance of {@link AnnotationConfigApplicationContext} *///from www . ja v a 2 s .c o m private ApplicationContext createAnnotatedApplicationContext(Class<?>[] classes, String[] packages) { if (classes.length > 0) { AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(classes); if (packages.length > 0) { applicationContext.scan(packages); applicationContext.refresh(); } return applicationContext; } else { return new AnnotationConfigApplicationContext(packages); } }
From source file:org.wicket_sapporo.springApp.SpringApplication.java
/** * Spring?Injector??./*from w w w.j av a2 s.com*/ */ protected void initSpring() { AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); // ???Bean??? ctx.scan("org.wicket_sapporo.springApp.service"); ctx.refresh(); getComponentInstantiationListeners().add(new SpringComponentInjector(this, ctx)); }