Exemplo n.º 1
0
 public static void main(String[] args) {
   ApplicationContext context = new ClassPathXmlApplicationContext("performer-context.xml");
   Performer duke = context.getBean("duke", Performer.class);
   duke.perform();
   Performer jim = context.getBean("jim", Juggler.class);
   jim.perform();
 }
  public static void main(String[] args) throws PerformanceException {
    ctx = new ClassPathXmlApplicationContext("p_binding.xml");
    Performer performer = (Performer) ctx.getBean("hank");
    performer.perform();
    Stage stage = (Stage) ctx.getBean("theStage");
    Stage stage2 = (Stage) ctx.getBean("theStage");

    System.out.println(stage.equals(stage2));
    System.out.println(ctx.isSingleton("theStage"));

    Performer performer2 = (Performer) ctx.getBean("kenny");
    performer2.perform();
  }
Exemplo n.º 3
0
 /**
  * Notify managers of changes to the specified entity.
  *
  * @param performer The performer that notifies the managers.
  * @param e Entity that has been affected.
  */
 protected void notifyManagers(Performer performer, Entity e) {
   for (Manager manager : managers) {
     performer.perform(manager, e);
   }
 }
Exemplo n.º 4
0
 /**
  * Notify systems of changes to the specified entity.
  *
  * @param performer The performer that notifies the systems.
  * @param e Entity that has been affected.
  */
 protected void notifySystems(Performer performer, Entity e) {
   for (int i = 0; i < systems.size; i++) {
     performer.perform(systems.get(i), e);
   }
 }
Exemplo n.º 5
0
 public static void main(String[] args) throws PerformanceException {
   ApplicationContext ctx = new ClassPathXmlApplicationContext("spring-idol.xml");
   Performer performer = (Performer) ctx.getBean("eddie");
   performer.perform();
 }