Örnek
Şöyle yaparız. Converter sınıfları @ReadingConverter veya @WritingConverter olarak işaretlidir
import org.springframework.data.r2dbc.config.AbstractR2dbcConfiguration;import org.springframework.data.r2dbc.repository.config.EnableR2dbcRepositories;import io.r2dbc.postgresql.PostgresqlConnectionConfiguration;import io.r2dbc.postgresql.PostgresqlConnectionFactory;import io.r2dbc.spi.ConnectionFactory;@Configuration@EnableR2dbcRepositoriespublic class PostgresConfig extends AbstractR2dbcConfiguration {@Override@Beanpublic ConnectionFactory connectionFactory() {return new PostgresqlConnectionFactory(PostgresqlConnectionConfiguration.builder().host("localhost").port(5432).username("postgres").password("admin").database("reactive_examples_db").build());}@Overrideprotected List<Object> getCustomConverters() {List<Object> converterList = new ArrayList<>();converterList.add(new PersonReadConverter());converterList.add(new PersonWriteConverter());converterList.add(new BookReadConverter());return converterList;}}
Hiç yorum yok:
Yorum Gönder