简体   繁体   English

使用*(classpath *:前缀)加载Spring资源

[英]Spring resource loading using * (classpath*: prefix)

In Spring, bean initialization using XML supports resource loading using the classpath*: prefix (ant style) 在Spring中,使用XML进行bean初始化支持使用classpath*:前缀(蚂蚁样式)加载资源

<bean id="mapper" class="org.Class"
    scope="singleton">
    <property name="mappingFiles" value="classpath*:/mappings/*Mapping.xml" />
</bean> 

How do I achieve the same result when using @Bean annotation? 使用@Bean注释时如何获得相同的结果?

In any spring bean 在任何春豆中

@Value("classpath:myClasspathLocation") 
private Resource res;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM