从application中获取特定对象,从对象中取出一些配置化的信息



public class BeanHolder {
public BeanHolder() {
}

public static Object getBean(String beanId) {
WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(ApplicationContext.getContext().getServletContext());
return ctx.getBean(beanId);
}
}

 <bean id="uploadProperty"
class="com.ibm.gbs.ai.portal.framework.common.upload.domain.UploadProperty">
<property name="savePath" value="/upload/file/" />
</bean>
UploadProperty up = (UploadProperty) BeanHolder.getBean("uploadProperty");
path = up.getSavePath()+"template/" + editFileName;

猜你喜欢

转载自www.cnblogs.com/fuerming/p/10938108.html
今日推荐