@EventListener(value = ContextRefreshedEvent.class) public void init() { log.info("start data initialization ..."); this.databaseClient.insert() .into("posts") //.nullValue("id", Integer.class) .value("title", "First post title") .value("content", "Content of my first post") .map((r, m) -> r.get("id", Integer.class)).all() .log() .thenMany( this.databaseClient.select() .from("posts") .orderBy(Sort.by(desc("id"))) .as(Post.class) .fetch() .all() .log() ) .subscribe(null, null, () -> log.info("initialization is done...")); }
@EventListener(value = ContextRefreshedEvent.class) public void init() { log.info("start data initialization ..."); this.databaseClient.insert() .into("posts") //.nullValue("id", Integer.class) .value("title", "First post title") .value("content", "Content of my first post") .map((r, m) -> r.get("id", Integer.class)) .all() .log() .thenMany( this.databaseClient.select() .from("posts") .orderBy(Sort.by(desc("id"))) .as(Post.class) .fetch() .all() .log() ) .subscribe(null, null, () -> log.info("initialization is done...")); }