resources
ResourceLoader 资源加载器
public interface ResourceLoader{
Resource getResource(String location);
}
Resource template=ctx.getResource("some/resource/myTemplate.txt");
Resource template=ctx.getResource("classpath:some/resource/myTemplate.txt");
Resource template=ctx.getResource("file:/some/resource/myTemplate.txt");
(none):直接写地址,依赖applicationContext
classpath:加载classpath下资源
file:/作为URL
url:http://作为URL
注解
![注解自动检测.png](https://upload-images.jianshu.io/upload_images/17230409-a7570cbca16a8e65.png?imageMogr2/auto-orient4
annotation:基于注解
asignable:基于某个类的
aspectj:基于aspectj的
regex:基于正则表达式
custom:自定义
实例:
@Component //不知是service(@Service),还是DAO(@Repository),还是控制(@Controller)
public class Xbean{
void say(String arg){}
}