![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
springboot
文章平均质量分 55
&露从今夜白
这个作者很懒,什么都没留下…
展开
-
Bean named ‘XXX‘ is expected to be of type ‘com.test.XXX‘ but was actually of type ‘com.sun.proxy.$P
在我们使用Spring声明式事务管理的途中,有可能会出现以下的异常:Bean named '' is expected to be of type '' but was actually of type 'com.sun.proxy.$Proxy30'造成这个错误的原因是注释@Transactional,Spring使一个代理AdminService在Runtime需要把类似@Autowired private UserServiceImpl userService;改为:@Aut原创 2022-05-12 09:53:19 · 2975 阅读 · 0 评论 -
mybatiesplus报错:basemapper为空(null)或者测试时注入不进去报null(隐蔽)
调试一直说basemapper为空,其实解决方案很简单,用注解而非new 构造;原因:注解注入是依赖注入,依赖会逐级传递,继承父级依赖,BaseMapper的实现你都看不到那他肯定是通过依赖注入xml实现功能的,你new就断层了,只能依赖传递传下来用他的方法;还有一种错误在测试的时候报错,但实际运行没事,比较隐蔽:就是在测试的时候,明明已经有注入层@Service,对象也是@Resource注解来的,却还是报null,不过这回不是basemapper的nul...原创 2022-05-11 00:53:10 · 4422 阅读 · 0 评论 -
class path resource [wxpay.properties] cannot be opened because it does not exist
后面就是这样一句话:nested exception is java.io.FileNotFoundException: class path resource [wxpay.properties] cannot be opened because it does not exist检查:对应的.properties的配置类是否关联配置文件@PropertySource("classpath:wxpay.properties") //读取配置文件@ConfigurationPrope..原创 2022-04-29 17:09:27 · 2117 阅读 · 7 评论 -
@Configuration注解的作用
1.@Configuration使用 官方文档描述: 用@Configuration注释类表明其主要目的是作为bean定义的源 @Configuration类允许通过调用同一类中的其他@Bean方法来定义bean之间的依赖关系代码示例: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 .转载 2022-04-28 19:26:30 · 1343 阅读 · 0 评论 -
Springboot中Bean的理解
一、Bean是什么1、Java面向对象,对象有方法和属性,那么就需要对象实例来调用方法和属性(即实例化);2、凡是有方法或属性的类都需要实例化,这样才能具象化去使用这些方法和属性;3、规律:凡是子类及带有方法或属性的类都要加上注册Bean到Spring IoC的注解;4、把Bean理解为类的代理或代言人(实际上确实是通过反射、代理来实现的),这样它就能代表类拥有该拥有的东西了5、我们都在微博上@过某某,对方会优先看到这条信息,并给你反馈,那么在Spring中,你标识一个@符号,那么Spr转载 2022-04-28 19:03:22 · 7406 阅读 · 0 评论