Springboot2.x 启动报错:Bean named 'xxxService'... but was actually of type 'com.sun.proxy.$Proxy82'

摘要:
Springboot2.0.5搭建一个新项目启动后报错:Beannamed'xxxService'...butwasactuallyoftype'com.sun.proxy.$Proxy82'C:Javajdk1.8.0_144injava.exe-XX:TieredStopAtLevel=1-noverify-Dspring.output.ansi.enabled=always-Dcom.sun

Springboot 2.0.5 搭建一个新项目启动后报错:Bean named 'xxxService'... but was actually of type 'com.sun.proxy.$Proxy82'

C:Javajdk1.8.0_144injava.exe -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote 
-Dcom.sun.management.jmxremote.port=12905 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=localhost -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true "-javaagent:C:JetBrainsIntelliJ IDEA 2018.2.2libidea_rt.jar=12906:C:JetBrainsIntelliJ IDEA 2018.2.2in" -Dfile.encoding=UTF-8 -classpath 
.......

  .   ____          _            __ _ _
 /\ / ___'_ __ _ _(_)_ __  __ _    
( ( )\___ | '_ | '_| | '_ / _` |    
 \/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.0.5.RELEASE)

2018-10-17 00:35:21,936 INFO (Jdk14Logger.java:87)- Root WebApplicationContext: initialization completed in 1464 ms
 _ _   |_  _ _|_. ___ _ |    _ 
| | |/|_)(_| | |_  |_)||_|_ 
     /               |         
                        3.0.5 
2018-10-17 00:35:22,328 WARN (Jdk14Logger.java:87)- Exception encountered during context initialization - cancelling refresh attempt: 
org.springframework.beans.factory.UnsatisfiedDependencyException: 
Error creating bean with name 'articleController': 
Unsatisfied dependency expressed through field 'articleService'; 
nested exception is org.springframework.beans.factory.BeanNotOfRequiredTypeException: 
Bean named 'articleService' is expected to be of type 'com.test.demo.elastic.service.impl.ArticleServiceImpl' 
but was actually of type 'com.sun.proxy.$Proxy82'

Process finished with exit code 1

后来想起pom.xml 文件中忘了加 aop 的依赖了…
pom.xml 中添加依赖:

  <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-aop</artifactId>
  </dependency>

免责声明:文章转载自《Springboot2.x 启动报错:Bean named 'xxxService'... but was actually of type 'com.sun.proxy.$Proxy82'》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇移动端-手机端-日历选择控件(支持Zepto和JQuery)Android 隐藏输入法键盘下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

CAS 单点登陆

一、Tomcat配置SSL 1. 生成 server key 以命令方式换到目录%TOMCAT_HOME%,在command命令行输入如下命令:keytool -genkey -alias tomcat_key -keyalg RSA -storepass changeit -keystore server.keystore -validity 3600...

获取Spring容器中Bean实例的工具类(Java泛型方法实现)

在使用Spring做IoC容器的时候,有的类不方便直接注入bean,需要手动获得一个类型的bean。 因此,实现一个获得bean实例的工具类,就很有必要。 以前,写了一个根据bean的名称和类型获取bean实例的2个工具方法,发现每次调用后,都需要强制转换成目标结果类型。 这样很不方便,突然想到可以使用Java泛型方法,实现1个新的工具方法,避免了类型转换...

@ConfigurationProperties 配置详解

文章转自 https://blog.csdn.net/qq_26000415/article/details/78942494 前言新的一年到了,在这里先祝大家新年快乐.我们在上一篇spring boot 源码解析12-servlet容器的建立 中 分析 ServerProperties时,发现其类上有@ConfigurationProperties 注解...

Java各种反射性能对比

对各种方法实现get方法的性能进行了一个测试。 总共有5个测试,,每个测试都是执行1亿次 1. 直接通过Java的get方法 2.通过高性能的ReflectAsm库进行测试 3.通过Java Class类自带的反射获得Method测试 4.使用Java自带的Property类获取Method测试 5.BeanUtils的getProperty测试 1 测试...

spring属性配置执行过程,单列和原型区别

  Spring配置中,采用属性注入时,当创建IOC容器时,也直接创建对象,并且执行相对应的setter方法 Student.java 1 package com.scope; 2 3 public class Student { 4 private String name; 5 private String number;...

在Spring中配置Hibernate事务

     本文主要探讨怎么用Spring来装配组件及其事务管理。在J2EE工程里连接到一个简单的数据库并不是什么难题,但是如果要综合组装企业类的组件就变得复杂了。一个简单的组件有一个或多个数据库支撑,所以,我们说到整合两个或多个的组件时,我们希望能够维持跨组件的许多数据库的运作的原子性。   J2EE提供了这些组件的容器,可以保证处理的原子性和独立性。在没...