zoukankan      html  css  js  c++  java
  • Springboot2.x 启动报错:Bean named 'xxxService'... but was actually of type 'com.sun.proxy.$Proxy82'

    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>
    
  • 相关阅读:
    CCF-Python的内置函数们
    CCF2019-03-Python题解
    Find a Number (记忆化+BFS)
    LeetCode15:三数之和(双指针)
    LeetCode:不用加号的加法(位运算)
    剑指Offer43:1~n整数中1出现的次数(数位DP)
    LeetCode190:颠倒二进制(位运算分治! 时间复杂度O(1))
    LeetCode5716:好因子的最大数目(数学、快速幂)
    python学习笔记:python的字符串拼接效率分析
    LeetCode1806:还原排列的最少操作步数(置换群 or 模拟)
  • 原文地址:https://www.cnblogs.com/xiaocy66/p/10589267.html
Copyright © 2011-2022 走看看