Closed llx206 closed 5 years ago
有一些公共的上下文信息,需要传递给调用的模块A和B,可以通过moduleconfig来设置setproperties的公共信息,例子如下: Map<String, Object> properties = new HashMap<String, Object>(); properties.put("url", "127.0.0.1"); moduleConfig.setProperties(properties); 但是各个模A和B如何才能获取到这些上下文信息呢。 通过看代码,发现会动态创建bean,名字是modulePropertyPlaceholderConfigurer,在各个模块中要如何使用这个bean呢。 模块中我通过使用注解value来获取属性值,但是运行后属性获取为空 @Value("#{'modulePropertyPlaceholderConfigurer[url]'}") private String url;
public String getUrl() { return url; }
public void setUrl(String url) { this.url = url; }
describe your question clearly
describe your use scenes (why need this feature)
describe the advice or solution you'd like
java -version
uname -a
Your question
有一些公共的上下文信息,需要传递给调用的模块A和B,可以通过moduleconfig来设置setproperties的公共信息,例子如下: Map<String, Object> properties = new HashMap<String, Object>(); properties.put("url", "127.0.0.1"); moduleConfig.setProperties(properties); 但是各个模A和B如何才能获取到这些上下文信息呢。 通过看代码,发现会动态创建bean,名字是modulePropertyPlaceholderConfigurer,在各个模块中要如何使用这个bean呢。 模块中我通过使用注解value来获取属性值,但是运行后属性获取为空 @Value("#{'modulePropertyPlaceholderConfigurer[url]'}") private String url;
public String getUrl() { return url; }
public void setUrl(String url) { this.url = url; }
describe your question clearly
Your scenes
describe your use scenes (why need this feature)
Your advice
describe the advice or solution you'd like
Environment
java -version
):uname -a
):