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

Camel Context not injected when service implements ApplicationEventListener #11597

Open
amitdk opened this issue Jul 25, 2020 · 1 comment
Open
Assignees

Comments

@amitdk
Copy link

amitdk commented Jul 25, 2020

We would like to leverage a Spring Camel context in our grails services. We can do this just fine in a regular Grails service. However, as soon as a Grails service implements the Micronaut ApplicationEventListener, the server application fails to start up with the following error:

Caused by: io.micronaut.context.exceptions.NoSuchBeanException: No bean of type [com.xyz.SomeService] exists. Make sure the bean is not disabled by bean requirements (enable trace logging for 'io.micronaut.context.condition' to check) and if the bean is enabled then ensure the class is declared a bean and annotation processing is enabled (for Java and Kotlin the 'micronaut-inject-java' dependency should be configured as an annotation processor).

As soon as I remove the camel context declaration, server application starts up again. There seem to be 2 issues here:

  1. Spring events are coming across to a Grails service even if it implements Spring's ApplicationListener interface. When looking into the code, it looks like Micronaut's ContextEventAdapter swallows the event because the Grails service doesn't get registered as a valid event listener for whatever reason. Again, this had all worked fine Grails 3.3.8.
  2. If I create a plain vanilla listener for the application that extends ApplicationEventListener and does not look to utliize an injected Camel Context, it is able to listen to events. However, injecting a Camel context even with adding annotationProcessor("io.micronaut:micronaut-inject-java") into the build.gradle fails on injecting the Camel context. I have compile "org.apache.camel:camel-spring:${camelVersion}" in the build.gradle as well.

Appreciate any help on this.

Thanks

@puneetbehl puneetbehl self-assigned this Aug 17, 2020
@puneetbehl puneetbehl added this to the grails-4.0.5 milestone Oct 19, 2020
@puneetbehl
Copy link
Contributor

@amitdk please attach a sample application.

@puneetbehl puneetbehl modified the milestones: grails-4.0.5, grails-4.0.6 Oct 25, 2020
@puneetbehl puneetbehl removed this from the grails-4.0.6 milestone Nov 30, 2020
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

2 participants