package com.ard.ossdock.service.impl; import com.ard.ossdock.config.OssDockConfiguration; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; /** * @author sean * @version 1.1 * @date 2022/6/20 */ @Component @Aspect public class OssDockAspectHandler { @Autowired private OssDockServiceContext ossDockServiceContext; @Before("execution(public * com.ard.ossdock.service.impl.OssDockServiceContext.*(..))") public void before() { if (!OssDockConfiguration.enable) { throw new IllegalArgumentException("Please enable OssConfiguration."); } if (this.ossDockServiceContext.getOssService() == null) { throw new IllegalArgumentException("Please check the OssConfiguration configuration."); } this.ossDockServiceContext.createClient(); } }