Redian新闻
>
搞钻井工程的(完井)的是不是要经常上油田啊?
avatar
搞钻井工程的(完井)的是不是要经常上油田啊?# ChemEng - 化学工程
c*n
1
it seems that there can be only one,
although the javadoc says there can be multiple.
there is a bug that makes only the first of multiple
PropertyPlaceholderConfigurer effective.
I need multiple since I want to give a default value for a placeholder in my
bean , provided by my library. if the user uses my library, the bean is
created with default behavior. otherwise if the user does not supply a
config key/val pair in his properties files, the placeholder can not be
resolved and gives an exception
have you been able to use multiple placeHolderConfigurer?
avatar
b*u
2
搞钻井工程的(包括完井)的是不是要经常上油田啊?工作岂不是很辛苦?
在美国的话?
请有经验的说说
avatar
e*t
3
you can certainly have multiple, but their placeholderprefix and suffix
should be different.

my

【在 c******n 的大作中提到】
: it seems that there can be only one,
: although the javadoc says there can be multiple.
: there is a bug that makes only the first of multiple
: PropertyPlaceholderConfigurer effective.
: I need multiple since I want to give a default value for a placeholder in my
: bean , provided by my library. if the user uses my library, the bean is
: created with default behavior. otherwise if the user does not supply a
: config key/val pair in his properties files, the placeholder can not be
: resolved and gives an exception
: have you been able to use multiple placeHolderConfigurer?

avatar
p*t
4
到rig的都是fluid engineer/tech service engineer,做Design和R&D不用去。

【在 b**u 的大作中提到】
: 搞钻井工程的(包括完井)的是不是要经常上油田啊?工作岂不是很辛苦?
: 在美国的话?
: 请有经验的说说

avatar
g*g
5
Write your own implementation to work around this,
should be fairly simple. I remember we went through this before.

my

【在 c******n 的大作中提到】
: it seems that there can be only one,
: although the javadoc says there can be multiple.
: there is a bug that makes only the first of multiple
: PropertyPlaceholderConfigurer effective.
: I need multiple since I want to give a default value for a placeholder in my
: bean , provided by my library. if the user uses my library, the bean is
: created with default behavior. otherwise if the user does not supply a
: config key/val pair in his properties files, the placeholder can not be
: resolved and gives an exception
: have you been able to use multiple placeHolderConfigurer?

avatar
c*n
6
do you remember how you circumvented this bug?
thanks

【在 g*****g 的大作中提到】
: Write your own implementation to work around this,
: should be fairly simple. I remember we went through this before.
:
: my

avatar
c*n
7
I don't think so
if you check the following simple code
///////////////////////
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class TTT {
private String p ;
public String getP() { return p;}
public void setP(String p) { this.p = p;}

public void fun() {
System.out.println("value" + p);
}

public static void main(String args[]) {

ApplicationContext ctx = new ClassPathXmlApplicationContext(
"ttt.xml");

TTT o = (TTT) ctx.getBean("ttt");
o.fun();
}
}
//////////////////////////////////////////////

http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">

class="org.springframework.beans.factory.config.
PropertyPlaceholderConfigurer">


p1.properties




class="org.springframework.beans.factory.config.
PropertyPlaceholderConfigurer">


p2.properties








#####################################################
now you have 2 property files, p1.properties comes first, you can see that
if you comment out everything from p1 , it throws an exception;
if p1 and p2 contents are different, the result you get depends on the order
of which PPC section is used first. assuming that these sections could be
from different libraries, and imported, then the order of import becomes
critical, which is not what we normally expect

【在 e*****t 的大作中提到】
: you can certainly have multiple, but their placeholderprefix and suffix
: should be different.
:
: my

avatar
r*s
8
https://jira.springsource.org/browse/SPR-6428
depending on what version of spring you are using, if it is 3.1.
Per this bug log:
The alternative is to (a) use the new PropertySourcesPlaceholderConfigurer i
nstead of the traditional PropertyPlaceholderConfigurer; (b) eliminate the f
irst PPC; (c) register a PropertySource with the ApplicationContext's Enviro
nment that contains the properties for the placeholders that need replacemen
t in the PropertySourcesPlaceholderConfigurer, such as ${resourceDirPlaceHol
der} from your original example.

【在 c******n 的大作中提到】
: do you remember how you circumvented this bug?
: thanks

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。