Springboot的AOP不生效

xiaoxiao2021-02-28  100

最新写的webservice用aop写日期和数据库,但是一直不生效.最后查明

在webservice注册时,在实例化Endpoint时,是用的new方法实例话ws,而不是用spring托管的ws

问题代码:

@Bean public Endpoint endpointCreateContract() { EndpointImpl endpoint = new EndpointImpl(springBus(), new CreateContractWS()); endpoint.publish("/createContract"); return endpoint; }

修复后代码

@Bean public CreateContractWS createContract() { return new CreateContractWS(); } @Bean public Endpoint endpointCreateContract() { EndpointImpl endpoint = new EndpointImpl(springBus(), createContract()); endpoint.publish("/createContract"); return endpoint; }

转载请注明原文地址: https://www.6miu.com/read-36428.html

最新回复(0)