栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

Spring Boot 启动报错:while scanning for the next token found character ‘@‘ that cannot start any token.

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Spring Boot 启动报错:while scanning for the next token found character ‘@‘ that cannot start any token.

使用Spring Boot 启动项目报错,错误如下。
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 7, column 13:
        active: @profileActive@

原因是我在项目中使用

spring:
  jackson:
    default-property-inclusion: non_null
  profiles:
    active: @profileActive@

@profileActive@ 可以使用 maven profile 进行选择不同配置文件进行开发、打包

为了解决上面的问题,我使用如下方法、 第一步:添加maven配置

	
	
		dev
		
			dev
		
		
			true
		
	
	
		test
		
			test
		
	
	
		pretest
		
			pretest
		
	
	
		prod
		
			prod
		
	

添加完上面的文件后,maven会出现图片的配置。

还是没解决问题,还需要引用pom依赖

第二步:添加pom依赖

    org.yaml
    snakeyaml
    1.17

添加依赖后,还需要添加一段配置

第三步:添加maven配置

    
    
        
            src/main/resources
            
            true
        
    

这样,问题就解决了,项目可以启动了。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/314953.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号