Spring上下文之ApplicationContextAware

@Component
public class StartRabbitUpdate implements ApplicationContextAware {
    @Autowired
    private ApplicationContext applicationContext;

    @PostConstruct
    private void startRabbitUpdate() throws Exception{
        //TODO STH
    }
    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        this.applicationContext=applicationContext;
    }
}

你可能感兴趣的:(Spring上下文之ApplicationContextAware)