Skip to content

Commit

Permalink
Update to Java 17 + Micronaut 4
Browse files Browse the repository at this point in the history
  • Loading branch information
pdambrauskas committed Oct 22, 2023
1 parent b199469 commit 085cf7e
Show file tree
Hide file tree
Showing 14 changed files with 106 additions and 201 deletions.
31 changes: 20 additions & 11 deletions server/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
plugins {
id "java"
id "groovy"
id "io.micronaut.application" version "3.7.10"
id "com.github.ben-manes.versions" version "0.48.0"
id "io.micronaut.application" version "4.1.1"
id "com.github.ben-manes.versions" version "0.49.0"
}

group "org.exacaster.lighter"
Expand All @@ -13,34 +13,39 @@ repositories {
}

java {
sourceCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_17
}

micronaut {
version = "3.10.1"
version = "4.1.5"
runtime "netty"
}
mainClassName = "com.exacaster.lighter.Application"

def sparkVersion = project.hasProperty("SPARK_VERSION") ? project.getProperty("SPARK_VERSION") : '3.5.0'
def hadoopVersion = '3.3.3'
def k8sClientVersion = '6.9.0'
def shedlockVersion = '4.46.0'
def shedlockVersion = '5.9.1'


dependencies {
annotationProcessor "io.micronaut:micronaut-validation"
annotationProcessor "io.micronaut.openapi:micronaut-openapi"
annotationProcessor "io.micronaut.validation:micronaut-validation-processor"
annotationProcessor "io.micronaut.data:micronaut-data-processor"

implementation "io.micronaut.validation:micronaut-validation"

implementation "io.micronaut:micronaut-validation"
implementation "io.micronaut.flyway:micronaut-flyway"
implementation "io.swagger.core.v3:swagger-annotations"

implementation "io.micronaut.sql:micronaut-jdbc-hikari"
implementation "io.micronaut.sql:micronaut-jdbi"
implementation "io.micronaut.data:micronaut-data-processor"
implementation "io.micronaut.data:micronaut-data-jdbc"

implementation "io.micronaut:micronaut-http-client"
implementation "io.micronaut:micronaut-jackson-databind"

implementation "org.apache.spark:spark-launcher_2.12:${sparkVersion}"
implementation "org.apache.spark:spark-launcher_2.13:${sparkVersion}"
implementation "io.fabric8:kubernetes-client:${k8sClientVersion}"
implementation("org.apache.hadoop:hadoop-yarn-client:${hadoopVersion}") {
exclude(group: "ch.qos.reload4j", module: "reload4j")
Expand All @@ -52,17 +57,21 @@ dependencies {
}
implementation 'net.sf.py4j:py4j:0.10.9.7'

implementation "net.javacrumbs.shedlock:shedlock-micronaut:${shedlockVersion}"
implementation "net.javacrumbs.shedlock:shedlock-provider-jdbc-micronaut:${shedlockVersion}"
implementation "net.javacrumbs.shedlock:shedlock-micronaut4:${shedlockVersion}"
implementation "net.javacrumbs.shedlock:shedlock-provider-jdbc-template:${shedlockVersion}"

runtimeOnly "io.micronaut.micrometer:micronaut-micrometer-core"
runtimeOnly "io.micronaut.micrometer:micronaut-micrometer-registry-prometheus"
runtimeOnly "io.micronaut:micronaut-management"

runtimeOnly "org.yaml:snakeyaml"
runtimeOnly "com.h2database:h2"
runtimeOnly "org.postgresql:postgresql"

testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.10.0"
testRuntimeOnly "net.bytebuddy:byte-buddy:1.14.9"
testRuntimeOnly "org.objenesis:objenesis:3.3"

testImplementation "io.micronaut:micronaut-inject-groovy"
testImplementation "io.micronaut.test:micronaut-test-spock"
testImplementation "io.micronaut:micronaut-http-client"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import io.micronaut.core.annotation.Introspected;
import io.micronaut.core.annotation.Nullable;

import javax.validation.constraints.NotNull;
import jakarta.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.StringJoiner;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import io.micronaut.context.annotation.ConfigurationProperties;
import io.micronaut.context.annotation.Requires;
import io.micronaut.core.annotation.Nullable;
import javax.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotBlank;
import org.apache.commons.lang3.builder.ToStringBuilder;

@ConfigurationProperties("lighter.yarn")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import io.swagger.v3.oas.annotations.tags.Tags;

import java.util.Optional;
import javax.validation.Valid;
import jakarta.validation.Valid;

@Tags(@Tag(name = "Batches"))
@Validated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.tags.Tags;

import javax.validation.Valid;
import jakarta.validation.Valid;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import io.micronaut.http.server.exceptions.response.ErrorContext;
import io.micronaut.http.server.exceptions.response.ErrorResponseProcessor;

import javax.inject.Singleton;
import jakarta.inject.Singleton;

@Primary
@Singleton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import javax.sql.DataSource;
import javax.transaction.Transactional;
import jakarta.transaction.Transactional;
import org.jdbi.v3.core.Jdbi;
import org.jdbi.v3.core.mapper.RowMapper;
import org.jdbi.v3.core.statement.StatementContext;
import org.slf4j.Logger;

import javax.sql.DataSource;

@Singleton
@Requires(beans = DataSource.class)
public class JdbcApplicationStorage implements ApplicationStorage, RowMapper<Application> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,27 @@

import io.micronaut.context.annotation.Factory;
import io.micronaut.context.annotation.Requires;
import io.micronaut.data.connection.jdbc.advice.DelegatingDataSource;
import jakarta.inject.Singleton;
import net.javacrumbs.shedlock.core.LockProvider;
import net.javacrumbs.shedlock.provider.jdbc.micronaut.MicronautJdbcLockProvider;
import net.javacrumbs.shedlock.provider.jdbctemplate.JdbcTemplateLockProvider;
import org.springframework.jdbc.core.JdbcTemplate;

import javax.sql.DataSource;


@Factory
@Requires(beans = DataSource.class)
public class JdbcLockProvider {

@Singleton
public LockProvider lockProvider(DataSource datasource) {
return new MicronautJdbcLockProvider(datasource);
public LockProvider lockProvider(DataSource dataSource) {
DataSource unwrappedDataSource = ((DelegatingDataSource) dataSource).getTargetDataSource();
return new JdbcTemplateLockProvider(
JdbcTemplateLockProvider.Configuration.builder()
.withJdbcTemplate(new JdbcTemplate(unwrappedDataSource))
.usingDbTime()
.build()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.util.Optional;
import jakarta.inject.Singleton;
import javax.sql.DataSource;
import javax.transaction.Transactional;
import jakarta.transaction.Transactional;
import org.jdbi.v3.core.Jdbi;
import org.jdbi.v3.core.mapper.RowMapper;
import org.jdbi.v3.core.statement.StatementContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
import java.util.List;
import java.util.Optional;
import java.util.UUID;
import javax.sql.DataSource;
import javax.transaction.Transactional;
import jakarta.transaction.Transactional;
import org.jdbi.v3.core.Jdbi;
import org.jdbi.v3.core.mapper.RowMapper;
import org.jdbi.v3.core.statement.StatementContext;

import javax.sql.DataSource;

@Singleton
@Requires(beans = DataSource.class)
public class JdbcStatementStorage implements StatementStorage, RowMapper<Statement> {
Expand Down

This file was deleted.

Loading

0 comments on commit 085cf7e

Please sign in to comment.