How to pass a Map with application.properties

后端 未结 4 1332
失恋的感觉
失恋的感觉 2020-12-14 08:29

I have implemented some authorization in a webservice that needs be configured.

Currently the user/password combo is hardcoded into the bean configuration. I would l

4条回答
  •  执念已碎
    2020-12-14 08:58

    you can use @Value.

    Properties file:

    users={test1:'test1',test2:'test2'}
    

    Java code:

    @Value("#{${users}}")
    private Map users;
    

提交回复
热议问题