Skip to content

Commit

Permalink
refactoring - do not inherit from ConfigModule.
Browse files Browse the repository at this point in the history
It doesn't add anything valuable to the picture anymore
  • Loading branch information
andrus committed Dec 9, 2023
1 parent 75f0cc9 commit 50d6c55
Showing 1 changed file with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package io.bootique.simplejavamail;

import io.bootique.ConfigModule;
import io.bootique.BQModule;
import io.bootique.ModuleCrate;
import io.bootique.config.ConfigurationFactory;
import io.bootique.di.Binder;
import io.bootique.di.Provides;
import io.bootique.shutdown.ShutdownManager;

Expand All @@ -13,19 +14,25 @@
* @deprecated in favor of the Jakarta flavor
*/
@Deprecated(since = "3.0", forRemoval = true)
public class SimpleJavaMailModule extends ConfigModule {
public class SimpleJavaMailModule implements BQModule {

private static final String CONFIG_PREFIX = "simplejavamail";

@Override
public ModuleCrate crate() {
return ModuleCrate.of(this)
.description("Deprecated, can be replaced with 'bootique-simplejavamail-jakarta'.")
.config(configPrefix, MailersFactory.class)
.config(CONFIG_PREFIX, MailersFactory.class)
.build();
}

@Override
public void configure(Binder binder) {
}

@Singleton
@Provides
Mailers provideMailers(ConfigurationFactory configurationFactory, ShutdownManager shutdownManager) {
return config(MailersFactory.class, configurationFactory).createMailers(shutdownManager);
Mailers provideMailers(ConfigurationFactory configFactory, ShutdownManager shutdownManager) {
return configFactory.config(MailersFactory.class, CONFIG_PREFIX).createMailers(shutdownManager);
}
}

0 comments on commit 50d6c55

Please sign in to comment.