Skip to content

cristianprofile/autentia

Repository files navigation

Create an application using J2ee standard without using any framework

Build Status

This project model a simple application managing courses (get all and create a course) A course entity has

Prerequisites

  • Java 8+, Docker and maven 3 installed.

Maven Structure

This is a maven multi-module project with 3 modules:

  1. autentia-services: it contains service logic of application

  2. autentia-web: it contains simple servlet web application using servlet an j2ee with tomcat embedded

  3. autentia-api-rest: it contains simple rest api web using servlet an j2ee with tomcat embedded

project modules

How to run application

Using maven you can create package with command (main parent folder):

$ mvn package

If command ends successfully inside target/bin you will have a script to run your application

Run docker compose up

docker-compose up

Run docker-compose up command in main folder (docker-compose.ylm file). 3 services will be created :

  • mysql database in port (port 3306)

  • rest api (port 8080)

  • web application (port 8081)

How to run web application

AUTENTIA WEB MAVEN MODULE (port 8081)

Access to you application with your favorite browser

localhost:8081/course

How to run rest api

Use postman test cases defined in postman folder

project modules

Log trace explanation

App use logback library to manage application’s logs. Logback.xml is defined inisde resource folder:

<configuration>

    <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
        <target>System.out</target>
        <encoder>
            <pattern>%d{HH:mm:ss.SSS} [%thread] [%X{correlationId}] %-5level %logger{36} - %msg%n</pattern>
        </encoder>
    </appender>
    <root level="debug">
        <appender-ref ref="console"/>
    </root>
</configuration>

Here you can see a line of application’s log (Correlation id is defined per thread local to be able to filter each request ):

21:00:50.762 [http-nio-8080-exec-2] [4a37a6ef-ac22-4d20-b7fc-4a7bb9b2520b] DEBUG com.mylab.cromero.AutentiaServlet - init post on inside servlet

project modules

About

autentia j2ee example

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published