dynamically change spring beans

前端 未结 5 1967
我在风中等你
我在风中等你 2021-01-01 01:24

how do I dynamically change the properties of a bean at runtime using java spring? I have a bean mainView, which should use as property \"class\" either \"class1\" or \"clas

5条回答
  •  南笙
    南笙 (楼主)
    2021-01-01 01:44

    Use a PropertyPlaceHolder to manage your properties file ..

    
      The service properties file 
       
      
    

    and change your ref attribute as follow :

    
        
        
    
    

    In your properties file some.where.MyApp.properties, add a key named withSmartCardClassImplementation which will have class1 or class2 (you choose) for value.

    withSmartCardClassImplementation=class1
    

提交回复
热议问题