How to pass parameters dynamically to Spring beans

后端 未结 5 2163
盖世英雄少女心
盖世英雄少女心 2020-12-28 14:31

I am new to Spring.

This is the code for bean registration:

 


        
5条回答
  •  悲哀的现实
    2020-12-28 15:19

    Constructor injection can help you. In this case you may need to generate a POJO with ID and user as its attributes and pass POJO to constructor. In constructor injection in config file you can refer this constructor with pojo as reference. So you will be handle the dynamic value of data in ID and User.

    Hope this helps !!

提交回复
热议问题