sofastack / sofa-jarslink

Jarslink is a sofa ark plugin used to manage multi-application deployment
Apache License 2.0
3.05k stars 705 forks source link

jarslink1.0 主程序中的properties如何传递给模块 #98

Closed llx206 closed 5 years ago

llx206 commented 5 years ago

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