@SuppressWarnings("resource")
  public static void main(String[] args) {

    ApplicationContext context =
        new AnnotationConfigApplicationContext("com.epam.training.spring.annotationconfig");

    BusinessLogic businessLogic = context.getBean("businessLogic", BusinessLogic.class);

    businessLogic.doBusiness("http://example.org/remotefile");

    System.out.println("Application ended");
  }
コード例 #2
0
  @SuppressWarnings("resource")
  public static void main(String[] args) {

    ConfigurableApplicationContext context =
        new ClassPathXmlApplicationContext("example-xmlconfig.xml");

    BusinessLogic businessLogic = context.getBean("businessLogic", BusinessLogic.class);

    businessLogic.doBusiness("http://example.org/remotefile");

    context.close();
    System.out.println("Application ended");
  }