Micronaut-core: Environment order specified in micronaut.environments system property is not retained

Created on 16 Nov 2018  路  1Comment  路  Source: micronaut-projects/micronaut-core

If you specify multiple environments in micronaut.environments system property, it's order is not retained in env.getActiveNames(). This results in unpredictable configuration if the same configuration key exists in multiple environments.

Steps to Reproduce

  1. specify multiple environment names in micronaut.environments
java  -Dmicronaut.environments=foo,bar,foo,bar,baz -jar app.jar
  1. run it on aws cloud instance where cloud and ec2 environments should be automatically detected

Expected Behaviour

env.getActiveNames() should return [ 'cloud', 'ec2', 'foo', 'bar', 'baz' ]

Actual Behaviour

env.getActiveNames() should returns names in arbitrary order because HashSet is used.

Environment Information

  • Operating System: Ubuntu Linux
  • Micronaut Version: 1.0.1
  • JDK Version: 8, 11
bug

Most helpful comment

Thanks for the contribution

>All comments

Thanks for the contribution

Was this page helpful?
0 / 5 - 0 ratings