flypangzhi opened a new issue #5171: ShardingTransactionType cannot be resolved 
to a type
URL: https://github.com/apache/incubator-shardingsphere/issues/5171
 
 
   ## Question
   I configured XA transactions as documented, but the ShardingTransactionType 
cannot be resolved to a type
   
   ## Version
   ```
   springboot 2.0.6.RELEASE
   mybatis-plus-boot-starter 3.1.0
   sharding-jdbc-spring-boot-starter 4.0.0-RC1
   sharding-transaction-xa-core 4.0.0-RC1
   ```
   
   ## pom.xml
   <!--shardingsphere依赖-->
           <dependency>
               <groupId>org.apache.shardingsphere</groupId>
               <artifactId>sharding-jdbc-spring-boot-starter</artifactId>
               <version>${sharding-jdbc-spring-boot-starter.version}</version>
           </dependency>
           <!-- 使用XA事务时,需要引入此模块 -->
                <dependency>
                    <groupId>org.apache.shardingsphere</groupId>
                    <artifactId>sharding-transaction-xa-core</artifactId>
                    <version>${shardingsphere.version}</version>
                </dependency>
   
   ## TransactionConfiguration.java
   ```
   @Configuration
   @EnableTransactionManagement
   public class TransactionConfiguration {
   
       @Bean
       public PlatformTransactionManager txManager(final DataSource dataSource) 
{
           return new DataSourceTransactionManager(dataSource);
       }
   
       @Bean
       public JdbcTemplate jdbcTemplate(final DataSource dataSource) {
           return new JdbcTemplate(dataSource);
       }
   }
   ```
   
   ## error Method
   ```
    @PostMapping("/xaManage")
       @Transactional
       @ShardingTransactionType(TransactionType.XA)  // ShardingTransactionType 
cannot be resolved to a type
       public ResponseData<?> xaManage(TabUser tabUser) {
           tabUserService.save(tabUser);
           int i = 5 / 0;
           return ResponseData.out(CodeEnum.SUCCESS, tabUser.getId());
       }
   ```
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to