0

Hello I have a configuration class in a spring boot project that looks something like this .

  @ConfigurationProperties(config.value) 
     public class ApplicationProperties{
              Map<String, User> userProperties;
        }
       
     public class User{
              String userName;
              String userCity;
      }

How do I give value for userProperties in my application.yaml file ?

Gregor Zurowski
  • 2,222
  • 2
  • 9
  • 15
Anuja Barve
  • 300
  • 1
  • 4
  • 23

1 Answers1

3

Given your example, the corresponding configuration properties for two different users in application.yml would look as follows:

userProperties:
  user1:
    userName: jane
    userCity: New York
  user2:
    userName: john
    userCity: Lisbon
Gregor Zurowski
  • 2,222
  • 2
  • 9
  • 15