Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add migration note about using @ConfigMapping only for Interfaces #19298

Closed
Sgitario opened this issue Aug 9, 2021 · 2 comments
Closed

Add migration note about using @ConfigMapping only for Interfaces #19298

Sgitario opened this issue Aug 9, 2021 · 2 comments
Labels
area/config area/housekeeping Issue type for generalized tasks not related to bugs or enhancements
Milestone

Comments

@Sgitario
Copy link
Contributor

Sgitario commented Aug 9, 2021

Description

In 483c4ff, we upgraded SmallRye Config to 2.4.3 and it seems that there is no longer possible to use the annotation @ConfigMapping on classes, only in interfaces.

Therefore, users that were using:

@ConfigMapping(prefix = "person")
public class Person {
    String name;
    int age;
}

Before, it worked fine, but now it throws an exception at startup:

Error:  Failed to execute goal io.quarkus:quarkus-maven-plugin:999-SNAPSHOT:build (build) on project properties: Failed to build quarkus application: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
Error: r]: Build step io.quarkus.arc.deployment.ConfigBuildStep#generateConfigClasses threw an exception: java.lang.IllegalStateException: SRCFG00043: The @ConfigMapping annotation can only be placed in interfaces, class io.quarkus.qe.properties.configmapping.Person is a class
Error:  	at io.smallrye.config.ConfigMappingLoader.validateAnnotations(ConfigMappingLoader.java:95)
Error:  	at io.smallrye.config.ConfigMappingLoader.getConfigMappingClass(ConfigMappingLoader.java:44)
Error:  	at io.smallrye.config.ConfigMappingLoader.getConfigMappingInterface(ConfigMappingLoader.java:40)
Error:  	at io.smallrye.config.ConfigMappingLoader.getConfigMappingsMetadata(ConfigMappingLoader.java:34)
Error:  	at io.quarkus.arc.deployment.ConfigBuildStep.generateConfigClasses(ConfigBuildStep.java:289)

I think this should be noted in the migration guide for 2.2.

Implementation ideas

No response

@Sgitario Sgitario added the area/housekeeping Issue type for generalized tasks not related to bugs or enhancements label Aug 9, 2021
Sgitario added a commit to Sgitario/quarkus-test-suite that referenced this issue Aug 9, 2021
Quarkus upstream upgraded SmallRye Config to 2.4.3 and it seems that there is no longer possible to use the annotation @ConfigMapping on classes, only in interfaces.
As we're already covering the interface mapping, I removed the field coverage.
Related issue: quarkusio/quarkus#19298
Sgitario added a commit to Sgitario/beefy-scenarios that referenced this issue Aug 9, 2021
Quarkus upstream upgraded SmallRye Config to 2.4.3 and it seems that there is no longer possible to use the annotation @ConfigMapping on classes, only in interfaces.
As we're already covering the interface mapping, I removed the field coverage.
Related issue: quarkusio/quarkus#19298
Sgitario added a commit to Sgitario/quarkus-test-suite that referenced this issue Aug 9, 2021
Quarkus upstream upgraded SmallRye Config to 2.4.3 and it seems that there is no longer possible to use the annotation @ConfigMapping on classes, only in interfaces.
As we're already covering the interface mapping, I removed the field coverage.
Related issue: quarkusio/quarkus#19298
@rsvoboda
Copy link
Member

CC @radcortez

@geoand
Copy link
Contributor

geoand commented Aug 27, 2021

@geoand geoand closed this as completed Aug 27, 2021
@geoand geoand added this to the 2.2.0.Final milestone Aug 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/config area/housekeeping Issue type for generalized tasks not related to bugs or enhancements
Projects
None yet
Development

No branches or pull requests

3 participants