2 changed files with 23 additions and 7 deletions
@ -1,30 +1,41 @@
@@ -1,30 +1,41 @@
|
||||
/** |
||||
* @author JOJO |
||||
* @class WebMacConfig |
||||
* @class MyWebMvcConfig |
||||
* @date 2023/3/19 |
||||
* @apiNote |
||||
*/ |
||||
|
||||
package co.depsystem.app.config; |
||||
|
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
||||
import org.springframework.web.servlet.ViewResolver; |
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; |
||||
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; |
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; |
||||
import org.springframework.web.servlet.view.InternalResourceViewResolver; |
||||
|
||||
@Configuration |
||||
public class WebMacConfig implements WebMvcConfigurer { |
||||
public class MyWebMvcConfig implements WebMvcConfigurer { |
||||
/** |
||||
* 导入拦截器 |
||||
* 添加拦截器设置 |
||||
*/ |
||||
@Override |
||||
public void addInterceptors(InterceptorRegistry registry) { |
||||
WebMvcConfigurer.super.addInterceptors(registry); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 添加视图配置 |
||||
*/ |
||||
@Bean |
||||
public ViewResolver viewResolver(){ |
||||
InternalResourceViewResolver resolver = new InternalResourceViewResolver(); |
||||
resolver.setPrefix("/static"); |
||||
resolver.setSuffix(".html"); |
||||
return resolver; |
||||
} |
||||
@Override |
||||
public void addViewControllers(ViewControllerRegistry registry) { |
||||
registry.addViewController("/static/index.html").setViewName("index"); |
||||
Loading…
Reference in new issue