Динамическое создание нескольких экземпляров одного и того же компонента с помощью Spring ⇐ JAVA
-
Anonymous
Динамическое создание нескольких экземпляров одного и того же компонента с помощью Spring
The problem is to create n beans. The n is determined by a config. The config is just a simple JSON file:
{ "bean1" : { "property": true }, "bean2" : { "property": false } } So when I parse config I get that n = 2 and create 2 beans.
There is a way to dynamically create n beans with BeanFactoryPostProcessor (how to get multiple instances of same bean in spring?)
However, In my case, I need to be able to inject config somehow, parse it, and only then create n beans. I don't believe that injection is possible with BeanFactoryPostProcessor.
Источник: https://stackoverflow.com/questions/583 ... ith-spring
The problem is to create n beans. The n is determined by a config. The config is just a simple JSON file:
{ "bean1" : { "property": true }, "bean2" : { "property": false } } So when I parse config I get that n = 2 and create 2 beans.
There is a way to dynamically create n beans with BeanFactoryPostProcessor (how to get multiple instances of same bean in spring?)
However, In my case, I need to be able to inject config somehow, parse it, and only then create n beans. I don't believe that injection is possible with BeanFactoryPostProcessor.
Источник: https://stackoverflow.com/questions/583 ... ith-spring
Мобильная версия