03 2023 档案
摘要:SpringBoot之任务调度 开启任务调度 @SpringBootApplication // 开启任务调度 @EnableScheduling public class TaskDemoApplication { public static void main(String[] args) {
阅读全文
摘要:依赖 其实这个不用引用,自带 <!-- 缓存 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-cache</artifactId> </dependency> 开
阅读全文
摘要:0、前言 创建项目的选择: 阿里云:https://start.aliyun.com/ 官方:https://start.spring.io/ 1、更换为jetty服务器 只需要排除tomcat的依赖,添加jetty依赖即可 <dependency> <groupId>org.springframe
阅读全文
摘要:介绍 基于SpringBoot项目 标准的crud 注意事项 自动生成的Mapper一定要添加注解@Mapper,或者定义mapper的扫描包@MapperScan("cn.tjhis.api.mapper") 如果有配置类,建议@MapperScan写到配置类上 几个注解 @TableName @
阅读全文
摘要:1、入门案例 1.1、导包 <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>5.3.18</version> </dependency> <depe
阅读全文
摘要:导读 AOP 面向切面编程 Aspect oriented Programming OOP 面向对象编程 Object oriented Programming 作用:在不惊动原始设计的基础上进行功能增强。 切入点表达式可以是接口,也可以是实现类 1、导入坐标 <!-- aop面向切面 --> <d
阅读全文
摘要:1、依赖 <!-- Spring容器 --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>5.3.18</version> </depende
阅读全文
摘要:1、创建配置类 替代配置文件 /** * <p>描述 : 配置信息,省去编写配置文件 */ @Configuration @ComponentScan("cn.tjhis") public class SpringConfig { } 2、实现类注解 @Repository public class
阅读全文
摘要:1、druid.properties # mysql连接参数 jdbc.driver-class-name=com.mysql.cj.jdbc.Driver jdbc.url=jdbc:mysql://localhost:3306/wangdb?useUnicode=true&characterEn
阅读全文
摘要:1、介绍 IoC:Inversion of Control 控制反转 对象的创建控制权由程序转到外部,这种思想就叫控制反转 Spring提供了一个容器叫IoC容器,用来充当IoC思想的外部,用于提供对象。 IoC容器负责对象的创建、初始化等一系列工作,被创建或被管理的对象在IoC容器中统称为Bean
阅读全文
摘要:1、依赖 <dependencies> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi-ooxml</artifactId> <version>3.15</version> </dependency> <dependenc
阅读全文
摘要:1、添加依赖 <dependencies> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>8.0.28</version> </dependency> <!--
阅读全文