「Spring MVC」SpringBeanAutowiringSupportを継承する方法
Javaコード
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.context.support.SpringBeanAutowiringSupport;
public class SpringCftBean extends SpringBeanAutowiringSupport {
/**
* beanFactory
*/
@Autowired
private BeanFactory beanFactory;
private SpringCftdBean() {
}
private static SpringCftdBean instance;
static {
instance = new SpringCftdBean();
}
/**
*
* getInstance
*
* @param beanId
* @return
*/
public Object getBeanById(String beanId) {
return beanFactory.getBean(beanId);
}
public static SpringCftdBean getInstance() {
return instance;
}
}