java - PropertyPlaceholderConfigurer 和依赖

标签 java spring spring-batch

在下面的代码片段中

<bean id="placeholderProperties" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
    depends-on="environment">
    <property name="location" value="classpath:batch-${ENVIRONMENT}.properties" />

“依赖”的意义是什么以及如何操纵 ${ENVIRONMENT} 的值??

系统的环境变量中的Environment是指我的系统变量吗?

最佳答案

检查 this

depends-on : The depends-on attribute can explicitly force one or more beans to be initialized before the bean using this element is initialized

在您的情况下,id 为 environment 的 bean 必须在“placeholderProperties”之前初始化

关于java - PropertyPlaceholderConfigurer 和依赖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6095803/

相关文章:

java - "main"java.lang.NoClassDefFoundError : org/apache/http/HttpEntity

java - 如何减少桌面应用程序中的 hibernate 内存使用?

database - 具有插入或更新机制的Spring批处理自定义itemWriter

java - 简单的 Android 应用程序没有响应

java - 如何使用 Jena API 在 vi​​rtuoso 中加载 n-triple 文件

java - 为什么我会收到 "Exception in thread "main"java.lang.IndexOutOfBoundsException : Index 0 out of bounds for length 0 "

java - 将 findAll PagingAndSortingRepository 与过滤器一起使用

java - 如何从 spring boot pom 中排除或替换 jackson

spring - 为什么不能使用注释在ItemProcessor中找到jobParameters?

spring-batch - 将 Spring Batch 与 JtaTransactionManager 一起使用时出现 java.lang.StackOverflowError 错误