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

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. Oct 18 at 13:04
  • yes. In java it's expected
    – Velmurugan
    Oct 20 at 14:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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