Skip to content

Commit

Permalink
chore: upgrade to java 21 (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
rgomezcasas authored Nov 6, 2023
1 parent ec51797 commit c65ab95
Show file tree
Hide file tree
Showing 29 changed files with 236 additions and 210 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
FROM openjdk:11-slim-buster
FROM openjdk:21-slim-buster
WORKDIR /app
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ run-tests:

.PHONY: test
test:
@docker exec codelytv-ddd_skeleton-java ./gradlew test --warning-mode all
@docker exec codelytv-ddd_example-java ./gradlew test --warning-mode all

.PHONY: run
run:
@./gradlew :run

.PHONY: ping-mysql
ping-mysql:
@docker exec codelytv-java_ddd_skeleton-mysql mysqladmin --user=root --password= --host "127.0.0.1" ping --silent
@docker exec codelytv-java_ddd_example-mysql mysqladmin --user=root --password= --host "127.0.0.1" ping --silent

# Start the app
.PHONY: start-mooc_backend
start-mooc_backend:
@./gradlew :run --args='mooc_backend server'
@./gradlew bootRun --args='mooc_backend server'

.PHONY: start-backoffice_frontend
start-backoffice_frontend:
@./gradlew :run --args='backoffice_frontend server'
@./gradlew bootRun --args='backoffice_frontend server'
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# ☕🚀 Java DDD Skeleton: Save the boilerplate in your new projects
# ☕🚀 Java DDD example: Save the boilerplate in your new projects

<img src="http://codely.tv/wp-content/uploads/2016/05/cropped-logo-codelyTV.png" align="left" width="192px" height="192px"/>
<img align="left" width="0" height="192px" hspace="10"/>

> ⚡ Start your Java projects as fast as possible
[![CodelyTV](https://img.shields.io/badge/codely-tv-green.svg?style=flat-square)](https://codely.tv)
[![CI pipeline status](https://github.com/CodelyTV/java-ddd-skeleton/workflows/CI/badge.svg)](https://github.com/CodelyTV/java-ddd-skeleton/actions)
[![CI pipeline status](https://github.com/CodelyTV/java-ddd-example/workflows/CI/badge.svg)](https://github.com/CodelyTV/java-ddd-example/actions)

## ℹ️ Introduction

Expand All @@ -18,7 +18,7 @@ Here you have the [course on CodelyTV Pro where we explain step by step all this

1. Install Java 11: `brew cask install corretto`
2. Set it as your default JVM: `export JAVA_HOME='/Library/Java/JavaVirtualMachines/amazon-corretto-11.jdk/Contents/Home'`
3. Clone this repository: `git clone https://github.com/CodelyTV/java-ddd-skeleton`.
3. Clone this repository: `git clone https://github.com/CodelyTV/java-ddd-example`.
4. Bring up the Docker environment: `make up`.
5. Execute some [Gradle lifecycle tasks](https://docs.gradle.org/current/userguide/java_plugin.html#lifecycle_tasks) in order to check everything is OK:
1. Create [the project JAR](https://docs.gradle.org/current/userguide/java_plugin.html#sec:jar): `make build`
Expand All @@ -33,20 +33,20 @@ Here you have the [course on CodelyTV Pro where we explain step by step all this

### ☕ Java

* 📂 [Java Basic Skeleton](https://github.com/CodelyTV/java-basic-skeleton)
* 📂 [Java Basic example](https://github.com/CodelyTV/java-basic-example)
*[Java OOP Examples](https://github.com/CodelyTV/java-oop-examples)
* 🧱 [Java SOLID Examples](https://github.com/CodelyTV/java-solid-examples)
* 🥦 [Java DDD Example](https://github.com/CodelyTV/java-ddd-example)

### 🐘 PHP

* 📂 [PHP Basic Skeleton](https://github.com/CodelyTV/php-basic-skeleton)
* 🎩 [PHP DDD Skeleton](https://github.com/CodelyTV/php-ddd-skeleton)
* 📂 [PHP Basic example](https://github.com/CodelyTV/php-basic-example)
* 🎩 [PHP DDD example](https://github.com/CodelyTV/php-ddd-example)
* 🥦 [PHP DDD Example](https://github.com/CodelyTV/php-ddd-example)

### 🧬 Scala

* 📂 [Scala Basic Skeleton](https://github.com/CodelyTV/scala-basic-skeleton)
*[Scala Basic Skeleton (g8 template)](https://github.com/CodelyTV/scala-basic-skeleton.g8)
* 📂 [Scala Basic example](https://github.com/CodelyTV/scala-basic-example)
*[Scala Basic example (g8 template)](https://github.com/CodelyTV/scala-basic-example.g8)
*[Scala Examples](https://github.com/CodelyTV/scala-examples)
* 🥦 [Scala DDD Example](https://github.com/CodelyTV/scala-ddd-example)
8 changes: 4 additions & 4 deletions apps/main/resources/.env
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#--------------------------------#
MOOC_BACKEND_SERVER_PORT=8081
# MySql
MOOC_DATABASE_HOST=codelytv-java_ddd_skeleton-mysql
MOOC_DATABASE_HOST=codelytv-java_ddd_example-mysql
MOOC_DATABASE_PORT=3306
MOOC_DATABASE_NAME=mooc
MOOC_DATABASE_USER=root
Expand All @@ -13,20 +13,20 @@ MOOC_DATABASE_PASSWORD=
BACKOFFICE_FRONTEND_SERVER_PORT=8090
BACKOFFICE_BACKEND_SERVER_PORT=8091
# MySql
BACKOFFICE_DATABASE_HOST=codelytv-java_ddd_skeleton-mysql
BACKOFFICE_DATABASE_HOST=codelytv-java_ddd_example-mysql
BACKOFFICE_DATABASE_PORT=3306
BACKOFFICE_DATABASE_NAME=backoffice
BACKOFFICE_DATABASE_USER=root
BACKOFFICE_DATABASE_PASSWORD=
# Elasticsearch
BACKOFFICE_ELASTICSEARCH_HOST=codelytv-java_ddd_skeleton-elasticsearch
BACKOFFICE_ELASTICSEARCH_HOST=codelytv-java_ddd_example-elasticsearch
BACKOFFICE_ELASTICSEARCH_PORT=9200
BACKOFFICE_ELASTICSEARCH_INDEX_PREFIX=backoffice

# COMMON #
#--------------------------------#
# RabbitMQ
RABBITMQ_HOST=codelytv-java_ddd_skeleton-rabbitmq
RABBITMQ_HOST=codelytv-java_ddd_example-rabbitmq
RABBITMQ_PORT=5672
RABBITMQ_LOGIN=codelytv
RABBITMQ_PASSWORD=c0d3ly
Expand Down
6 changes: 3 additions & 3 deletions apps/main/resources/log4j2.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name = CodelyTvJavaDddSkeleton
name = CodelyTvJavaDddExample
property.filename = logs
appenders = console, file

Expand All @@ -16,15 +16,15 @@ appender.console.logstash.stackTraceEnabled = true

appender.file.type = File
appender.file.name = LOGFILE
appender.file.fileName = var/log/java-ddd-skeleton.log
appender.file.fileName = var/log/java-ddd-example.log
appender.file.logstash.type = LogstashLayout
appender.file.logstash.dateTimeFormatPattern = yyyy-MM-dd'T'HH:mm:ss.SSSZZZ
appender.file.logstash.eventTemplateUri = classpath:LogstashJsonEventLayoutV1.json
appender.file.logstash.prettyPrintEnabled = false
appender.file.logstash.stackTraceEnabled = true

loggers = file
logger.file.name = tv.codely.java_ddd_skeleton
logger.file.name = tv.codely.java_ddd_example
logger.file.level = info
logger.file.appenderRefs = file
logger.file.appenderRef.file.ref = LOGFILE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import tv.codely.shared.domain.bus.command.CommandBus;
import tv.codely.shared.domain.bus.command.CommandHandlerExecutionError;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.*;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Base64;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public MoocBackendServerConfiguration(RequestMappingHandlerMapping mapping) {
}

@Bean
public FilterRegistrationBean<ApiExceptionMiddleware> basicHttpAuthMiddleware() {
public FilterRegistrationBean<ApiExceptionMiddleware> apiExceptionMiddleware() {
FilterRegistrationBean<ApiExceptionMiddleware> registrationBean = new FilterRegistrationBean<>();

registrationBean.setFilter(new ApiExceptionMiddleware(mapping));
Expand Down
6 changes: 3 additions & 3 deletions apps/test/resources/log4j2.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name = CodelyTvJavaDddSkeleton
name = CodelyTvJavaDddExample
property.filename = logs
appenders = console, file

Expand All @@ -15,15 +15,15 @@ appender.console.filter.threshold.level = info

appender.file.type = File
appender.file.name = LOGFILE
appender.file.fileName = var/log/java-ddd-skeleton-test.log
appender.file.fileName = var/log/java-ddd-example-test.log
appender.file.logstash.type = LogstashLayout
appender.file.logstash.dateTimeFormatPattern = yyyy-MM-dd'T'HH:mm:ss.SSSZZZ
appender.file.logstash.eventTemplateUri = classpath:LogstashJsonEventLayoutV1.json
appender.file.logstash.prettyPrintEnabled = false
appender.file.logstash.stackTraceEnabled = true

loggers = file
logger.file.name = tv.codely.java_ddd_skeleton
logger.file.name = tv.codely.java_ddd_example
logger.file.level = info
logger.file.appenderRefs = file
logger.file.appenderRef.file.ref = LOGFILE
Expand Down
3 changes: 0 additions & 3 deletions apps/test/tv/codely/apps/ApplicationTestCase.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package tv.codely.apps;

import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.ResultMatcher;
import tv.codely.shared.domain.bus.event.DomainEvent;
Expand All @@ -20,7 +18,6 @@
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

@RunWith(SpringRunner.class)
@SpringBootTest
@AutoConfigureMockMvc
public abstract class ApplicationTestCase {
Expand Down
Loading

0 comments on commit c65ab95

Please sign in to comment.