ui设计师是做网站吗,网站建设推广行业,共享网站的详细规划,尚易企业邮箱登录入口1.在初始化时保存ApplicationContext对象
2.通过Spring提供的utils类获取ApplicationContext对象
3.继承自抽象类ApplicationObjectSupport
4.继承自抽象类WebApplicationObjectSupport
5.实现接口ApplicationContextAware
6.通过Spring提供的ContextLoader 来说一下实现接…1.在初始化时保存ApplicationContext对象
2.通过Spring提供的utils类获取ApplicationContext对象
3.继承自抽象类ApplicationObjectSupport
4.继承自抽象类WebApplicationObjectSupport
5.实现接口ApplicationContextAware
6.通过Spring提供的ContextLoader 来说一下实现接口的方法
Component
public class example implements ApplicationContextAware {private static ApplicationContext context;Overridepublic void setApplicationContext(ApplicationContext applicationContext) throws BeansException {context applicationContext;}example(){}public static TypeHandler createHandler(Type type) throws Exception{if(typenull){throw new Exception(handler type is null);}return (TypeHandler) context.getBean(type.getShortName()Handler);}}
实现接口之后getBrean时要实现类型转换