java.lang.IllegalStateException: Failed to load ApplicationContext

错误提示:

public java.lang.String com.zdnl.controlle.Users.UsersController.UpdateUser(javax.servlet.http.HttpSession,java.lang.String,java.lang.String)
to {POST /user/ufindbyph}: There is already ‘usersController’ bean method
public java.lang.String com.zdnl.controlle.Users.UsersController.uSelectByPhone(java.lang.String) mapped.

Caused by: java.lang.IllegalStateException: Ambiguous mapping. Cannot map ‘usersController’ method
public java.lang.String com.zdnl.controlle.Users.UsersController.UpdateUser(javax.servlet.http.HttpSession,java.lang.String,java.lang.String)
to {POST /user/ufindbyph}: There is already ‘usersController’ bean method
public java.lang.String com.zdnl.controlle.Users.UsersController.uSelectByPhone(java.lang.String) mapped.
发现问题:
1.
在这里插入图片描述
2.
在这里插入图片描述

解决方案:
@PostMapping两个请求路径相同了

java.lang.IllegalStateException: Failed to load ApplicationContext

报错提示:

java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘companyController’: Unsatisfied dependency expressed through field ‘companyService’; nested exception is org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named ‘companyService’ is expected to be of type ‘com.zdnl.service.CompanyService’ but was actually of type ‘com.sun.proxy.$Proxy79’
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.

2019-10-28 16:45:48.158 ERROR 6166 — [ main] o.s.test.context.TestContextManager : Caught exception while allowing TestExecutionListener [org.springframework.test.context.web.ServletTestExecutionListener@77659b30] to prepare test instance [com.zdnl.service.CompanyServiceTest@2e86807a]

原因:

在这里插入图片描述
就是它的原因,@EnableTransactionManagement 是 spring-tx 的注解,不是 spring-boot 的 spring-boot 会自动配置事务,相关的配置在->org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration
在自动配置类里已经写好了 @EnableTransactionManagement

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值