-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathWebConfig.java
More file actions
33 lines (28 loc) · 1.11 KB
/
WebConfig.java
File metadata and controls
33 lines (28 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package bigdata.web;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.EnableMBeanExport;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
@Component
@EnableWebMvc
@ComponentScan(basePackages={"bigdata.web.controller"})
public class WebConfig extends WebMvcConfigurerAdapter{
/**
* 视图解析
*/
@Bean
public ViewResolver viewResolver(){
InternalResourceViewResolver resolve=new InternalResourceViewResolver("/jsps/",".jsp");
resolve.setExposeContextBeansAsAttributes(true);
return resolve;
}
//配置默认处理器
public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer){
configurer.enable();
}
}