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

Incorrect arguments to Assert.isInstanceOf in AnnotatedControllerConfigurer #282

Closed
voydz opened this issue Feb 8, 2022 · 7 comments
Closed
Assignees
Labels
type: bug A general bug
Milestone

Comments

@voydz
Copy link

voydz commented Feb 8, 2022

Hi there,

first of all thank you for your awesome work. I noticed a potential bug on the M5 release of spring-boot-graphql. Upon launching my application the exception "Object of class [java.lang.String] must be an instance of class org.springframework.format.support.FormattingConversionService" occurs.

After a bit of digging in the code I noticed a potential bug in the following line:

Assert.isInstanceOf(FormattingConversionService.class, "FormattingConversionService is required");

I am no expert in this by all means, but isn't the second argument of the assert the actual object to check? Thus passing the message as the second argument would raise the exception shown above.

It was introduced with 0b449d8 to fix #271.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Feb 8, 2022
@voydz
Copy link
Author

voydz commented Feb 8, 2022

For reference:

As a workaround I am defining the annotatedControllerConfigurer bean myself without calling the faulty setConversionService. This works because the AnnotatedControllerConfigurer is already initialized with the DefaultFormattingConversionService.

@Bean
fun annotatedControllerConfigurer(): AnnotatedControllerConfigurer? {
    return AnnotatedControllerConfigurer()
}

@bclozel
Copy link
Member

bclozel commented Feb 8, 2022

Could you tell us which Spring for GraphQL and Spring Boot versions are you using to reproduce that?

@bclozel bclozel added the status: waiting-for-feedback We need additional information before we can continue label Feb 8, 2022
@voydz
Copy link
Author

voydz commented Feb 8, 2022

I am using Spring Boot 2.6.3 and Spring for GraphQL 1.0.0-M5

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Feb 8, 2022
@bclozel
Copy link
Member

bclozel commented Feb 8, 2022

I see - those are incompatible versions.
As of Spring for GraphQL 1.0.0-M5, we've moved the auto-configuration to Spring Boot proper.

You can get a default setup with start.spring.io (by selecting the latest 2.7.x milestone or snapshot).
Thanks for this report!

@bclozel bclozel closed this as completed Feb 8, 2022
@bclozel bclozel added status: invalid An issue that we don't feel is valid and removed status: feedback-provided Feedback has been provided status: waiting-for-triage An issue we've not yet triaged labels Feb 8, 2022
@voydz
Copy link
Author

voydz commented Feb 8, 2022

Thats fine. I take that note. But did you actually look at the linked line in the code? I am quite convinced, that there is an issue anyway. This issue is not raised from version incompatibility.

Here is another use of Assert.isInstanceOf() in the codebase

and the signature differs from the one I mentioned above.

In other words: This issue will persist in Spring Boot 2.7.0-M1 and 3.0.0-SNAPSHOT

@rstoyanchev
Copy link
Contributor

This appears to be an issue with the Assert arguments indeed.

@rstoyanchev rstoyanchev reopened this Feb 8, 2022
@rstoyanchev rstoyanchev changed the title Exception launching Spring Boot application with the spring-boot-graphql M5 release Incorrect arguments to Assert.isInstanceOf in AnnotatedControllerConfigurer Feb 8, 2022
@rstoyanchev rstoyanchev added type: bug A general bug and removed status: invalid An issue that we don't feel is valid labels Feb 8, 2022
@rstoyanchev rstoyanchev added this to the 1.0.0-M6 milestone Feb 8, 2022
@voydz
Copy link
Author

voydz commented Feb 8, 2022

@rstoyanchev @bclozel Thank you very much for looking into this.

best regards

@rstoyanchev rstoyanchev self-assigned this Feb 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

4 participants