package com.battery.business.runtime; import java.util.List; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; import org.springframework.scheduling.annotation.EnableScheduling; import com.battery.device.api.NoopDeviceAdapterFactory; import com.battery.device.bts.BtsDeviceAdapterFactory; import com.battery.device.api.registry.DeviceAdapterRegistry; /** 装配单进程设备适配器运行时。 */ @Configuration @EnableScheduling public class DeviceAdapterRuntimeConfig { @Bean(destroyMethod = "close") @Profile("!dev-simulator & !bts") public DeviceAdapterRegistry noopDeviceAdapterRegistry() { return new DeviceAdapterRegistry(List.of(new NoopDeviceAdapterFactory())); } @Bean(destroyMethod = "close") @Profile({ "dev-simulator", "bts" }) public DeviceAdapterRegistry deviceAdapterRegistry() { return new DeviceAdapterRegistry(List.of(new BtsDeviceAdapterFactory())); } }