springboot项目启动,报错, 截图如下:
从控制台日志看不出来错误的详细原因。
在log4j2配置文件中 将第三方的日志又过滤掉了
<!-- 第三方 logger -->
<logger name="com.alibaba.druid" level="warn" additivity="false">
</logger>
<logger name="org.springframework" level="warn" additivity="false">
</logger>
<logger name="org.hibernate" level="warn" additivity="false">
</logger>
<logger name="org.apache.ibatis" level="warn" additivity="false">
</logger>
<logger name="org.mybatis" level="warn" additivity="false">
</logger>
<logger name="druid.sql" level="debug" />
去掉上面的过滤, 这些详细的错误日志才能显示出来, 不然找不出错误原因, 其实就是controller中有重名的mapping,
Caused by: java.lang.IllegalStateException: Ambiguous mapping. Cannot map 'authController' method
public com.fshows.loan.result.ResultModel com.fshows.loan.controller.AuthController.approveBankCard222(com.fshows.loan.model.Form.ApproveBankCardForm,org.springframework.validation.BindingResult)
to {[/approve/approveBankCard],methods=[POST]}: There is already 'authController' bean method
例如:
@PostMapping("/approveBankCard")
public ResultModel approveBankCard(@Valid ApproveBankCardForm form, BindingResult result) {
if (result.hasErrors()) {
return ResultModel.ErrorMessage(result);
}
return authService.approveBankCard(form);
}
@PostMapping("/approveBankCard")
public ResultModel approveBankCard222(@Valid ApproveBankCardForm form, BindingResult result) {
if (result.hasErrors()) {
return ResultModel.ErrorMessage(result);
}
return authService.approveBankCard(form);
}