The spec and javadoc indicate that CDI should manage the lifecycle of GraphQL beans.
When testing a new version of SmallRye on Open Liberty, I mistakenly left out the CDI support and the TCK still passed. But Open Liberty functional tests failed indicating that @PostConstruct methods were not being executed in my @ApplicationScoped and @RequestScoped GraphQL beans (POJOs annotated with @GraphQLApi. This means that the implementation was simply loading the GraphQL class, instantiating it and executing the queries/mutations - it wasn't actually managed by CDI.
I think we should add some TCK tests that ensure that CDI lifecycle methods like @PostConstruct, @PreDestroy (if possible), etc. are invoked correctly.
The spec and javadoc indicate that CDI should manage the lifecycle of GraphQL beans.
When testing a new version of SmallRye on Open Liberty, I mistakenly left out the CDI support and the TCK still passed. But Open Liberty functional tests failed indicating that
@PostConstruct
methods were not being executed in my@ApplicationScoped
and@RequestScoped
GraphQL beans (POJOs annotated with@GraphQLApi
. This means that the implementation was simply loading the GraphQL class, instantiating it and executing the queries/mutations - it wasn't actually managed by CDI.I think we should add some TCK tests that ensure that CDI lifecycle methods like
@PostConstruct
,@PreDestroy
(if possible), etc. are invoked correctly.