Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the while scanning an alias problem of Spring Boot v2.1.3.RELEASE

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces "how to solve the while scanning an alias problem of Spring Boot v2.1.3.RELEASE". In the daily operation, it is believed that many people have doubts about how to solve the while scanning an alias problem of Spring Boot v2.1.3.RELEASE. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the question of "how to solve the while scanning an alias problem of Spring Boot v2.1.3.RELEASE"! Next, please follow the editor to study!

When I started to learn the Spring Boot framework, I encountered problems when building "elegant outage". How could I not be configured? there were a series of problems (all because of my own fault, too lame). Let's briefly say that, first of all, I configured it with the application.yml configuration file. This leads to the following configuration

Management.endpoints.web.exposure.include: *

If you start the project again, there will be an error:

09VOVA 56VA 06.571 [main] ERROR org.springframework.boot.SpringApplication-Application run failedjava.lang.IllegalStateException: Failed to load property source from location 'classpath:/application.yml' at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load (ConfigFileApplicationListener.java:554) at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.loadForFileExtension (ConfigFileApplicationListener.java:500) at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load (ConfigFileApplicationListener.java:467) At org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.lambda$null$6 (ConfigFileApplicationListener.java:448) at java.lang.Iterable.forEach (Iterable.java:75) at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.lambda$load$7 (ConfigFileApplicationListener.java:447) at java.lang.Iterable.forEach (Iterable.java:75) at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load (ConfigFileApplicationListener.java:444) at org.springframework.boot .context.config.ConfigFileApplicationListener $Loader.load (ConfigFileApplicationListener.java:332) at org.springframework.boot.context.config.ConfigFileApplicationListener.addPropertySources (ConfigFileApplicationListener.java:207) at org.springframework.boot.context.config.ConfigFileApplicationListener.postProcessEnvironment (ConfigFileApplicationListener.java:190) at org.springframework.boot.context.config.ConfigFileApplicationListener.onApplicationEnvironmentPreparedEvent (ConfigFileApplicationListener.java:177) at org.springframework.boot.context.config.ConfigFileApplicationListener.onApplicationEvent (ConfigFileApplicationListener.java:163) 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:75) at org.springframework .boot.SpringApplicationRunListeners.environmentPrepared (SpringApplicationRunListeners.java:54) at org.springframework.boot.SpringApplication.prepareEnvironment (SpringApplication.java:347) at org.springframework.boot.SpringApplication.run (SpringApplication.java:306) at org.springframework.boot.SpringApplication.run (SpringApplication.java:1260) at org.springframework.boot.SpringApplication.run (SpringApplication.java:1248) at com.eric.diary.DiaryApplication.main (DiaryApplication.java:12) Caused by : org.yaml.snakeyaml.scanner.ScannerException: while scanning an alias in 'reader' Line 25, column 44:... Endpoints.web.exposure.include: * ^ (13) in 'reader', line 25, column 45:... Ndpoints.web.exposure.include: * ^ at org.yaml.snakeyaml.scanner.ScannerImpl.scanAnchor (ScannerImpl.java:1444) at org.yaml.snakeyaml.scanner.ScannerImpl.fetchAlias (ScannerImpl.java:916) at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens (ScannerImpl.java:364) at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken (ScannerImpl.java: At org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingValue.produce (ParserImpl.java:586) at org.yaml.snakeyaml.parser.ParserImpl.peekEvent (ParserImpl.java:158) at org.yaml.snakeyaml.parser.ParserImpl.checkEvent (ParserImpl.java:148) at org.yaml.snakeyaml.composer.Composer.composeNode (Composer.java:124) at org.yaml.snakeyaml.composer.Composer.composeValueNode (Composer.java:236) At org.yaml.snakeyaml.composer.Composer.composeMappingChildren (Composer.java:227) at org.yaml.snakeyaml.composer.Composer.composeMappingNode (Composer.java:215) at org.yaml.snakeyaml.composer.Composer.composeNode (Composer.java:144) at org.yaml.snakeyaml.composer.Composer.getNode (Composer.java:85) 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:134) at org.springframework.boot.env.OriginTrackedYamlLoader.load (OriginTrackedYamlLoader.java:75) at org.springframework.boot.env.YamlPropertySourceLoader.load (YamlPropertySourceLoader.java:50) at org.springframework.boot. Context.config.ConfigFileApplicationListener$Loader.loadDocuments (ConfigFileApplicationListener.java:572) at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load (ConfigFileApplicationListener.java:526)... 23 common frames omittedDisconnected from the target VM Address: '127.0.0.1 59532, transport:' socket'Process finished with exit code 1

After checking some materials, it is found that the special symbols in the configuration file of yml need to be enclosed in single quotation marks. This problem can be solved by configuring as follows:

Management.endpoints.web.exposure.include:'*'

Digression:

The configuration of "elegant suspension of service" was about to succeed. When this mistake occurred, I once thought that I had made a mistake and rematched it, which delayed me for a long time. In fact, the 1.x and 2.x configurations of Spring Boot are different, and then application.properties and application.yml are also a little different. The following is a record of the 2.1.3 configuration of "elegant outage" of Spring Boot:

# / actuator is converted to / eric (you can also write any, default is / actuator) management.endpoints.web.base-path: / eric# activates web requests for all endpoints (or only shutdown breakpoints can be exposed alone, which some people call exposure) management.endpoints.web.exposure.include:'*'# enable shutdown (enable Spring Boot's shutdown feature) management.endpoint.shutdown.enabled: true so far The study on "how to solve the while scanning an alias problem of Spring Boot v2.1.3.RELEASE" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report