@Bean public WebMvcConfigurer webMvcConfigurer() { return new WebMvcConfigurerAdapter() { @Override public void addViewControllers(ViewControllerRegistry viewControllerRegistry) { // 首页默认加载web端 viewControllerRegistry.addViewController("/").setViewName("/web/index.html"); viewControllerRegistry.addViewController("/index.html").setViewName("redirect:/"); // web首页 viewControllerRegistry.addViewController("/web").setViewName("/web/index.html"); // webapp首页 viewControllerRegistry.addViewController("/webapp").setViewName("/webapp/index.html"); viewControllerRegistry.setOrder(Ordered.HIGHEST_PRECEDENCE); super.addViewControllers(viewControllerRegistry); } }; }
@Override public void addViewControllers(ViewControllerRegistry registry) { super.addViewControllers(registry); registry.addRedirectViewController("/", "/ui"); registry.addViewController("/ui/**").setViewName("forward:/index.html"); }
@Override public void addViewControllers(final ViewControllerRegistry registry) { super.addViewControllers(registry); registry.addViewController("/login/form") .setViewName("login"); registry.addViewController("/errors/403") .setViewName("/errors/403"); registry.setOrder(Ordered.HIGHEST_PRECEDENCE); }
@Override public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController( "/" ).setViewName("index"); registry.setOrder(Ordered.HIGHEST_PRECEDENCE ); registry.addViewController( "/edit" ).setViewName("edit"); registry.addViewController( "/upload" ).setViewName("upload"); super.addViewControllers(registry); }
/** * 配置默认路径为文档 * @param registry */ @Override public void addViewControllers( ViewControllerRegistry registry ) { registry.addViewController( "" ).setViewName( "redirect:/swagger-ui.html" ); registry.setOrder( Ordered.HIGHEST_PRECEDENCE ); super.addViewControllers( registry ); }
@Bean public WebMvcConfigurerAdapter forwardToIndex() { return new WebMvcConfigurerAdapter() { @Override public void addViewControllers(ViewControllerRegistry registry) { // forward requests to /admin and /user to their index.html registry.addViewController("/**").setViewName( "forward:/index.html"); } }; }
@Override public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController("/viewUsers").setViewName("viewUsers"); registry.addViewController("/index").setViewName("index"); registry.addViewController("/").setViewName("index"); registry.addViewController("/login").setViewName("login"); }
@Override public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController("/index").setViewName("/index"); registry.addViewController("/toUpload").setViewName("/upload"); registry.addViewController("/converter").setViewName("/converter"); registry.addViewController("/sse").setViewName("/sse"); }
@Override public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController("/index").setViewName("/index"); registry.addViewController("/toUpload").setViewName("/upload"); registry.addViewController("/converter").setViewName("/converter"); registry.addViewController("/sse").setViewName("/sse"); registry.addViewController("/async").setViewName("/async"); }
@Bean public WebMvcConfigurerAdapter webMvcConfigurerAdapter() { return new WebMvcConfigurerAdapter() { @Override public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController("/") .setStatusCode(HttpStatus.PERMANENT_REDIRECT) .setViewName("/swagger-ui.html"); } }; }
@Override public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController("/").setViewName("home"); registry.addViewController("/home").setViewName("home"); registry.addViewController("/login").setViewName("login"); registry.addViewController("/oauth/confirm_access").setViewName("authorize"); }
@Override public void addViewControllers(final ViewControllerRegistry registry) { registry.addViewController("/ui").setViewName("redirect:ui/"); registry.addViewController("/ui/").setViewName("forward:index.html"); registry.setOrder(Ordered.HIGHEST_PRECEDENCE); super.addViewControllers(registry); }
@Bean public WebMvcConfigurerAdapter forwardToIndex() { return new WebMvcConfigurerAdapter() { @Override public void addViewControllers(ViewControllerRegistry registry) { // forward requests index.htm (as we might have two spring boot tomcats running in the same JVM they can see each others resources // so we use different index files to avoid confusion registry.addViewController("/").setViewName( "forward:/monitor.html"); } }; }