Spring使用@EnableScheduling在类级别注释

时间:2019-06-11 12:48:00

标签: java spring spring-scheduled

我有一个具有进行异步调用功能的服务类。下面提供了代码

@Service
public class EllaService {

    @Async
    public void invokeEllaAsync( final IrisBo irisBo ) throws EllaGatewayUnsuccessfulResponseException {

        if( !isTrafficIgnored( irisBo ) ) {
            try {
                callEllaService( irisBo );
            }
            catch( EllaGatewayUnsuccessfulResponseException ex ) {
                throw new EllaGatewayUnsuccessfulResponseException( ex.getMessage(), ex.getCause() );
            }

        }
    }
}

我需要在班级使用@EnableScheduling进行注释吗?