Spring STS - 无法解析属性

时间:2016-01-21 01:19:31

标签: eclipse sts-springsourcetoolsuite

这个问题与spring无关,而是与STS工具套件或spring eclipse IDE有关。给出以下类的声明

@Configuration()
@Import({ WebSharedConfig.class, SpringSecurityConfig.class })
@ComponentScan({ "com.finovera.web", "com.finovera.platformServices","com.finovera.authentication" })
@PropertySources(value = { @PropertySource({ "${FINOVERA_PROPERTIES}" }),
@PropertySource(value = { "${STATIC_OVERRIDE_PROPERTIES}", }, ignoreResourceNotFound = true) })
@Scope("singleton")
@EnableTransactionManagement
public class CabinetConfig extends WebMvcConfigurationSupport {
}

我在STS插件中看到以下异常(org.springframework.ide.eclipse.beans.core)

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.finovera.web.config.CabinetConfig]; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'FINOVERA_PROPERTIES' in string value "${FINOVERA_PROPERTIES}"
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:181)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:321)

错误很简单,因为在应用程序启动时将属性名称传递给JVM。应用程序运行时代码工作正常,但STS没有。主要配置扫描失败时缺少许多功能。评论属性源注释,一切正常。

如何将属性值传递给STS或说服它忽略PropertySources注释?

1 个答案:

答案 0 :(得分:0)

我认为这是当前实施的一个限制。请提交针对以下内容的增强请求:https://issuetracker.springsource.com/browse/STS我们可以尝试为下一版本的STS和Spring IDE修复此问题。