package com.yaoyan.listener;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
public class ApplicationContextAwareListner implements ApplicationContextAware {
private static ApplicationContext context;
public static ApplicationContext getContext() {
return context;
}
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
ApplicationContextAwareListner.context = applicationContext;
}
}
package com.yaoyan.service.impl;
import com.yaoyan.service.Service;
public class ServiceImpl implements Service {
@Override
public String say() {
return "say";
}
}
package com.yaoyan.service;
public interface Service {
String say();
}