Java – spring profile contains yaml files

When the team set up WebSphere profile activation, I was trying to complete the cloud profile activation

Yaml file

---
    spring:
      application:
        name: kicapp
      output:
        ansi:
          enabled: ALWAYS
      profiles:
        active: local
    #server:
      #context-path: /
      #port: 8080
    #logging:
      #level:
        #org.springframework.security: DEBUG
    ---
    spring:
      profiles: local
    ---
    spring:
      profiles: unittest
    ---
    spring:
      profiles: cloud
      test: loaded
    ---
    spring:
      profiles: websphere
        include: cloud

When I set up – spring profiles. When active = WebSphere, I receive the following error

Solution

This seems to be a limitation on the snake yaml parser and how spring boot uses it Since yaml allows multiple different documents to be specified in a single file with the - separator, spring separates individual documents by using spring. XML Profiles key, which should be a simple structure rather than a complex structure

A good solution is actually to split it into multiple files in this way:

Applications with common content Yaml, application – < profiles > use profile specific extensions, using this structural key spring profiles. Include will work as expected

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>