spring注解排除某些bean
发表于|更新于
|浏览量:
劳动是唯一导向知识的道路。——萧伯纳
使用:
1 | @ComponentScan(excludeFilters = {@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, |
即可
这里还有其他的过滤类型
例如注解
1 | @ComponentScan(excludeFilters = @Filter( |
切面
1 | @ComponentScan(includeFilters = @Filter( |
正则
1 | @ComponentScan(includeFilters = @Filter( |
相关推荐
2021-03-13
yml中list写法
三更灯火五更鸡,正是男儿读书时。黑发不知勤学早,白首方悔读书迟。——颜真卿 之前写过一个springboot自定义配置 当时配置map使用的是这种方式 123456ruben: number: 4444 avatar: /img/oss/2020-06-01/head.jpg gender: male hobby: ["游戏","动漫","编程"] introduce: {"food": "blood","programLanguage": "java"} 这里hobby是一个List<String>,introduce是一个Map<String,String>,实际上我们可以使用如下写法 1234567891011ruben: number: 4444 avatar: /img/oss/2020-06-01/head.jpg gender: male hobby: -...
2022-04-21
在SpringBoot单元测试中添加参数
我的肩上是风,风上是闪烁的星群。——北岛《结局或开始·献给遇罗克》 当时是解决一个issue而去查阅的 https://github.com/baomidou/mybatis-plus/issues/4417 最后代码如下: 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566package com.ruben.mybatisplusissue;import javax.annotation.Resource;import org.junit.jupiter.api.Test;import org.junit.jupiter.api.extension.ExtendWith;import org.springframework.boot.SpringApplication;import org.springframework.boot.test.context.SpringBootCo...
2022-07-06
eclipse-collections
志向和热爱是伟大行为的双翼。——歌德 之前分享了vavr,今天在分享一个同类框架eclipse-collections 官方文档:http://www.eclipse.org/collections/ 1234567891011<dependency> <groupId>org.eclipse.collections</groupId> <artifactId>eclipse-collections-api</artifactId> <version>11.0.0</version></dependency><dependency> <groupId>org.eclipse.collections</groupId> <artifactId>eclipse-collections</artifactId> <version>11.0.0</version></dependency&...
2021-01-25
BindingException:Invalid bound statement not found
性格左右命运,气度影响格局。——余世雅博士 转,原文 解决:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): 在用maven配置mybatis环境时出现此BindingExceptiony异常,发现在classes文件下没有mapper配置文件,应该是maven项目没有扫描到mapper包下的xml文件,在pom.xml中加入一下代码可以解决: 123456789101112131415161718<build> <resources> <!-- maven项目中src源代码下的xml等资源文件编译进classes文件夹, 注意:如果没有这个,它会自动搜索resources下是否有mapper.xml文件, 如果没有就会报org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.pe...
2022-12-07
CompletableFuture事务处理
男人的盟誓是女人的陷阱——莎士比亚 使用CompletableFuture进行异步任务编排时,可能会有事务的支持需求,我们这里可以使用之前我写的手动回滚、提交事务进行处理 代码案例如下,所用框架stream-query: 首先是不加事务的 123456789101112131415161718192021222324252627282930313233package io.github.vampireachao.stream.plugin.mybatisplus;import io.github.vampireachao.stream.plugin.mybatisplus.pojo.po.UserInfo;import org.junit.jupiter.api.Assertions;import org.junit.jupiter.api.Test;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.boot.test.context.SpringB...
2022-10-26
PersistJobDataAfterExecution注解
心地善良的人、富于幻想的人比冷酷残忍的人更容易聚合——约翰逊 quartz之前我们也聊过了,今天说下这个注解org.quartz.PersistJobDataAfterExecution 一般和DisallowConcurrentExecution搭配使用 PersistJobDataAfterExecution表示Job执行结束后更新JobDataMap DisallowConcurrentExecution表示不允许并发执行 12345678910111213141516171819202122232425262728293031@Slf4j@DisallowConcurrentExecution@PersistJobDataAfterExecutionpublic class SettlementJob implements Job { /** * <p> * Called by the <code>{@link Scheduler}</code> when a <code&g...

阿超
我的名字叫阿超 年龄25岁 家在北京市 职业是软件开发 每天最晚也会在八点前回家 不抽烟 酒浅尝辄止 晚上十二点上床 保证睡足八个小时 睡前写一篇博客 再做二十分钟俯卧撑暖身 然后再睡觉 基本能熟睡到天亮 像婴儿一样不留下任何疲劳和压力 就这样迎来第二天的早晨 健康检查结果也显示我很正常 我想说明我是一个不论何时都追求内心平稳的人 不拘泥于胜负 不纠结于烦恼 不树立使我夜不能寐的敌人 这就是我在这社会的生活态度
Follow Me公告
This is my Blog