错误提示:
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