diff --git a/hexagonal/README.md b/hexagonal/README.md index 3253eb2..e6f2629 100644 --- a/hexagonal/README.md +++ b/hexagonal/README.md @@ -59,6 +59,7 @@ reading as an example of testing through the port rather than through a seed scr | [`persistence-adapter/output/00-jpa-adapter-tests.txt`](persistence-adapter/output/00-jpa-adapter-tests.txt) | `@DataJpaTest` against a real H2 database: a save-then-find round trip and an unknown-id lookup | | [`web-adapter/output/00-webmvctest-mockmvc.txt`](web-adapter/output/00-webmvctest-mockmvc.txt) | `@WebMvcTest` with the ports mocked: the real JSON a deposit and a rejected withdrawal return | | [`app/output/00-end-to-end-http.txt`](app/output/00-end-to-end-http.txt) | the full stack over real HTTP: deposit, withdraw, an overdraft rejected with 409, and the balance reloaded straight from the database to cross-check the HTTP response | +| [`app/output/01-missing-scan-base-packages-failure.txt`](app/output/01-missing-scan-base-packages-failure.txt) | the real `NoSuchBeanDefinitionException` that comes back if `@EnableJpaRepositories`/`@EntityScan` are removed from `HexagonalApplication` -- captured by actually removing them and running the test, not reconstructed from memory | ## A note for anyone copying this reactor shape diff --git a/hexagonal/app/output/01-missing-scan-base-packages-failure.txt b/hexagonal/app/output/01-missing-scan-base-packages-failure.txt new file mode 100644 index 0000000..aae94a0 --- /dev/null +++ b/hexagonal/app/output/01-missing-scan-base-packages-failure.txt @@ -0,0 +1,17 @@ +Captured by temporarily removing @EnableJpaRepositories and @EntityScan from +HexagonalApplication (leaving only @SpringBootApplication(scanBasePackages = "com.ankurm.hexagonal")) +and running `mvn -pl app test`. The real, unedited exception chain Spring produced: + +Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'jpaWalletRepositoryAdapter' defined in URL [jar:file:/root/.m2/repository/com/ankurm/hexagonal-persistence-adapter/1.0/hexagonal-persistence-adapter-1.0.jar!/com/ankurm/hexagonal/persistence/JpaWalletRepositoryAdapter.class]: Unsatisfied dependency expressed through constructor parameter 0: No qualifying bean of type 'com.ankurm.hexagonal.persistence.SpringDataWalletRepository' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {} + at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:804) + at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:240) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1380) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1219) + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:565) +Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.ankurm.hexagonal.persistence.SpringDataWalletRepository' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {} + at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:2304) + at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1732) + +Restoring @EnableJpaRepositories(basePackages = "com.ankurm.hexagonal.persistence") and +@EntityScan(basePackages = "com.ankurm.hexagonal.persistence") on HexagonalApplication and +re-running the exact same test produces the green run captured in 00-end-to-end-http.txt.