你可以在Spring 3中使用EL支持进行此操作。例:
@Value("#{systemProperties.databaseName}")public void setDatabaseName(String dbName) { ... }@Value("#{strategyBean.databaseKeyGenerator}")public void setKeyGenerator(KeyGenerator kg) { ... }systemProperties是一个隐式对象,并且
strategyBean是Bean名称。
还有一个示例,当你想从
Properties对象中获取属性时,该示例将起作用。它还显示你可以应用于@Value字段:
@Value("#{myProperties['github.oauth.clientId']}")private String githubOauthClientId;


