do not use config loader or config logger in BaseApplicationBuilder

This commit is contained in:
Jörg Prante 2024-03-25 10:04:57 +01:00
parent ea799e7a87
commit 7983abf23a
4 changed files with 16 additions and 46 deletions

View file

@ -1,3 +1,3 @@
group = org.xbib group = org.xbib
name = net-http name = net-http
version = 4.4.0 version = 4.4.1

View file

@ -1,6 +1,15 @@
module org.xbib.net.http.server { module org.xbib.net.http.server {
uses org.xbib.config.ConfigLogger; requires java.logging;
requires java.naming;
requires java.sql;
requires org.xbib.datastructures.common;
requires org.xbib.datastructures.tiny;
requires org.xbib.datastructures.json.tiny;
requires org.xbib.settings.api;
requires org.xbib.net;
requires org.xbib.net.mime;
requires org.xbib.net.http;
exports org.xbib.net.http.server; exports org.xbib.net.http.server;
exports org.xbib.net.http.server.application; exports org.xbib.net.http.server.application;
exports org.xbib.net.http.server.auth; exports org.xbib.net.http.server.auth;
@ -22,14 +31,4 @@ module org.xbib.net.http.server {
exports org.xbib.net.http.server.session.memory; exports org.xbib.net.http.server.session.memory;
exports org.xbib.net.http.server.validate; exports org.xbib.net.http.server.validate;
exports org.xbib.net.http.server.executor; exports org.xbib.net.http.server.executor;
requires org.xbib.net;
requires org.xbib.net.mime;
requires org.xbib.net.http;
requires org.xbib.datastructures.common;
requires org.xbib.datastructures.tiny;
requires org.xbib.datastructures.json.tiny;
requires org.xbib.config;
requires java.logging;
requires java.naming;
requires java.sql;
} }

View file

@ -5,13 +5,8 @@ import java.nio.file.Paths;
import java.time.ZoneId; import java.time.ZoneId;
import java.util.Locale; import java.util.Locale;
import java.util.Objects; import java.util.Objects;
import java.util.Optional;
import java.util.ServiceLoader;
import java.util.Set; import java.util.Set;
import org.xbib.config.ConfigLoader;
import org.xbib.config.ConfigLogger;
import org.xbib.config.ConfigParams;
import org.xbib.config.SystemConfigLogger;
import org.xbib.net.http.server.executor.BaseExecutor; import org.xbib.net.http.server.executor.BaseExecutor;
import org.xbib.net.http.server.executor.Executor; import org.xbib.net.http.server.executor.Executor;
import org.xbib.net.http.server.route.HttpRouter; import org.xbib.net.http.server.route.HttpRouter;
@ -20,15 +15,6 @@ import org.xbib.settings.Settings;
public class BaseApplicationBuilder implements ApplicationBuilder { public class BaseApplicationBuilder implements ApplicationBuilder {
private static final ConfigLogger bootLogger;
static {
// early loading of boot logger during static initialization block
ServiceLoader<ConfigLogger> serviceLoader = ServiceLoader.load(ConfigLogger.class);
Optional<ConfigLogger> optionalBootLogger = serviceLoader.findFirst();
bootLogger = optionalBootLogger.orElse(new SystemConfigLogger());
}
private static final Set<String> DEFAULT_SUFFIXES = private static final Set<String> DEFAULT_SUFFIXES =
Set.of("css", "js", "ico", "png", "jpg", "jpeg", "gif", "woff2"); Set.of("css", "js", "ico", "png", "jpg", "jpeg", "gif", "woff2");
@ -38,6 +24,8 @@ public class BaseApplicationBuilder implements ApplicationBuilder {
protected ClassLoader classLoader; protected ClassLoader classLoader;
protected Settings settings;
protected Path home; protected Path home;
protected String contextPath; protected String contextPath;
@ -54,12 +42,6 @@ public class BaseApplicationBuilder implements ApplicationBuilder {
protected Set<String> staticFileSuffixes; protected Set<String> staticFileSuffixes;
protected ConfigParams configParams;
protected ConfigLoader configLoader;
protected Settings settings;
protected Executor executor; protected Executor executor;
protected HttpRouter httpRouter; protected HttpRouter httpRouter;
@ -170,16 +152,6 @@ public class BaseApplicationBuilder implements ApplicationBuilder {
if (profile == null) { if (profile == null) {
profile = System.getProperty("application.profile", "developer"); profile = System.getProperty("application.profile", "developer");
} }
if (this.settings == null) {
this.configParams = new ConfigParams()
.withDirectoryName(name)
.withFileNamesWithoutSuffix(profile)
.withSystemEnvironment()
.withSystemProperties();
this.configLoader = ConfigLoader.getInstance()
.withLogger(bootLogger);
this.settings = configLoader.load(configParams);
}
if (this.mimeTypeService == null) { if (this.mimeTypeService == null) {
this.mimeTypeService = new MimeTypeService(); this.mimeTypeService = new MimeTypeService();
} }

View file

@ -5,7 +5,7 @@ dependencyResolutionManagement {
version('groovy', '4.0.16') version('groovy', '4.0.16')
version('netty', '4.1.107.Final') version('netty', '4.1.107.Final')
version('netty-tcnative', '2.0.62.Final') version('netty-tcnative', '2.0.62.Final')
version('datastructures', '5.0.6') version('datastructures', '5.0.7')
version('net', '4.3.0') version('net', '4.3.0')
library('netty-codec-http2', 'io.netty', 'netty-codec-http2').versionRef('netty') library('netty-codec-http2', 'io.netty', 'netty-codec-http2').versionRef('netty')
library('netty-handler', 'io.netty', 'netty-handler').versionRef('netty') library('netty-handler', 'io.netty', 'netty-handler').versionRef('netty')
@ -35,10 +35,9 @@ dependencyResolutionManagement {
library('settings-datastructures-yaml', 'org.xbib', 'settings-datastructures-yaml').versionRef('datastructures') library('settings-datastructures-yaml', 'org.xbib', 'settings-datastructures-yaml').versionRef('datastructures')
library('jdbc-query', 'org.xbib', 'jdbc-query').version('2.0.2') library('jdbc-query', 'org.xbib', 'jdbc-query').version('2.0.2')
library('jdbc-connection-pool', 'org.xbib', 'jdbc-connection-pool').version('2.0.2') library('jdbc-connection-pool', 'org.xbib', 'jdbc-connection-pool').version('2.0.2')
library('event', 'org.xbib', 'event').version('0.0.8')
} }
testLibs { testLibs {
version('junit', '5.10.1') version('junit', '5.10.2')
library('junit-jupiter-api', 'org.junit.jupiter', 'junit-jupiter-api').versionRef('junit') library('junit-jupiter-api', 'org.junit.jupiter', 'junit-jupiter-api').versionRef('junit')
library('junit-jupiter-params', 'org.junit.jupiter', 'junit-jupiter-params').versionRef('junit') library('junit-jupiter-params', 'org.junit.jupiter', 'junit-jupiter-params').versionRef('junit')
library('junit-jupiter-engine', 'org.junit.jupiter', 'junit-jupiter-engine').versionRef('junit') library('junit-jupiter-engine', 'org.junit.jupiter', 'junit-jupiter-engine').versionRef('junit')