Skip to content
This repository was archived by the owner on Sep 1, 2023. It is now read-only.

Commit ad9678c

Browse files
Improvie example.
1 parent 6eec3d6 commit ad9678c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

examples/simple/src/main/java/org/neo4j/doc/driver/springframework/boot/simple/DisplayMoviesComponent.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.slf4j.Logger;
2828
import org.slf4j.LoggerFactory;
2929
import org.springframework.boot.CommandLineRunner;
30+
import org.springframework.context.ConfigurableApplicationContext;
3031
import org.springframework.stereotype.Component;
3132

3233
@Component
@@ -36,8 +37,12 @@ public class DisplayMoviesComponent implements CommandLineRunner {
3637

3738
private final Driver driver;
3839

39-
public DisplayMoviesComponent(Driver driver) {
40+
private final ConfigurableApplicationContext applicationContext;
41+
42+
public DisplayMoviesComponent(Driver driver,
43+
ConfigurableApplicationContext applicationContext) {
4044
this.driver = driver;
45+
this.applicationContext = applicationContext;
4146
}
4247

4348
@Override
@@ -51,6 +56,9 @@ public void run(String... args) {
5156
.map(n -> n.get("title").asString())
5257
.forEach(LOGGER::info);
5358
}
59+
60+
// We need to indicate here that we are done.
61+
applicationContext.close();
5462
}
5563
}
5664
// end::simple-example[]

0 commit comments

Comments
 (0)