Spring4 根据类型自动装配属性类型为java.util.Properties
巴扎黑
巴扎黑 2017-04-18 10:44:01
0
2
650
巴扎黑
巴扎黑

reply all(2)
PHPzhong

No need for get set method

@Value("#{propertiesReader}")
public Properties props;

@Value("#{propertiesReader['username']}")
public String username;
洪涛

Since you want to inject the entire properties, you should write:

@Value("#{propertiesReader}")
public void setProps(Properties props) {
    this.props = props;
}

instead of

@Value("#{propertiesReader[username]}")
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template