If I use @ApplicationContext annotation on the funqy bean,
in a similar way as shown in the docs, at the time of writing this issue report is:
@ApplicationScoped
public class GreetingFunction {
I actually get:
2021-10-07 10:21:26,152 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.arc.deployment.ArcProcessor#registerBeans threw an exception: javax.enterprise.inject.spi.DefinitionException: Bean class MyDMNFn declares multiple scope type annotations: javax.enterprise.context.ApplicationScoped, javax.enterprise.context.Dependent
at io.quarkus.arc.processor.Beans.multipleScopesFound(Beans.java:427)
at io.quarkus.arc.processor.Beans$BeanInfoBuilder.build(Beans.java:148)
at io.quarkus.arc.processor.Beans.createClassBean(Beans.java:206)
at io.quarkus.arc.processor.BeanDeployment.findBeans(BeanDeployment.java:957)
at io.quarkus.arc.processor.BeanDeployment.registerBeans(BeanDeployment.java:232)
at io.quarkus.arc.processor.BeanProcessor.registerBeans(BeanProcessor.java:115)
at io.quarkus.arc.deployment.ArcProcessor.registerBeans(ArcProcessor.java:375)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:820)
at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at java.base/java.lang.Thread.run(Thread.java:834)
at org.jboss.threads.JBossThread.run(JBossThread.java:501)
at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:418)
at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:276)
at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:67)
at io.quarkus.deployment.dev.IsolatedDevModeMain.firstStart(IsolatedDevModeMain.java:92)
at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:441)
at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:65)
at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:137)
at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:93)
at io.quarkus.deployment.dev.DevModeMain.start(DevModeMain.java:145)
at io.quarkus.deployment.dev.DevModeMain.main(DevModeMain.java:63)
Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.arc.deployment.ArcProcessor#registerBeans threw an exception: javax.enterprise.inject.spi.DefinitionException: Bean class MyDMNFn declares multiple scope type annotations: javax.enterprise.context.ApplicationScoped, javax.enterprise.context.Dependent
at io.quarkus.arc.processor.Beans.multipleScopesFound(Beans.java:427)
at io.quarkus.arc.processor.Beans$BeanInfoBuilder.build(Beans.java:148)
at io.quarkus.arc.processor.Beans.createClassBean(Beans.java:206)
at io.quarkus.arc.processor.BeanDeployment.findBeans(BeanDeployment.java:957)
at io.quarkus.arc.processor.BeanDeployment.registerBeans(BeanDeployment.java:232)
at io.quarkus.arc.processor.BeanProcessor.registerBeans(BeanProcessor.java:115)
at io.quarkus.arc.deployment.ArcProcessor.registerBeans(ArcProcessor.java:375)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:820)
at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at java.base/java.lang.Thread.run(Thread.java:834)
at org.jboss.threads.JBossThread.run(JBossThread.java:501)
at io.quarkus.builder.Execution.run(Execution.java:116)
at io.quarkus.builder.BuildExecutionBuilder.execute(BuildExecutionBuilder.java:79)
at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:160)
at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:416)
... 9 more
Caused by: javax.enterprise.inject.spi.DefinitionException: Bean class MyDMNFn declares multiple scope type annotations: javax.enterprise.context.ApplicationScoped, javax.enterprise.context.Dependent
at io.quarkus.arc.processor.Beans.multipleScopesFound(Beans.java:427)
at io.quarkus.arc.processor.Beans$BeanInfoBuilder.build(Beans.java:148)
at io.quarkus.arc.processor.Beans.createClassBean(Beans.java:206)
at io.quarkus.arc.processor.BeanDeployment.findBeans(BeanDeployment.java:957)
at io.quarkus.arc.processor.BeanDeployment.registerBeans(BeanDeployment.java:232)
at io.quarkus.arc.processor.BeanProcessor.registerBeans(BeanProcessor.java:115)
at io.quarkus.arc.deployment.ArcProcessor.registerBeans(ArcProcessor.java:375)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:820)
at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at java.base/java.lang.Thread.run(Thread.java:834)
at org.jboss.threads.JBossThread.run(JBossThread.java:501)
but if instead I use simply:
//@ApplicationScoped
public class MyDMNFn {
@Inject
AppRoot appRoot;
@Inject
DecisionService svc;
@Funq
public MapDataContext helloFn(Map<String, Object> payload) {
System.out.println(payload);
notice the commented out @ApplicationScope,
it actually works just fine.
Describe the bug
I follow the Quarkus Funqy guide here: https://quarkus.io/guides/funqy#funqy-di for injecting my other bean/services into a simple Funqy demo.
If I use
@ApplicationContext
annotation on the funqy bean, in a similar way as shown in the docs, at the time of writing this issue report is:I actually get:
but if instead I use simply:
notice the commented out
@ApplicationScope
, it actually works just fine.Expected behavior
No response
Actual behavior
No response
How to Reproduce?
= Reproducer1
https://github.com/quarkusio/quarkus-quickstarts/blob/0beb76f889c79d321447f0df7e891c3b14e1b033/funqy-quickstarts/funqy-http-quickstart/src/main/java/org/acme/funqy/GreetingFunction.java#L6-L10
@ApplicationScope
so to align with the documentationit breaks.
= Reproducer2
https://github.com/tarilabs/kogito-examples/blob/8e619360b1f23a325fe529bf2772bbf301b19166/dmn-quarkus-example/src/main/java/MyDMNFn.java#L14-L23
@ApplicationScope
so to align with the documentationit breaks.
Output of
uname -a
orver
No response
Output of
java -version
No response
GraalVM version (if different from Java)
No response
Quarkus version or git rev
Quarkus 2.3.0.Final
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.6.3
Additional information
= My question is
If I look at the documentation, I should annotate
@ApplicationScope
, but it fails as described.If I look at the Quickstart code at the time of writing this issue report: https://github.com/quarkusio/quarkus-quickstarts/blob/0beb76f889c79d321447f0df7e891c3b14e1b033/funqy-quickstarts/funqy-http-quickstart/src/main/java/org/acme/funqy/GreetingFunction.java#L6-L10
is not annotated, and if I don't annotate my bean either, then it works.
Can you kindly clarify which is the expectation, is the Doc having the "bug" or the quickstart? :)
https://github.com/quarkusio/quarkus/issues/20580
$upstream:20580$