网上图书商城网站设计,七夕表白网站制作,仪器网站模版,00后怎么赚钱白手起家日常工作总结 1000. JAVA基础1. 泛型1.1 泛型和Object的区别 1100. Spring1. 常用注解1.1 ControllerAdvice注解1.2 缓存Cacheable 2. 常用方法2.1 BeanUtils.copyProperties的用法 3. 常用功能组件3.1 过滤器Filter 2000. Linux应用 1000. JAVA基础
1. 泛型
1.1 泛型和Objec… 日常工作总结 1000. JAVA基础1. 泛型1.1 泛型和Object的区别 1100. Spring1. 常用注解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 注解在方法上表示该方法的返回结果是可以缓存的。也就是说该方法的返回结果会放在缓存中以便于以后使用相同的参数调用该方法时会返回缓存中的值而不会实际执行该方法。
依赖 dependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-data-redis/artifactId/dependencydependencygroupIdorg.springframework.boot/groupIdartifactIdspring-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;OverrideCacheable(value listCategoryForCustomer)public ListCategoryVO listCategoryForCustomer() {ArrayListCategoryVO 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应用