How to set dynamically a bean reference in Spring?

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



  

        
6条回答
  •  鱼传尺愫
    2020-12-09 20:25

    Assuming you meant Spring 3.1, rather than Spring 2.1 (which doesn't exist), then you can use the new "Environment Profiles" feature that was introduced in 3.1. This allows you to define a set of beans for each of your environments, and then select the "active" one at runtime.

    See this SpringSource Blog Entry for examples.

提交回复
热议问题