<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:p="http://www.springframework.org/schema/p"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/tx
        http://www.springframework.org/schema/tx/spring-tx.xsd
        http://www.springframework.org/schema/aop
        http://www.springframework.org/schema/aop/spring-aop.xsd
        http://dubbo.apache.org/schema/dubbo
        http://dubbo.apache.org/schema/dubbo/dubbo.xsd">

    <context:component-scan base-package="com.itheima"></context:component-scan>

    <context:property-placeholder location="classpath:config/jdbc.properties"></context:property-placeholder>

    <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource">
        <property name="url" value="${url_item}"/>
        <property name="driverClassName" value="${driverClassName_item}"/>
        <property name="username" value="${username_item}"/>
        <property name="password" value="${password_item}"/>
    </bean>

    <bean id="sqlSessionFactoryBean" class="org.mybatis.spring.SqlSessionFactoryBean">
        <property name="dataSource" ref="dataSourceProxy"></property>
        <property name="typeAliasesPackage" value="com.itheima.domain"></property>
    </bean>

    <bean id="mapperScanner" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
        <property name="basePackage" value="com.itheima.dao"></property>
    </bean>


    <dubbo:application name="seata-tcc-inventoryservice"/>

    <dubbo:registry protocol="zookeeper" address="localhost:2181"/>

    <dubbo:protocol name="dubbo" port="20885"
                    server="netty"
                    charset="UTF-8" threadpool="fixed" threads="500"
                    queues="0" buffer="8192" accepts="0" payload="8388608" />
    <dubbo:annotation package="com.itheima.service"/>

    <!--注入全局事务管理器-->
    <bean class="io.seata.spring.annotation.GlobalTransactionScanner">
        <constructor-arg value="seata-tcc-inventoryservice"/>
        <constructor-arg value="my_test_tx_group"/>
    </bean>

    <!--代理数据源-->
    <bean id="dataSourceProxy" class="io.seata.rm.datasource.DataSourceProxy">
        <!--注入当前(被代理的)数据源-->
        <constructor-arg ref="dataSource" />
    </bean>

    <!--配置undolog解析器-->
    <bean id="undoLogParser" class="io.seata.rm.datasource.undo.parser.JacksonUndoLogParser"></bean>
</beans>
