@Configuration(prefix = "aabb") (or: how to create reusable configurations) [SPR-14103] #18675
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
type: enhancement
A general enhancement
Milestone
Stepan Koltsov opened SPR-14103 and commented
Requesting a
attribute. When prefix is specified, it is prepended to names of all beans defined in that
@Configuration
.Why is it important: to create reusable configurations. For example, one might have database connection component which comprises of: DataSource, DataSourceMonitoring, ThreadPool etc.
It could be written like this:
With "prefix" attribute these configurations emit beans with names "primary-dataSource", "primary-dataSourceMonitoring", "another-dataSource", "another-dataSourceMonitoring".
However, currently Spring has no anything like "prefix" attribute, so this configuration is not possible, since generated bean names for "dataSource" would be the same for both subclass configurations.
Generally, it is not currently possible in Spring to create reusable configurations (configurations which could be used more than once in the application context). It would be good to have it in large applications.
Affects: 4.2.5
Reference URL: http://stackoverflow.com/questions/36298227/spring-how-to-reuse-the-same-configuration-multiple-times
Issue Links:
@Configuration
interface with Java 8 default methods (as a standalone artifact)4 votes, 5 watchers
The text was updated successfully, but these errors were encountered: