Пример #1
0
 @Bean
 public Persona juan() {
   Persona p = new Persona();
   p.setNombre("Juan");
   p.setApellido("Perez");
   return p;
 }
  /** @param args the command line arguments */
  public static void main(String[] args) {
    ApplicationContext contexto = new ClassPathXmlApplicationContext("resources/configSpring.xml");

    Persona p2 = (Persona) contexto.getBean("ejemploAutowiringByName");
    System.out.println(p2.toString());
  }