From a40289c3081f1e232eec10b68a6ca7873e8100fe Mon Sep 17 00:00:00 2001 From: Cies Date: Thu, 23 May 2024 13:02:53 +0200 Subject: [PATCH] Replace javax.inject with jakarta.inject --- framework/build.gradle | 1 - framework/src/play/Play.java | 2 +- framework/src/play/db/jpa/JPARepository.java | 6 +++--- framework/src/play/libs/ws/WSAsync.java | 2 +- framework/src/play/mvc/ActionInvoker.java | 2 +- framework/src/play/mvc/FlashStore.java | 2 +- framework/src/play/mvc/Redirector.java | 2 +- .../src/play/server/netty3/HttpServerPipelineFactory.java | 2 +- netty4/src/play/server/netty4/HttpServerInitializer.java | 2 +- pdf/src/play/modules/pdf/PdfGenerator.java | 2 +- replay-tests/criminals/app/controllers/Criminals.java | 2 +- replay-tests/criminals/app/controllers/Login.java | 2 +- .../criminals/app/services/CriminalSafetyCalculator.java | 4 ++-- replay-tests/criminals/app/services/OtpCodeService.java | 2 +- replay-tests/criminals/app/services/RestClient.java | 2 +- replay-tests/criminals/test/ui/MailServerEmulator.java | 2 +- .../dependency-injection/app/jobs/CounterUpdaterJob.java | 2 +- .../dependency-injection/app/jobs/CounterUpdaterJob2.java | 2 +- .../dependency-injection/app/jobs/CounterUpdaterJob3.java | 2 +- .../dependency-injection/app/plugins/DebugPlugin.java | 2 +- replay-tests/dependency-injection/app/services/Counter.java | 2 +- .../dependency-injection/app/services/Mathematics.java | 2 +- replay-tests/liquibase-app/app/controllers/PetApi.java | 2 +- .../liquibase-app/app/controllers/PetRegistration.java | 2 +- replay-tests/liquibase-app/app/controllers/PetReport.java | 2 +- replay-tests/liquibase-app/app/controllers/PetStore.java | 2 +- replay-tests/liquibase-app/app/model/PetRepository.java | 2 +- 27 files changed, 29 insertions(+), 30 deletions(-) diff --git a/framework/build.gradle b/framework/build.gradle index ac4a8d0d..fc646098 100644 --- a/framework/build.gradle +++ b/framework/build.gradle @@ -18,7 +18,6 @@ dependencies { implementation 'com.github.f4b6a3:ulid-creator:5.2.3' api('commons-logging:commons-logging:1.3.2') api('javax.mail:mail:1.4.7') - api('javax.inject:javax.inject:1') api('jakarta.inject:jakarta.inject-api:2.0.1') implementation('ch.qos.reload4j:reload4j:1.2.25') implementation('org.ehcache:ehcache:3.10.8') diff --git a/framework/src/play/Play.java b/framework/src/play/Play.java index 3b42126e..78033b6a 100644 --- a/framework/src/play/Play.java +++ b/framework/src/play/Play.java @@ -18,8 +18,8 @@ import play.templates.JavaExtensions; import play.templates.TemplateLoader; +import jakarta.inject.Inject; import javax.annotation.Nullable; -import javax.inject.Inject; import java.io.File; import java.lang.management.ManagementFactory; import java.lang.reflect.Field; diff --git a/framework/src/play/db/jpa/JPARepository.java b/framework/src/play/db/jpa/JPARepository.java index 0e1f90e4..80db3ea2 100644 --- a/framework/src/play/db/jpa/JPARepository.java +++ b/framework/src/play/db/jpa/JPARepository.java @@ -2,11 +2,11 @@ import play.db.jpa.GenericModel.JPAQuery; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; -import javax.inject.Singleton; +import jakarta.inject.Singleton; import jakarta.persistence.Entity; import jakarta.persistence.PersistenceUnit; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.List; @Singleton diff --git a/framework/src/play/libs/ws/WSAsync.java b/framework/src/play/libs/ws/WSAsync.java index 5d35719c..4929f5bd 100644 --- a/framework/src/play/libs/ws/WSAsync.java +++ b/framework/src/play/libs/ws/WSAsync.java @@ -8,7 +8,7 @@ import org.slf4j.LoggerFactory; import play.Play; -import javax.inject.Singleton; +import jakarta.inject.Singleton; import javax.net.ssl.SSLContext; import java.util.Optional; diff --git a/framework/src/play/mvc/ActionInvoker.java b/framework/src/play/mvc/ActionInvoker.java index b2dba274..8db5a947 100644 --- a/framework/src/play/mvc/ActionInvoker.java +++ b/framework/src/play/mvc/ActionInvoker.java @@ -25,7 +25,7 @@ import play.utils.Java; import play.utils.Utils; -import javax.inject.Inject; +import jakarta.inject.Inject; import java.io.File; import java.io.InputStream; import java.lang.reflect.InvocationTargetException; diff --git a/framework/src/play/mvc/FlashStore.java b/framework/src/play/mvc/FlashStore.java index 33b8b8c4..86ee5d4a 100644 --- a/framework/src/play/mvc/FlashStore.java +++ b/framework/src/play/mvc/FlashStore.java @@ -6,9 +6,9 @@ import play.libs.Signer; import play.mvc.results.Forbidden; +import jakarta.inject.Singleton; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import javax.inject.Singleton; import java.util.Map; import static play.mvc.Scope.COOKIE_PREFIX; diff --git a/framework/src/play/mvc/Redirector.java b/framework/src/play/mvc/Redirector.java index 8fe6a07b..ed4d5c5c 100644 --- a/framework/src/play/mvc/Redirector.java +++ b/framework/src/play/mvc/Redirector.java @@ -2,7 +2,7 @@ import play.data.binding.Unbinder; -import javax.inject.Singleton; +import jakarta.inject.Singleton; import java.lang.annotation.Annotation; import java.util.HashMap; import java.util.List; diff --git a/netty3/src/play/server/netty3/HttpServerPipelineFactory.java b/netty3/src/play/server/netty3/HttpServerPipelineFactory.java index b7892381..b4fe0bef 100644 --- a/netty3/src/play/server/netty3/HttpServerPipelineFactory.java +++ b/netty3/src/play/server/netty3/HttpServerPipelineFactory.java @@ -10,7 +10,7 @@ import play.Invoker; import play.mvc.ActionInvoker; -import javax.inject.Inject; +import jakarta.inject.Inject; public class HttpServerPipelineFactory implements ChannelPipelineFactory { private final Invoker invoker; diff --git a/netty4/src/play/server/netty4/HttpServerInitializer.java b/netty4/src/play/server/netty4/HttpServerInitializer.java index b6efd94e..3004ee39 100644 --- a/netty4/src/play/server/netty4/HttpServerInitializer.java +++ b/netty4/src/play/server/netty4/HttpServerInitializer.java @@ -10,7 +10,7 @@ import play.Invoker; import play.mvc.ActionInvoker; -import javax.inject.Inject; +import jakarta.inject.Inject; import static play.server.ServerHelper.maxContentLength; diff --git a/pdf/src/play/modules/pdf/PdfGenerator.java b/pdf/src/play/modules/pdf/PdfGenerator.java index 6b2f54e5..76ebef0d 100644 --- a/pdf/src/play/modules/pdf/PdfGenerator.java +++ b/pdf/src/play/modules/pdf/PdfGenerator.java @@ -2,7 +2,7 @@ import play.mvc.Http; -import javax.inject.Singleton; +import jakarta.inject.Singleton; import java.io.ByteArrayOutputStream; @Singleton diff --git a/replay-tests/criminals/app/controllers/Criminals.java b/replay-tests/criminals/app/controllers/Criminals.java index 8c95a2ec..1b8a9125 100644 --- a/replay-tests/criminals/app/controllers/Criminals.java +++ b/replay-tests/criminals/app/controllers/Criminals.java @@ -6,7 +6,7 @@ import play.rebel.View; import services.CriminalSafetyCalculator; -import javax.inject.Inject; +import jakarta.inject.Inject; public class Criminals extends Controller { @Inject diff --git a/replay-tests/criminals/app/controllers/Login.java b/replay-tests/criminals/app/controllers/Login.java index 3ca24f56..1daad1d8 100644 --- a/replay-tests/criminals/app/controllers/Login.java +++ b/replay-tests/criminals/app/controllers/Login.java @@ -11,7 +11,7 @@ import play.rebel.View; import services.OtpCodeService; -import javax.inject.Inject; +import jakarta.inject.Inject; public class Login extends Controller { private static final Logger log = LoggerFactory.getLogger(Login.class); diff --git a/replay-tests/criminals/app/services/CriminalSafetyCalculator.java b/replay-tests/criminals/app/services/CriminalSafetyCalculator.java index b54fc5c3..f2fc97b9 100644 --- a/replay-tests/criminals/app/services/CriminalSafetyCalculator.java +++ b/replay-tests/criminals/app/services/CriminalSafetyCalculator.java @@ -6,8 +6,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.inject.Inject; -import javax.inject.Singleton; +import jakarta.inject.Inject; +import jakarta.inject.Singleton; import java.io.IOException; import java.util.List; diff --git a/replay-tests/criminals/app/services/OtpCodeService.java b/replay-tests/criminals/app/services/OtpCodeService.java index 3b1eb997..21dce8af 100644 --- a/replay-tests/criminals/app/services/OtpCodeService.java +++ b/replay-tests/criminals/app/services/OtpCodeService.java @@ -4,7 +4,7 @@ import org.apache.commons.mail.SimpleEmail; import play.libs.Mail; -import javax.inject.Singleton; +import jakarta.inject.Singleton; @Singleton public class OtpCodeService { diff --git a/replay-tests/criminals/app/services/RestClient.java b/replay-tests/criminals/app/services/RestClient.java index 9c0be504..1bd3e04f 100644 --- a/replay-tests/criminals/app/services/RestClient.java +++ b/replay-tests/criminals/app/services/RestClient.java @@ -5,7 +5,7 @@ import models.CriminalRecord; import org.apache.http.client.fluent.Request; -import javax.inject.Singleton; +import jakarta.inject.Singleton; import java.io.IOException; import java.lang.reflect.Type; import java.util.ArrayList; diff --git a/replay-tests/criminals/test/ui/MailServerEmulator.java b/replay-tests/criminals/test/ui/MailServerEmulator.java index 485f41b4..524867e5 100644 --- a/replay-tests/criminals/test/ui/MailServerEmulator.java +++ b/replay-tests/criminals/test/ui/MailServerEmulator.java @@ -5,7 +5,7 @@ import org.subethamail.smtp.server.SMTPServer; import play.Play; -import javax.inject.Singleton; +import jakarta.inject.Singleton; import javax.mail.MessagingException; import javax.mail.Session; import javax.mail.internet.MimeMessage; diff --git a/replay-tests/dependency-injection/app/jobs/CounterUpdaterJob.java b/replay-tests/dependency-injection/app/jobs/CounterUpdaterJob.java index d5e368c5..f730b26d 100644 --- a/replay-tests/dependency-injection/app/jobs/CounterUpdaterJob.java +++ b/replay-tests/dependency-injection/app/jobs/CounterUpdaterJob.java @@ -4,7 +4,7 @@ import play.jobs.SimpleJob; import services.Counter; -import javax.inject.Inject; +import jakarta.inject.Inject; @Every("1s") public class CounterUpdaterJob extends SimpleJob { diff --git a/replay-tests/dependency-injection/app/jobs/CounterUpdaterJob2.java b/replay-tests/dependency-injection/app/jobs/CounterUpdaterJob2.java index 67d664f8..d427236c 100644 --- a/replay-tests/dependency-injection/app/jobs/CounterUpdaterJob2.java +++ b/replay-tests/dependency-injection/app/jobs/CounterUpdaterJob2.java @@ -4,7 +4,7 @@ import play.jobs.SimpleJob; import services.Counter; -import javax.inject.Inject; +import jakarta.inject.Inject; @OnApplicationStart public class CounterUpdaterJob2 extends SimpleJob { diff --git a/replay-tests/dependency-injection/app/jobs/CounterUpdaterJob3.java b/replay-tests/dependency-injection/app/jobs/CounterUpdaterJob3.java index 63223540..06843259 100644 --- a/replay-tests/dependency-injection/app/jobs/CounterUpdaterJob3.java +++ b/replay-tests/dependency-injection/app/jobs/CounterUpdaterJob3.java @@ -4,7 +4,7 @@ import play.jobs.SimpleJob; import services.Counter; -import javax.inject.Inject; +import jakarta.inject.Inject; @On("cron.counterUpdater") public class CounterUpdaterJob3 extends SimpleJob { diff --git a/replay-tests/dependency-injection/app/plugins/DebugPlugin.java b/replay-tests/dependency-injection/app/plugins/DebugPlugin.java index 943f237a..38133c0f 100644 --- a/replay-tests/dependency-injection/app/plugins/DebugPlugin.java +++ b/replay-tests/dependency-injection/app/plugins/DebugPlugin.java @@ -8,7 +8,7 @@ import play.mvc.Scope.Flash; import services.Mathematics; -import javax.inject.Inject; +import jakarta.inject.Inject; import java.lang.reflect.Method; import java.math.BigDecimal; diff --git a/replay-tests/dependency-injection/app/services/Counter.java b/replay-tests/dependency-injection/app/services/Counter.java index c924614b..d1fb5ec9 100644 --- a/replay-tests/dependency-injection/app/services/Counter.java +++ b/replay-tests/dependency-injection/app/services/Counter.java @@ -1,6 +1,6 @@ package services; -import javax.inject.Singleton; +import jakarta.inject.Singleton; import java.util.HashMap; import java.util.Map; import java.util.concurrent.atomic.AtomicLong; diff --git a/replay-tests/dependency-injection/app/services/Mathematics.java b/replay-tests/dependency-injection/app/services/Mathematics.java index 498fddf3..c58b02c0 100644 --- a/replay-tests/dependency-injection/app/services/Mathematics.java +++ b/replay-tests/dependency-injection/app/services/Mathematics.java @@ -1,6 +1,6 @@ package services; -import javax.inject.Singleton; +import jakarta.inject.Singleton; import java.math.BigDecimal; @Singleton diff --git a/replay-tests/liquibase-app/app/controllers/PetApi.java b/replay-tests/liquibase-app/app/controllers/PetApi.java index 8bbb8c16..4ac2cc84 100644 --- a/replay-tests/liquibase-app/app/controllers/PetApi.java +++ b/replay-tests/liquibase-app/app/controllers/PetApi.java @@ -10,7 +10,7 @@ import play.mvc.results.RenderJson; import play.mvc.results.Result; -import javax.inject.Inject; +import jakarta.inject.Inject; import java.util.Map; public class PetApi extends Controller { diff --git a/replay-tests/liquibase-app/app/controllers/PetRegistration.java b/replay-tests/liquibase-app/app/controllers/PetRegistration.java index 70b45788..086d1014 100644 --- a/replay-tests/liquibase-app/app/controllers/PetRegistration.java +++ b/replay-tests/liquibase-app/app/controllers/PetRegistration.java @@ -9,7 +9,7 @@ import play.mvc.results.Result; import play.rebel.View; -import javax.inject.Inject; +import jakarta.inject.Inject; import java.util.Map; public class PetRegistration extends Controller { diff --git a/replay-tests/liquibase-app/app/controllers/PetReport.java b/replay-tests/liquibase-app/app/controllers/PetReport.java index e85a2e37..05e45eda 100644 --- a/replay-tests/liquibase-app/app/controllers/PetReport.java +++ b/replay-tests/liquibase-app/app/controllers/PetReport.java @@ -9,7 +9,7 @@ import play.mvc.Controller; import play.mvc.results.Result; -import javax.inject.Inject; +import jakarta.inject.Inject; import java.time.LocalDate; import java.util.List; import java.util.Map; diff --git a/replay-tests/liquibase-app/app/controllers/PetStore.java b/replay-tests/liquibase-app/app/controllers/PetStore.java index 145e7fde..4b047fd0 100644 --- a/replay-tests/liquibase-app/app/controllers/PetStore.java +++ b/replay-tests/liquibase-app/app/controllers/PetStore.java @@ -6,7 +6,7 @@ import play.mvc.Controller; import play.rebel.View; -import javax.inject.Inject; +import jakarta.inject.Inject; import java.util.List; public class PetStore extends Controller { diff --git a/replay-tests/liquibase-app/app/model/PetRepository.java b/replay-tests/liquibase-app/app/model/PetRepository.java index 6544ea42..3b3ece52 100644 --- a/replay-tests/liquibase-app/app/model/PetRepository.java +++ b/replay-tests/liquibase-app/app/model/PetRepository.java @@ -2,7 +2,7 @@ import play.db.jpa.JPA; -import javax.inject.Singleton; +import jakarta.inject.Singleton; import jakarta.persistence.Query; import java.time.LocalDateTime; import java.util.List;