spring-boot 启动时候 出现异常:The bean 'xxx' could not be injected as a 'xx.xxxx' because it is a JDK dynamic proxy that implements:

The bean ‘xxxService‘ could not be injected as a ‘AaaXxxService‘ because it is a JDK dynamic proxy that implements: 

Action:  

Consider injecting the bean as one of its interfaces or forcing the use of CGLib-based proxies by setting proxyTargetClass=true on @EnableAsync and/or @EnableCaching.

查了半天,原来是因为把 @Autowired 换成了 @Resource

以前的代码是

@Autowired
private AaaXxxService xxxService;

修改后的代码

@Resource
private AaaXxxService xxxService;

这样就报错了。。

主要问题是名字和类名不一样导致 Resource 注入失败,但是刚好又有一个 xxxService 同名的类存在,就会报这个错误

解决方法就是 名字改成和类一样

@Resource
private AaaXxxService aaaXxxService;

spring-boot 启动时候 出现异常:The bean 'xxx' could not be injected as a 'xx.xxxx' because it is a JDK dynamic proxy that implements:

原文地址:https://www.cnblogs.com/romicLord/p/8664198.html

时间: 2024-11-09 03:05:32

spring-boot 启动时候 出现异常:The bean 'xxx' could not be injected as a 'xx.xxxx' because it is a JDK dynamic proxy that implements:的相关文章

spring Boot启动报错Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotatedElementUtils.getAnnotationAttributes

spring boot 启动报错如下 org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure

Spring Boot启动原理解析

Spring Boot启动原理解析http://www.cnblogs.com/moonandstar08/p/6550758.html 前言 前面几章我们见识了SpringBoot为我们做的自动配置,确实方便快捷,但是对于新手来说,如果不大懂SpringBoot内部启动原理,以后难免会吃亏.所以这次博主就跟你们一起一步步揭开SpringBoot的神秘面纱,让它不在神秘. 正文 我们开发任何一个Spring Boot项目,都会用到如下的启动类 从上面代码可以看出,Annotation定义(@Sp

spring boot启动原理步骤分析

spring boot最重要的三个文件:1.启动类 2.pom.xml 3.application.yml配置文件 一.启动类->main方法 1.spring boot通过fat jar方式用jdk命令java -jar jarname.jar启动的. fat jar就是包含被引用jar包的jar,因为会包含很多jar包,所以称为fat,肥胖. 2.spring  boot通过static void main方法启动,main方法是java程序总是最先运行的地方,这个是由jvm虚拟机决定的.任

Spring Boot启动过程(四):Spring Boot内嵌Tomcat启动

之前在Spring Boot启动过程(二)提到过createEmbeddedServletContainer创建了内嵌的Servlet容器,我用的是默认的Tomcat. private void createEmbeddedServletContainer() { EmbeddedServletContainer localContainer = this.embeddedServletContainer; ServletContext localServletContext = getServ

Spring Boot启动过程及回调接口汇总

Spring Boot启动过程及回调接口汇总 链接: https://www.itcodemonkey.com/article/1431.html 来自:chanjarster (Daniel Qian) 注:本文基于spring-boot 1.4.1.RELEASE, spring 4.3.3.RELEASE撰写. 启动顺序 Spring boot的启动代码一般是这样的: 1 2 3 4 5 6 @SpringBootApplication public class SampleApplica

Spring Boot 报错:Error creating bean with name 'entityManagerFactory' defined in class path resource

spring boot 写一个web项目,在使用spring-data-jpa的时候,启动报如下错误: Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.2018-04-02 17:00:47.076 ERROR 4648 --- [ main] o.s.boot.SpringApplication : A

Spring Boot启动过程(三)

我已经很精简了,两篇(Spring Boot启动过程(一).pring Boot启动过程(二))依然没写完,接着来. refreshContext之后的方法是afterRefresh,这名字起的真...好.afterRefresh方法内只调用了callRunners一个方法,这个方法从上下文中获取了所有的ApplicationRunner和CommandLineRunner接口的实现类,并执行这些实现类的run方法.例如Spring Batch的JobLauncherCommandLineRun

Spring Boot 启动(二) 配置详解

Spring Boot 启动(二) 配置详解 Spring 系列目录(https://www.cnblogs.com/binarylei/p/10198698.html) Spring Boot 配置文件加载顺序 Spring Boot 配置文件加载分析 - ConfigFileApplicationListener 一.Spring Framework 配置 略... 二.Spring Boot 配置 2.1 随机数配置 name.value=${random.int} name.int=${

Spring Boot 启动(四) EnvironmentPostProcessor

Spring Boot 启动(四) EnvironmentPostProcessor Spring 系列目录(https://www.cnblogs.com/binarylei/p/10198698.html) Spring Boot 配置使用 Spring Boot 配置文件加载流程分析 - ConfigFileApplicationListener Spring Boot 配置文件加载 - EnvironmentPostProcessor 一.EnvironmentPostProcessor