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

ArgumentInjectionPoint not working anymore in version 4.5 #11198

Closed
FrogDevelopper opened this issue Sep 20, 2024 · 1 comment
Closed

ArgumentInjectionPoint not working anymore in version 4.5 #11198

FrogDevelopper opened this issue Sep 20, 2024 · 1 comment
Assignees
Labels
type: bug Something isn't working

Comments

@FrogDevelopper
Copy link

FrogDevelopper commented Sep 20, 2024

Expected Behavior

We can inject @PulsarReader in a constructor

Actual Behaviour

We got the error

Message: Outer injection point inaccessible from here
Path Taken: MessageBrokerIntegrationTest.pulsarConsumer --> new MessageBrokerIntegrationTest$PulsarMessageConsumer$Intercepted([Reader reader],BeanResolutionContext $beanResolutionContext,BeanContext $beanContext,Qualifier $qualifier,List $interceptors,InterceptorRegistry $interceptorRegistry)
io.micronaut.context.exceptions.BeanInstantiationException: Error instantiating bean of type [com.frogdevelopment.pulsar.MessageBrokerIntegrationTest$PulsarMessageConsumer$Intercepted]

Steps To Reproduce

  1. Clone the demo repository https://github.com/FrogDevelopper/micronaut-4_5
  2. switch to example/pulsar branch
  3. Check that gradle.properties#micronautVersion is 4.4.3 (= micronaut-inject:4.4.10)
  4. Run test in MessageBrokerIntegrationTest.java (start pulsar service before)=> test pass ✅
  5. Upgrate gradle.properties#micronautVersion to 4.5.1 (= micronaut-inject:4.5.4)
  6. Run test in MessageBrokerIntegrationTest.java => test fail ❌ with error

Message: Outer injection point inaccessible from here
Path Taken: MessageBrokerIntegrationTest.pulsarConsumer --> new MessageBrokerIntegrationTest$PulsarMessageConsumer$Intercepted([Reader reader],BeanResolutionContext $beanResolutionContext,BeanContext $beanContext,Qualifier $qualifier,List $interceptors,InterceptorRegistry $interceptorRegistry)
at io.micronaut.context.DefaultBeanContext.resolveByBeanFactory(DefaultBeanContext.java:2343)
at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2298)
at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2310)
at io.micronaut.context.DefaultBeanContext.createRegistration(DefaultBeanContext.java:3120)
at io.micronaut.context.DefaultBeanContext.resolveBeanRegistration(DefaultBeanContext.java:3010)
at io.micronaut.context.DefaultBeanContext.resolveBeanRegistration(DefaultBeanContext.java:2749)
at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:1748)
at io.micronaut.context.AbstractBeanResolutionContext.getBean(AbstractBeanResolutionContext.java:89)
at io.micronaut.context.AbstractInitializableBeanDefinition.resolveBean(AbstractInitializableBeanDefinition.java:2188)
at io.micronaut.context.AbstractInitializableBeanDefinition.getBeanForConstructorArgument(AbstractInitializableBeanDefinition.java:1350)
at com.frogdevelopment.pulsar.$MessageBrokerIntegrationTest$PulsarMessageConsumer$Intercepted$Definition.instantiate(Unknown Source)
at io.micronaut.context.DefaultBeanContext.resolveByBeanFactory(DefaultBeanContext.java:2328)
at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2298)
at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2310)
at io.micronaut.context.DefaultBeanContext.createRegistration(DefaultBeanContext.java:3120)
at io.micronaut.context.SingletonScope.getOrCreate(SingletonScope.java:80)
at io.micronaut.context.DefaultBeanContext.findOrCreateSingletonBeanRegistration(DefaultBeanContext.java:3022)
at io.micronaut.context.DefaultBeanContext.resolveBeanRegistration(DefaultBeanContext.java:2983)
at io.micronaut.context.DefaultBeanContext.resolveBeanRegistration(DefaultBeanContext.java:2749)
at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:1748)
at io.micronaut.context.AbstractBeanResolutionContext.getBean(AbstractBeanResolutionContext.java:89)
at io.micronaut.context.AbstractInitializableBeanDefinition.resolveBean(AbstractInitializableBeanDefinition.java:2188)
at io.micronaut.context.AbstractInitializableBeanDefinition.getBeanForField(AbstractInitializableBeanDefinition.java:1694)
at com.frogdevelopment.pulsar.$MessageBrokerIntegrationTest$Definition.inject(Unknown Source)
at io.micronaut.context.DefaultBeanContext.doInjectAndInitialize(DefaultBeanContext.java:2655)
at io.micronaut.context.DefaultBeanContext.inject(DefaultBeanContext.java:1012)
at io.micronaut.test.extensions.AbstractMicronautExtension.beforeEach(AbstractMicronautExtension.java:459)
at io.micronaut.test.extensions.junit5.MicronautJunit5Extension.beforeEach(MicronautJunit5Extension.java:223)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
Caused by: java.lang.UnsupportedOperationException: Outer injection point inaccessible from here
at io.micronaut.context.AbstractBeanResolutionContext$ConstructorArgumentSegment.getOuterInjectionPoint(AbstractBeanResolutionContext.java:504)
at io.micronaut.pulsar.PulsarReaderFactory.getReaderByInjectionPoint(PulsarReaderFactory.java:115)
at io.micronaut.pulsar.PulsarReaderFactory.getReaderByInjectionPoint(PulsarReaderFactory.java:90)
at io.micronaut.pulsar.$PulsarReaderFactory$GetReaderByInjectionPoint0$Definition.doInstantiate(Unknown Source)
at io.micronaut.context.AbstractInitializableBeanDefinition.instantiate(AbstractInitializableBeanDefinition.java:770)
at io.micronaut.context.DefaultBeanContext.resolveByBeanFactory(DefaultBeanContext.java:2326)

Environment Information

  • JDK version: 21

Example Application

https://github.com/FrogDevelopper/micronaut-4_5

Version

4.5.1

@graemerocher graemerocher added the type: bug Something isn't working label Sep 20, 2024
@dstepanov
Copy link
Contributor

It works fine with 4.6.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants