minijax-persistence

Minijax ORM

License

License

GroupId

GroupId

org.minijax
ArtifactId

ArtifactId

minijax-persistence
Last Version

Last Version

0.5.5
Release Date

Release Date

Type

Type

jar
Description

Description

minijax-persistence
Minijax ORM
Project Organization

Project Organization

Minijax

Download minijax-persistence

How to add to project

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

Dependencies

provided (2)

Group / Artifact Type Version
jakarta.persistence : jakarta.persistence-api jar 3.0.0
org.minijax : minijax-core jar 0.5.5

test (3)

Group / Artifact Type Version
ch.qos.logback : logback-classic jar 1.2.3
com.h2database : h2 jar 1.4.200
org.junit.jupiter : junit-jupiter-api jar 5.7.0

Project Modules

There are no modules declared in this project.

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.5.5
0.5.3
0.5.2
0.5.1
0.4.17