当前位置: 首页 > news >正文

日常工作总结

日常工作总结

  • 1000. JAVA基础
    • 1. 泛型
      • 1.1 泛型和Object的区别
  • 1100. Spring
    • 1. 常用注解
      • 1.1 @ControllerAdvice注解
      • 1.2 缓存@Cacheable
    • 2. 常用方法
      • 2.1 BeanUtils.copyProperties的用法
    • 3. 常用功能组件
      • 3.1 过滤器Filter
  • 2000. Linux应用

1000. JAVA基础

1. 泛型

1.1 泛型和Object的区别

泛型和Object的区别 什么时候用泛型 什么时候使用Object

1100. Spring

1. 常用注解

1.1 @ControllerAdvice注解

spring的@ControllerAdvice注解

1.2 缓存@Cacheable

@Cacheable使用详解
@Cacheable 注解在方法上,表示该方法的返回结果是可以缓存的。也就是说,该方法的返回结果会放在缓存中,以便于以后使用相同的参数调用该方法时,会返回缓存中的值,而不会实际执行该方法。

依赖

    <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-redis</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-cache</artifactId></dependency>

配置类

package com.imooc.mall.config;import java.time.Duration;import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.cache.RedisCacheConfiguration;
import org.springframework.data.redis.cache.RedisCacheManager;
import org.springframework.data.redis.cache.RedisCacheWriter;
import org.springframework.data.redis.connection.RedisConnectionFactory;/*** 描述:     缓存的配置类*/
@Configuration
@EnableCaching
public class CachingConfig {@Beanpublic RedisCacheManager redisCacheManager(RedisConnectionFactory connectionFactory) {RedisCacheWriter redisCacheWriter = RedisCacheWriter.lockingRedisCacheWriter(connectionFactory);RedisCacheConfiguration cacheConfiguration = RedisCacheConfiguration.defaultCacheConfig();//超时时间30scacheConfiguration = cacheConfiguration.entryTtl(Duration.ofSeconds(30));RedisCacheManager redisCacheManager = new RedisCacheManager(redisCacheWriter, cacheConfiguration);return redisCacheManager;}
}

启动类需要@EnableCaching描述

package com.imooc.mall;import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import springfox.documentation.swagger2.annotations.EnableSwagger2;@SpringBootApplication
@MapperScan(basePackages = "com.imooc.mall.model.dao")
@EnableSwagger2
@EnableCaching
public class MallApplication {public static void main(String[] args) {SpringApplication.run(MallApplication.class, args);}}

应用

	import org.springframework.cache.annotation.Cacheable;@Override@Cacheable(value = "listCategoryForCustomer")public List<CategoryVO> listCategoryForCustomer() {ArrayList<CategoryVO> categoryVOList = new ArrayList<>();recursivelyFindCategories(categoryVOList, 0);return categoryVOList;}

2. 常用方法

2.1 BeanUtils.copyProperties的用法

BeanUtils.copyProperties的用法(超详细,建议收藏)

如果有两个具有很多相同属性名的JavaBean对象a和b,想把a中的属性赋值到b

3. 常用功能组件

3.1 过滤器Filter

Filter(过滤器)简介

JavaWeb过滤器(Filter)详解

2000. Linux应用

http://www.lryc.cn/news/310981.html

相关文章:

  • Android Activity启动模式
  • 【JavaScript】面试手撕防抖
  • 【Kubernetes】K3S
  • Docker实战——容器
  • 亚信安慧AntDB开启超融合数据库新纪元
  • 数学建模【多元线性回归模型】
  • 【 10X summary report】怎么看?详细解读笔记
  • K8S—Pod控制器
  • LabVIEW石油钻机提升系统数字孪生技术
  • C#双向链表实现:在当前节点后插入新数据的方法Insert()
  • 10-Java装饰器模式 ( Decorator Pattern )
  • Vue.js 实用技巧:深入理解 Vue.set 方法
  • 单词规律00
  • vue3 vite项目一运行就401(Unauthorized)
  • LeetCode102.二叉树的层序遍历
  • Java底层自学大纲_JVM篇
  • 数据可视化?这些平台能处
  • [ai笔记14] 周鸿祎的ai公开课笔记1
  • 在Linux系统中创建新用户并登录
  • Vue.js+SpringBoot开发高校实验室管理系统
  • 文献阅读笔记《Spatial-temporal Forecasting for Regions without Observations》13页
  • 如何学习openfoam
  • vue前端密码加密,springboot后端密码解密
  • selenuim【1】$x(‘xpath’)、WebDriverWait()、try/assert
  • 机器学习模型总结
  • HTML5:七天学会基础动画网页6
  • mybatis中#{}和${}的区别?
  • 常用git 打tag命令
  • Learning from Unlabeled 3D Environments forVision-and-Language Navigation
  • 【算法分析与设计】组合