Note that instead of simply configuring the bean scope into multiple instances, you need to create different instances according to different parameters at startup. These created instances need to be called in subsequent business Example.
My current idea is to use factoryBean to proxy the abstracted parent class, and then configure the concretely implemented subclasses into different instances in the xml file. However, in this way, the parameters may be dynamically read from the database. Second, the number of generated instances cannot be determined, so I don’t know if there is any other way?
You can read the database at startup, then put the multiple generated instances into a HashMap, and then provide a method to get the instance objects based on the type. No need to make it @Bean