CDI and plugins, Bean Discovery, Migrations, Async Microservice Communication, Validations with JAX-RS, Serialization---or 52nd airhacks.tv is available

"CDI components as plugins, CDI bean discovery mode recommendations, asynchronous microservice calls, modelling validations with REST, JSON-B and selective serialization, DB migrations with Java EE 7, how to be a happy consultant" , or 52nd airhacks.tv is available:

Any questions left? Ask now: https://gist.github.com/AdamBien/24c3560d05e7bcba9a82af072955a6c4 and get the answers at the next airhacks.tv.

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.


NEW MUC Airport Workshop: Migrating Java Client (Swing / Java FX) to Web Standards

Airport MUC workshops: Web (SPA, PWAs, Offline, Desktop, Mobile) Applications Essentials and Effective Web Applications. No migrations. #usetheplatform

Podcast: airhacks.fm and newsletter: airhacks.news

A book about rethinking Java EE Patterns

From Zero to Hello with Open Liberty 18 Full Profile Java EE 8

How long does it take to install, start "Java EE 7/8 Full Profile" Open Liberty 18 (the opensource version of IBM WebSphere) server, then clone, build and deploy a Java EE application (ping) with Maven 3?

No tricks, no magic, no dependencies:

Also checkout other Java EE "Full Profile" application servers.

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.


NEW MUC Airport Workshop: Migrating Java Client (Swing / Java FX) to Web Standards

Airport MUC workshops: Web (SPA, PWAs, Offline, Desktop, Mobile) Applications Essentials and Effective Web Applications. No migrations. #usetheplatform

Podcast: airhacks.fm and newsletter: airhacks.news

A book about rethinking Java EE Patterns

Generating Swagger / OpenAPI Without External Dependencies

A CRUD JAX-RS 2 (Java EE 7/8) service:


@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Path("workshops")
public class WorkshopsResource {

    @GET
    public JsonArray all() {
        return Json.createArrayBuilder().
                add("java").
                add("web").
                build();
    }

    @GET
    @Path("{name}")
    public JsonObject get(@PathParam("name") String name) {
        return null;
    }

    @PUT
    @Path("{name}")
    public void add(@PathParam("name") String name, JsonObject workshop) {

    }

    @DELETE
    @Path("{name}")
    public void remove(@PathParam("name") String name) {

    }
}    

...deployed on MicroProfile compatible application servers (tested with Payara Server 5 Full Profile), emits the following OpenAPI/swagger document from the standardized uri: http://localhost:8080/openapi:


openapi: 3.0.0
info:
    title: Deployed Resources
    version: 1.0.0
servers:
- url: http://localhost:8080/openapi-sample
    description: Default Server.
paths:
    /resources/workshops:
    get:
        operationId: all
        responses:
        default:
            description: Default Response.
            content:
            application/json:
                schema:
                type: object
    /resources/workshops/{name}:
    get:
        operationId: get
        parameters:
        - name: name
        in: path
        required: true
        style: simple
        schema:
            type: string
        responses:
        default:
            description: Default Response.
            content:
            application/json:
                schema:
                type: object
    put:
        operationId: add
        parameters:
        - name: name
        in: path
        required: true
        style: simple
        schema:
            type: string
        requestBody:
        content:
            application/json:
            schema:
                type: object
        responses:
        default:
            description: Default Response.
            content:
            application/json:
                schema:
                type: object
    delete:
        operationId: remove
        parameters:
        - name: name
        in: path
        required: true
        style: simple
        schema:
            type: string
        responses:
        default:
            description: Default Response.
            content:
            application/json:
                schema:
                type: object
components: {}

For the creation of the document above, no additional dependencies, configuration or changes were needed. The example above is a 3.9kB Thin WAR.

Because servers like Payara Server 5 Full Profile or OpenLiberty support Java EE 8 and MicroProfile at the same time, you neither have to change your runtime, nor your lean Java EE 8 build setup:


<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.airhacks</groupId>
<artifactId>openapi-sample</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<dependencies>
   <dependency>
       <groupId>javax</groupId>
       <artifactId>javaee-api</artifactId>
       <version>8.0</version>
       <scope>provided</scope>
   </dependency>
</dependencies>
<build>
   <finalName>openapi-sample</finalName>
</build>
<properties>
   <maven.compiler.source>1.8</maven.compiler.source>
   <maven.compiler.target>1.8</maven.compiler.target>
   <failOnMissingWebXml>false</failOnMissingWebXml>
</properties>
</project>    
For customizations (coming with the MicroProfile OpenAPI) you will need a single provided dependency to the MicroProfile API:

<dependency>
    <groupId>org.eclipse.microprofile</groupId>
    <artifactId>microprofile</artifactId>
    <version>1.3</version>
    <type>pom</type>
    <scope>provided</scope>
</dependency>	    

Enjoy Java EE 8 + MicroProfile and stay light!

See you at MicroProfile With or Without Jakarta EE, at Munich Airport, Terminal 2


NEW MUC Airport Workshop: Migrating Java Client (Swing / Java FX) to Web Standards

Airport MUC workshops: Web (SPA, PWAs, Offline, Desktop, Mobile) Applications Essentials and Effective Web Applications. No migrations. #usetheplatform

Podcast: airhacks.fm and newsletter: airhacks.news

A book about rethinking Java EE Patterns

From JSF and PrimeFaces to WebComponents--A Conversation With Cagatay Civici

An airhacks.fm podcast conversation with Cagatay Civici (@cagataycivici) about starting with Java, interfaces and return statements, IBM RAD JSF, Sun JSF Woodstock, Apache MyFaces, Apache MyFaces Tomahawk, JSF Chart Creator, Apache MyFaces Tobago, Oracle's ADF, YUI, jQuery and JSF, the non-dependency mindset, building complex UI components, Jakarta EE and microprofile, a scientific approach to design, choosing colors and color palletes, ideas for themes, standards and PrimeFaces, keeping up with Angular, React and WebComponents, StencilJS, PrimeFaces NG, an opensource model with commercial support, why "Prime", component sponsorship, performance under pressure and PrimeTek.

Subscribe to airhacks.fm podcast via: RSS iTunes

See you at Effective Progressive-, Offline-, Single Page-, Desktop Apps with Web Standards -- the "no frameworks, no migrations" approach, at Munich Airport, Terminal 2 or webcomponents.training (online).


NEW MUC Airport Workshop: Migrating Java Client (Swing / Java FX) to Web Standards

Airport MUC workshops: Web (SPA, PWAs, Offline, Desktop, Mobile) Applications Essentials and Effective Web Applications. No migrations. #usetheplatform

Podcast: airhacks.fm and newsletter: airhacks.news

A book about rethinking Java EE Patterns

From Zero to Hello with WildFly Full 13.0.0.Final

How long does it take to install, start "Java EE 7/8 Full Profile" WildFly 13 (and the largest available WildFly distribution) server, then clone, build and deploy a Java EE application (ping) with Maven 3?

No tricks, no magic, no dependencies:

Also checkout other Java EE "Full Profile" application servers.

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.


NEW MUC Airport Workshop: Migrating Java Client (Swing / Java FX) to Web Standards

Airport MUC workshops: Web (SPA, PWAs, Offline, Desktop, Mobile) Applications Essentials and Effective Web Applications. No migrations. #usetheplatform

Podcast: airhacks.fm and newsletter: airhacks.news

A book about rethinking Java EE Patterns

Building PWA with Polymer 3, WebComponents and Java EE 8 Backend

I'm starting with the implementation, build and deployment of a Java EE 8 HTTP/JSON endpoint, then scaffold a polymer 3 Progressive Web Application (PWA) with CLI, and finally create a vanilla Custom Element which calls the Java EE 8 backend. From scratch, without tricks or magic. #usetheplatform

In 8 mins:

See you at Structuring Single Page Applications (SPA)s / Progressive Web Applications (PWA)s with WebComponents -- the "no frameworks, no migrations" approach, at Munich Airport, Terminal 2 or webcomponents.training (online).


NEW MUC Airport Workshop: Migrating Java Client (Swing / Java FX) to Web Standards

Airport MUC workshops: Web (SPA, PWAs, Offline, Desktop, Mobile) Applications Essentials and Effective Web Applications. No migrations. #usetheplatform

Podcast: airhacks.fm and newsletter: airhacks.news

A book about rethinking Java EE Patterns

Using enums as CDI Events

Java enum can be used as an CDI "command" event:


public enum OrderEvent {
    CREATE, CANCEL;
}

Now you can sent enum instances:


public class OrderProcessor {

    @Inject
    Event<OrderEvent> events;

    public void createOrder() {
        events.fire(OrderEvent.CREATE);
    }

    public void cancelOrder() {
        events.fire(OrderEvent.CANCEL);
    }
}

...and consume them:


public class OrderMetrics {

    //...

    public void onSuccess(@Observes(during = TransactionPhase.AFTER_SUCCESS) OrderEvent event) {
        switch (event) {
            case CREATE:
                //...
                break;
            case CANCEL:
                //...
                break;
        }
    }
    public void onFailure(@Observes(during = TransactionPhase.AFTER_FAILURE) OrderEvent event) {
        switch (event) {
            case CREATE:
                //...
                break;
            case CANCEL:
                //...
                break;
        }
    }
}    

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.


NEW MUC Airport Workshop: Migrating Java Client (Swing / Java FX) to Web Standards

Airport MUC workshops: Web (SPA, PWAs, Offline, Desktop, Mobile) Applications Essentials and Effective Web Applications. No migrations. #usetheplatform

Podcast: airhacks.fm and newsletter: airhacks.news

A book about rethinking Java EE Patterns

When "There is a process already using the admin port 4848", but it is not true

When you try to start Payara 5 / GlassFish with:

asadmin start-domain

...and you get the following error:

There is a process already using the admin port 4848 -- it could be another instance of Payara Server or Payara Micro. Command start-domain failed.

although there is no running Java process and the port is not occupied, you hostname is probably not pingable:

ping $(hostname)

output: Request timeout

Solution:

Add the following line to the /etc/hosts file:

127.0.0.1 [YOUR_NOT_PINGABLE_HOSTNAME]

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.


NEW MUC Airport Workshop: Migrating Java Client (Swing / Java FX) to Web Standards

Airport MUC workshops: Web (SPA, PWAs, Offline, Desktop, Mobile) Applications Essentials and Effective Web Applications. No migrations. #usetheplatform

Podcast: airhacks.fm and newsletter: airhacks.news

A book about rethinking Java EE Patterns

Combining Serverless Functions with CDI 2.0 from Java EE 8

Serverless functions act as a facade / gateway to business logic. With CDI from Java EE 8, plain POJOs can be directly injected to fnproject.io functions and increase productivity:

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.


NEW MUC Airport Workshop: Migrating Java Client (Swing / Java FX) to Web Standards

Airport MUC workshops: Web (SPA, PWAs, Offline, Desktop, Mobile) Applications Essentials and Effective Web Applications. No migrations. #usetheplatform

Podcast: airhacks.fm and newsletter: airhacks.news

A book about rethinking Java EE Patterns

CDI and plugins, Discovery Modes, CompletableFuture and failures, ECB, ReadOnly JPA, Migrations -- or topics for 52nd airhacks.tv

Topics and questions for the 52nd airhacks.tv live show, July 2nd, 6pm:

  1. CDI components as plugins
  2. CDI bean discovery mode recommendations
  3. Dealing with failures in CompletableFuture.allOff
  4. Structuring business applications -- experiences with ECB
  5. Consultancy recommendations
  6. Read-only JPA
  7. How to design validations with REST
  8. Is JSON-B appropriate for selective serialization?
  9. How to implement Flyway Migrations with Java EE
  10. Most important books about programming
Any questions left? Ask now: https://gist.github.com/AdamBien/bfa3a444b6af3316e772f8eaf133f1cb and get the answers at the next airhacks.tv. See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.


NEW MUC Airport Workshop: Migrating Java Client (Swing / Java FX) to Web Standards

Airport MUC workshops: Web (SPA, PWAs, Offline, Desktop, Mobile) Applications Essentials and Effective Web Applications. No migrations. #usetheplatform

Podcast: airhacks.fm and newsletter: airhacks.news

A book about rethinking Java EE Patterns

realworldpatterns.com
Online Workshops
...the last 150 posts
...the last 10 comments
License