-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[AOP]: ConstructorInterceptor is not working #11044
Comments
I think the problem here is that I did a quick test by changing your example a bit
and my output is
|
constructor interception cannot work when you directly use |
Hello, I am trying to use the solution mentioned. However, I am encountering an issue where instantiating a Product bean using Named does not work as expected, and the interceptor is not being triggered. Here is the code I am using: `
} ` Caused by: io.micronaut.context.exceptions.NoSuchBeanException: No bean of type [com.example.stuff.Product] exists for the given qualifier: Named('teste'). When I attempt to instantiate a Product bean using the Named annotation, the dependency injection fails with the error above. Additionally, it seems that using Named prevents the interceptor from being triggered. Question: Is it possible to use Named in this context and still have the interceptor work as expected? If so, could you provide guidance on how to achieve this? |
Expected Behavior
A class implementing the ConstructorInterceptor should be able to intercept the respective object's contrusctor pre/post its invoke, based on the InterceptorBinding of the advice that the interceptor is listening to throught the InterceptorBean.
Actual Behaviour
A class implementing the ConstructorInterceptor is not intercepting consctructors on/post/pre object creation.
Steps To Reproduce
Expected behavior:
After a Product contsructor is invoked, the interceptor should print "Product created" and afterwards the program should print Is my product favorite false
Actual behavior:
The program only prints Is my product favorite null
Environment Information
Example Application
https://github.com/HristoP96/aop-demo-1
Version
4.4.2
The text was updated successfully, but these errors were encountered: