08 2022 档案

摘要:SpringBoot Web依赖包包含了拦截器, Spring中的拦截器 指的是SpringMVC提供的HandlerInterceptor SpringBoot配置拦截器,只需要2步 1.自定义一个拦截器类 示例代码 MyInterceptor.java package cn.lzh.kam.in 阅读全文
posted @ 2022-08-21 15:42 silent_fall 阅读(455) 评论(0) 推荐(0)
摘要:在Spring框架中,想使用Spring容器中的Bean,需要先实例化Bean SpringBean的实例化有3种方式 构造方法实例化 (最常用) 在Java配置类中,写一个构造方法,在这个构造方法中new一个Bean实例, 然后在构造方法上添加注解@Bean(value="beanClass") 阅读全文
posted @ 2022-08-21 14:01 silent_fall 阅读(489) 评论(0) 推荐(0)
摘要:准备工作 创建一个springboot 2.7.2版本的新项目 建议去官网生成一个springboot项目,官网地址:https://start.spring.io/ 代码编写工作 pom依赖添加AOP <dependency> <groupId>org.springframework.boot</ 阅读全文
posted @ 2022-08-21 12:54 silent_fall 阅读(144) 评论(0) 推荐(0)
摘要:准备工作 创建一个springboot 2.7.2版本的新项目 建议去官网生成一个springboot项目,官网地址:https://start.spring.io/ 代码编写工作 pom依赖添加 web,mybatis-plus,mysql <?xml version="1.0" encoding 阅读全文
posted @ 2022-08-20 16:46 silent_fall 阅读(43) 评论(0) 推荐(0)