title: How to set up database connection in r2dbc?
body: <p>How to set up a PostgreSQL database connection in r2dbc Spring boot project?</p>
  <p>I have tried the below configuration, it connects to the database but it's not returning any values</p>
  <pre><code>@Configuration
  @EnableR2dbcRepositories
  public class DatabaseConfig extends AbstractR2dbcConfiguration {
  
      @Override
      public ConnectionFactory connectionFactory() {
          return ConnectionFactories.get(&quot;r2dbc:postgresql://localhost:5432/sample&quot;);
      }
  
      /*@Override
      public ConnectionFactory connectionFactory() {
          return ConnectionFactories.get(new PostgresqlConnectionFactory(
                  PostgresqlConnectionConfiguration.builder()
                  .host(&quot;localhost&quot;)
                  .port(5432)
                  .username(&quot;postgres&quot;)
                  .password(&quot;thirumal&quot;)
                  .database(&quot;sample&quot;)
                  .build()););
      }*/
  
  }
  </code></pre>
  <p>application.properties</p>
  <pre><code>spring.r2dbc.url=r2dbc:postgresql://localhost:5432/sample
  spring.r2dbc.username=postgres
  spring.r2dbc.password=thirumal
  spring.r2dbc.pool.enabled=true
  </code></pre>
  <p>Model</p>
  <pre><code>@Data@NoArgsConstructor@AllArgsConstructor@Getter@Setter
  @ToString
  @Table(&quot;public.test&quot;)
  public class Test implements Serializable{
  
      /**
       * 
       */
      private static final long serialVersionUID = 4205798689305488147L;
  
      @Id//@Column(&quot;id&quot;)
      private Long id;
      
      private String name;
      
  }
  </code></pre>
  <p>Repository</p>
  <pre><code>public interface TestRepository extends ReactiveCrudRepository&lt;Test, Long&gt; {
  
  }
  </code></pre>
  <p>REST CONTROLLER:</p>
  <pre><code>@GetMapping(&quot;/test&quot;)
  public Mono&lt;Test&gt; test() {
     testRepository.findById(3L).subscribe(v-&gt;System.out.println(&quot;Value: &quot; + v.toString()));
     return testRepository.findById(3L);
  }
  </code></pre>
  <p>It prints the output in the console but in the JSON, I get only empty braces <code>{}</code></p>
  <p>What is the correct way to configure? Any other configuration is required?</p>