Example usage for org.springframework.context.support AbstractRefreshableConfigApplicationContext getBean

List of usage examples for org.springframework.context.support AbstractRefreshableConfigApplicationContext getBean

Introduction

In this page you can find the example usage for org.springframework.context.support AbstractRefreshableConfigApplicationContext getBean.

Prototype

@Override
    public <T> T getBean(String name, Class<T> requiredType) throws BeansException 

Source Link

Usage

From source file:pl.altkom.spring.sample.Main.java

public static void main(String[] args) {

    System.out.println("!!!!!");

    AbstractRefreshableConfigApplicationContext ctx = new ClassPathXmlApplicationContext("spring-context.xml");

    ctx.registerShutdownHook();/*from   w  ww.ja va2 s  . c o m*/

    NewsletterService newsletterService = ctx.getBean("newsletterServiceImpl", NewsletterService.class);
    newsletterService.send("tre", "temat");

    //ctx.close();

}