启动器
@SpringBootApplication
public class ApplicationRun {
public static void main(String[] args) {
SpringApplication.run(ApplicationRun.class , args);
}
}
配置类
@Configuration
@EnableWebMvc
public class MyMvcConfig extends WebMvcConfigurerAdapter {
@Bean
public ViewResolver getViewResolver() {
InternalResourceViewResolver resolver = new InternalResourceViewResolver();
resolver.setPrefix("/WEB-INF/views/");
resolver.setSuffix(".jsp");
return resolver;
}
@Override
public void configureDefaultServletHandling(
DefaultServletHandlerConfigurer configurer) {
configurer.enable();
}
}
===========
application.yml
注意~ 在 : 后面一定要加上空格!
spring:
mvc:
view:
prefix : /WEB-INF/views/
suffix : .jsp
sever:
port: 9999
前端控制器
@Controller
public class SseController {
@RequestMapping(value="/push") //①
public String get() {
return "see";
}
}
网友评论