| | |
| | | import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; |
| | | import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; |
| | | |
| | | /** |
| | | * @author wMeng |
| | | * @ClassName CorsConfig |
| | | * @Description 跨域配置 |
| | | * @date 2022/10/31 16:42 |
| | | * @Version 1.0 |
| | | */ |
| | | @Configuration |
| | | public class CorsConfig extends WebMvcConfigurationSupport { |
| | | @Override |
| | | public void addViewControllers(ViewControllerRegistry registry) { |
| | | // 设置访问路径为 “/” 跳转到指定页面 |
| | | registry.addViewController("/").setViewName("redirect:/doc.html"); |
| | | // 设置为最高优先级 |
| | | registry.setOrder(Ordered.HIGHEST_PRECEDENCE); |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | public void addResourceHandlers(ResourceHandlerRegistry registry) { |
| | | //设置静态资源映射 |
| | | registry.addResourceHandler("/backend/**").addResourceLocations("classpath:/backend/"); |
| | | registry.addResourceHandler("/front/**").addResourceLocations("classpath:/front/"); |
| | | |