rain
2024-03-27 cf56db5a3340b2bb12b7ac55c69fa755320b9f71
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package com.dji.sample.component.oss.service.impl;
 
import com.dji.sample.component.oss.model.OssConfiguration;
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 OssAspectHandler {
 
    @Autowired
    private OssServiceContext ossServiceContext;
 
    @Before("execution(public * com.dji.sample.component.oss.service.impl.OssServiceContext.*(..))")
    public void before() {
        if (!OssConfiguration.enable) {
            throw new IllegalArgumentException("请启用OssConfiguration");
        }
        if (this.ossServiceContext.getOssService() == null) {
            throw new IllegalArgumentException("请检查OssConfiguration配置");
        }
        this.ossServiceContext.createClient();
    }
}