Steps to reproduce

  1. Download source from https://guides.micronaut.io/latest/micronaut-data-mongodb-asynchronous-maven-java.zip
  2. Add a new test class under package example.micronaut.some.other named SomeOtherTest
  3. Change Fruit class package to example.micronaut.entity
  4. Change FruitRepository class package to example.micronaut.repository

Environment

  1. Operating System: Ubuntu 22.04 LTS
  2. JDK "17.0.1" 2021-10-19 LTS
  3. Java HotSpot(TM) 64-Bit Server

For error snapshot, do refer https://github.com/micronaut-projects/micronaut-guides/issues/928

Is some micronaut configuration/ tags missing? I am trying to avoid creating a Micronaut codec class since I make use of only primitive data types!

I have basically found no way out, hence a quick help/ pointer would greatly help.

1

There are 1 best solutions below

0
On

If you put your entities outside of the application package, you need to specify it in the mongo configuration:

mongodb:
  package-names:
    xyz