ScheduleTestApp.java 2.03 KB
package com.bsth.service.schedule;

import com.bsth.service.schedule.impl.SchedulePlanRuleResultServiceImpl;
import com.bsth.service.schedule.impl.SchedulePlanServiceImpl;
import com.bsth.service.schedule.rules.MyDroolsConfiguration;
import com.bsth.service.schedule.utils.DataToolsServiceImpl;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.orm.jpa.EntityScan;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;

/**
 * 基础测试类(用于计划调度模块测试测试)。
 * 配置计划调度的模块的用到的entity,repository,service
 *
 * 注意:测试环境下测试类 TestApp 和springdata的类不在统一级包里,必须指定EnableJpaRepositories
 */
@Configuration
@EntityScan(
        basePackages = {"com.bsth.entity"}
)
@ComponentScan(
        basePackages = {"com.bsth.repository", "com.bsth.service"},
        useDefaultFilters = false,
        includeFilters = {
                @ComponentScan.Filter(
                        type = FilterType.ASSIGNABLE_TYPE,
                        value = SchedulePlanRuleResultServiceImpl.class
                ),
                @ComponentScan.Filter(
                        type = FilterType.ASSIGNABLE_TYPE,
                        value = SchedulePlanServiceImpl.class
                ),
                @ComponentScan.Filter(
                        type = FilterType.ASSIGNABLE_TYPE,
                        value = MyDroolsConfiguration.class
                ),
                @ComponentScan.Filter(
                        type = FilterType.ASSIGNABLE_TYPE,
                        value = DataToolsServiceImpl.class
                )
        }
)
@EnableJpaRepositories(
        basePackages = {"com.bsth.repository"}
)
@SpringBootApplication
public class ScheduleTestApp {
}