Created
July 20, 2025 19:16
-
-
Save arleighdickerson/e702b9d1beeea70607b400878150044e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import io.arleigh.gantry.ServicesApplication; | |
import lombok.RequiredArgsConstructor; | |
import org.redisson.api.RedissonClient; | |
import org.redisson.spring.transaction.RedissonTransactionManager; | |
import org.springframework.beans.factory.annotation.Qualifier; | |
import org.springframework.context.annotation.AdviceMode; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; | |
import org.springframework.context.annotation.Primary; | |
import org.springframework.jdbc.datasource.DataSourceTransactionManager; | |
import org.springframework.transaction.annotation.EnableTransactionManagement; | |
import javax.sql.DataSource; | |
@RequiredArgsConstructor | |
@Configuration | |
@EnableTransactionManagement(mode = AdviceMode.ASPECTJ, proxyTargetClass = ServicesApplication.PROXY_TARGET_CLASS) | |
class TransactionManagementConfig // implements TransactionManagementConfigurer { | |
{ | |
private final DataSource dataSource; | |
private final RedissonClient redisson; | |
@Bean | |
@Qualifier("redis") | |
public RedissonTransactionManager redissonTransactionManager() { | |
return new RedissonTransactionManager(redisson); | |
} | |
@Bean | |
@Primary | |
public DataSourceTransactionManager transactionManager() { | |
return new DataSourceTransactionManager(dataSource); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment