Override ConfigurationProperties Of Library from Application

18 views Asked by At

I've created a ConfigurationProperties in my base-library:

@Setter
@Getter
@Configuration
@ConfigurationProperties(prefix = "base.props")
public class DemoProperties {
    private String host;
    private String realm;
}

Then I build my library and handled a jar file and imported to an application.

    <dependency>
        <groupId>com.sha</groupId>
        <artifactId>demo-library</artifactId>
        <version>${version}</version>
    </dependency>

Then I try to set properties from spring-boot application via application.properties:

base.props.host=Test
base.props.realm=Test

but these aren't seen by library.and Intellij says "Cannot resolve configuration property..."

Any suggestion?

1

There are 1 answers

0
Sha On

The problem was "application.properties" on library. Changed the name to "application-x.properties" and solved.