PC
2024-03-30 e46f64d9f9f26531af2104afd2c46ec6b05c430c
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package com.qianwen.core.scanner.config;
 
import com.qianwen.core.scanner.config.properties.ScannerProperties;
import com.qianwen.core.scanner.modular.ApiResourceScanner;
import com.qianwen.core.scanner.modular.constants.ConfigPrefixConstants;
import com.qianwen.core.scanner.modular.factory.ApiResourceFactory;
import com.qianwen.core.scanner.modular.factory.DefaultApiResourceFactory;
import com.qianwen.core.scanner.modular.listener.ResourceReportListener;
import com.qianwen.core.scanner.modular.service.ResourceCollectService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;
 
@Configuration
@EnableAsync
/* loaded from: blade-starter-scanner-9.3.0.0-SNAPSHOT.jar:org/springblade/core/scanner/config/ScannerAutoConfiguration.class */
public class ScannerAutoConfiguration {
    @Value("${spring.application.name}")
    private String applicationName;
 
    @ConfigurationProperties(prefix = ConfigPrefixConstants.SCANNER_PREFIX)
    @Bean
    public ScannerProperties scannerProperties() {
        return new ScannerProperties();
    }
 
    @Bean
    public ApiResourceFactory apiResourceFactory() {
        return new DefaultApiResourceFactory();
    }
 
    @ConditionalOnProperty(prefix = ConfigPrefixConstants.SCANNER_PREFIX, name = {"open"}, havingValue = "true")
    @Bean
    public ResourceCollectService resourceCollectService(ApiResourceFactory apiResourceFactory, ScannerProperties scannerProperties) {
        return new ResourceCollectService(apiResourceFactory, scannerProperties);
    }
 
    @ConditionalOnProperty(prefix = ConfigPrefixConstants.SCANNER_PREFIX, name = {"open"}, havingValue = "true")
    @Bean
    public ApiResourceScanner apiResourceScaner(ApiResourceFactory apiResourceFactory, ScannerProperties scannerProperties) {
        return new ApiResourceScanner(apiResourceFactory, scannerProperties, this.applicationName);
    }
 
    @ConditionalOnProperty(prefix = ConfigPrefixConstants.SCANNER_PREFIX, name = {"open"}, havingValue = "true")
    @Bean
    public ResourceReportListener resourceReportListener(ScannerProperties scannerProperties) {
        return new ResourceReportListener(scannerProperties, this.applicationName);
    }
}