
com.nepxion.discovery.plugin.test.automation.configuration.TestAutoConfiguration Maven / Gradle / Ivy
package com.nepxion.discovery.plugin.test.automation.configuration;
/**
* Title: Nepxion Discovery
* Description: Nepxion Discovery
* Copyright: Copyright (c) 2017-2050
* Company: Nepxion
* @author Haojun Ren
* @version 1.0
*/
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.ConfigurableEnvironment;
import com.nepxion.discovery.common.exception.DiscoveryException;
import com.nepxion.discovery.plugin.test.automation.aop.TestAutoScanProxy;
import com.nepxion.discovery.plugin.test.automation.aop.TestInterceptor;
import com.nepxion.discovery.plugin.test.automation.constant.TestConstant;
import com.nepxion.discovery.plugin.test.automation.operation.TestOperation;
@Configuration
public class TestAutoConfiguration {
@Autowired
private ConfigurableEnvironment environment;
@Bean
public TestAutoScanProxy testAutoScanProxy() {
String scanPackages = environment.getProperty(TestConstant.SPRING_APPLICATION_TEST_SCAN_PACKAGES);
if (StringUtils.isEmpty(scanPackages)) {
throw new DiscoveryException(TestConstant.SPRING_APPLICATION_TEST_SCAN_PACKAGES + "'s value can't be empty");
}
return new TestAutoScanProxy(scanPackages);
}
@Bean
public TestInterceptor testInterceptor() {
String scanPackages = environment.getProperty(TestConstant.SPRING_APPLICATION_TEST_SCAN_PACKAGES);
if (StringUtils.isEmpty(scanPackages)) {
throw new DiscoveryException(TestConstant.SPRING_APPLICATION_TEST_SCAN_PACKAGES + "'s value can't be empty");
}
return new TestInterceptor();
}
@Bean
public TestOperation testOperation() {
return new TestOperation();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy