Skip to content

Follow the Spring ComponentScan rule to create beans #5393

@hantsy

Description

@hantsy

I created a AppConfig to setup some configurations for Spring application.

@Configuration
public class AppConfig {

    @Bean
    public ObjectMapper jackson2ObjectMapperBuilder(){
        Jackson2ObjectMapperBuilder builder = Jackson2ObjectMapperBuilder.json()
                .featuresToEnable(INDENT_OUTPUT)
                .featuresToDisable(WRITE_DATES_AS_TIMESTAMPS);

        return builder.build();
    }
}

But if I removed @Configuration annotation, this class is still active, and the Jackson ObjectMapper format rule is applied.

I have created a beans.xml and set attribute bean-discovery-mode="annotated" in the root element.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/springIssues relating to the Spring integrationkind/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions