List of usage examples for org.springframework.context ApplicationContext getBean
<T> T getBean(String name, Class<T> requiredType) throws BeansException;
From source file:exercise2.BlogConsole.java
protected static BlogService createBlogService() { // Use ApplicationContext to enable container-managed // transactions. ApplicationContext context = new ClassPathXmlApplicationContext("exercise2/applicationContext.xml"); return context.getBean("blogService", BlogService.class); }
From source file:solution1.BlogConsole.java
protected static BlogService createBlogService() { // Use ApplicationContext to enable container-managed // transactions. ApplicationContext context = new ClassPathXmlApplicationContext("solution1/applicationContext.xml"); return context.getBean("blogService", BlogService.class); }
From source file:solution2.BlogConsole.java
protected static BlogService createBlogService() { // Use ApplicationContext to enable container-managed // transactions. ApplicationContext context = new ClassPathXmlApplicationContext("solution2/applicationContext.xml"); return context.getBean("blogService", BlogService.class); }
From source file:com.apress.prospringintegration.corespring.iocbasics.BasicIoCMain.java
public static void demonstrateScopes(ApplicationContext ctx) { for (int i = 0; i < 5; i++) { System.out.println("randomeverytime: " + ctx.getBean("randomeverytime", ColorEnum.class)); System.out.println("alwaysthesame: " + ctx.getBean("alwaysthesame", ColorEnum.class)); }/*from w w w . j ava2s .c o m*/ }