io.github.factoryfx:factory

factoryfx dependency injection framework


License
Apache-2.0

Documentation

FactoryFX

Lightweight dependency and data (re-)injection framework for all kinds of Java applications.

Introduction

  • Lightweight
    Fully debuggable programmatic Java API (no annotations)
    Fast startup (no classpath scanning)

  • Dependency injection
    Factory based implementation of the dependency injection pattern.

  • Data (re-)injection
    (Like dependencies) Data can be injected into Java objects.
    Supports OOP and avoids OR mapping or external configuration files.
    Allows optimized (partial) reconfiguration at runtime.

Key concepts

Setup

Group ID Artifact ID Version
io.github.factoryfx factory 2.1.0

java 16+ required

Dependencies

Gradle example dependency setups

New project template

Template

Changelog

CHANGELOG

Basic example "Hello World"

Factory

public class PrinterFactory extends SimpleFactoryBase<Printer,PrinterFactory> {
    public final StringAttribute text = new StringAttribute();
    @Override
    protected Printer create() {
        return new Printer(text.get());
    }
}

Factory explanation

Live object

public class Printer{
    private final String text;
    public Printer(String text) {
        this.text = text;
    }
    public void print(){
        System.out.println(text);
    }
}

Live object explanation

Setup the dependency tree

    new FactoryTreeBuilder<Printer,PrinterFactory,Void>(PrinterFactory.class)
        .addSingleton(PrinterFactory.class, ctx-> {
            PrinterFactory printerFactory = new PrinterFactory();
            printerFactory.text.set("Hello World");
            return printerFactory;
        })
    .microservice().build().start().print();

The complete example

Documentation

Fundamentals

Common applications

  • REST server
    Basic jetty server with a jersey REST resource

Advanced

Example

Example
An example that implements a simplified online store.

License

Released under the Apache 2.0 license.

Professional support

FactoryFX is the long-time development effort of the german company SCOOP Software GmbH. We are a consulting and software company with a constant direction towards state-of-the-art technologies and methods. Our high performance systems are used in multiple medium sized and large enterprises in branches such as online retail, telecommunications, financial services, logistics and local government.

If you are thinking about using FactoryFX in your own project and need more help, SCOOP Software is willing to offer professional support on a commercial basis. We offer workshops, coaching, or any other help to get your FactoryFx project up and running.