0

I want to know the purpose of below methods inside the class when the class extends AbstractAnnotationConfigDispatcherServletInitializer

  1. protected Class[] getRootConfigClasses() { return new Class[0]; }

    @Override

    1. protected Class[] getServletConfigClasses() { return new Class[] { testAPI.class }; } 3.@Override protected String[] getServletMappings() { return new String[] { "/" }; }
JimHawkins
  • 4,107
  • 8
  • 28
  • 53
Rithik_Star
  • 561
  • 5
  • 12
  • 29

1 Answers1

0

(1) wants a list of @Configuration (user) classes for creating a Root ApplicationContext and (2) wants a list of (user) classes for the AnnotationConfigWebApplicationContext.

So image you have several @Configuration classes coded somewhere, you can register them with:

@Override
protected final Class<?>[] getRootConfigClasses() {
    return new Class[]{CoreConfiguration.class, JpaConfiguration.class,
            ShiroSecurityConfig.class};
} 
Logemann
  • 2,150
  • 24
  • 41