Example usage for org.springframework.context.annotation AnnotationConfigApplicationContext AnnotationConfigApplicationContext

List of usage examples for org.springframework.context.annotation AnnotationConfigApplicationContext AnnotationConfigApplicationContext

Introduction

In this page you can find the example usage for org.springframework.context.annotation AnnotationConfigApplicationContext AnnotationConfigApplicationContext.

Prototype

public AnnotationConfigApplicationContext(String... basePackages) 

Source Link

Document

Create a new AnnotationConfigApplicationContext, scanning for bean definitions in the given packages and automatically refreshing the context.

Usage

From source file:com.gamersrepublic.services.impl.LoginServiceImpl.java

public LoginServiceImpl() {
    ctx = new AnnotationConfigApplicationContext(ConnectionConfig.class);
    repo = ctx.getBean(EmployeeRepository.class);
}

From source file:com.nkosy.chapter5.creational.singleton.SingletonTest.java

@Before
public void setUp() {
    ApplicationContext ctx = new AnnotationConfigApplicationContext(AppConfig.class);
    obj = (SingletonExample) ctx.getBean("singletonTest");

}

From source file:crud.StatementCrud.java

@BeforeClass
public static void setUpClass() throws Exception {
    ctx = new AnnotationConfigApplicationContext(ConnectionConfig.class);

    department = new Department.Builder().department("Food").build();

    productRepo = ctx.getBean(ProductRepository.class);
    product = new Product.Builder().productName("Topdeck").price(9.50).productType(null).quantity(10).build();
    productRepo.save(product);//  w w w.j  a v a  2 s  .co  m

    teller = new Teller.Builder().tellerName("John Smith").build();

    productList = new ArrayList();
    productList.add(product);
}

From source file:cputgroup3a.assertingnullnonnull.AssertingNullNonNullTest.java

@BeforeClass
public static void setUpClass() throws Exception {
    ApplicationContext ctx = new AnnotationConfigApplicationContext(AppConfig.class);
    obj = (AssertingNullNonNull) ctx.getBean("Ann");
}

From source file:com.mycompany.model.MongoDBTest.java

public List<Marker> getMarker() {
    ApplicationContext ctx = new AnnotationConfigApplicationContext(MongoConfig.class);
    MongoOperations mongoOperation = (MongoOperations) ctx.getBean("mongoTemplate");

    DBCollection markerCollection = mongoOperation.getCollection("markers");
    DBCursor result = markerCollection.find();

    while (result.hasNext()) {
        DBObject tobj = result.next();//  www .  j av a 2s  .c  om
        //System.out.println(tobj.get("_id"));

    }

    List<Marker> listUser = mongoOperation.findAll(Marker.class, "markers");

    return listUser;

}

From source file:com.github.sebhoss.contract.example.SpringUELInsuranceCompanyTest.java

/**
 * Creates a new insurance company for each test.
 *///w ww .  ja  va  2s .  c  om
@Before
@SuppressWarnings(CompilerWarnings.RESOURCE)
public void createCompany() {
    final ApplicationContext context = new AnnotationConfigApplicationContext(SpringUelConfiguration.class);
    setInsuranceCompany(context.getBean(InsuranceCompany.class));
}

From source file:com.github.sebhoss.contract.example.SpringJEXLInsuranceCompanyTest.java

/**
 * Creates a new insurance company for each test.
 *///from  w w  w.ja v  a  2  s  .co m
@Before
@SuppressWarnings(CompilerWarnings.RESOURCE)
public void createCompany() {
    final ApplicationContext context = new AnnotationConfigApplicationContext(SpringJexlConfiguration.class);
    setInsuranceCompany(context.getBean(InsuranceCompany.class));
}

From source file:com.github.sebhoss.contract.example.SpringJUELInsuranceCompanyTest.java

/**
 * Creates a new insurance company for each test.
 *//*from   w w  w  .  j av a2  s . co m*/
@Before
@SuppressWarnings(CompilerWarnings.RESOURCE)
public void createCompany() {
    final ApplicationContext context = new AnnotationConfigApplicationContext(SpringJuelConfiguration.class);
    setInsuranceCompany(context.getBean(InsuranceCompany.class));
}

From source file:com.github.sebhoss.contract.example.SpringMVELInsuranceCompanyTest.java

/**
 * Creates a new insurance company for each test.
 *///w  ww  .j a v  a  2 s.  c om
@Before
@SuppressWarnings(CompilerWarnings.RESOURCE)
public void createCompany() {
    final ApplicationContext context = new AnnotationConfigApplicationContext(SpringMvelConfiguration.class);
    setInsuranceCompany(context.getBean(InsuranceCompany.class));
}

From source file:com.github.sebhoss.contract.example.SpringOgnlInsuranceCompanyTest.java

/**
 * Creates a new insurance company for each test.
 *///from   w  w w  .j a  v a 2  s .co m
@Before
@SuppressWarnings(CompilerWarnings.RESOURCE)
public void createCompany() {
    final ApplicationContext context = new AnnotationConfigApplicationContext(SpringOgnlConfiguration.class);
    setInsuranceCompany(context.getBean(InsuranceCompany.class));
}