Package org.springframework.tests.sample.beans

Examples of org.springframework.tests.sample.beans.Employee


    Pet pet = ctx.getBean(Pet.class);
    assertNotNull("pet", pet);
    assertEquals("Dogbert", pet.getName());

    Employee employee = ctx.getBean(Employee.class);
    assertNotNull("employee", employee);
    assertEquals("Dilbert", employee.getName());
    assertEquals("???", employee.getCompany());
  }
View Full Code Here


@Configuration
public class PojoAndStringConfig {

  @Bean
  public Employee employee() {
    Employee employee = new Employee();
    employee.setName("John Smith");
    employee.setAge(42);
    employee.setCompany("Acme Widgets, Inc.");
    return employee;
  }
View Full Code Here

  @Configuration
  static class ContextConfiguration {

    @Bean
    public Employee employee() {
      Employee employee = new Employee();
      employee.setName("Yoda");
      employee.setAge(900);
      employee.setCompany("The Force");
      return employee;
    }
View Full Code Here

  // @Configuration
  static class AnnotatedFactoryBeans {

    @Bean
    public Employee employee() {
      Employee employee = new Employee();
      employee.setName("John Smith");
      employee.setAge(42);
      employee.setCompany("Acme Widgets, Inc.");
      return employee;
    }
View Full Code Here

  @Configuration
  static class Config {

    @Bean
    public Employee employee() {
      Employee employee = new Employee();
      employee.setName("John Smith");
      employee.setAge(42);
      employee.setCompany("Acme Widgets, Inc.");
      return employee;
    }
View Full Code Here

@Configuration
public class DevProfileConfig {

  @Bean
  public Employee employee() {
    Employee employee = new Employee();
    employee.setName("John Smith");
    employee.setAge(42);
    employee.setCompany("Acme Widgets, Inc.");
    return employee;
  }
View Full Code Here

  @Configuration
  static class ContextConfiguration {

    @Bean
    public Employee employee() {
      Employee employee = new Employee();
      employee.setName("John Smith");
      employee.setAge(42);
      employee.setCompany("Acme Widgets, Inc.");
      return employee;
    }
View Full Code Here

  @Transactional(propagation = Propagation.NOT_SUPPORTED)
  public void verifyApplicationContextSet() {
    assertInTransaction(false);
    assertNotNull(super.applicationContext,
      "The application context should have been set due to ApplicationContextAware semantics.");
    Employee employeeBean = (Employee) super.applicationContext.getBean("employee");
    assertEquals(employeeBean.getName(), "John Smith", "employee's name.");
  }
View Full Code Here

    // Verifying dependency injection:
    assertNotNull("The pet field should have been autowired.", this.pet);

    // Verifying 'parameterized' support:
    final Employee employee = (Employee) this.applicationContext.getBean(this.employeeBeanName);
    employees.add(employee);
    assertEquals("Verifying the name of the employee configured as bean [" + this.employeeBeanName + "].",
      this.employeeName, employee.getName());
  }
View Full Code Here

  @Configuration
  static class Config {

    @Bean
    public Employee employee() {
      Employee employee = new Employee();
      employee.setName("Yoda");
      employee.setAge(900);
      employee.setCompany("The Force");
      return employee;
    }
View Full Code Here

TOP

Related Classes of org.springframework.tests.sample.beans.Employee

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.