多模块spring注入处理
发表于|更新于
|浏览量:
踏破铁鞋无觅处,得来全不费功夫。——施耐庵
今天在搭建多模块项目时发现一个问题,其中一个公共依赖里需要注入的bean,注入不到字模块spring容器里去
最后在resources/META-INF/spring下面新建了org.springframework.boot.autoconfigure.AutoConfiguration.imports
内容为
1 | com.xxx.GlobalExceptionHandler |
手动指定要注入的bean搞定了
相关推荐
2020-09-21
java实现控制台打印进度条
我们自古以来,就有埋头苦干的人,有拼命硬干的人,有为民请命的人,有舍身求法的人……这都是中国的脊梁。——鲁迅 转载,原文 123456789101112131415public static void main(String[] args) { final long size = 1000L; for (int i = 0; i < 101; i++) { String tu = "▧"; for (int j = 0; j < i / 10; j++) { tu += "▧"; } System.out.print("\r当前进度:" + (i) + "%\t" + tu + "\t" + (i * 10) + "/" + size); try ...
2024-08-24
jdk未来特性可空运算符
人一辈子都在高潮——低潮中浮沉,唯有庸碌的人,生活才如死水一般。——傅雷 主要PR: 8338874: [lw5] add nullable types by vicente-romero-oracle · Pull Request #1219 · openjdk/valhalla · GitHub 对应的提交之一如下: https://github.com/openjdk/valhalla/commit/dbf4f49a57e30e0daa14541adc6a66ea51860182 大概如下: 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151...
2023-02-18
bean-searcher参数转换
即使在最丑的孩子身上,也有新鲜的东西,无穷的希望——罗曼·罗兰 昨天写了bean-searcher支持DbType为UNKNOWN的使用Converter 虽然解决了对应场景的问题: 前端传入枚举的name,数据库存储类型为tinyint,导致获取DbType为UNKNOWN,从而没有自定义进入Convertor的问题,虽然可以手动在枚举字段上加@DbField(type=DbType.INT)让其进入Converter,但是即便进入了Convertor,由于参数只有DbType为INT,以及实际的String类型的枚举name,导致仍然无法获取到其枚举对应类型,就拿不到name对应的枚举ordinal 但是由于距离发版还有一段时间,或者是低版本想要实现这个需求的场景,就得手动注入ParamResolver 了 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869impor...
2020-06-14
箭头函数
最近在代码中用到大量箭头函数,例如 12345result = page.stream().map(p -> { //这个p相当于list里的每一项,map需要return Map<String, Object> tempMap = BeanUtil.beanToMap(p); tempMap.put("isMeLikeHisProduct", StringUtils.isNotBlank(master.getUFavorite()) && master.getUFavorite().contains(p.getId())); return tempMap;}).collect(Collectors.toList()); //可以把return的结果收集起来,转换成一个新的list 以及 1234567productList.forEach(product -> { //这个product相当于list里的每一项,forEach不需要return if (p...
2024-08-25
apache-shenyu拉取swagger注册API文档功能升级swagger3
凡心所向,素履所往,生如逆旅,一苇以航。——《尘曲》 先上issue: [BUG] Can not startup shenyu-examples-http-swagger2 · Issue #5628 · apache/shenyu · GitHub pr: [Improve] [ISSUE #5628] Migrate Admin swagger from springfox to springdoc by VampireAchao · Pull Request #5630 · apache/shenyu · GitHub 这里主要是参考我之前写的 spring3 springfox报错Type javax.servlet.http.HttpServletRequest not present 以及按照文档里替换注解: https://springdoc.org/#google_vignette 比较棘手的是 https://github.com/apache/shenyu/pull/5630/files#diff-b5460fdf3947d08e58...
2024-03-27
stream-query开源合规
不好的书也像不好的朋友一样,可能把你戕害。——菲尔丁 首先是检查header的github action的ci 123456789101112131415161718192021222324252627282930313233343536373839404142# Licensed to the Apache Software Foundation (ASF) under one# or more contributor license agreements. See the NOTICE file# distributed with this work for additional information# regarding copyright ownership. The ASF licenses this file# to you under the Apache License, Version 2.0 (the# "License"); you may not use this file except in compliance# with...
