-
Notifications
You must be signed in to change notification settings - Fork 108
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
java.lang.IllegalArgumentException: Unable to locate persister: org.springframework.modulith.events.jpa.JpaEventPublication #345
Comments
You're running into a limitation of the way that boot handles So the only option for now is that you explicitly declare |
Yes, that is what I did in the end, adding |
As stated initially, when I add the @EntityScan to my Application.java to make my app start, I get
So I cannot find a configuration where both the tests and my app are working. @odrotbohm could you pls help and point me to a workaround, am I still missing something? |
Just to be clear: now I have the The problem lies with my
|
Hm, I'm sorry about that. I don't quite get how your code could enter that particular path, as it's basically a leftover from early Boot 2.x days. On Boot 3, the fields looked up reflectively there shouldn't even be found. 🤔 |
Do you need more information like a full stacktrace? |
Hm, not really. I wonder if you're able to test the 1.1 snapshots as it has this code path removed. |
I tried again with spring-modulith:1.1.0-RC2 and now the test case fails with Violations like this one:
I have to look into those violations but for now is there a way to disable those checks just to see if the original problem goes away? |
Moved classes in my solution package to a package
I verified that I have |
Seems to be the same with
|
I do not understand why |
I think you've revealed a hole in our tests. The problematic code path filters the existing autoconfiguration / entity scan packages (including those manually configured) and only keeps the ones that are related to Spring Modulith. It looks like we never test exactly that scenario (someone explicitly configuring a Spring Modulith package as entity scan package for example). On the positive side: it is great timing to catch this before the GA release :). |
…uration packages. If Spring Modulith packages were explicitly configured as autoconfiguration or entity scan packages, the test autoconfiguration would fail as it previously attempted to manipulate an immutable list. We now create a copy of that list to fix this.
This should be fixed and also backported to 1.0.x. If you try these snapshots, you should also not see the tightened cycle detection, yet. |
Looks great, I will test it when I am back to work. Thanks for fixing this so quickly :-) |
Hi! First of all thank you for the great work you are doing :-)
I have a Maven multi-module project with one Maven module for each application module plus a solution module that packages all the modules as a Spring fat jar.
I have a simple test case in my solution module to see if the application context still loads:
I have 2 modules,
company
andconnector
. When a company is created, I create an event.Then in the
connector
module, I handle the event:Like stated in the Spring Modulith docs, I also added the dependency to the starter package for JPA:
Now, when running my
ApplicationTests
, I getjava.lang.IllegalArgumentException: Unable to locate persister: org.springframework.modulith.events.jpa.JpaEventPublication
I seems that
JpaEventPublication
is not picked up by the entity scan.Already tried to add it to @EntityScan as another base package, but that led to an immutable collection exception because I already have a base package configured:
Any idea what I am doing wrong here?
The text was updated successfully, but these errors were encountered: