yaml的ScannerException:while scanningfor thenext token found character '@' that cannot start anytoken

org.yaml.snakeyaml.scanner.ScannerException: while scanning for the next token

错误日志:

Caused by: org.yaml.snakeyaml.scanner.ScannerException: while scanning for the next token
found character '@' that cannot start any token. (Do not use @ for indentation)
 in 'reader', line 3, column 13:
        active: @spring.active@
                ^

	at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:419)
	at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:227)
	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:239)
	at org.yaml.snakeyaml.composer.Composer.composeMappingChildren(Composer.java:230)
	at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:218)
	at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:144)
	at org.yaml.snakeyaml.composer.Composer.composeValueNode(Composer.java:239)
	at org.yaml.snakeyaml.composer.Composer.composeMappingChildren(Composer.java:230)
	at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:218)
	at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:144)
	at org.yaml.snakeyaml.composer.Composer.composeValueNode(Composer.java:239)
	at org.yaml.snakeyaml.composer.Composer.composeMappingChildren(Composer.java:230)
	at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:218)
	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:125)
	at org.yaml.snakeyaml.Yaml$1.next(Yaml.java:548)
	at org.springframework.beans.factory.config.YamlProcessor.process(YamlProcessor.java:160)
	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:562)
	at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:518)
	... 25 common frames omitted
Disconnected from the target VM, address: '127.0.0.1:51106', transport: 'socket'

Process finished with exit code 1

解决方法:active的值用两个单引号标注,如:

spring:
  profiles:
    active: '@spring.active@'

你可能感兴趣的:(bug)