List of usage examples for org.springframework.context ApplicationContext getBean
Object getBean(String name) throws BeansException;
From source file:org.tanzim.javabrains.DrawingApp.java
public static void main(String[] args) { System.out.print("Hello World\n"); // BeanFactory factory = new XmlBeanFactory(new FileSystemResource("spring.xml")); // Triangle t = (Triangle) factory.getBean("triangle"); ApplicationContext context = new ClassPathXmlApplicationContext("spring.xml"); Triangle t = (Triangle) context.getBean("triangle-alias"); t.draw();/*from w w w . ja va 2 s . c o m*/ }
From source file:com.as.sagma.ProbarCuentas.java
public static void main(String args[]) { ApplicationContext ctx = new AnnotationConfigApplicationContext(ApConfig.class); ServicioCuenta cuenta = ctx.getBean(ServicioCuenta.class); System.out.println("Bienvenido a la creacion de cuentas"); // ServicioCuenta cuenta=new CuentaAhorroImpl(); System.out.println(cuenta.crearCuenta()); }
From source file:com.antero.tankkitietokanta.firsttest.MainApp.java
public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext("Beans.xml"); HelloWorld obj = (HelloWorld) context.getBean("helloWorld"); obj.getMessage();/*from ww w.j a v a 2s .c o m*/ }
From source file:com.carranza.web.Probarpersona.java
/** * @param args the command line arguments *//* www . ja v a2 s . c o m*/ public static void main(String[] args) { ApplicationContext ctx = new AnnotationConfigApplicationContext(ServiciosChingativos.class); Persona p = ctx.getBean(Persona.class); p.ejecutarGracia(); System.out.println(p.ejecutarGracia()); }
From source file:com.mycompany.daospring.StudentManager.java
public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext("SpringConfiguration.xml"); Student s = (Student) context.getBean("student"); System.out.println(s);/* ww w. j ava 2 s . co m*/ }
From source file:com.apress.prospringintegration.corespring.config.annotation.AnnotationMain.java
public static void main(String[] args) throws Exception { ApplicationContext app = new ClassPathXmlApplicationContext("ioc_annotations.xml"); ColorPicker cp = app.getBean(ColorPicker.class); assert cp != null; assert cp.getColorRandomizer() != null; System.out.println(cp.getColorRandomizer().randomColor()); }
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();/*from ww w. j a v a 2 s . 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 v a 2 s . c om }
From source file:edu.eci.cosw.polizas.logica.Test.java
public static void main(String ap[]) { ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml"); OperationsFacade f = ac.getBean(OperationsFacade.class); Cliente c = f.getClient(1, "cc"); System.out.println(c.getNombre()); System.out.println(c.getPolizasAprobadases().iterator().next()); }
From source file:test.TesterApp.java
public static void main(String[] args) { ApplicationContext ctx = new ClassPathXmlApplicationContext("appconfig.xml"); Soldier rambo = (Soldier) ctx.getBean("rambo"); rambo.firing();/*w w w . j av a2 s . co m*/ rambo.firing(); rambo.firing(); rambo.firing(); rambo.firing(); rambo.firing(); rambo.firing(); }