This is a maven multi-module project with 3 modules:
-
autentia-services: it contains service logic of application
-
autentia-web: it contains simple servlet web application using servlet an j2ee with tomcat embedded
-
autentia-api-rest: it contains simple rest api web using servlet an j2ee with tomcat embedded
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
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)
AUTENTIA WEB MAVEN MODULE (port 8081)
Access to you application with your favorite browser
localhost:8081/course
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