Skip to content

Better inheritance support for @Nested when using @SpringIntegration #9492

@mtomik

Description

@mtomik

Expected Behavior

I have @SpringIntegration(noAutoStartup = {"*"}) defined in abstract class that holds all integration tests to disable all IntegrationFlows by default

When @nested class is used in some test, same configuration (@SpringIntegration(noAutoStartup = {"*"})) is applied to that nested class as well

Current Behavior

class annotated with @nested doesn't have that annotation inherited, that leads to starting all IntegrationFlows during test, that is not intended

Context

Without this feature, it leads to unexpected IntegrationFlow startup

sample for demonstration:

@SpringIntegrationTest(noAutoStartup = {"*"})
class AbstractIntegrationTest {}


class SomeIntegrationTest extends AbstractIntegrationTest {

    // all beans autoStarted just because of this  
    @Nested
    class SomeNestedTest {
        
        @Test 
        void test() {}
    }
} 

workaround:

  1. Have IT profile defined and used when running integration tests
  2. Define IntegrationFlow beans with non-"IT" profile ( @Profile("!it") )

Thanks guys for any feedback on this.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions