Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.weib.concert; import com.weib.concert.beans.Performance; import com.weib.concert.configuration.CDConfig; import com.weib.concert.configuration.ConcertConfig; import com.weib.concert.pointcut.ifex.Encoreable; import org.springframework.context.annotation.AnnotationConfigApplicationContext; /** * * @author zhangjingwei */ public class ConcertMain { public static void main(String[] args) { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ConcertConfig.class); // Director director = context.getBean(Director.class); // director.perform(); Performance concert = (Performance) context.getBean("concert"); //??Bean Qualifier concert.perform(); Performance play = (Performance) context.getBean("play"); //??Bean play.perform(); /** * public class EncoreableIntroducer { * @DeclareParents(value="com.weib.concert.beans.Performance+", //?? * defaultImpl=PerformanceEncoreable.class) // * public static Encoreable encoreable; * } */ Encoreable encoreablePlay = (Encoreable) play; //??(Performance??playproxy??) encoreablePlay.performEncore(); // context.close(); AnnotationConfigApplicationContext cdContext = new AnnotationConfigApplicationContext(CDConfig.class); CDPlayer cdplayer = cdContext.getBean(CDPlayer.class); cdplayer.playAll(); cdplayer.playShuffle(); cdContext.close(); } }