此版本仍在开发中,尚未被视为稳定版本。对于最新的稳定版本,请使用 Spring Integration 6.3.1Spring中文文档

此版本仍在开发中,尚未被视为稳定版本。对于最新的稳定版本,请使用 Spring Integration 6.3.1Spring中文文档

提供的每个组件都使用该类,而该类又使用接口的实现。 运行方式类似于典型的数据访问对象 (DAO),并提供 find、persist、executeUpdate 等方法。 对于大多数用例,默认实现 () 就足够了。 但是,如果需要自定义行为,则可以指定自己的实现。o.s.i.jpa.core.JpaExecutoro.s.i.jpa.core.JpaOperationsJpaOperationso.s.i.jpa.core.DefaultJpaOperationsSpring中文文档

若要初始化 ,必须使用接受以下项之一的构造函数之一:JpaExecutorSpring中文文档

以下示例演示如何使用 an 初始化 a 并在出站网关中使用它:JpaExecutorentityManagerFactorySpring中文文档

@Bean
public JpaExecutor jpaExecutor() {
    JpaExecutor executor = new JpaExecutor(this.entityManagerFactory);
    executor.setJpaParameters(Collections.singletonList(new JpaParameter("firstName", null, "#this")));
    executor.setUsePayloadAsParameterSource(true);
    executor.setExpectSingleResult(true);
    return executor;
}

@ServiceActivator(inputChannel = "getEntityChannel")
@Bean
public MessageHandler retrievingJpaGateway() {
    JpaOutboundGateway gateway = new JpaOutboundGateway(jpaExecutor());
    gateway.setGatewayType(OutboundGatewayType.RETRIEVING);
    gateway.setOutputChannelName("resultsChannel");
    return gateway;
}