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