I’ve reproduced the problem on the Mario’s multi-module project GitHub - mariodavid/jmix-entity-soft-reference at cuba-compatability · GitHub.
Here it’s caused by simple inability of Spring to find beans from different module in tests (no matter if it’s a datatype or a regular @Component). When you run tests in the child module (jmix-entity-soft-reference-cuba), it looks for beans in its own sources because of @ComponentScan on SoftReferenceCubaConfiguration, and in dependencies declared in build.gradle because of their auto-configurations. But the parent module (jmix-entity-soft-reference) is not scanned and its beans are not added to the context.
The straightforward solution is to import the parent’s configuration class in the test configuration of the child module:
@Import({
SoftReferenceConfiguration.class, // added
SoftReferenceCubaConfiguration.class})
public class SoftReferenceCubaTestConfiguration {
After that, the contextLoads() test passes. Maybe you can find a better way to build the context in tests correctly.
In single-module add-ons, I couldn’t reproduce the problem. See these projects: parent, child. The parent project includes the Instant datatatype and converter, the child project’s entities use them. Tests in the child project pass. I didn’t add any imports because the child project depends on the parent’s starter with auto-configuration.
Regards,
Konstantin