@Configurable not recognized in SpringBoot application

I am trying to write a custom JPA-EntityListener for my spring boot application that is somehow familiar with the application context. after reading the docs to see how to do this, I stumbled upon the AuditingEntityListener that comes with spring-data and @Configurable Annotation that is also used in this Listener, which allows you to customize objects that are not managed by spring. So I tried to use it in my own listener, but the annotation will not be recognized there. I have already read the docs and many posts on this topic, but some of them seemed to be quite outdated. This is why I am asking here:

Should I be specifying spring-tool.jar for LoadTimeWeaving anyway? The spring docs say there are other ways and it can also be configured (for each classloader?) In the context of the application. but when I run my application with @EnableLoadTimeWeaving without specifying an agent on the command line, I get an error.

I'm wondering why the AuditingEntityListener is recognized at startup even in applications where neither @EnableLoadTimeWeaving nor @EnableSpringConfigured is set. Is it because the distributed spring-jars are already compiled with CTW?

I also tried CompileTimeWeaving, but this contradicted the lombok. I've found a solution / workaround for this since 2011, but it didn't work for me. Is there a way to do this?

What are the advantages and disadvantages of LTW and CTW and waht is the best way to implement a custom JPAEntityListener that supports ApplicationContext?

+2


source to share





All Articles