import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.annotation.PropertySources;
import org.springframework.core.env.Environment;
@Configuration
@PropertySources({
@PropertySource("creden.properties")
})
public class ApplicationConfiguration {
@Autowired
private Environment env;
public String getProperties(String key){
return env.getProperty(key);
}
}
@Autowired
ApplicationConfiguration ac;
ac.getProperties("userid"),ac.getProperties("pwd")
No comments:
Post a Comment