Skip to content

SpringContexts not properly closed after test-class is finished [SPR-11363] #15989

@spring-projects-issues

Description

@spring-projects-issues

Andreas Eternach opened SPR-11363 and commented

Hello,

i have two test classes:

First testclass: derived from class AbstractTestNGSpringContextTests, uses annotation @EnableSpringConfigured

Second testclass: plain TestNG-Test without spring context, tries to instantiate a @Configurable-annotated-class

Maven runs the testcases in the order given above. When the second testclass is run and the @Configurable-annotated-class is constructed, a NoSuchBeanDefinitionEception is thrown.

I assume that the spring-context of the first testclass is not automatically destroyed.

Further investigation showed:

  1. adding @DiritiesContext to the first testclass resolves the problem.
  2. running AnnotationBeanConfigurerAspect.aspectOf().destroy() before the second test-class is executed resolves the problem.

Best Regards, Andreas


Affects: 3.2.6

Issue Links:

Metadata

Metadata

Assignees

Labels

in: testIssues in the test modulestatus: duplicateA duplicate of another issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions