Java Spring-boot 自动导入applicationContext.xml?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25687754/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 00:55:33  来源:igfitidea点击:

Spring-boot automatically import applicationContext.xml?

javaspringspring-boot

提问by membersound

I'm using spring-bootand would like to automatically import src/main/resources/applicationContext.xmlfile.

我正在使用spring-boot并希望自动导入src/main/resources/applicationContext.xml文件。

So far it only works if I explicit tell spring to import it:

到目前为止,它只有在我明确告诉 spring 导入它时才有效:

@EnableAutoConfiguration
@Configuration
@ImportResource({"classpath*:applicationContext.xml"})

But spring-boot has so many default, maybe someone knows the "default" name for the app.xml file so that is gets picked up by spring-boot by default?

但是 spring-boot 有这么多默认值,也许有人知道 app.xml 文件的“默认”名称,以便 spring-boot 默认选择它?

采纳答案by geoand

There is no such feature for importing an XML configuration by default based on it's name or location.

默认情况下,没有根据名称或位置导入 XML 配置的功能。

Check out thispart of the documentation.

查看文档的这一部分。