<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd">
  <context:property-placeholder/>
  <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="com.mysql.cj.jdbc.Driver"/>
    <property name="url" value="${u38.saga.jdbc.url}"/>
    <property name="username" value="${u38.saga.jdbc.user}"/>
    <property name="password" value="${u38.saga.jdbc.password}"/>
  </bean>
  <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate"><constructor-arg ref="dataSource"/></bean>
  <bean id="inventoryService" class="study.saga.InventoryService"><constructor-arg ref="jdbcTemplate"/></bean>
  <bean id="stateMachineEngine" class="org.apache.seata.saga.engine.impl.ProcessCtrlStateMachineEngine">
    <property name="stateMachineConfig" ref="dbStateMachineConfig"/>
  </bean>
  <bean id="dbStateMachineConfig" class="org.apache.seata.saga.engine.config.DbStateMachineConfig">
    <property name="dataSource" ref="dataSource"/>
    <property name="resources" value="saga/statelang/*.json"/>
    <property name="enableAsync" value="false"/>
    <property name="applicationId" value="u38-saga-demo"/>
    <property name="txServiceGroup" value="u38_tx_group"/>
    <property name="sagaBranchRegisterEnable" value="false"/>
    <property name="sagaJsonParser" value="jackson"/>
  </bean>
</beans>
