1

I have multiple sqlQueries.xml files e.g sqlQueries.xml, sqlQueriesAB.xml, sqlQueriesBC.xml and i want to load all of them using below tag but it seems that only supports loading one file only.

<util:properties id="sqlQueries" location="classpath:sqlQueries.xml" /> - This is working. in this case, i have moved all entries from other sqlQueries*.xml to this file.

<util:properties id="sqlQueries" location="classpath*:sqlQueries*.xml" /> - not working..it says that, [classpath*:sqlQueries*.xml] doesn't exists.

<util:properties id="sqlQueries" location="classpath*:sqlQueries.xml,sqlQueriesAB.xml, sqlQueriesBC.xml" /> - this is not working. Error same as above.

Can someone tell me how can i load multiple .xml file using util-properties or other way?

Thanks

2 Answers 2

2
<bean id="applicationProperties" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <list>
                <value>classpath:helloWorld.properties</value>
                <value>classpath:helloWorld1.properties</value>
                    </list>
        </property>
        <property name="ignoreResourceNotFound" value="true" />
        <property name="ignoreUnresolvablePlaceholders" value="true" />
</bean>

should work for xml file too I guess.

Sign up to request clarification or add additional context in comments.

Comments

2

You can create a xml file which contains or imports all other sql query files. Create queries.xml file. And add all xml files in it.

<import resource="sqlQueries.xml"/>     
<import resource="sqlQueriesAB.xml"/>
<import resource="sqlQueriesBC.xml"/>

Then load queries.xml file in app context.

<util:properties id="sqlQueries" location="classpath:queries.xml" />

Try this.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.