Path: csiph.com!aioe.org!.POSTED.O5hsyUvK01te0L/SZurVSQ.user.gioia.aioe.org!not-for-mail From: =?UTF-8?Q?Arne_Vajh=c3=b8j?= Newsgroups: comp.lang.java.programmer Subject: Re: Specifying Spring DI XML config file location Date: Thu, 4 Jun 2020 21:07:50 -0400 Organization: Aioe.org NNTP Server Lines: 36 Message-ID: References: NNTP-Posting-Host: O5hsyUvK01te0L/SZurVSQ.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.1 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.9.2 Xref: csiph.com comp.lang.java.programmer:39482 On 6/4/2020 4:31 PM, Daniele Futtorovic wrote: > On 2020-06-03 03:25, Arne Vajhøj wrote: >> If I have some code that does not use Spring DI directly but uses >> a library that uses Spring DI, then what are my options for >> specifying what XML config file that library should use? >> >> Any class and method: >> >> SomeSpringClass.setDefaultConfigURL("..."); >> >> ? >> >> Any property: >> >> -Dspring.config.url=.... >> >> ? >> >> Google does not seem to be my friend today. > > https://docs.spring.io/spring/docs/5.3.0-SNAPSHOT/spring-framework-reference/core.html#beans-basics > > Don't know the details, but `new ClassPathXmlApplicationContext(...)` or > `new AnnotationConfigApplicationContext(...)` would seem the way to go. > > Specifying the location alone (likely) won't help you. You need > something that starts the engine that will try to read those sources -- > i.e. the ApplicationContext. That is already being done in the library. I need a way to control where the library find the XML config file without hacking the library. Arne