zoukankan      html  css  js  c++  java
  • 解决org.yaml.snakeyaml.scanner.ScannerException: while scanning for the next token found character '@'

    1、问题


    运行springboot项目,遇到了如下的错误
    org.yaml.snakeyaml.scanner.ScannerException: while scanning for the next token found character '@' 。

    这是因为我在pom.xml中配置了

    <profiles>
    		<profile>
    			<id>dev</id>
    			<properties>
    				<env>dev</env>
    				<mysql.host>172.30.254.12</mysql.host>
    				<mysql.port>3306</mysql.port>
    				<mysql.user>root</mysql.user>
    				<mysql.password>123456</mysql.password>
    			</properties>
                            **<activation>**
    **				<activeByDefault>true</activeByDefault>**
    **			</activation>**
    		</profile>
    </profiles>
    

    然后,我希望在application.yml中通过 %mysql.host% 得到 profile 里边配置的mysql.host属性。

    但是,当项目启动之后,就报出了上面的错误。

    2、解决办法


    从网上搜了一下,确实有人曾经遇到了类似的问题,他文章中讲到 maven reimport 一下就可以解决。

    可是,在我的案例中真实的情况不是这样的,真实的原因是 pom的profile中没有增加activation节点,如上面代码中的加粗部分所示。当我后来搞清楚了真实原因后,增加了activation节点,问题就得到了彻底的解决。





  • 相关阅读:
    读《梦断代码》有感
    The Third Group Meeting!
    第一次课程作业项目报告
    第四次读后感
    个人作业进度(五)
    个人作业进度(四)
    个人作业进度(三)
    个人进度(二)
    个人作业进度(一)
    java中类的封装与继承
  • 原文地址:https://www.cnblogs.com/zhangzl419/p/15556328.html
Copyright © 2011-2022 走看看