springboot
一、优势
1.敏捷开发
2.无需tomcat
3.xml配置,配置properties
二.依赖包
两个包:springboot父类包+springboot的web组件包
三.注解:
1.@EnableAutoConfiguration :相当于扫描当前类
2.@RestController :返回json
3.@SpringBootApplication:申明让spring boot自动给程序进行必要的配置,这个配置等同于:@Configuration ,@EnableAutoConfiguration 和 @ComponentScan 三个配置。
四、加载静态资源,只需直接访问staitc下面的文件名即可
五.全局捕获异常
@ControllerAdvice 通过切面,异常通知,捕获全局异常
@ExceptionHandler 捕获哪种异常,需要指明
六.springboot整合freemarker

浙公网安备 33010602011771号