Skip to content

Instantly share code, notes, and snippets.

@mainul35
Last active September 6, 2020 07:54
Show Gist options
  • Save mainul35/a836cebce8acb8b3222d6831cc4d65d4 to your computer and use it in GitHub Desktop.
Save mainul35/a836cebce8acb8b3222d6831cc4d65d4 to your computer and use it in GitHub Desktop.
@SpringBootApplication
public class ReactivespringApplication implements CommandLineRunner {
@Autowired
private DatabaseClient databaseClient;
@Autowired
private ReservationRepository reservationRepository;
public static void main(String[] args) {
SpringApplication.run(ReactivespringApplication.class, args);
}
@Override
public void run(String... args) throws Exception {
Arrays.asList("DROP TABLE IF EXISTS reservation;",
"CREATE TABLE reservation (room_id serial primary key, name varchar, check_in timestamp, check_out timestamp, price bigint, room_number integer);")
.forEach(s ->
databaseClient.execute(s)
.fetch()
.rowsUpdated()
.block()
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment