Properties properties = new Properties();
InputStream inputStream = getClass().getClassLoader().getResourceAsStream("config.properties");
properties.load(inputStream);
String username = properties.getProperty("username");
String password = properties.getProperty("password");
PropertiesConfiguration config = new PropertiesConfiguration("config.properties");
String username = config.getString("username");
String password = config.getString("password");
@Configuration
@PropertySource("classpath:config.properties")
public class AppConfig {
@Value("${username}")
private String username;
@Value("${password}")
private String password;
// ...
}