com.nepxion.discovery.plugin.test.automation.configuration.TestAutoConfiguration Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of discovery-plugin-test-starter-automation Show documentation
Show all versions of discovery-plugin-test-starter-automation Show documentation
Nepxion Discovery is a solution for Spring Cloud with blue green, gray, weight, limitation, circuit breaker, degrade, isolation, monitor, tracing, dye, failover, async agent
The newest version!
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();
}
}