Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.

Problem when using aspect with annotation pointcut #1712

Closed
agrancaric opened this issue Sep 8, 2022 · 2 comments
Closed

Problem when using aspect with annotation pointcut #1712

agrancaric opened this issue Sep 8, 2022 · 2 comments
Labels
for: external-project For an external project and not something we can fix

Comments

@agrancaric
Copy link

Hello, I have a problem when using an aspect with annotation pointcut. It seems that the pointcut matches more that it should and causes an exception:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'projectingArgumentResolverBeanPostProcessor': Initialization of bean failed; nested exception is com.oracle.svm.core.jdk.UnsupportedFeatureError: Proxy class defined by interfaces [interface org.springframework.beans.factory.config.BeanPostProcessor, interface org.springframework.beans.factory.BeanFactoryAware, interface org.springframework.beans.factory.BeanClassLoaderAware] not found. Generating proxy classes at runtime is not supported. Proxy classes need to be defined at image build time by specifying the list of interfaces that they implement. To define proxy classes use -H:DynamicProxyConfigurationFiles=<comma-separated-config-files> and -H:DynamicProxyConfigurationResources=<comma-separated-config-resources> options.
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:628) ~[com.example.springnativepointcutexample.SpringNativePointcutExampleApplication:5.3.22]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[com.example.springnativepointcutexample.SpringNativePointcutExampleApplication:5.3.22]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[com.example.springnativepointcutexample.SpringNativePointcutExampleApplication:5.3.22]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[com.example.springnativepointcutexample.SpringNativePointcutExampleApplication:5.3.22]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[com.example.springnativepointcutexample.SpringNativePointcutExampleApplication:5.3.22]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:213) ~[com.example.springnativepointcutexample.SpringNativePointcutExampleApplication:5.3.22]
	at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:270) ~[na:na]
	at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:762) ~[com.example.springnativepointcutexample.SpringNativePointcutExampleApplication:5.3.22]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:567) ~[com.example.springnativepointcutexample.SpringNativePointcutExampleApplication:5.3.22]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) ~[na:na]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734) ~[com.example.springnativepointcutexample.SpringNativePointcutExampleApplication:na]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) ~[com.example.springnativepointcutexample.SpringNativePointcutExampleApplication:na]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[com.example.springnativepointcutexample.SpringNativePointcutExampleApplication:na]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306) ~[com.example.springnativepointcutexample.SpringNativePointcutExampleApplication:na]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295) ~[com.example.springnativepointcutexample.SpringNativePointcutExampleApplication:na]
	at com.example.springnativepointcutexample.SpringNativePointcutExampleApplication.main(SpringNativePointcutExampleApplication.java:14) ~[com.example.springnativepointcutexample.SpringNativePointcutExampleApplication:na]

when I add the mentioned interfaces to proxy-config.json another exception is thrown with more missing proxy entries etc. The issue seems to happen when I have also spring-boot-starter-data-jpa dependency (without it it works ok). What also works is a pointcut by full path execution (referencing the exact class and methods without annotation).
Not sure can I do anything from my side to fix it (the project attached is just an example and the original annotation and aspect are in a library so I would like to avoid users having to add a package)?
The Graal and Java versions are:

Version info: 'GraalVM 22.2.0 Java 11 CE'
Java version info: '11.0.16.1+1-LTS'

Thanks in advance for any help.

The example project:
spring-native-pointcut-example.zip

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Sep 8, 2022
@toohandsome
Copy link

same error

@sdeleuze
Copy link
Contributor

Proper aspect support should come with Spring Framework 6 and Spring Boot 3 which are just around the corner. You can follow spring-projects/spring-framework#28711 related issue.

@sdeleuze sdeleuze added for: external-project For an external project and not something we can fix and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Sep 14, 2022
@sdeleuze sdeleuze closed this as not planned Won't fix, can't repro, duplicate, stale Sep 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
for: external-project For an external project and not something we can fix
Development

No branches or pull requests

4 participants