目前正在开发Spring应用程序;我对Spring非常陌生。 出于某种原因,Spring拾取我的.properties文件并将文本注入到我的对象中。但是,在堆栈跟踪的后面,它说这个值是无法解析的: com.test.Baseball@345e5a17 with the name "Chuck Norris"workspace\Spring<
Caused by: java.io.FileNotFoundException: class path resource [properties/database-configuration-${spring.profiles.active}.properties] cannot be opened because it does not exist
对于为什么没有使用这个值,有什么想法吗?
关于Spring控制器的单元测试,我遇到了@RequestMapping和应用程序属性的问题。在每个文件中设置和显示base.url属性值。我还为测试提供了不同的Spring上下文配置,它只在一个Bean中与生产版本不同。在单元测试模式中,在构建${base.url}对象时,不设置mockMvc值并引发异常:
java.lang.IllegalArgumentException: Could not resolve placeholder