我刚刚在Spring Boot上工作了很短的时间,希望有人可以帮助我找出我的项目出了什么问题。这是描述
我有一个使用Liferay构建Portlet Web应用程序的项目。有一些属性文件将在运行时被调用。
我的作品现在是: 将项目的源代码从Liferay框架迁移到Spring引导框架。
我已经完全移动它了,可以将其构建/打包为jar文件了。但是在运行时,初始化此应用程序时出现了此错误:
[错误]
app_1 | java.lang.NoSuchMethodError: org.springframework.util.Assert.isTrue(ZLjava/util/function/Supplier;)V
app_1 | at org.springframework.boot.context.properties.bind.Bindable.withExistingValue(Bindable.java:162) ~[spring-boot-2.0.4.RELEASE.jar!/:2.0.4.RELEASE]
app_1 | at org.springframework.boot.context.properties.bind.Bindable.ofInstance(Bindable.java:192) ~[spring-boot-2.0.4.RELEASE.jar!/:2.0.4.RELEASE]
app_1 | at org.springframework.boot.SpringApplication.bindToSpringApplication(SpringApplication.java:548) [spring-boot-2.0.4.RELEASE.jar!/:2.0.4.RELEASE]
app_1 | at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:362) [spring-boot-2.0.4.RELEASE.jar!/:2.0.4.RELEASE]
app_1 | at org.springframework.boot.SpringApplication.run(SpringApplication.java:320) [spring-boot-2.0.4.RELEASE.jar!/:2.0.4.RELEASE]
app_1 | at org.springframework.boot.SpringApplication.run(SpringApplication.java:1258) [spring-boot-2.0.4.RELEASE.jar!/:2.0.4.RELEASE]
app_1 | at org.springframework.boot.SpringApplication.run(SpringApplication.java:1246) [spring-boot-2.0.4.RELEASE.jar!/:2.0.4.RELEASE]
app_1 | at com.demo.DemoApplication.main(DemoApplication.java:11) [classes!/:na]
app_1 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_171]
app_1 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_171]
app_1 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_171]
app_1 | at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_171]
app_1 | at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [app-1.0.0-SNAPSHOT.jar:na]
app_1 | at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [app-1.0.0-SNAPSHOT.jar:na]
app_1 | at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [app-1.0.0-SNAPSHOT.jar:na]
app_1 | at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) [app-1.0.0-SNAPSHOT.jar:na]
app_1 | app_1 exited with code 1
有2个与propertySource相关的文件
@Configuration
@ComponentScan
@Import({A.class, B.class})
@PropertySource(value = {"classpath:demo.properties",
"file:${demo.config.location}"}, ignoreResourceNotFound = true) public class
DemoConfiguration { ... }
和
@SpringBootApplication
@PropertySource(value = {"application.properties"})
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
两个文件:demo.properties和application.properties在/ src / main / resources文件夹中
非常感谢您!