
springBoot
文章平均质量分 55
code_agent
代码特工
展开
-
@ConditionalOnBean主键的坑
ConditionalOnBean(A22.class)的坑。预期应该A22不会创建,故不会出错任何字符。此时并没有配置tea.redis.a。原创 2024-09-11 17:09:16 · 242 阅读 · 0 评论 -
@Cacheable的使用
一、配置1.配置redis默认是有配置redis的情况会使用redis作为缓存。2.配置Cache@Configuration// 使用redis作为cache的缓存,前提是要配置redis@ConditionalOnBean(RedisConfiguration.class)public class CacheConfiguration { @Resource private RedisConnectionFactory factory; @Resource原创 2021-06-10 18:45:24 · 1879 阅读 · 0 评论 -
springboot集成websocket
springboot集成websocket1.pom添加依赖<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-websocket</artifactId></dependency>2.配置文件:server: port: 88853.添加配置类import org.spri原创 2020-10-29 17:26:33 · 182 阅读 · 0 评论 -
@async注解的使用
异步调用1.使用:springboot中的启动类中添加注解**@EnableAsync**来开启异步调用;在需要异步执行的方法上添加**@Async(“taskExecutor”)**注解进行标注;类或者方法中都可使用@Async注解,(类上标有该注解表示类中方法都是异步方法);@Target({ElementType.METHOD, ElementType.TYPE})@Retention(RetentionPolicy.RUNTIME)@Documentedpublic @inter原创 2021-06-03 21:52:59 · 1717 阅读 · 0 评论