SpringBoot中出现'@' that cannot start any token. (Do not use @ for indentation)....

我想在yml配置文件中把数据库环境换成动态,然后在jenkins中打包方便
SpringBoot中出现'@' that cannot start any token. (Do not use @ for indentation)...._第1张图片
但是我出现了’@’ that cannot start any token. (Do not use @ for indentation)…
我最开始在’@package.environment@‘加上了’'但是,我在控制台输出的时候发现它只是被当做字符串解析,没有卵用
在网上看到这样一句话
你可以使用Maven的资源过滤(resource filter)自动暴露来自Maven项目的属性,如果使用spring-boot-starter-parent,你可以通过@…@占位符引用Maven项目的属性,例如:
[email protected]@
[email protected]@
注 如果启用addResources标识,spring-boot:run可以将src/main/resources直接添加到classpath(出于热加载目的),这就绕过了资源过滤和本特性。你可以使用exec:java目标进行替代,或自定义该插件的配置,具体查看插件使用页面
最终解决方法


    
        src/main/resources
        true
    

和(元素内):


    org.apache.maven.plugins
    maven-resources-plugin
    2.7
    
        
            @
        
        false
    

SpringBoot中出现'@' that cannot start any token. (Do not use @ for indentation)...._第2张图片
注 如果你在配置中使用标准的Spring占位符(比如${foo})且没有将useDefaultDelimiters属性设置为false,那构建时这些属性将被暴露出去

你可能感兴趣的:(异常bug)