SHARE
TWEET

Untitled

a guest Aug 24th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import io.r2dbc.mssql.MssqlConnectionConfiguration;
  2. import io.r2dbc.mssql.MssqlConnectionFactory;
  3. import io.r2dbc.spi.ConnectionFactory;
  4. import org.springframework.context.annotation.Bean;
  5. import org.springframework.context.annotation.Configuration;
  6. import org.springframework.data.r2dbc.config.AbstractR2dbcConfiguration;
  7.  
  8. import javax.annotation.ParametersAreNonnullByDefault;
  9.  
  10. @Configuration
  11. @ParametersAreNonnullByDefault
  12. public class R2dbcConfig extends AbstractR2dbcConfiguration {
  13.  
  14.     private final R2dbcProperties r2dbcProperties;
  15.  
  16.     public R2dbcConfig(R2dbcProperties r2dbcProperties) {
  17.         this.r2dbcProperties = r2dbcProperties;
  18.     }
  19.  
  20.     @Bean
  21.     @Override
  22.     public ConnectionFactory connectionFactory() {
  23.         MssqlConnectionConfiguration configuration = MssqlConnectionConfiguration.builder()
  24.                 .host(r2dbcProperties.getHost())
  25.                 .username(r2dbcProperties.getUsername())
  26.                 .password(r2dbcProperties.getPassword())
  27.                 .database(r2dbcProperties.getDatabase())
  28.                 .build();
  29.         return new MssqlConnectionFactory(configuration);
  30.     }
  31.  
  32. //    @Bean
  33. //    ReactiveTransactionManager transactionManager(ConnectionFactory connectionFactory) {
  34. //        return new R2dbcTransactionManager(connectionFactory);
  35. //    }
  36.  
  37. //    @Bean
  38. //    ReactiveTransactionSynchronization reactiveTransactionSynchronization() {
  39. //        return new ReactiveTransactionSynchronization();
  40. //    }
  41. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top