pom.xml的版本信息工作:春天@Aspect不能swagger2
- springfox-swagger2:2.5.0
- 招摇核心:1.5.10
- springfox-招摇的用户界面:2.6 0.1
- springboot:1.5.3
我有swagger2和springboot项目。
没有@Aspect的项目代码工作得很好。代码如下所示。
public interface TestApi {
WfExecution test(Long temp);
}
@Api(value = "TestAPI")
@RequestMapping(value = "/test")
@RestController
public class TestApiImpl implements TestApi {
@Override
@RequestMapping(value = "/test")
@ApiOperation(value = "", notes = "", produces = MediaType.APPLICATION_JSON)
public WfExecution test(@ApiParam(value = "", required = true) @RequestParam(required = true, value = "temp")
Long temp) {
return new WfExecution();
}
}
正确的结果:
但当我增加以下代码,招摇的用户界面不显示测试API-implement执行。
@Aspect
@Component
public class LoggerAop {
@Before("execution(* com.XXX.controller.impl.TestApiImpl.*(..))")
public void doBeforeAdvice(JoinPoint joinPoint){
System.out.println("XXX");
}
}
的错误结果:
有招摇和Spring AOP之间的冲突?
我使用Springfox的spring AOP。从来没有任何问题。 –
在webUi中,我发现webUi中有一个代理类。它的方法与TestApi类的方法相同。 https://github.com/springfox/springfox/issues/2050 – egg