Home > Back-end >  The question of addViewControllers SpringBoot
The question of addViewControllers SpringBoot

Time:05-05

As shown in figure one USES a configuration class for ws. The HTML made a path configuration, FIG. 3 is abnormal, could you tell me how to solve the

CodePudding user response:

Register a WebMvcConfigurationAdapter bean, realizing addViewControllers method

CodePudding user response:

Your View path and viewName/ws, dead cycle
Registry. AddViewController ("/ws ") setViewName (" ws ");

CodePudding user response:

Don't need to/write directly in setViewName name it

CodePudding user response:

Did you write addViewControllers WebMvcConfigurerAdapter object Adapter, and to give WebMvcConfig returns a Adapter

CodePudding user response:

Why in addViewControllers add multiple views can also play a role, it is how to determine the implementation of that?
 
@ Slf4j
//view controller;
@ Configuration
Public class WebViewConfig implements WebMvcConfigurer {
@ Override
Public void addViewControllers (ViewControllerRegistry registry) {
Registry. AddViewController ("/admin ".) setViewName (" admin/login ");
Registry. AddViewController ("/"). SetViewName (" index ");
}
}

  • Related