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

Service becomes null when using private @SchemaMapping #1084

Closed
sydneyhenrard opened this issue Nov 8, 2024 · 3 comments
Closed

Service becomes null when using private @SchemaMapping #1084

sydneyhenrard opened this issue Nov 8, 2024 · 3 comments

Comments

@sydneyhenrard
Copy link

I faced a strange behavior. It might not be a bug, or it's something specific to my application but I figured it could help.

The query has 2 @SchemaMapping one is public and the other is private. No reason just inconsistency on my side. When running the query locally it works fine, but when deployed in dev, the facets part throws a NPE because productService is null. When switching the method from private to public it works.

JDK 21
SB 3.3.4

@Controller
public class ProductGraphQlController {

    private final ProductService productService;

    public ProductGraphQlController(ProductService productService) {
        this.productService = productService;
    }

    @QueryMapping
    public ProductSearch allProductsWithFacets(
        @Argument String tenant,
        ScrollSubrange subrange,
        GraphQLContext graphQLContext
    ) {...}   

    @SchemaMapping(field = "content")
    public Window<Product> content(
        ProductSearch productSearch,
        @ContextValue String tenant,
        @ContextValue ScrollSubrange subrange
    ) {...}   

    @SchemaMapping(field = "facets")
    private List<Facet> facets(
        ProductSearch productSearch,
        @ContextValue String tenant
    ) {...}   
}
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 8, 2024
@bclozel
Copy link
Member

bclozel commented Nov 8, 2024

I think there is more to this as the behavior you're describing doesn't make sense to me. Can you share a minimal sample application that we can take a look at?

@bclozel bclozel added the status: waiting-for-feedback We need additional information before we can continue label Nov 8, 2024
@spring-projects-issues
Copy link
Collaborator

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

@spring-projects-issues spring-projects-issues added the status: feedback-reminder We've sent a reminder that we need additional information before we can continue label Nov 15, 2024
@spring-projects-issues
Copy link
Collaborator

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.

@spring-projects-issues spring-projects-issues added status: waiting-for-triage An issue we've not yet triaged and removed status: waiting-for-feedback We need additional information before we can continue status: feedback-reminder We've sent a reminder that we need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged labels Nov 22, 2024
@rstoyanchev rstoyanchev closed this as not planned Won't fix, can't repro, duplicate, stale Dec 4, 2024
@rstoyanchev rstoyanchev removed the status: waiting-for-triage An issue we've not yet triaged label Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants