Skip to content

dgf/dimpl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

dimpl - simple Java class context and factory

This DI approach is only useful for dependency injection of concrete implementations.

There are no plans to support interfaces or annotations at all.

Example usage

a simple component

public class Component {
    public String toString() {
        return "dependency";
    }
}

the example the needs a component injection

public class Example {
    private Component component;

    public Example(Component component) {
        this.component = component;
    }

    public String toString() {
        return "example " + component;
    }
}

build context and retrieve the example dependency

import org.aplatanao.dimpl.Context;

public class Main {

    public static void main(String[] args) {
        Example example = new Context().get(Example.class);
        System.out.println(example); // outputs: "example dependency"
    }
}

About

simple Java class context and factory for dependency injection of implementations

Topics

Resources

License

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages