Using the latest 2.0.0.RELEASE
, i am trying to expose all the actuator endpoints on web.
Following this guide, i am trying to add the following in my YAML configuration:
management.endpoints.web.exposure.include: *
I get the following error, apparently because of the *
character:
17:39:07.467 [restartedMain] ERROR org.springframework.boot.SpringApplication - Application run failed
java.lang.IllegalStateException: Failed to load property source from location 'classpath:/application.yml'
at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:535)
at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.loadForFileExtension(ConfigFileApplicationListener.java:494)
at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:462)
at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.lambda$null$4(ConfigFileApplicationListener.java:444)
at java.lang.Iterable.forEach(Iterable.java:75)
at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.lambda$load$5(ConfigFileApplicationListener.java:443)
at java.lang.Iterable.forEach(Iterable.java:75)
at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:440)
at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:331)
at org.springframework.boot.context.config.ConfigFileApplicationListener.addPropertySources(ConfigFileApplicationListener.java:213)
at org.springframework.boot.context.config.ConfigFileApplicationListener.postProcessEnvironment(ConfigFileApplicationListener.java:196)
at org.springframework.boot.context.config.ConfigFileApplicationListener.onApplicationEnvironmentPreparedEvent(ConfigFileApplicationListener.java:183)
at org.springframework.boot.context.config.ConfigFileApplicationListener.onApplicationEvent(ConfigFileApplicationListener.java:169)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127)
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:74)
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:351)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:317)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1246)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1234)
at com.socgen.rmdsusage.Application.main(Application.java:15)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: org.yaml.snakeyaml.scanner.ScannerException: while scanning an alias
in 'reader', line 53, column 44:
... endpoints.web.exposure.include: *
^
(13)
in 'reader', line 53, column 45:
... ndpoints.web.exposure.include: *
^
at org.yaml.snakeyaml.scanner.ScannerImpl.scanAnchor(ScannerImpl.java:1447)
at org.yaml.snakeyaml.scanner.ScannerImpl.fetchAlias(ScannerImpl.java:918)
at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:366)
at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:226)
at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingValue.produce(ParserImpl.java:585)
at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:157)
at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:147)
at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:133)
at org.yaml.snakeyaml.composer.Composer.composeValueNode(Composer.java:249)
at org.yaml.snakeyaml.composer.Composer.composeMappingChildren(Composer.java:240)
at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:228)
at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:154)
at org.yaml.snakeyaml.composer.Composer.composeDocument(Composer.java:122)
at org.yaml.snakeyaml.composer.Composer.getNode(Composer.java:84)
at org.yaml.snakeyaml.constructor.BaseConstructor.getData(BaseConstructor.java:123)
at org.yaml.snakeyaml.Yaml$1.next(Yaml.java:547)
at org.springframework.beans.factory.config.YamlProcessor.process(YamlProcessor.java:161)
at org.springframework.beans.factory.config.YamlProcessor.process(YamlProcessor.java:139)
at org.springframework.boot.env.OriginTrackedYamlLoader.load(OriginTrackedYamlLoader.java:72)
at org.springframework.boot.env.YamlPropertySourceLoader.load(YamlPropertySourceLoader.java:50)
at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.loadDocuments(ConfigFileApplicationListener.java:542)
at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:515)
... 28 common frames omitted
Not sure if it is a YAML parser limitation or Spring Boot limitation, or a bug ?
I believe it's a YAML parser thing. YAML thinks it's an alias.
Try the following and let us know how it goes:
management:
endpoints:
web:
exposure:
include: "*"
The above worked for me. Thanks for the help.
I was thinking it would be good for the documentation to have an example using property file and using yaml.
It works well with the solution suggested by @bclozel :+1:
I agree with @devinwhalen , the documentation would benefit to have examples for both property file and yaml file, maybe a bit like what is done on the Spring guides where you can switch between Maven
or Gradle
to see the sample code for dependencies.
I am not keen to add a yaml example there. We use properties consistently everywhere and if you chose to use YAML, you need to be aware of the specifics of its syntax (nothing to do with Spring Boot, really).
However, we have a somewhat related tip for something else in the doc so we could add something similar.
Most helpful comment
I believe it's a YAML parser thing. YAML thinks it's an alias.
Try the following and let us know how it goes: