dynamically change spring beans

前端 未结 5 1970
我在风中等你
我在风中等你 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:50

    Agree with @Olivier above.

    There are many ways to do it.

    1. Use PropertyPlaceHolderConfigurer..
    2. Use BeanPostProcessor..
    3. Use Spring AOP, create an advice and manipulate the properties.

    I would recommend item no:1 above.

提交回复
热议问题