Skip to content

ActiveProfiles not included when using a custom annotation. [SPR-13748] #18321

Closed
@spring-projects-issues

Description

@spring-projects-issues

Adam Berlin opened SPR-13748 and commented

The following doesn't work:

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(loader = SpringApplicationContextLoader.class)
@ReproduceTest.MyActiveProfile
public class ReproduceTest {

    @Autowired
    private String value;

    @Test
    public void itDoesNotPickUpTestPropertiesUsingMetaAnnotation() {
        assertEquals("foo", this.value);
    }

    @ActiveProfiles({"foo"})
    public static @interface MyActiveProfile {
    }

    @Configuration
    @Profile("foo")
    public static class FooConfig {
        @Bean
        public String value() {
            return "foo";
        }
    }
}

Affects: 4.1.8

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