diff --git a/bootique-logback-sentry/src/main/java/io/bootique/logback/sentry/LogbackSentryModule.java b/bootique-logback-sentry/src/main/java/io/bootique/logback/sentry/LogbackSentryModule.java index 290302a..a527b6a 100644 --- a/bootique-logback-sentry/src/main/java/io/bootique/logback/sentry/LogbackSentryModule.java +++ b/bootique-logback-sentry/src/main/java/io/bootique/logback/sentry/LogbackSentryModule.java @@ -19,13 +19,33 @@ package io.bootique.logback.sentry; +import io.bootique.BQModuleProvider; +import io.bootique.ModuleCrate; import io.bootique.di.Binder; import io.bootique.di.BQModule; +import io.bootique.logback.LogbackModule; + +import java.util.Collection; +import java.util.Collections; /** * Loads configuration for {@link io.sentry.Sentry}. */ -public class LogbackSentryModule implements BQModule { +public class LogbackSentryModule implements BQModule, BQModuleProvider { + + @Override + public ModuleCrate moduleCrate() { + return ModuleCrate.of(new LogbackSentryModule()) + .provider(this) + .description("Integrates Sentry logging appender to Logback") + .build(); + } + + @Override + @Deprecated(since = "3.0", forRemoval = true) + public Collection dependencies() { + return Collections.singletonList(new LogbackModule()); + } @Override public void configure(Binder binder) { diff --git a/bootique-logback-sentry/src/main/java/io/bootique/logback/sentry/LogbackSentryModuleProvider.java b/bootique-logback-sentry/src/main/java/io/bootique/logback/sentry/LogbackSentryModuleProvider.java deleted file mode 100644 index cb1f704..0000000 --- a/bootique-logback-sentry/src/main/java/io/bootique/logback/sentry/LogbackSentryModuleProvider.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to ObjectStyle LLC under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ObjectStyle LLC licenses - * this file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package io.bootique.logback.sentry; - -import io.bootique.BQModuleProvider; -import io.bootique.bootstrap.BuiltModule; -import io.bootique.logback.LogbackModule; - -import java.util.Collection; -import java.util.Collections; - -/** - * Provider for {@link LogbackSentryModule}. - */ -public class LogbackSentryModuleProvider implements BQModuleProvider { - - @Override - public BuiltModule buildModule() { - return BuiltModule.of(new LogbackSentryModule()) - .provider(this) - .description("Integrates Sentry logging appender to Logback") - .build(); - } - - @Override - @Deprecated(since = "3.0", forRemoval = true) - public Collection dependencies() { - return Collections.singletonList(new LogbackModule()); - } -} diff --git a/bootique-logback-sentry/src/main/resources/META-INF/services/io.bootique.BQModuleProvider b/bootique-logback-sentry/src/main/resources/META-INF/services/io.bootique.BQModuleProvider index 85bfd84..46e33b3 100644 --- a/bootique-logback-sentry/src/main/resources/META-INF/services/io.bootique.BQModuleProvider +++ b/bootique-logback-sentry/src/main/resources/META-INF/services/io.bootique.BQModuleProvider @@ -1 +1 @@ -io.bootique.logback.sentry.LogbackSentryModuleProvider \ No newline at end of file +io.bootique.logback.sentry.LogbackSentryModule \ No newline at end of file diff --git a/bootique-logback-sentry/src/test/java/io/bootique/logback/sentry/LogbackSentryModuleProviderIT.java b/bootique-logback-sentry/src/test/java/io/bootique/logback/sentry/LogbackSentryModuleTest.java similarity index 91% rename from bootique-logback-sentry/src/test/java/io/bootique/logback/sentry/LogbackSentryModuleProviderIT.java rename to bootique-logback-sentry/src/test/java/io/bootique/logback/sentry/LogbackSentryModuleTest.java index 4698fe5..a554183 100644 --- a/bootique-logback-sentry/src/test/java/io/bootique/logback/sentry/LogbackSentryModuleProviderIT.java +++ b/bootique-logback-sentry/src/test/java/io/bootique/logback/sentry/LogbackSentryModuleTest.java @@ -25,24 +25,24 @@ import org.junit.jupiter.api.Test; @BQTest -public class LogbackSentryModuleProviderIT { +public class LogbackSentryModuleTest { @BQTestTool final BQTestFactory testFactory = new BQTestFactory(); @Test public void autoLoadable() { - BQModuleProviderChecker.testAutoLoadable(LogbackSentryModuleProvider.class); + BQModuleProviderChecker.testAutoLoadable(LogbackSentryModule.class); } @Test public void metadata() { - BQModuleProviderChecker.testMetadata(LogbackSentryModuleProvider.class); + BQModuleProviderChecker.testMetadata(LogbackSentryModule.class); } @Test public void moduleDeclaresDependencies() { - final BQRuntime bqRuntime = testFactory.app().moduleProvider(new LogbackSentryModuleProvider()).createRuntime(); + final BQRuntime bqRuntime = testFactory.app().moduleProvider(new LogbackSentryModule()).createRuntime(); BQRuntimeChecker.testModulesLoaded(bqRuntime, LogbackSentryModule.class, LogbackModule.class); } } diff --git a/bootique-logback/src/main/java/io/bootique/logback/LogbackModule.java b/bootique-logback/src/main/java/io/bootique/logback/LogbackModule.java index c3ba628..61bcf3a 100644 --- a/bootique-logback/src/main/java/io/bootique/logback/LogbackModule.java +++ b/bootique-logback/src/main/java/io/bootique/logback/LogbackModule.java @@ -22,7 +22,7 @@ import ch.qos.logback.classic.Logger; import io.bootique.BQModuleProvider; import io.bootique.annotation.LogLevels; -import io.bootique.bootstrap.BuiltModule; +import io.bootique.ModuleCrate; import io.bootique.config.ConfigurationFactory; import io.bootique.di.BQModule; import io.bootique.di.Binder; @@ -38,8 +38,8 @@ public class LogbackModule implements BQModule, BQModuleProvider { private static final String CONFIG_PREFIX = "log"; @Override - public BuiltModule buildModule() { - return BuiltModule.of(this) + public ModuleCrate moduleCrate() { + return ModuleCrate.of(this) .description("Integrates Logback logging library") .config(CONFIG_PREFIX, LogbackContextFactory.class) .build();