简体   繁体   中英

Spring resource loading using * (classpath*: prefix)

In Spring, bean initialization using XML supports resource loading using the classpath*: prefix (ant style)

<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?

In any spring bean

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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