You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@empire-db.apache.org by do...@apache.org on 2026/02/01 14:08:59 UTC

(empire-db) 01/02: upgrade Spring Boot version to 4.0.2 fix and configure logback logging fix employee name string concatenation

This is an automated email from the ASF dual-hosted git repository.

doebele pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/empire-db.git

commit 729e25be71cf0736eca286e50a555b07421e775e
Author: datazuul <ra...@gmail.com>
AuthorDate: Fri Jan 30 19:10:54 2026 +0100

    upgrade Spring Boot version to 4.0.2
    fix and configure logback logging
    fix employee name string concatenation
---
 .../empire-db-example-spring-boot/pom.xml          | 47 ++++++++++++----------
 .../empire/samples/springboot/SampleApp.java       | 11 ++---
 .../src/main/resources/logback-spring.xml          | 12 ++++++
 3 files changed, 44 insertions(+), 26 deletions(-)

diff --git a/empire-db-examples/empire-db-example-spring-boot/pom.xml b/empire-db-examples/empire-db-example-spring-boot/pom.xml
index da999a25..b23e2367 100644
--- a/empire-db-examples/empire-db-example-spring-boot/pom.xml
+++ b/empire-db-examples/empire-db-example-spring-boot/pom.xml
@@ -15,21 +15,22 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
     <modelVersion>4.0.0</modelVersion>
-  
+
     <parent>
         <artifactId>empire-db-examples</artifactId>
         <groupId>org.apache.empire-db</groupId>
         <version>3.4.1-SNAPSHOT</version>
     </parent>
-  
+
     <name>Apache Empire-db Spring Boot Example</name>
     <artifactId>empire-db-example-spring-boot</artifactId>
     <packaging>jar</packaging>
 
     <properties>
-        <spring-boot.version>2.7.17</spring-boot.version>
+        <spring-boot.version>4.0.2</spring-boot.version>
     </properties>
 
     <dependencyManagement>
@@ -49,31 +50,35 @@
         <dependency>
             <groupId>org.apache.empire-db</groupId>
             <artifactId>empire-db</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter</artifactId>
             <exclusions>
-            	<exclusion>
-            		<groupId>ch.qos.logback</groupId>
-            		<artifactId>logback-classic</artifactId>
-            	</exclusion>
+                <exclusion>
+                    <groupId>log4j</groupId>
+                    <artifactId>log4j</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-api</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-reload4j</artifactId>
+                </exclusion>
             </exclusions>
         </dependency>
-
-		<!-- logging -->
-		<dependency>
-		    <groupId>org.slf4j</groupId>
-		    <artifactId>slf4j-reload4j</artifactId>
-		</dependency>
-
         <dependency>
             <groupId>org.hsqldb</groupId>
             <artifactId>hsqldb</artifactId>
             <scope>runtime</scope>
         </dependency>
-    
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <version>2.0.17</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-jdbc</artifactId>
diff --git a/empire-db-examples/empire-db-example-spring-boot/src/main/java/org/apache/empire/samples/springboot/SampleApp.java b/empire-db-examples/empire-db-example-spring-boot/src/main/java/org/apache/empire/samples/springboot/SampleApp.java
index b5a6986b..6284e553 100644
--- a/empire-db-examples/empire-db-example-spring-boot/src/main/java/org/apache/empire/samples/springboot/SampleApp.java
+++ b/empire-db-examples/empire-db-example-spring-boot/src/main/java/org/apache/empire/samples/springboot/SampleApp.java
@@ -346,15 +346,16 @@ public class SampleApp implements ApplicationRunner {
     for (DataListEntry dle : list) {
       long empId = dle.getRecordId(EMP);
       // int depId = dle.getId(DEP);
-      String empName = StringUtils.concat(", ", dle.getString(EMP.LAST_NAME), dle.getString(EMP.FIRST_NAME));
+      // Put the comma between last and first name (Last, First)
+      String empName = StringUtils.concat(dle.getString(EMP.LAST_NAME), ", ", dle.getString(EMP.FIRST_NAME));
       String depName = dle.getString(DEP.NAME);
       boolean hasPayments = !dle.isNull(Q_EMP_TOTAL.column(EMP_TOTAL));
       if (hasPayments) {   // report
         BigDecimal empTotal = dle.getDecimal(Q_EMP_TOTAL.column(EMP_TOTAL));
         BigDecimal pctOfDep = dle.getDecimal(PCT_OF_DEP_COST).setScale(1, RoundingMode.HALF_UP);
-        LOGGER.info("Eployee[{}]: {}\tDepartment: {}\tPayments: {} ({}% of Department)", empId, empName, depName, empTotal, pctOfDep);
+        LOGGER.info("Employee[{}]: {}\tDepartment: {}\tPayments: {} ({}% of Department)", empId, empName, depName, empTotal, pctOfDep);
       } else {
-        LOGGER.info("Eployee[{}]: {}\tDepartment: {}\tPayments: [No data avaiable]", empId, empName, depName);
+        LOGGER.info("Employee[{}]: {}\tDepartment: {}\tPayments: [No data avaiable]", empId, empName, depName);
       }
     }
 
@@ -517,10 +518,10 @@ public class SampleApp implements ApplicationRunner {
     for (DBRecordBean record : list) {
       Object[] key = record.getKey();
       // print info
-      String empName = StringUtils.concat(", ", record.getString(EMP.LAST_NAME), record.getString(EMP.FIRST_NAME));
+      String empName = StringUtils.concat(record.getString(EMP.LAST_NAME), ", ", record.getString(EMP.FIRST_NAME));
       String phone = record.getString(EMP.PHONE_NUMBER);
       BigDecimal salary = record.getDecimal(EMP.SALARY);
-      LOGGER.info("Eployee[{}]: {}\tPhone: {}\tSalary: {}", StringUtils.toString(key), empName, phone, salary);
+      LOGGER.info("Employee[{}]: {}\tPhone: {}\tSalary: {}", StringUtils.toString(key), empName, phone, salary);
       // modify salary
       BigDecimal newSalary = new BigDecimal(2000 + ((Math.random() * 200) - 100.0));
       record.set(EMP.SALARY, newSalary);
diff --git a/empire-db-examples/empire-db-example-spring-boot/src/main/resources/logback-spring.xml b/empire-db-examples/empire-db-example-spring-boot/src/main/resources/logback-spring.xml
new file mode 100644
index 00000000..f732ae06
--- /dev/null
+++ b/empire-db-examples/empire-db-example-spring-boot/src/main/resources/logback-spring.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration debug="true">
+    <appender name="default" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <pattern>[%d{ISO8601} %5p] %40.40c:%4L [%-8t] - %m%n</pattern>
+        </encoder>
+    </appender>
+
+    <root level="info">
+        <appender-ref ref="default"/>
+    </root>
+</configuration>