found character ‘@‘ that cannot start any token. 解决方案
spring:
  profiles:
    active: @spring.profiles.active@
1
2
3
用 pom.xml 配合 yaml 文件实现动态配置。
项目使用了如上配置,一开始可以运行。但是在某次运行时突然开始报错。
Exception in thread "main" while scanning for the next token
found character '@' that cannot start any token. (Do not use @ for indentation)
 in 'reader', line 3, column 13:
        name: @spring.profiles.active@
1
2
3
4
解决方案是先检查是否在 maven 构建时选择了相应的配置。如果不能解决问题,则在 @@ 两侧加上单引号 ' 或双引号 " 。
spring:
  profiles:
    active: '@spring.profiles.active@'
————————————————
版权声明:本文为CSDN博主「ahy231」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/ahy231/article/details/119141951
 
                    
                     
                    
                 
                    
                
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号