minijax-extensions

Minijax extensions

License

License

GroupId

GroupId

org.minijax
ArtifactId

ArtifactId

minijax-extensions
Last Version

Last Version

0.4.14
Release Date

Release Date

Type

Type

pom
Description

Description

minijax-extensions
Minijax extensions
Project Organization

Project Organization

Ajibot

Download minijax-extensions

How to add to project

<!-- https://jarcasting.com/artifacts/org.minijax/minijax-extensions/ -->
<dependency>
    <groupId>org.minijax</groupId>
    <artifactId>minijax-extensions</artifactId>
    <version>0.4.14</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/org.minijax/minijax-extensions/
implementation 'org.minijax:minijax-extensions:0.4.14'
// https://jarcasting.com/artifacts/org.minijax/minijax-extensions/
implementation ("org.minijax:minijax-extensions:0.4.14")
'org.minijax:minijax-extensions:pom:0.4.14'
<dependency org="org.minijax" name="minijax-extensions" rev="0.4.14">
  <artifact name="minijax-extensions" type="pom" />
</dependency>
@Grapes(
@Grab(group='org.minijax', module='minijax-extensions', version='0.4.14')
)
libraryDependencies += "org.minijax" % "minijax-extensions" % "0.4.14"
[org.minijax/minijax-extensions "0.4.14"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

  • minijax-client
  • minijax-db
  • minijax-json
  • minijax-liquibase
  • minijax-mustache
  • minijax-security
  • minijax-servlet
  • minijax-undertow
  • minijax-undertow-websocket
  • minijax-validation
  • minijax-view

Build status Quality Gate

Minijax

Lightweight Jakarta EE

  • Fast and simple JAX-RS, JSON, WebSockets, JPA, dependency injection
  • Code to standard Java and Java EE API's as much as possible
  • Minimal dependencies, setup, configuration, and hassle

Getting Started

<dependency>
    <groupId>org.minijax</groupId>
    <artifactId>minijax-undertow</artifactId>
    <version>0.5.9</version>
</dependency>
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;

import org.minijax.Minijax;

@Path("/")
public class Hello {

    @GET
    public static String hello() {
        return "Hello world!";
    }

    public static void main(String[] args) {
        new Minijax()
                .register(Hello.class)
                .start();
    }
}

Dependency Injection

Minijax uses the JSR-330 standard for dependency injection. It recognizes standard annotations such as @Provider and @Inject.

package com.example;

import jakarta.inject.Inject;
import jakarta.ws.rs.DefaultValue;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.ext.Provider;

import org.minijax.Minijax;

public class HelloInjection {

    public interface MyService {

        String shout(String str);
    }

    @Provider
    public class MyServiceImpl implements MyService {

        @Override
        public String shout(final String str) {
            return str.toUpperCase();
        }
    }

    @Path("/")
    public class MyResource {

        @Inject
        private MyService service;

        @GET
        public String get(@QueryParam("name") @DefaultValue("friend") final String name) {
            return "Hello " + service.shout(name);
        }
    }

    public static void main(final String[] args) {
        new Minijax()
                .packages("com.example")
                .start();
    }
}

Testing

Minijax provides a rich set of testing features that integrate with standard testing libraries such as JUnit and Mockito.

package com.example;

import static org.junit.jupiter.api.Assertions.*;

import static org.mockito.Mockito.*;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.minijax.rs.test.MinijaxTest;

import com.example.HelloInjection.MyResource;
import com.example.HelloInjection.MyService;

class HelloInjectionTest extends MinijaxTest {

    @BeforeEach
    public void setUp() {
        final MyService mockService = mock(MyService.class);
        when(mockService.shout(eq("friend"))).thenReturn("FRIEND");
        when(mockService.shout(eq("cody"))).thenReturn("CODY");

        bind(mockService, MyService.class);
        register(MyResource.class);
    }

    @Test
    void testDefault() {
        assertEquals("Hello FRIEND", target("/").request().get(String.class));
    }

    @Test
    void testQueryString() {
        assertEquals("Hello CODY", target("/?name=cody").request().get(String.class));
    }
}

Learn more

Versions

Version
0.4.14
0.4.13
0.4.1
0.3.20
0.3.18
0.3.14
0.3.12
0.3.11
0.3.10
0.3.7
0.3.6
0.3.5
0.3.4
0.3.3
0.3.2
0.3.1
0.3.0
0.2.6
0.2.4
0.2.3
0.2.2
0.2.1
0.2.0
0.1.7
0.1.6
0.1.5
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0
0.0.47
0.0.43
0.0.42
0.0.41
0.0.40
0.0.39
0.0.35
0.0.34
0.0.33
0.0.32
0.0.31
0.0.30
0.0.29
0.0.28
0.0.27
0.0.26
0.0.25
0.0.22
0.0.20
0.0.18