eltonsandre

ConfigurationPropertiesExemplo

May 1st, 2020
574
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 0.95 KB | None | 0 0
  1. application.yml
  2. ---
  3. Srping: ...
  4.  
  5. # Aqui seu Map
  6. integracoes:
  7.   http:
  8.     google:
  9.       health-check-path: ''
  10.       url: https://www.google.com/
  11.     telegram:
  12.       health-check-path: ''
  13.       url: https://web.telegram.org/
  14.     docs-spring:
  15.       health-check-path: ''
  16.       url: https://docs.spring.io/
  17.  
  18. app.cache.ttls:
  19.     produtos-id: PT15M
  20.  
  21.  
  22. ---
  23. /**
  24.  * Aqui vc vai mapear suas configuraรงรตes
  25.  * @author eltonsandre
  26.  * date 01/05/2020 18:08
  27.  */
  28. @Data
  29. @Component
  30. @ConfigurationProperties(prefix = "integracoes")
  31. public class IntegracaoProperties {
  32.  
  33.   private Map<String, IntegracaoHttp> http;
  34.  
  35.   @Data
  36.   public static class IntegracaoHttp {
  37.     private String healthCheckPath;
  38.     private String url;
  39.   }
  40.  
  41. }
  42. ---
  43. /**
  44.  * @author eltonsandre
  45.  * date 19/04/2019 12:30
  46.  */
  47. @Data
  48. @Component
  49. @ConfigurationProperties(prefix = "app.cache")
  50. public class CacheTTLProperties {
  51.  
  52.   private Map<String, Duration> ttls;
  53.  
  54. }
  55.  
  56. ---
Add Comment
Please, Sign In to add comment