Home>

In application-production.yml

frontend:
  url: "1.com" or "2.com"


What should I do when I want to enter two values ​​like?
Thanks for your cooperation.

What i did
"1.com", "2.com"
"1.com,2.com"
1.com, 2.com
{1.com}, {2.com}
{1.com} {2.com}

"*" Is too wide, so I would like to exclude it.

  • Answer # 1

    frontend:
      url:>
        a.com,
        b.com,
        c.com
      @Value ("${frontend.url}")
        private List<String>urls;

  • Answer # 2

    It's a yml file, so it looks like the following.

    frontend:
      url:
    -1.com
    -2.com


    The acquisition method is as follows

    @Value ("${frontend.url}")
    private List<String>url;


    How about storing it in an array at the acquisition destination and choosing one of the two values?

    * In the first answer, I misunderstood it as properties, so I modified it to yml format.