Skip to content
This repository has been archived by the owner on Apr 12, 2023. It is now read-only.
/ autumn Public archive

Experimental Netty-based Java 16 application/web framework

Notifications You must be signed in to change notification settings

queer/autumn

Repository files navigation

autumn

Experimental Netty-based application/web framework.

An example application can be seen here.

Should I use this?

Probably not! It's still incredibly early-stage -- everything's versioned at 0.0.1 for a reason, after all~ -- and so there's all sorts of instabilities, weirdness, etc. that you probably don't want to deal with.

Components

  • autumn-example: Example application.
  • autumn-application: Application bootstrap.
  • autumn-config: HJSON-based configuration.
  • autumn-di: Dependency injection framework.
  • autumn-data: Database access layer.
  • autumn-json: JSON helper library.
  • autumn-web: Web framework.

What does work

  • JVM boot to usable API in ~500ms
  • Runs with 32MB of heap RAM or less
  • Runtime DI + modularisation via components
  • Component dependencies
  • JSON
  • Web server
  • HJSON-based autoconfig
  • Object-mapping database manipulation via PostgreSQL JSONB.

What doesn't work

  • Multipart
  • Websockets
  • HTTP/2 (dealing with SSL is a hairy problem)
  • Globbing routes

Build an API in 30 seconds

public class Readme {
    public static void main(String[] args) {
        AutumnApplication.run();
    }

    @Route(method = HttpMethod.GET, path = "/hello/:name")
    public Response hello(Request req) {
        return Response.create().body("henlo " + req.params().get("name") + '!');
    }
}

Modularise with components

@Component
public class HelloComponent {
    public String sayHello(String name) {
        return "henlo " + name + "!";
    }
}

public class Readme {
    @Inject
    private HelloComponent hello;

    public static void main(String[] args) {
        AutumnApplication.run();
    }

    @Route(method = HttpMethod.GET, path = "/hello/:name")
    public Response hello(Request req) {
        return Response.create().body(hello.sayHello(req.params().get("name")));
    }
}

Singleton components for ex. databases

@Component
@Singleton
public class SingletonComponent {
    public String sayHello(String name) {
        return "henlo " + name + "!";
    }
}

public class Readme {
    @Inject
    private SingletonComponent singleton;

    public static void main(String[] args) {
        AutumnApplication.run();
    }

    @Route(method = HttpMethod.GET, path = "/hello/:name")
    public Response hello(Request req) {
        return Response.create().body(singleton.sayHello(req.params().get("name")));
    }
}

About

Experimental Netty-based Java 16 application/web framework

Resources

Stars

Watchers

Forks

Packages