Path: csiph.com!news.swapon.de!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Daniele Futtorovic Newsgroups: comp.lang.java.programmer Subject: Re: Specifying Spring DI XML config file location Date: Thu, 4 Jun 2020 22:31:49 +0200 Organization: A noiseless patient Spider Lines: 35 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Thu, 4 Jun 2020 20:31:56 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="4ad58ea03dcbed5926bcbf57cf13000a"; logging-data="18950"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+/ewUZnODWnkCl3fVpsqV4" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.1 Cancel-Lock: sha1:BzwDJ30ogfgaq5TIeZxsRdCYjDg= In-Reply-To: X-Antivirus-Status: Clean Content-Language: en-US X-Antivirus: AVG (VPS 200603-2, 06/03/2020), Outbound message Xref: csiph.com comp.lang.java.programmer:39481 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. > > Arne 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. On the other hand if you made your main app a spring-boot app, then you could simply reference lib's config and be done with it. -- DF.