Advertisement
Guest User

Untitled

a guest
Feb 8th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. package com.infa.eic.sample;
  2.  
  3. import java.io.FileNotFoundException;
  4. import java.io.IOException;
  5. import java.io.InputStream;
  6. import java.util.Date;
  7. import java.util.Properties;
  8.  
  9. public class getprop {
  10. InputStream inputStream;
  11.  
  12. public List<String> getPropValues() throws IOException {
  13.  
  14. try {
  15. Properties prop = new Properties();
  16. String propFileName = "application.properties";
  17.  
  18. inputStream = getClass().getClassLoader().getResourceAsStream(propFileName);
  19.  
  20. if (inputStream != null) {
  21. prop.load(inputStream);
  22. } else {
  23. throw new FileNotFoundException("property file '" + propFileName + "' not found in the classpath");
  24. }
  25.  
  26. Date time = new Date(System.currentTimeMillis());
  27.  
  28. String truststore = prop.getProperty("truststore");
  29. String truststorepass = prop.getProperty("truststorepass");
  30. String url = prop.getProperty("url");
  31. String user = prop.getProperty("user");
  32. string pass = prop.getProperty("pass");
  33.  
  34. List<String> listaWartosci = new ArrayList<>();
  35. listaWartosci.add(truststore);
  36. listaWartosci.add(truststorepass);
  37. listaWartosci.add(user);
  38. listaWartosci.add(pass);
  39.  
  40. } catch (Exception e) {
  41. System.out.println("Exception: " + e);
  42. } finally {
  43. inputStream.close();
  44. }
  45. return listaWartosci;
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement