【发布时间】:2020-01-09 13:42:51
【问题描述】:
在 Websphere 8.5.5 中启动我的应用程序时,我在标准输出中收到以下错误消息:
1/9/20 11:56:48:437 UTC] 000000c0 SystemOut O 11:56:48.435 [WebContainer : 3] ERROR
org.springframework.boot.SpringApplication - Application run failed
java.lang.IllegalStateException: Failed to load property source from location 'classpath:/application.xml'
at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:545)
at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.loadForFileExtension(ConfigFileApplicationListener.java:494)
at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:464)
at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.lambda$null$7(ConfigFileApplicationListener.java:443)
at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader$$Lambda$290.0000000000368730.accept(Unknown Source)
at java.lang.Iterable.forEach(Iterable.java:86)
at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.lambda$load$8(ConfigFileApplicationListener.java:443)
我使用的spring boot版本是2.2.2。
为什么 Spring Boot 会尝试加载位于 META-INF 文件夹中的 ear 部署描述符?
【问题讨论】:
-
因为
XML是属性的有效格式,所以.properties和.xml都已加载。 Spring 使用同时加载两者的默认属性支持。因此它尝试加载application.xml。我怀疑它在 META-INF 中,而是在你的类路径的根目录中。 -
不是 websphere 但试试这个stackoverflow.com/questions/48955035/…
标签: spring-boot jboss websphere ear