How to set dynamically a bean reference in Spring?

后端 未结 6 994
抹茶落季
抹茶落季 2020-12-09 19:56
   
     



  

        
6条回答
  •  忘掉有多难
    2020-12-09 20:30

    1. setup up the placeholder bean by specfiy, let spring know you want the placeholder
    2. set up the config for the "my bean" by using the "${env}"

    for example:

    
    
               env.properties
     
    
       
         
    
    
    
    

    and you need the add the env = dev key-value to the env.properties file

提交回复
热议问题