From 6570432afb184fec5c0608067c4c134314097c8b Mon Sep 17 00:00:00 2001
From: BlankSpacePlus <blankspaceplus@foxmail.com>
Date: Thu, 7 Sep 2023 12:44:08 +0800
Subject: [PATCH] Replace some magic values and upgrade the neo4j-driver
 version

---
 pom.xml                                       | 2 +-
 src/main/java/example/movies/Environment.java | 8 ++++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/pom.xml b/pom.xml
index f4adf9d..ddc20af 100644
--- a/pom.xml
+++ b/pom.xml
@@ -33,7 +33,7 @@
         <dependency>
             <groupId>org.neo4j.driver</groupId>
             <artifactId>neo4j-java-driver</artifactId>
-            <version>5.9.0</version>
+            <version>5.12.0</version>
         </dependency>
 <!-- end::bolt-dependency[] -->
         <dependency>
diff --git a/src/main/java/example/movies/Environment.java b/src/main/java/example/movies/Environment.java
index de73604..c3e8621 100644
--- a/src/main/java/example/movies/Environment.java
+++ b/src/main/java/example/movies/Environment.java
@@ -13,10 +13,14 @@ public class Environment {
 
     private static final String DEFAULT_PASS = "movies";
 
+    private static final int DEFAULT_PORT = 8080;
+
+    private static final String VERSION_PREFIX = "4";
+
     public static int getPort() {
         String webPort = System.getenv("PORT");
         if (webPort == null || webPort.isEmpty()) {
-            return 8080;
+            return DEFAULT_PORT;
         }
         return Integer.parseInt(webPort);
     }
@@ -31,7 +35,7 @@ public static String getNeo4jUrl() {
 
     public static String getNeo4jDatabase() {
         String neo4jVersion = System.getenv("NEO4J_VERSION");
-        if (neo4jVersion == null || neo4jVersion.startsWith("4")) {
+        if (neo4jVersion == null || neo4jVersion.startsWith(VERSION_PREFIX)) {
             String database = System.getenv("NEO4J_DATABASE");
             if (database == null || database.isEmpty()) {
                 return DEFAULT_DATABASE;