Skip to content
Advertisement

Tag: yaml

Property file reading error in spring boot

Below is my yml file in spring boot app below value access is working file but when I try to access in below way it gives an error. I checked it gives error only when add “com.cloudimpl.outstack.runtime.EventRepositoryFactory” this part. How can I solve this?? Answer It doesn’t work so. You have list with values under “outstack.providers.com.cloudimpl.outstack.runtime.EventRepositoryFactory”. It means you can

Set environment property in yaml using placeholder

I have a map propMap, set as a PropertySource in the Environment object in my Spring Boot application. What would be the correct notation to access a key in the map from the .yaml file? I tried using username: “#{propMap.[‘username’]}” but doesn’t seem to work. I tried few others too but didn’t help. Could I know what would be the

YamlSlurper cannot parse Enum value

I have yaml: Parsing file using YamlSlurper: error: java.lang.ClassCastException: java.lang.String cannot be cast to model.FlowType Is there a way to solve this? Answer The YAML slurper is a cute tool to quickly read a YAML file or string and deal with it to the degree, that you would use the other slurpers: get some basic data types inside lists and

How to flatten dynamic yaml file using java

I want to parse dynamic yaml files using java into HashMap and access them using dot syntax (i.e “a.b.d”) Given the following example.yml: And can fetch it as Any idea How we can achieve this? Answer As Thorbjørn said in a comment, a HashMap is probably not the correct data structure for representing a YAML file. You should try looking

Spring Boot 2 datasource by configuration does not work

I have an application.yml(!) for the configuration containing the following: Which gives me the errormessage: Doing it this way works: Ideas? 🙂 Answer Rename driverClassName to driver-class-name since Kebab case is preferred over Camel case in Spring Boot Auto Configuration properties. If that doesn’t help then make sure that you didn’t turn off DataSourceAutoConfiguration feature. It usually may look like

map yaml config to a java hashmap

I have below in my yaml I am map it in my spring bean as follow, I get below error, Cannot convert value of type [java.lang.String] to required type [java.util.Map]: no matching editors or conversion strategy found How can I map a configuration map representation to a java hashmap? Answer In yaml try to format it in this way: Or

Advertisement