0

We are currently having application in dxa-2.2 java and we are trying to separate out common code out of it as separate dxa module.

It is not getting registered on viewEntryMap

here is a initializer code

@Configuration
@ComponentScan("com.example.dxa.modules.test")
public class TestInitializer {

    @RegisteredViewModels({
            @RegisteredViewModel(viewName = "Test", modelClass = Test.class),
            @RegisteredViewModel(viewName = "Test", modelClass = RegionModelImpl.class)
    })
    @Component
    @ModuleInfo(name = "Test module", areaName = "Test", description = "Test module")
    public static class TestModuleInitializer extends AbstractModuleInitializer {
        @Override
        protected String getAreaName() {
            return "Test";
        }
    }
}

when I am trying to debug, I can not find this on

final RegisteredViewModels views = getClass().getAnnotation(RegisteredViewModels.class);

of class AbstractModuleInitializer

could you please suggest how to load this module into another dxa webapp which is having different module

1 Answer 1

1

Issue was fixed when I changed the namespace to com.sdl.dxa.modules from com.example.dxa.modules.test in the module.

now able to load entities from custom module as well.

2
  • Interesting, it should not be needed to use the com.sdl.dxa.modules package name for custom Modules, but it's good to know that this is a way to make it work. Commented Oct 18, 2021 at 13:04
  • yes. In java it's expected
    – Velmurugan
    Commented Oct 20, 2021 at 14:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.