我有一个带有PropertyPlaceholderConfigurer的Spring application-context.xml,用于从.properties文件中获取属性值.主文件夹和测试源文件夹具有单独的.properties文件.问题是我需要在.properties文件中使用环境变量.但是,当我按以下方式执行此操作时:
property.name=${env.SYSTEM_PROPERTY}
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'beanName' defined in class path resource [com/example/applicationContext.xml]: Could not resolve placeholder 'env.SYSTEM_PROPERTY'
Run Code Online (Sandbox Code Playgroud)
而占位符配置器定义为
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="classpath:com/example/application.properties"/>
</bean>
Run Code Online (Sandbox Code Playgroud)
任何想法如何使property.name被解释为环境变量(而不是占位符)?
最好的问候,德米特里.
java spring environment-variables properties-file applicationcontext
我有一个可以通过HTTPS获得的Nexus.只有授权用户才有权访问它.使用Maven,当所有需要的人工制品都在本地仓库中时,我甚至可以部署建筑物.但是当我从本地存储库中删除一些必需的工件时,构建失败.
Downloading: https://example.com/nexus/content/groups/all/org/springframework/spring-test-mvc/1.0.0.BUILD-SNAPSHOT/spring-test-mvc-1.0.0.BUILD-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] example - project1 ..................................... SUCCESS [0.500s]
[INFO] example - project2 ..................................... FAILURE [2.951s]
[INFO] example - project3 ...................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.599s
[INFO] Finished at: Tue May 15 13:58:13 EEST 2012
[INFO] Final Memory: 6M/121M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project example - project2: Could not resolve dependencies for project com.example:example-project:jar:1.2.0-SNAPSHOT: Failed to collect dependencies for [com.example:example-project:jar:1.2.0-SNAPSHOT (compile), org.springframework:spring-beans:jar:3.1.1.RELEASE …Run Code Online (Sandbox Code Playgroud) 我有一个包含Maven Center的组类型存储库的Nexus服务器.我可以在Maven Center [1]中看到org.codehaus.mojo:cobertura-maven-plugin:2.5.1工件(包括pom和jar),但是当我尝试使用Maven下载这个工件时,它说:
Downloading: https://example.com/nexus/content/groups/all/org/codehaus/mojo/cobertura-maven-plugin/2.5.1/cobertura-maven-plugin-2.5.1.pom
[WARNING] The POM for org.codehaus.mojo:cobertura-maven-plugin:jar:2.5.1 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.523s
[INFO] Finished at: Wed May 16 16:31:24 EEST 2012
[INFO] Final Memory: 18M/219M
[INFO] ------------------------------------------------------------------------
[INFO] [16:31:24.647] Execute org.codehaus.mojo:cobertura-maven-plugin:2.5.1:cobertura done: 3978 ms
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] example project 1 ................................. FAILURE [10.077s]
[INFO] example project 2 ................................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: …Run Code Online (Sandbox Code Playgroud)