package com.battery.business.runtime; import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.List; import org.junit.jupiter.api.Test; import org.springframework.boot.env.YamlPropertySourceLoader; import org.springframework.core.io.ClassPathResource; /** * 默认启动不连接任何设备:没有配置来源时装配无设备实现,真实来源按适配器实例逐行配置。 * 这里锁定配置文件里的默认 profile,避免有人在配置里提前打开设备连接。 */ class DefaultSpringProfileContractTest { @Test void usesNoDeviceProfileByDefault() throws Exception { var sources = new YamlPropertySourceLoader().load("application", new ClassPathResource("application.yml")); Object profiles = sources.get(0).getProperty("spring.profiles.active"); assertEquals(List.of("druid"), List.of(String.valueOf(profiles).split(","))); } }