diff --git a/src/main/java/com/guicedee/guicedinjection/GuiceContext.java b/src/main/java/com/guicedee/guicedinjection/GuiceContext.java index bb23574..812f230 100644 --- a/src/main/java/com/guicedee/guicedinjection/GuiceContext.java +++ b/src/main/java/com/guicedee/guicedinjection/GuiceContext.java @@ -19,20 +19,17 @@ import com.google.common.base.*; import com.google.inject.*; import com.guicedee.client.*; -import com.guicedee.guicedinjection.abstractions.*; import com.guicedee.guicedinjection.interfaces.*; -import com.guicedee.guicedinjection.interfaces.annotations.*; import io.github.classgraph.*; import jakarta.validation.constraints.*; -import lombok.extern.java.Log; +import lombok.extern.java.*; -import java.lang.annotation.*; import java.util.*; import java.util.concurrent.*; import java.util.logging.*; import java.util.regex.Pattern; -import static com.guicedee.guicedinjection.properties.GlobalProperties.*; +import static com.guicedee.guicedinjection.properties.GlobalProperties.getSystemPropertyOrEnvironment; /** * Provides an interface for reflection and injection in one. @@ -139,6 +136,7 @@ public synchronized Injector inject() cModules.addAll(iGuiceModules); //cModules.add(new GuiceInjectorModule()); + log.config("Modules - " + Arrays.toString(cModules.toArray())); GuiceContext.instance().injector = Guice.createInjector(cModules); GuiceContext.buildingInjector = false; GuiceContext diff --git a/src/main/java/com/guicedee/guicedinjection/abstractions/GuiceInjectorModule.java b/src/main/java/com/guicedee/guicedinjection/abstractions/GuiceInjectorModule.java deleted file mode 100644 index 0f3308f..0000000 --- a/src/main/java/com/guicedee/guicedinjection/abstractions/GuiceInjectorModule.java +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Copyright (C) 2017 GedMarc - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.guicedee.guicedinjection.abstractions; - -import com.google.inject.AbstractModule; -import com.google.inject.Binder; -import com.google.inject.Binding; -import com.google.inject.Key; -import com.google.inject.Module; -import com.google.inject.Provider; -import com.google.inject.Scope; -import com.google.inject.TypeLiteral; -import com.google.inject.binder.AnnotatedBindingBuilder; -import com.google.inject.binder.AnnotatedConstantBindingBuilder; -import com.google.inject.binder.LinkedBindingBuilder; -import com.google.inject.matcher.Matcher; -import com.google.inject.spi.Message; -import com.google.inject.spi.ProvisionListener; -import com.google.inject.spi.TypeListener; -import com.guicedee.guicedinjection.GuiceContext; -import com.guicedee.guicedinjection.interfaces.IGuiceModule; -import lombok.extern.java.Log; - -import java.lang.annotation.Annotation; -import java.lang.reflect.Method; -import java.util.*; -import java.util.logging.Level; - -/** - * Exposes the abstract module methods as public - * - * @author GedMarc - * @since 12 Dec 2016 - */ -@Log -public class GuiceInjectorModule - extends AbstractModule - implements IGuiceModule { - /** - * Constructs a new instance of the module - */ - public GuiceInjectorModule() { - //Nothing Needed - } - - /** - * Executes the runBinders method - */ - @Override - public void configure() { - runBinders(); - } - - /** - * Executes the linked binders to perform any custom binding - */ - @SuppressWarnings("unchecked") - private void runBinders() { - Set iGuiceModules = GuiceContext.instance().loadIGuiceModules(); - Set guicy = new TreeSet<>(); - guicy.addAll(iGuiceModules); - for (IGuiceModule iGuiceModule : guicy) - { - log.log(Level.CONFIG, "Loading IGuice Module - " + iGuiceModule.getClass() - .getSimpleName()); - Module mod = (Module) iGuiceModule; - install(mod); - } - } - - /** - * Gets direct access to the underlying {@code Binder}. - */ - @Override - public Binder binder() { - return super.binder(); - } - - /** - * @see Binder#bindScope(Class, Scope) - */ - @Override - public void bindScope(Class scopeAnnotation, Scope scope) { - super.bindScope(scopeAnnotation, scope); - } - - /** - * @see Binder#bind(Key) - */ - @Override - public LinkedBindingBuilder bind(Key key) { - return super.bind(key); - } - - /** - * @see Binder#bind(TypeLiteral) - */ - @Override - public AnnotatedBindingBuilder bind(TypeLiteral typeLiteral) { - return super.bind(typeLiteral); - } - - /** - * @see Binder#bind(Class) - */ - @Override - public AnnotatedBindingBuilder bind(Class clazz) { - return super.bind(clazz); - } - - /** - * @see Binder#bindConstant() - */ - @Override - public AnnotatedConstantBindingBuilder bindConstant() { - return super.bindConstant(); - } - - /** - * @see Binder#install(Module) - */ - @Override - public void install(Module module) { - super.install(module); - } - - /** - * @see Binder#addError(String, Object[]) - */ - @Override - public void addError(String message, Object... arguments) { - super.addError(message, arguments); - } - - /** - * @see Binder#addError(Throwable) - */ - @Override - public void addError(Throwable t) { - super.addError(t); - } - - /** - * @see Binder#addError(Message) - * @since 2.0 - */ - @Override - public void addError(Message message) { - super.addError(message); - } - - /** - * @see Binder#requestInjection(Object) - * @since 2.0 - */ - @Override - public void requestInjection(Object instance) { - super.requestInjection(instance); - } - - /** - * @see Binder#requestStaticInjection(Class[]) - */ - @Override - public void requestStaticInjection(Class... types) { - super.requestStaticInjection(types); - } - - /** - * @see Binder#bindInterceptor(com.google.inject.matcher.Matcher, - * com.google.inject.matcher.Matcher, org.aopalliance.intercept.MethodInterceptor[]) - */ - @Override - public void bindInterceptor(Matcher> classMatcher, Matcher methodMatcher, org.aopalliance.intercept.MethodInterceptor... interceptors) { - binder().bindInterceptor(classMatcher, methodMatcher, interceptors); - } - - /** - * @see Binder#getProvider(Key) - * @since 2.0 - */ - @Override - public Provider getProvider(Key key) { - return super.getProvider(key); - } - - /** - * @see Binder#getProvider(Class) - * @since 2.0 - */ - @Override - public Provider getProvider(Class type) { - return super.getProvider(type); - } - - /** - * @see Binder#bindListener(com.google.inject.matcher.Matcher, com.google.inject.spi.TypeListener) - * @since 2.0 - */ - @Override - public void bindListener(Matcher> typeMatcher, TypeListener listener) { - super.bindListener(typeMatcher, listener); - } - - /** - * @see Binder#bindListener(com.google.inject.matcher.Matcher, com.google.inject.spi.TypeListener) - * @since 2.0 - */ - @Override - public void bindListener(Matcher> bindingMatcher, ProvisionListener... listener) { - super.bindListener(bindingMatcher, listener); - } - - -} diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index d5d892c..b9fa788 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -17,7 +17,7 @@ exports com.guicedee.guicedinjection; //exports com.guicedee.guicedinjection.exceptions; - exports com.guicedee.guicedinjection.abstractions; + //exports com.guicedee.guicedinjection.abstractions; //exports com.guicedee.guicedinjection.pairing; //exports com.guicedee.services.jsonrepresentation.json; exports com.guicedee.guicedinjection.representations; diff --git a/src/main/resources/META-INF/services/com.guicedee.guicedinjection.interfaces.IGuiceDefaultBinder b/src/main/resources/META-INF/services/com.guicedee.guicedinjection.interfaces.IGuiceDefaultBinder deleted file mode 100644 index 7bd6858..0000000 --- a/src/main/resources/META-INF/services/com.guicedee.guicedinjection.interfaces.IGuiceDefaultBinder +++ /dev/null @@ -1,2 +0,0 @@ -com.guicedee.guicedinjection.injections.ContextBinderGuice -com.guicedee.guicedinjection.json.ObjectMapperBinder \ No newline at end of file