Skip to content

Configuration Processor @Bean Duplicate Prefix Definition APT Error #6781

@nwoike

Description

@nwoike

When using the spring-boot-configuration-processor and leveraging the same @ConfigurationProperties prefix on an @Bean I am seeing an APT error in Eclipse in 1.4.0.RELEASE. While I agree that this error should be generated when using a duplicate prefix on an @Component class definition, I think this restriction should be relaxed on @Bean definitions.

I am referencing the External Config 3rd Party Configuration section in the reference guide.

Basic example of the issue

@Bean
@ConfigurationProperties("spring.datasource.tomcat")
public DataSource readDataSource() {
        return DataSourceBuilder.create()
            .url(properties.getReadUrl())
            .username(properties.getUsername())
            .password(properties.getPassword())
            .build();
}

@Bean
@ConfigurationProperties("spring.datasource.tomcat")
public DataSource readWriteDataSource() {
        return DataSourceBuilder.create()
            .url(properties.getReadUrl())
            .username(properties.getUsername())
            .password(properties.getPassword())
            .build();
}
Duplicate `@ConfigurationProperties` definition for prefix 'spring.datasource.tomcat'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: invalidAn issue that we don't feel is valid

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions