Skip to content

Commit c434d7d

Browse files
release2.4.13 (#285)
1 parent d68cd3e commit c434d7d

28 files changed

+906
-523
lines changed

pom.xml

Lines changed: 46 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>org.summerboot</groupId>
66
<artifactId>jexpress</artifactId>
7-
<version>2.4.10</version>
7+
<version>2.4.13</version>
88
<packaging>jar</packaging>
99
<name>Summer Boot jExpress</name>
1010
<description>Summer Boot jExpress focuses on solving non-functional and operational maintainability requirements,
@@ -62,14 +62,15 @@
6262
<plugins>
6363
<plugin>
6464
<!--for unit test-->
65+
<groupId>org.apache.maven.plugins</groupId>
6566
<artifactId>maven-surefire-plugin</artifactId>
66-
<version>3.2.5</version>
67+
<version>3.5.0</version>
6768
</plugin>
6869
<plugin>
6970
<groupId>org.apache.maven.plugins</groupId>
7071
<artifactId>maven-scm-plugin</artifactId>
7172
<!-- <version>1.12.2</version> -->
72-
<version>2.0.0-M1</version>
73+
<version>2.1.0</version>
7374
</plugin>
7475
<!--Source-->
7576
<plugin>
@@ -90,7 +91,7 @@
9091
<plugin>
9192
<groupId>org.apache.maven.plugins</groupId>
9293
<artifactId>maven-javadoc-plugin</artifactId>
93-
<version>3.6.3</version>
94+
<version>3.10.0</version>
9495
<configuration>
9596
<source>17</source>
9697
<!-- <aggregate>true</aggregate>-->
@@ -111,9 +112,10 @@
111112

112113
<!--Deploy-->
113114
<plugin>
115+
<groupId>org.apache.maven.plugins</groupId>
114116
<artifactId>maven-deploy-plugin</artifactId>
115117
<!-- <version>2.8.2</version> -->
116-
<version>3.1.1</version>
118+
<version>3.1.3</version>
117119
<executions>
118120
<execution>
119121
<id>default-deploy</id>
@@ -128,7 +130,7 @@
128130
<plugin>
129131
<groupId>org.apache.maven.plugins</groupId>
130132
<artifactId>maven-gpg-plugin</artifactId>
131-
<version>3.2.2</version>
133+
<version>3.2.5</version>
132134
<executions>
133135
<execution>
134136
<phase>verify</phase>
@@ -143,7 +145,7 @@
143145
<plugin>
144146
<groupId>org.sonatype.plugins</groupId>
145147
<artifactId>nexus-staging-maven-plugin</artifactId>
146-
<version>1.6.13</version>
148+
<version>1.7.0</version>
147149
<extensions>true</extensions>
148150
<configuration>
149151
<serverId>ossrh</serverId>
@@ -190,28 +192,28 @@
190192
<maven.resources.version>3.3.1</maven.resources.version>
191193
<maven-surefire.version>3.2.5</maven-surefire.version>
192194
<!-- Commons -->
193-
<commons-lang3.version>3.15.0</commons-lang3.version>
194-
<commons-cli.version>1.8.0</commons-cli.version>
195+
<commons-lang3.version>3.17.0</commons-lang3.version>
196+
<commons-cli.version>1.9.0</commons-cli.version>
195197
<commons-io.version>2.16.1</commons-io.version>
196198
<!-- <commons-text.version>1.11.0</commons-text.version>-->
197199
<!-- <owasp.encoder.version>1.2.3</owasp.encoder.version>-->
198200
<!-- Logging -->
199-
<log4j-api.version>2.23.1</log4j-api.version>
201+
<log4j-api.version>2.24.0</log4j-api.version>
200202
<log4j-disruptor.version>4.0.0</log4j-disruptor.version>
201203
<!-- Mail -->
202204
<jakarta-mail.version>2.0.1</jakarta-mail.version>
203205
<!-- Security -->
204206
<bouncycastle.version>1.78.1</bouncycastle.version>
205207
<!-- JWT -->
206-
<jwt.version>0.11.5</jwt.version>
208+
<jwt.version>0.12.6</jwt.version>
207209

208210
<!-- NIO Netty -->
209-
<netty.version>4.1.112.Final</netty.version>
210-
<netty-tcnative.version>2.0.65.Final</netty-tcnative.version>
211+
<netty.version>4.1.113.Final</netty.version>
212+
<netty-tcnative.version>2.0.66.Final</netty-tcnative.version>
211213
<!-- gRPC and protobuf -->
212-
<grpc.version>1.65.1</grpc.version>
213-
<guava.version>33.2.1-jre</guava.version>
214-
<protobuf.version>4.27.3</protobuf.version>
214+
<grpc.version>1.66.0</grpc.version>
215+
<guava.version>33.3.0-jre</guava.version>
216+
<protobuf.version>4.28.0</protobuf.version>
215217
<!-- Web JAX-RS -->
216218
<swagger.core.version>2.2.22</swagger.core.version>
217219
<!--<elastic-apm.version>1.36.0</elastic-apm.version>-->
@@ -227,20 +229,21 @@
227229
<!-- JSON/XML/Bean Validation -->
228230
<jackson.version>2.17.2</jackson.version>
229231
<!-- Bean Validation -->
230-
<hibernate-validator.version>8.0.1.Final</hibernate-validator.version>
231232
<jakarta.el.version>6.0.1</jakarta.el.version>
233+
<tomcat-embed-el.version>11.0.0-M24</tomcat-embed-el.version>
234+
<hibernate-validator.version>8.0.1.Final</hibernate-validator.version>
232235

233236
<!-- IOC Injection -->
234237
<guice.version>7.0.0</guice.version>
235238

236239
<!-- JPA -->
237-
<hibernate.version>6.5.2.Final</hibernate.version>
240+
<hibernate.version>6.6.0.Final</hibernate.version>
238241
<hikari-cp.version>5.1.0</hikari-cp.version>
239242

240243
<!-- Cache -->
241-
<jedis.version>5.1.4</jedis.version>
244+
<jedis.version>5.1.5</jedis.version>
242245

243-
<quartz.version>2.5.0-rc1</quartz.version>
246+
<quartz.version>2.3.2</quartz.version>
244247
<mqtt.version>1.2.5</mqtt.version>
245248

246249
<!-- Template Engine -->
@@ -263,12 +266,6 @@
263266

264267
<dependencies>
265268
<!-- Commons -->
266-
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 Apache 2.0-->
267-
<dependency>
268-
<groupId>org.apache.commons</groupId>
269-
<artifactId>commons-lang3</artifactId>
270-
<version>${commons-lang3.version}</version>
271-
</dependency>
272269
<!-- https://mvnrepository.com/artifact/commons-cli/commons-cli Apache 2.0-->
273270
<dependency>
274271
<groupId>commons-cli</groupId>
@@ -282,6 +279,12 @@
282279
<artifactId>commons-io</artifactId>
283280
<version>${commons-io.version}</version>
284281
</dependency>
282+
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 Apache 2.0-->
283+
<dependency>
284+
<groupId>org.apache.commons</groupId>
285+
<artifactId>commons-lang3</artifactId>
286+
<version>${commons-lang3.version}</version>
287+
</dependency>
285288
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-text -->
286289
<!-- <dependency>
287290
<groupId>org.apache.commons</groupId>
@@ -540,23 +543,29 @@
540543

541544

542545
<!-- Bean Validation -->
543-
<!-- https://mvnrepository.com/artifact/org.hibernate.validator/hibernate-validator -->
546+
<!-- https://mvnrepository.com/artifact/jakarta.el/jakarta.el-api -->
544547
<dependency>
545-
<groupId>org.hibernate.validator</groupId>
546-
<artifactId>hibernate-validator</artifactId>
547-
<version>${hibernate-validator.version}</version>
548+
<groupId>jakarta.el</groupId>
549+
<artifactId>jakarta.el-api</artifactId>
550+
<version>${jakarta.el.version}</version>
548551
</dependency>
549552
<!-- https://mvnrepository.com/artifact/org.glassfish/jakarta.el -->
553+
<!-- <dependency>-->
554+
<!-- <groupId>org.glassfish</groupId>-->
555+
<!-- <artifactId>jakarta.el</artifactId>-->
556+
<!-- <version>4.0.2</version>-->
557+
<!-- </dependency>-->
558+
<!-- https://mvnrepository.com/artifact/org.apache.tomcat.embed/tomcat-embed-el -->
550559
<dependency>
551-
<groupId>org.glassfish</groupId>
552-
<artifactId>jakarta.el</artifactId>
553-
<version>4.0.2</version>
560+
<groupId>org.apache.tomcat.embed</groupId>
561+
<artifactId>tomcat-embed-el</artifactId>
562+
<version>${tomcat-embed-el.version}</version>
554563
</dependency>
555-
<!-- https://mvnrepository.com/artifact/jakarta.el/jakarta.el-api -->
564+
<!-- https://mvnrepository.com/artifact/org.hibernate.validator/hibernate-validator -->
556565
<dependency>
557-
<groupId>jakarta.el</groupId>
558-
<artifactId>jakarta.el-api</artifactId>
559-
<version>${jakarta.el.version}</version>
566+
<groupId>org.hibernate.validator</groupId>
567+
<artifactId>hibernate-validator</artifactId>
568+
<version>${hibernate-validator.version}</version>
560569
</dependency>
561570

562571

src/main/java/org/summerboot/jexpress/boot/BootConstant.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public interface BootConstant {
2525
String APP_ID = String.format("%06d", new Random().nextInt(999999));
2626

2727
//version
28-
String VERSION = "SummerBoot.jExpress 2.4.10";
28+
String VERSION = "jExpress 2.4.13";
2929
String JEXPRESS_PACKAGE_NAME = "org.summerboot.jexpress";
3030

3131
String DEFAULT_ADMIN_MM = "changeit";

src/main/java/org/summerboot/jexpress/boot/BootGuiceModule.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.quartz.Scheduler;
2626
import org.summerboot.jexpress.boot.annotation.Controller;
2727
import org.summerboot.jexpress.boot.annotation.Inspector;
28+
import org.summerboot.jexpress.boot.annotation.Service;
2829
import org.summerboot.jexpress.boot.event.AppLifecycleHandler;
2930
import org.summerboot.jexpress.boot.event.AppLifecycleListener;
3031
import org.summerboot.jexpress.boot.event.HttpExceptionHandler;
@@ -76,7 +77,7 @@ public BootGuiceModule(Object caller, Class callerClass, Set<String> userSpecifi
7677
this.memo = memo;
7778
}
7879

79-
protected boolean isCliUseImplTag(String implTag) {
80+
protected boolean isTagSpecifiedViaCLI(String implTag) {
8081
return userSpecifiedImplTags != null && userSpecifiedImplTags.contains(implTag);
8182
}
8283

@@ -171,13 +172,20 @@ protected void scanAnnotation_BindInstance(Binder binder, Class<? extends Annota
171172
if (Modifier.isAbstract(mod) || Modifier.isInterface(mod)) {
172173
continue;
173174
}
175+
String implTag = null;
174176
if (a instanceof Controller) {
175177
Controller ca = (Controller) a;
176-
String implTag = ca.implTag();
177-
if (StringUtils.isNotBlank(implTag) && !isCliUseImplTag(implTag)) {
178-
continue;
178+
implTag = ca.implTag();
179+
} else if (a instanceof Inspector) {
180+
Service sa = (Service) c.getAnnotation(Service.class);
181+
if (sa != null) {
182+
implTag = sa.implTag();
179183
}
180184
}
185+
// no tag = always use this controller, with tag = only use this controller when -use <tag> specified
186+
if (StringUtils.isNotBlank(implTag) && !isTagSpecifiedViaCLI(implTag)) {
187+
continue;
188+
}
181189
classesAll.add(c);
182190
}
183191
//}

src/main/java/org/summerboot/jexpress/boot/ScanedGuiceModule.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public ScanedGuiceModule(Map<Class, Map<String, List<SummerSingularity.ServiceMe
5050
this.memo = memo;
5151
}
5252

53-
protected boolean isCliUseImplTag(String implTag) {
53+
protected boolean isTagSpecifiedViaCLI(String implTag) {
5454
return userSpecifiedImplTags.contains(implTag);
5555
}
5656

@@ -72,7 +72,7 @@ public void configure() {
7272
continue;
7373
}
7474
String implTag = serviceImpl.getImplTag();
75-
boolean isCliUseImplTag = isCliUseImplTag(implTag);
75+
boolean isCliUseImplTag = isTagSpecifiedViaCLI(implTag);
7676
memo.append(INFO_FOUND).append(interfaceClass.getName()).append(", implTag=").append(uniqueKey).append(BIND_TO).append(serviceImpl).append(", isCliUseImplTag=").append(isCliUseImplTag);
7777

7878
String named = serviceImpl.getNamed();

src/main/java/org/summerboot/jexpress/boot/SummerApplication.java

Lines changed: 49 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
import io.grpc.ServerInterceptor;
2323
import io.grpc.ServerServiceDefinition;
2424
import org.apache.commons.lang3.exception.ExceptionUtils;
25+
import org.apache.logging.log4j.Level;
26+
import org.apache.logging.log4j.core.Appender;
27+
import org.apache.logging.log4j.core.Filter;
28+
import org.apache.logging.log4j.core.appender.ConsoleAppender;
29+
import org.apache.logging.log4j.core.filter.LevelRangeFilter;
2530
import org.quartz.SchedulerException;
2631
import org.summerboot.jexpress.boot.config.ConfigUtil;
2732
import org.summerboot.jexpress.boot.event.AppLifecycleListener;
@@ -40,9 +45,11 @@
4045
import org.summerboot.jexpress.nio.server.NioServer;
4146
import org.summerboot.jexpress.util.ApplicationUtil;
4247

48+
import java.io.File;
4349
import java.net.InetSocketAddress;
4450
import java.util.ArrayList;
4551
import java.util.List;
52+
import java.util.Map;
4653

4754
/**
4855
* In Code We Trust
@@ -282,12 +289,13 @@ public void start() {
282289
log.info(() -> sb.toString());
283290
}
284291

285-
long timeoutMs = BackOffice.agent.getProcessTimeoutMilliseconds();
286-
String timeoutDesc = BackOffice.agent.getProcessTimeoutAlertMessage();
287292
// 4. health inspection
288293
log.trace("4. health inspection");
289-
String serviceStatus = HealthMonitor.start(true);
294+
String serviceStatus = HealthMonitor.start(true, guiceInjector);
290295

296+
long timeoutMs = BackOffice.agent.getProcessTimeoutMilliseconds();
297+
String timeoutDesc = BackOffice.agent.getProcessTimeoutAlertMessage();
298+
StringBuilder startingMemo = new StringBuilder();
291299
// 5a. start server: gRPC
292300
if (hasGRPCImpl) {
293301
log.trace("5a. start server: gRPC hasGRPCImpl.bs={}", gRPCBindableServiceImplClasses);
@@ -316,7 +324,7 @@ public void start() {
316324
serverBuilder.addService(impl);
317325
}
318326
if (gRPCCfg.isAutoStart()) {
319-
gRPCServer.start();
327+
gRPCServer.start(startingMemo);
320328
}
321329
gRPCServerList.add(gRPCServer);
322330
}
@@ -330,14 +338,16 @@ public void start() {
330338
NioChannelInitializer channelInitializer = super.guiceInjector.getInstance(NioChannelInitializer.class);
331339
NIOStatusListener nioListener = super.guiceInjector.getInstance(NIOStatusListener.class);
332340
httpServer = new NioServer(channelInitializer.init(guiceInjector, channelHandlerNames), nioListener);
333-
httpServer.bind(NioConfig.cfg);
341+
httpServer.bind(NioConfig.cfg, startingMemo);
334342
}
335343
}
336344

337345
// 6. announcement
346+
startingMemo.append(BootConstant.BR).append(serviceStatus);
347+
startingMemo.append(BootConstant.BR).append("pid#" + BootConstant.PID);
338348
log.info(() -> BootConstant.BR + BootConstant.BR + I18n.info.launched.format(userSpecifiedResourceBundle, appVersion + " pid#" + BootConstant.PID) + serviceStatus);
339349
if (appLifecycleListener != null) {
340-
appLifecycleListener.onApplicationStart(super.appVersion, serviceStatus);
350+
appLifecycleListener.onApplicationStart(super.appVersion, startingMemo.toString());
341351
}
342352
} catch (java.net.BindException ex) {// from NioServer
343353
log.fatal(ex + BootConstant.BR + BackOffice.agent.getPortInUseAlertMessage());
@@ -350,11 +360,42 @@ public void start() {
350360
log.fatal(I18n.info.unlaunched.format(userSpecifiedResourceBundle), ex);
351361
}
352362
System.exit(1);
363+
} finally {
364+
// show prompt only with default log4j2.xml in case user is not familiar with log4j2.xml (only one ConsoleAppender with maxLevel is NOT "ALL"), no prompt if user modify the default log4j2.xml due to user knows what he/she is doing
365+
String prompt = null;
366+
try {
367+
org.apache.logging.log4j.core.Logger c = (org.apache.logging.log4j.core.Logger) log;
368+
Map<String, Appender> as = c.getContext().getConfiguration().getAppenders();
369+
int countConsoleAppender = 0;
370+
for (Map.Entry<String, Appender> entry : as.entrySet()) {
371+
Appender appender = entry.getValue();
372+
if (appender instanceof ConsoleAppender) {
373+
countConsoleAppender++;
374+
if (countConsoleAppender > 1) {
375+
prompt = null;
376+
break;
377+
}
378+
ConsoleAppender sa = (ConsoleAppender) appender;
379+
Filter f = sa.getFilter();
380+
if (f instanceof LevelRangeFilter) {
381+
LevelRangeFilter lrf = (LevelRangeFilter) f;
382+
Level maxLevel = lrf.getMaxLevel();
383+
if (!Level.ALL.equals(maxLevel)) {
384+
prompt = "\nTo show logs in console, please edit " + this.userSpecifiedConfigDir + File.separator
385+
+ "log4j2.xml \n\t<Configuration ...>\n\t <Appenders>\n\t <Console name=\"" + sa.getName() + "\" target=\"" + sa.getTarget() + "\">\n\t <LevelRangeFilter maxLevel=\"" + maxLevel + "\"/>\n\tchange around line#13: set maxLevel=\"" + Level.ALL + "\"";
386+
}
387+
}
388+
}
389+
}
390+
} catch (Throwable ex) {
391+
log.error("Failed to inspect " + this.userSpecifiedConfigDir + File.separator + "log4j2.xml", ex);
392+
}
393+
if (prompt != null) {
394+
System.out.println(prompt);
395+
}
353396
}
354397
}
355398

356-
protected static boolean a = true;
357-
358399
public void shutdown() {
359400
log.trace("");
360401
if (gRPCServerList != null && !gRPCServerList.isEmpty()) {

0 commit comments

Comments
 (0)