yeg
2026-09-09 9e332b9ea5f0866cf7ac03db5736d10469e5ed4a
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
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()));
    }
 
}