Advertisement
Guest User

Untitled

a guest
Jan 10th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.52 KB | None | 0 0
  1. spring:
  2. cloud:
  3. config:
  4. server:
  5. git:
  6. repos:
  7. publisher:
  8. uri: 'https://github.company.com/toos/spring-cloud-config-publisher-config'
  9. cloneOnStart: true
  10. username: myuser
  11. password: password
  12. pullOnRequest: false
  13. differentProperty: My Value
  14. config_test_server_config:
  15. uri: 'https://github.company.com/mdesales/config-test-server-config'
  16. cloneOnStart: true
  17. username: 226b4bb85aa131cd6393acee9c484ec426111d16
  18. password: ""
  19. completelyDifferentProp: this is a different one
  20.  
  21. public class ConfigServerProperties {
  22.  
  23. private List<ConfigServerOnboard> repos;
  24.  
  25. public void setRepos(List<ConfigServerOnboard> repos) {
  26. this.repos = repos;
  27. }
  28.  
  29. public List<ConfigServerOnboard> getRepos() {
  30. return this.repos;
  31. }
  32. }
  33.  
  34. public class ConfigServerOnboard {
  35.  
  36. private String configAppName;
  37.  
  38. private Map<String, String> properties;
  39.  
  40. public String getConfigAppName() {
  41. return this.configAppName;
  42. }
  43.  
  44. public void setConfigAppName(String configAppName) {
  45. this.configAppName = configAppName;
  46. }
  47.  
  48. public Map<String, String> getProperties() {
  49. return properties;
  50. }
  51.  
  52. public void setProperties(Map<String, String> properties) {
  53. this.properties = properties;
  54. }
  55.  
  56. }
  57.  
  58. public static ConfigServerProperties parseProperties(File filePath)
  59. throws JsonParseException, JsonMappingException, IOException {
  60.  
  61. ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
  62. JsonNodeFactory jsonNodeFactory = new JsonNodeFactory(false);
  63. jsonNodeFactory.textNode("spring.cloud.config");
  64. // tried to use this attempting to get the prefix
  65. mapper.setNodeFactory(jsonNodeFactory);
  66. ConfigServerProperties user = mapper.readValue(filePath, ConfigServerProperties.class);
  67. return user;
  68. }
  69.  
  70. Exception in thread "main" com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "spring" (class com.intuit.platform.config.onboarding.files.config.model.ConfigServerProperties), not marked as ignorable (one known property: "repos"])
  71. at [Source: /tmp/config-server-onboards.yml; line: 3, column: 3] (through reference chain: com.intuit.platform.config.onboarding.files.config.model.ConfigServerProperties["spring"])
  72. at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:62)
  73. at com.fasterxml.jackson.databind.DeserializationContext.handleUnknownProperty(DeserializationContext.java:834)
  74. at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:1094)
  75. at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1470)
  76. at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownVanilla(BeanDeserializerBase.java:1448)
  77. at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:282)
  78. at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:140)
  79. at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3798)
  80. at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2740)
  81. at com.intuit.platform.config.onboarding.files.config.model.ConfigServerProperties.parseProperties(ConfigServerProperties.java:37)
  82. at com.intuit.platform.config.onboarding.files.config.model.ConfigServerProperties.main(ConfigServerProperties.java:42)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement