简体   繁体   中英

How to access resources in external jar file using spring?

I have a spring project which uses different libraries, packed as multiple jars. One of them (jar) has xml files, as resources.

What I'm trying to do, is to inject this resources to castor marshaller, like here:

<bean id="marshaller" class="org.springframework.oxm.castor.CastorMarshaller">

    <property name="mappingLocations">
        <list>
            <value>classpath*:/mapping*.xml</value>
        </list>
    </property>

</bean>

It doesn't work, and the array of resources is empty.

What am I doing wrong?

Make it:

<value>classpath:mapping*.xml</value>

Provided that, mapping*.xml file is there directly on classpath (root of external jar which is directly under classpath)

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