Skip to content

Instantly share code, notes, and snippets.

View alexandre-jacquot-ptl's full-sized avatar

Alexandre JACQUOT alexandre-jacquot-ptl

View GitHub Profile
@alexandre-jacquot-ptl
alexandre-jacquot-ptl / docker-compose.yml
Last active January 16, 2021 12:50
Setup a local instance of MongoDB
version: "3.1"
services:
mongo:
image: mongo
restart: always
ports:
- "27017:27017"
volumes:
version: "3.5"
services:
postgres:
container_name: postgres
image: postgres:13.2
restart: always
environment:
- POSTGRES_USER=admin
@alexandre-jacquot-ptl
alexandre-jacquot-ptl / pom.xml
Last active May 17, 2021 15:47
r2dbc pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-r2dbc</artifactId>
</dependency>
@Table
@Getter
@Setter
@Accessors(chain = true)
@NoArgsConstructor
public class Item {
@Id
private Long id;
@Table
@Getter
@Setter
@Accessors(chain = true)
public class Person {
@Id
private Long id;
@Version
@Table
@Getter
@Setter
@Accessors(chain = true)
public class Tag {
@Id
private Long id;
@Version
@SpringBootApplication
@EnableR2dbcAuditing
public class TodoListApplication {
public static void main(String[] args) {
SpringApplication.run(TodoListApplication.class, args);
}
}
databaseChangeLog:
...
- changeSet:
id: create-item-table
author: ajacquot
changes:
- createTable:
schema: public
# Liquibase (schema update)
spring.liquibase.change-log=classpath:/db/db.changelog.yaml
spring.liquibase.url=jdbc:postgresql://127.0.0.1:5432/todolist
spring.liquibase.user=admin
spring.liquibase.password=password
@alexandre-jacquot-ptl
alexandre-jacquot-ptl / ItemRepository.java
Last active May 25, 2021 20:39
r2dbc item repository
@Repository
public interface ItemRepository extends ReactiveSortingRepository<Item, Long> {
}