diff --git a/spring-modulith-events/spring-modulith-events-jpa/pom.xml b/spring-modulith-events/spring-modulith-events-jpa/pom.xml
index 5aa3d6d9..08c2d4f3 100644
--- a/spring-modulith-events/spring-modulith-events-jpa/pom.xml
+++ b/spring-modulith-events/spring-modulith-events-jpa/pom.xml
@@ -64,10 +64,10 @@
spring-boot-starter-test
test
-
+
- org.springframework
- spring-orm
+ org.springframework.boot
+ spring-boot-starter-data-jpa
test
diff --git a/spring-modulith-events/spring-modulith-events-jpa/src/main/java/org/springframework/modulith/events/jpa/JpaEventPublicationAutoConfiguration.java b/spring-modulith-events/spring-modulith-events-jpa/src/main/java/org/springframework/modulith/events/jpa/JpaEventPublicationAutoConfiguration.java
index 058bb5d4..21ec1160 100644
--- a/spring-modulith-events/spring-modulith-events-jpa/src/main/java/org/springframework/modulith/events/jpa/JpaEventPublicationAutoConfiguration.java
+++ b/spring-modulith-events/spring-modulith-events-jpa/src/main/java/org/springframework/modulith/events/jpa/JpaEventPublicationAutoConfiguration.java
@@ -16,11 +16,17 @@
package org.springframework.modulith.events.jpa;
import org.springframework.boot.autoconfigure.AutoConfigurationPackage;
+import org.springframework.boot.autoconfigure.AutoConfigureBefore;
+import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
import org.springframework.context.annotation.Configuration;
/**
+ * Auto-configuration for JPA based event publication. Registers this class' package as auto-configuration package, so
+ * that it gets picked up for entity scanning by default.
+ *
* @author Oliver Drotbohm
*/
@Configuration(proxyBeanMethods = false)
+@AutoConfigureBefore(HibernateJpaAutoConfiguration.class)
@AutoConfigurationPackage
class JpaEventPublicationAutoConfiguration {}
diff --git a/spring-modulith-events/spring-modulith-events-jpa/src/test/java/example/ExampleApplication.java b/spring-modulith-events/spring-modulith-events-jpa/src/test/java/example/ExampleApplication.java
new file mode 100644
index 00000000..b769fc01
--- /dev/null
+++ b/spring-modulith-events/spring-modulith-events-jpa/src/test/java/example/ExampleApplication.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2022 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package example;
+
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+/**
+ * @author Oliver Drotbohm
+ */
+@SpringBootApplication
+public class ExampleApplication {}
diff --git a/spring-modulith-events/spring-modulith-events-jpa/src/test/java/org/springframework/modulith/events/jpa/JpaEventPublicationAutoConfigurationIntegrationTests.java b/spring-modulith-events/spring-modulith-events-jpa/src/test/java/org/springframework/modulith/events/jpa/JpaEventPublicationAutoConfigurationIntegrationTests.java
new file mode 100644
index 00000000..9b5bba60
--- /dev/null
+++ b/spring-modulith-events/spring-modulith-events-jpa/src/test/java/org/springframework/modulith/events/jpa/JpaEventPublicationAutoConfigurationIntegrationTests.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2022 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.modulith.events.jpa;
+
+import static org.assertj.core.api.Assertions.*;
+
+import example.ExampleApplication;
+import lombok.RequiredArgsConstructor;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.BeanFactory;
+import org.springframework.boot.autoconfigure.AutoConfigurationPackages;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.mock.mockito.MockBean;
+import org.springframework.modulith.events.EventSerializer;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.TestConstructor;
+import org.springframework.test.context.TestConstructor.AutowireMode;
+
+/**
+ * @author Oliver Drotbohm
+ */
+@SpringBootTest
+@ContextConfiguration(classes = ExampleApplication.class)
+@TestConstructor(autowireMode = AutowireMode.ALL)
+@RequiredArgsConstructor
+class JpaEventPublicationAutoConfigurationIntegrationTests {
+
+ private final BeanFactory factory;
+
+ @MockBean EventSerializer serializer;
+
+ @Test // GH-10
+ void registersJpaEventPublicationPackageForAutoConfiguration() {
+
+ var examplePackage = ExampleApplication.class.getPackageName();
+ var eventPublicationPackage = JpaEventPublication.class.getPackageName();
+
+ assertThat(AutoConfigurationPackages.get(factory))
+ .containsExactlyInAnyOrder(examplePackage, eventPublicationPackage);
+ }
+}
diff --git a/spring-modulith-events/spring-modulith-events-jpa/src/test/java/org/springframework/modulith/events/jpa/JpaEventPublicationConfigurationIntegrationTests.java b/spring-modulith-events/spring-modulith-events-jpa/src/test/java/org/springframework/modulith/events/jpa/JpaEventPublicationConfigurationIntegrationTests.java
index d0f72c78..1243c195 100644
--- a/spring-modulith-events/spring-modulith-events-jpa/src/test/java/org/springframework/modulith/events/jpa/JpaEventPublicationConfigurationIntegrationTests.java
+++ b/spring-modulith-events/spring-modulith-events-jpa/src/test/java/org/springframework/modulith/events/jpa/JpaEventPublicationConfigurationIntegrationTests.java
@@ -40,7 +40,7 @@ import org.springframework.test.context.junit.jupiter.SpringExtension;
@ExtendWith(SpringExtension.class)
@TestConstructor(autowireMode = AutowireMode.ALL)
@RequiredArgsConstructor
-public class JpaEventPublicationConfigurationIntegrationTests {
+class JpaEventPublicationConfigurationIntegrationTests {
private final ApplicationContext context;