Skip to content

kigawa01/kunit

Repository files navigation

kutil-unit

About

  • add DI Container for java app
  • inject dependency instance to unit constructor
  • manage unit by container

Usage

<dependency>
  <groupId>net.kigawa.kutil</groupId>
  <artifactId>kunit-unit</artifactId>
  <version>4.4.0</version>
</dependency>

Unitの登録

register unit

// java

import net.kigawa.kutil.unit.annotation.Unit;

@Kunit
class Unit
{

}
// kotlin
import net.kigawa.kutil.unit.annotation.Kunit

@Knnit
object Unit {

}

Unitをロードして初期化する

load units and init them

import net.kigawa.kutil.unit.api.component.*;
import net.kigawa.kutil.unit.classlist.*;
import net.kigawa.kutil.unit.component.container.*;
import net.kigawa.kutil.unit.container.*;
import net.kigawa.kutil.unit.extension.identify.*;

import java.util.*;

class Main
{
    public static void main(String[] args)
    {
        // init
        var container = UnitContainer.create();
        container.getUnit(ResourceRegistrar.class).register(UnitContainerTest.class);

        // shutdown
        container.close();
    }
}

Requirement

  • java

Author

Making

Version

Example: 9.1.2

  • 9: major, destructive
  • 1: miner, new function
  • 2: miner, bug fix

ToDo

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published