How to make a class configurable without adding any code?

╄→гoц情女王★ 提交于 2019-12-04 18:50:29

What you can do, is to use Spring 3.0 EL. An example can be found here, but what it basically boils down to is that you can do the following:

@Value("#{systemProperties.databaseName}")
public void setDatabaseName(String dbName) { ... }

And your properties will be automatically set. This will work on setters and on properties.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!