ClassPathResource使用

ClassPathResource类,如果没有指定相对的类名,该类将从类的根路径开始寻找某个resource,如果指定了相对的类名,则根据指定类的相对路径来查找某个resource。

Resource rs = new ClassPathResource("DispatcherServlet.properties");
或者
Resource rs = new ClassPathResource("DispatcherServlet.properties",DispatcherServlet.class);

猜你喜欢

转载自z724130632.iteye.com/blog/2272484
今日推荐