Unverified Commit 2678420a authored by zhaojun's avatar zhaojun Committed by GitHub
Browse files

Merge pull request #164 from cherrylzhao/dev

migrate spi-impl association example to spi-impl-example.
parents c1505d1a e70b288a
Loading
Loading
Loading
Loading
+0 −25
Original line number Diff line number Diff line
@@ -77,11 +77,6 @@
                <artifactId>sharding-transaction-xa-core</artifactId>
                <version>${project.parent.version}</version>
            </dependency>
            <dependency>
                <groupId>io.shardingsphere</groupId>
                <artifactId>sharding-transaction-base-saga</artifactId>
                <version>${sharding-sphere.spi.impl.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.shardingsphere</groupId>
                <artifactId>sharding-transaction-base-seata-at</artifactId>
@@ -107,26 +102,6 @@
                <artifactId>sharding-jdbc-orchestration-spring-namespace</artifactId>
                <version>${sharding-sphere.version}</version>
            </dependency>
            <dependency>
                <groupId>io.shardingsphere</groupId>
                <artifactId>sharding-transaction-jdbc-spring</artifactId>
                <version>${sharding-sphere.spi.impl.version}</version>
            </dependency>
            <dependency>
                <groupId>io.shardingsphere</groupId>
                <artifactId>sharding-transaction-proxy-spring</artifactId>
                <version>${sharding-sphere.spi.impl.version}</version>
            </dependency>
            <dependency>
                <groupId>io.shardingsphere</groupId>
                <artifactId>sharding-transaction-jdbc-spring-boot-starter</artifactId>
                <version>${sharding-sphere.spi.impl.version}</version>
            </dependency>
            <dependency>
                <groupId>io.shardingsphere</groupId>
                <artifactId>sharding-transaction-proxy-spring-boot-starter</artifactId>
                <version>${sharding-sphere.spi.impl.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.shardingsphere</groupId>
                <artifactId>sharding-orchestration-reg-zookeeper-curator</artifactId>
+2 −3
Original line number Diff line number Diff line
@@ -12,9 +12,8 @@
    <packaging>pom</packaging>

    <modules>
        <module>transaction-2pc-xa-example</module>
        <module>transaction-base-saga-example</module>
        <module>transaction-base-seata-example</module>
        <module>transaction-2pc-xa-raw-jdbc-example</module>
        <module>transaction-base-seata-raw-jdbc-example</module>
    </modules>

</project>
+0 −19
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.apache.shardingsphere.example</groupId>
        <artifactId>transaction-example</artifactId>
        <version>4.0.0-RC2-SNAPSHOT</version>
    </parent>
    <artifactId>transaction-2pc-xa-example</artifactId>
    <packaging>pom</packaging>

    <modules>
        <module>transaction-xa-raw-jdbc-example</module>
        <module>transaction-xa-spring-namespace-example</module>
        <module>transaction-xa-spring-boot-example</module>
    </modules>
</project>
+0 −41
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.apache.shardingsphere.example</groupId>
        <artifactId>transaction-2pc-xa-example</artifactId>
        <version>4.0.0-RC2-SNAPSHOT</version>
    </parent>

    <artifactId>transaction-xa-spring-boot-example</artifactId>

    <dependencies>
        <dependency>
            <groupId>org.apache.shardingsphere.example</groupId>
            <artifactId>repository-jpa</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.shardingsphere</groupId>
            <artifactId>sharding-transaction-xa-core</artifactId>
        </dependency>
        <dependency>
            <groupId>io.shardingsphere</groupId>
            <artifactId>sharding-transaction-jdbc-spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.shardingsphere</groupId>
            <artifactId>sharding-jdbc-spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
        </dependency>
    </dependencies>
</project>
+0 −46
Original line number Diff line number Diff line
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.shardingsphere.example.transaction.xa.spring.boot;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;

@ComponentScan({"org.apache.shardingsphere.example"})
@EntityScan(basePackages = "org.apache.shardingsphere.example.common.jpa.entity")
@SpringBootApplication
public class SpringBootExample {
    
    public static void main(final String[] args) {
        try (ConfigurableApplicationContext applicationContext = SpringApplication.run(SpringBootExample.class, args)) {
            processXATransaction(applicationContext);
        }
    }
    
    private static void processXATransaction(final ConfigurableApplicationContext applicationContext) {
        XATransactionalService transactionalService = applicationContext.getBean(XATransactionalService.class);
        transactionalService.processSuccess();
        try {
            transactionalService.processFailure();
        } catch (final Exception ex) {
            transactionalService.printData();
        }
    }
}
Loading