Guest User

Untitled

a guest
Apr 7th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. <parent>
  2. <groupId>org.springframework.boot</groupId>
  3. <artifactId>spring-boot-starter-parent</artifactId>
  4. <version>1.5.10.RELEASE</version>
  5. </parent>
  6. <dependency>
  7. <groupId>org.springframework.integration</groupId>
  8. <artifactId>spring-integration-core</artifactId>
  9. </dependency>
  10. <dependency>
  11. <groupId>org.springframework.integration</groupId>
  12. <artifactId>spring-integration-jdbc</artifactId>
  13. </dependency>
  14.  
  15. @Configuration
  16. public class LeaderElectionConfiguration {
  17.  
  18. @Bean
  19. public LockRegistry lockRegistry(LockRepository lockRepository) {
  20. return new JdbcLockRegistry(lockRepository);
  21. }
  22.  
  23. @Bean
  24. public DefaultLockRepository lockRepository(DataSource dataSource) {
  25. return new DefaultLockRepository(dataSource);
  26. }
  27.  
  28. @Bean
  29. public LockRegistryLeaderInitiator leaderInitiator(LockRegistry lockRegistry) {
  30. LockRegistryLeaderInitiator lockRegistryLeaderInitiator = new LockRegistryLeaderInitiator(lockRegistry);
  31. lockRegistryLeaderInitiator.start();
  32. return lockRegistryLeaderInitiator;
  33. }
  34.  
  35. spring:
  36. datasource:
  37. initialize: false
  38. url: jdbc:mysql://localhost:3306/whatever
  39. username: admin
  40. password: adminpw
  41. driver-class-name: com.mysql.cj.jdbc.Driver
Add Comment
Please, Sign In to add comment