Skip to content

Add option to register configuration classes via Class<?> in AnnotationConfigWebApplicationContext [SPR-8320] #12968

@spring-projects-issues

Description

@spring-projects-issues

Rossen Stoyanchev opened SPR-8320 and commented

If you instantiate AnnotationConfigWebApplicationContext in a JUnit test or standalone code the only option to register @Configuration classes is to use setConfigLocation(String) or setConfigLocations(String[]). This means you have to convert configuration class names to a String based location that contains the class. Although this is simple (using clazz.getName() will do), it's not immediately obvious what the syntax for the String should be.

For comparison AnnotationConfigApplicationContext does provide a register(Class<?>... annotatedClasses) method. It would make sense to have such a method on AnnotationConfigWebApplicationContext as well for parity.


Affects: 3.0.5, 3.1 M1

Attachments:

Issue Links:

Referenced from: commits c696e19, e128ee2

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions