Saturday, May 10, 2014

Reading properties files in spring

Service file:
@Service("configurationService")
@Transactional
public class ConfigurationServiceImpl implements ConfigurationService {
    @Value("${app_id}")
    protectedString appId;

    public String getAppId() {
        return appId;
    }

}

"Beans" file:
        <context:property-placeholder location="classpath:database.properties" />
        <context:property-placeholder location="classpath:settings.properties" order="2" ignore-unresolvable="true" />

No comments:

Post a Comment