我有一个配置类,@ConfigurationProperties如下所示。我可以systemConfigMap从类中的 application.yaml进行填充,MyConfig如下所示
@ConfigurationProperties(prefix = "my-config")
@ConstructorBinding
@AllArgsConstructor
public class MyConfig {
/**
* A Configuration Map of multiple Systems
*/
private Map<String, SystemConfig> systemConfigMap;
}
主要课程为
@EnableConfigurationProperties(MyConfig.class)
public class SpringApp {
public static void main(String[] args) {
SpringApplication.run(SpringApp.class, args);
}
}
问题是生成的 bean 名称是my-config-a.b.c.config.MyConfig,我无法在payload-expressionon中使用spring integration http inbound gateway它,我猜是因为它里面有“-”。
如何为生成的 bean 指定 bean 名称MyConfig?
编辑:HTTP 网关配置
<int:channel id="myConfigListChannel" />
<int-http:inbound-gateway request-channel="myConfigListChannel"
path="/data"
error-channel="errorChannel"
supported-methods="GET"
payload-expression="@my-config-a.b.c.config.MyConfig.getSystemConfigMap().values()"
/>
我想在请求开始处理流程systemConfigMap时加载这些值。/data