diff --git a/blackbox-test-inject/pom.xml b/blackbox-test-inject/pom.xml
index 6baf53e77..b55dc32df 100644
--- a/blackbox-test-inject/pom.xml
+++ b/blackbox-test-inject/pom.xml
@@ -47,6 +47,13 @@
test
+
+ org.slf4j
+ slf4j-jdk-platform-logging
+ 2.0.0-alpha5
+ test
+
+
org.avaje.composite
logback
diff --git a/blackbox-test-inject/src/test/java/org/example/myapp/HelloServiceTest.java b/blackbox-test-inject/src/test/java/org/example/myapp/HelloServiceTest.java
index 03f9bfce6..a9476f3d5 100644
--- a/blackbox-test-inject/src/test/java/org/example/myapp/HelloServiceTest.java
+++ b/blackbox-test-inject/src/test/java/org/example/myapp/HelloServiceTest.java
@@ -2,16 +2,38 @@
import io.avaje.inject.BeanScope;
import org.junit.jupiter.api.Test;
+import org.slf4j.LoggerFactory;
+import org.slf4j.bridge.SLF4JBridgeHandler;
-import static org.junit.jupiter.api.Assertions.*;
+import java.util.logging.Level;
+import java.util.logging.LogManager;
+import java.util.logging.Logger;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
class HelloServiceTest {
+ static {
+ LogManager.getLogManager().reset();
+ SLF4JBridgeHandler.install();
+ }
+
+ void asd() {
+ org.slf4j.Logger slf4j = LoggerFactory.getLogger("io.avaje.doo2");
+ slf4j.trace("trace doo2");
+ }
/**
* No mocking, no use of @TestScope
so just like main.
*/
@Test
void basic() {
+
+ asd();
+ Logger utilLogger = Logger.getLogger("io.avaje.doo1");
+ utilLogger.log(Level.FINE, "fine doo");
+ utilLogger.log(Level.FINER, "finer doo");
+ utilLogger.log(Level.INFO, "info doo");
+
// just wire everything with no test scope, mocks etc
BeanScope beanScope = BeanScope.newBuilder().build();
diff --git a/blackbox-test-inject/src/test/resources/logback-test.xml b/blackbox-test-inject/src/test/resources/logback-test.xml
new file mode 100644
index 000000000..82ebb4696
--- /dev/null
+++ b/blackbox-test-inject/src/test/resources/logback-test.xml
@@ -0,0 +1,14 @@
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
+
+
diff --git a/inject-test/src/main/java/io/avaje/inject/test/InjectExtension.java b/inject-test/src/main/java/io/avaje/inject/test/InjectExtension.java
index 0d264ef77..13e988e06 100644
--- a/inject-test/src/main/java/io/avaje/inject/test/InjectExtension.java
+++ b/inject-test/src/main/java/io/avaje/inject/test/InjectExtension.java
@@ -7,8 +7,6 @@
import org.junit.jupiter.api.extension.BeforeEachCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.api.extension.ExtensionContext.Namespace;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.Iterator;
@@ -23,7 +21,6 @@
*/
public class InjectExtension implements BeforeAllCallback, BeforeEachCallback, AfterEachCallback, ExtensionContext.Store.CloseableResource {
- private static final Logger log = LoggerFactory.getLogger(InjectExtension.class);
private static final Namespace INJECT_NS = Namespace.create("io.avaje.inject.InjectTest");
private static final String BEAN_SCOPE = "BEAN_SCOPE";
private static final ReentrantLock lock = new ReentrantLock();
@@ -48,7 +45,7 @@ public void close() throws Throwable {
lock.lock();
try {
if (globalTestScope != null) {
- log.debug("Closing global test BeanScope");
+ Log.debug("Closing global test BeanScope");
globalTestScope.close();
}
} finally {
@@ -59,12 +56,11 @@ public void close() throws Throwable {
private void initialiseGlobalTestScope(ExtensionContext context) {
Iterator iterator = ServiceLoader.load(TestModule.class).iterator();
if (iterator.hasNext()) {
- log.debug("Building global test BeanScope (as parent scope for tests)");
+ Log.debug("Building global test BeanScope (as parent scope for tests)");
globalTestScope = BeanScope.newBuilder()
.withModules(iterator.next())
.build();
- log.trace("register global test BeanScope with beans {}", globalTestScope);
context.getRoot().getStore(Namespace.GLOBAL).put(InjectExtension.class.getCanonicalName(), this);
}
}
@@ -90,7 +86,6 @@ public void beforeEach(final ExtensionContext context) {
for (MetaReader reader : readers) {
reader.setFromScope(beanScope);
}
- log.trace("test setup with {}", readers);
context.getStore(INJECT_NS).put(BEAN_SCOPE, beanScope);
}
diff --git a/inject-test/src/main/java/io/avaje/inject/test/Log.java b/inject-test/src/main/java/io/avaje/inject/test/Log.java
new file mode 100644
index 000000000..66520ca8f
--- /dev/null
+++ b/inject-test/src/main/java/io/avaje/inject/test/Log.java
@@ -0,0 +1,13 @@
+package io.avaje.inject.test;
+
+import java.util.logging.Logger;
+
+class Log {
+
+ private static final Logger log = Logger.getLogger("io.avaje.inject");
+
+ static void debug(String message) {
+ log.fine(message);
+ }
+
+}
diff --git a/inject/pom.xml b/inject/pom.xml
index e72ebcd44..f0eee5c6e 100644
--- a/inject/pom.xml
+++ b/inject/pom.xml
@@ -19,12 +19,6 @@
2.0.1
-
- org.slf4j
- slf4j-api
- 1.7.30
-
-
io.avaje
avaje-lang
@@ -77,6 +71,51 @@
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+ compile-java-8
+
+ compile
+
+
+
+ 1.8
+
+
+
+ compile-java-11
+ compile
+
+ compile
+
+
+ 11
+
+ ${project.basedir}/src/main/java11
+
+ true
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 3.2.0
+
+
+
+ true
+
+
+
+
+
diff --git a/inject/src/main/java/io/avaje/inject/DBeanScopeBuilder.java b/inject/src/main/java/io/avaje/inject/DBeanScopeBuilder.java
index 476a6be73..1674060b9 100644
--- a/inject/src/main/java/io/avaje/inject/DBeanScopeBuilder.java
+++ b/inject/src/main/java/io/avaje/inject/DBeanScopeBuilder.java
@@ -5,8 +5,6 @@
import io.avaje.inject.spi.Module;
import io.avaje.inject.spi.SuppliedBean;
import io.avaje.lang.Nullable;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import java.lang.reflect.Type;
import java.util.*;
@@ -17,8 +15,6 @@
*/
class DBeanScopeBuilder implements BeanScopeBuilder.ForTesting {
- private static final Logger log = LoggerFactory.getLogger("io.avaje.inject");
-
@SuppressWarnings("rawtypes")
private final List suppliedBeans = new ArrayList<>();
@@ -150,7 +146,6 @@ public BeanScope build() {
" Review IntelliJ Settings / Build / Build tools / Gradle - 'Build and run using' value and set that to 'Gradle'. " +
" Refer to https://avaje.io/inject#gradle");
}
- log.debug("building with modules {}", moduleNames);
Builder builder = Builder.newBuilder(suppliedBeans, enrichBeans, parent, parentOverride);
for (Module factory : factoryOrder.factories()) {
factory.build(builder);
diff --git a/inject/src/main/java/io/avaje/inject/spi/DBeanScope.java b/inject/src/main/java/io/avaje/inject/spi/DBeanScope.java
index d8f0af664..187a0d3ce 100644
--- a/inject/src/main/java/io/avaje/inject/spi/DBeanScope.java
+++ b/inject/src/main/java/io/avaje/inject/spi/DBeanScope.java
@@ -5,8 +5,6 @@
import io.avaje.inject.Priority;
import io.avaje.lang.NonNullApi;
import io.avaje.lang.Nullable;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
@@ -16,8 +14,6 @@
@NonNullApi
class DBeanScope implements BeanScope {
- private static final Logger log = LoggerFactory.getLogger("io.avaje.inject");
-
private final ReentrantLock lock = new ReentrantLock();
private final List postConstruct;
private final List preDestroy;
@@ -152,7 +148,7 @@ public List