java 代碼
import org
import org
import org
import org
public class Publisher implements ApplicationContextAware {
private ApplicationContext context;
@Override
public void setApplicationContext(ApplicationContext arg
throws BeansException {
// TODO Auto
this
}
public void publish(String message){
context
}
public static void main(String[] args) {
ApplicationContext ctx = new FileSystemXmlApplicationContext (
Publisher pub = (Publisher) ctx
pub
pub
}
}
[
From:http://tw.wingwit.com/Article/program/Java/ky/201311/29121.html