未卜先知
2016-12-13 11:28
public class MoocResource implements ApplicationContextAware { private ApplicationContext applicationContext; @Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { this.applicationContext = applicationContext; } public void resource() throws IOException { Resource resource = applicationContext.getResource("config.txt"); System.out.println(resource.getFilename()); System.out.println(resource.contentLength()); } }
是我自己看漏了,在try里面resource.resource()
我还以为怎么会出现这么神奇的事情
Spring入门篇
268786 学习 · 963 问题
相似问题