diff --git a/bom/application/pom.xml b/bom/application/pom.xml index dff2a3a7481c..16b6750564ac 100644 --- a/bom/application/pom.xml +++ b/bom/application/pom.xml @@ -1154,6 +1154,19 @@ 3.1.9.Final + + org.glassfish.jersey.ext.cdi + jersey-cdi1x + ${jersey.version} + + + + org.glassfish.jersey.ext.cdi + jersey-cdi1x-servlet + ${jersey.version} + + + org.glassfish.hk2.external bean-validator diff --git a/dotCMS/pom.xml b/dotCMS/pom.xml index 7792bba84dc7..f9981c37eb2d 100644 --- a/dotCMS/pom.xml +++ b/dotCMS/pom.xml @@ -1405,6 +1405,17 @@ 3.1.9.Final + + org.glassfish.jersey.ext.cdi + jersey-cdi1x + + + + + org.glassfish.jersey.ext.cdi + jersey-cdi1x-servlet + + org.glassfish.hk2.external bean-validator diff --git a/dotCMS/src/main/java/com/dotcms/business/FactoryLocatorProducers.java b/dotCMS/src/main/java/com/dotcms/business/FactoryLocatorProducers.java deleted file mode 100644 index 0c2d4cf8fe3a..000000000000 --- a/dotCMS/src/main/java/com/dotcms/business/FactoryLocatorProducers.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.dotcms.business; - -import com.dotcms.cube.CubeJSClientFactory; -import com.dotmarketing.business.FactoryLocator; - -import javax.enterprise.context.ApplicationScoped; -import javax.enterprise.inject.Produces; - -/** - * This class is useful to include classes are not into the CDI container but - * wants to be available to be injected. - * Most of the {@link FactoryLocator} classes will be eventually here. - * @author jsanca - */ -@ApplicationScoped -public class FactoryLocatorProducers { - - - @Produces - public CubeJSClientFactory getCubeJSClientFactory() { - return FactoryLocator.getCubeJSClientFactory(); - } -} diff --git a/dotCMS/src/main/java/com/dotcms/jobs/business/queue/JobQueueProducer.java b/dotCMS/src/main/java/com/dotcms/jobs/business/queue/JobQueueProducer.java deleted file mode 100644 index 1596e9fb17d6..000000000000 --- a/dotCMS/src/main/java/com/dotcms/jobs/business/queue/JobQueueProducer.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.dotcms.jobs.business.queue; - -import com.dotmarketing.util.Config; -import javax.enterprise.context.ApplicationScoped; -import javax.enterprise.inject.Produces; - -/** - * This class is responsible for producing the JobQueue implementation used in the application. It - * is application-scoped, meaning a single instance is created for the entire application. - */ -@ApplicationScoped -public class JobQueueProducer { - - // The type of job queue implementation to use - private static final String JOB_QUEUE_IMPLEMENTATION_TYPE = Config.getStringProperty( - "JOB_QUEUE_IMPLEMENTATION_TYPE", "postgres" - ); - - /** - * Produces a JobQueue instance. This method is called by the CDI container to create a JobQueue - * instance when it is needed for dependency injection. - * - * @return A JobQueue instance - */ - @Produces - @ApplicationScoped - public JobQueue produceJobQueue() { - - if (JOB_QUEUE_IMPLEMENTATION_TYPE.equals("postgres")) { - return new PostgresJobQueue(); - } - - throw new IllegalStateException( - "Unknown job queue implementation type: " + JOB_QUEUE_IMPLEMENTATION_TYPE - ); - } - -} \ No newline at end of file diff --git a/dotCMS/src/main/java/com/dotcms/rest/config/ContainerReloader.java b/dotCMS/src/main/java/com/dotcms/rest/config/ContainerReloader.java index 969420976ad0..7c5695dfaf7c 100644 --- a/dotCMS/src/main/java/com/dotcms/rest/config/ContainerReloader.java +++ b/dotCMS/src/main/java/com/dotcms/rest/config/ContainerReloader.java @@ -9,7 +9,7 @@ import org.glassfish.jersey.server.spi.Container; /** - * A new Reloader will get created on each reload there can only be one container at a time + * A new Re-loader will get created on each reload there can only be one container at a time */ @Provider @ApplicationScoped diff --git a/dotCMS/src/main/java/com/dotcms/rest/config/DotRestApplication.java b/dotCMS/src/main/java/com/dotcms/rest/config/DotRestApplication.java index 38af8db95716..ed2141aa53f2 100644 --- a/dotCMS/src/main/java/com/dotcms/rest/config/DotRestApplication.java +++ b/dotCMS/src/main/java/com/dotcms/rest/config/DotRestApplication.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; import io.swagger.v3.jaxrs2.integration.resources.AcceptHeaderOpenApiResource; import io.swagger.v3.jaxrs2.integration.resources.OpenApiResource; +import org.glassfish.jersey.ext.cdi1x.internal.CdiComponentProvider; import io.swagger.v3.oas.annotations.OpenAPIDefinition; import io.swagger.v3.oas.annotations.info.Info; import io.swagger.v3.oas.annotations.servers.Server; @@ -57,7 +58,9 @@ public DotRestApplication() { "com.dotcms.rendering.js", "com.dotcms.ai.rest", "io.swagger.v3.jaxrs2" - ); + ).register(CdiComponentProvider.class); + + System.out.println("DotRestApplication: " + this); } /** diff --git a/dotCMS/src/main/webapp/WEB-INF/beans.xml b/dotCMS/src/main/webapp/WEB-INF/beans.xml index 1675ad7ab74c..8a308e187938 100644 --- a/dotCMS/src/main/webapp/WEB-INF/beans.xml +++ b/dotCMS/src/main/webapp/WEB-INF/beans.xml @@ -1,9 +1,5 @@ - - - - +xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd" +version="1.1" bean-discovery-mode="all"> \ No newline at end of file diff --git a/dotCMS/src/test/resources/META-INF/beans.xml b/dotCMS/src/test/resources/META-INF/beans.xml index 1675ad7ab74c..0619c9e63ad0 100644 --- a/dotCMS/src/test/resources/META-INF/beans.xml +++ b/dotCMS/src/test/resources/META-INF/beans.xml @@ -1,9 +1,5 @@ - - - - + xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd" + version="1.1" bean-discovery-mode="all"> \ No newline at end of file diff --git a/dotcms-integration/src/test/java/com/dotcms/TestBaseJunit5WeldInitiator.java b/dotcms-integration/src/test/java/com/dotcms/TestBaseJunit5WeldInitiator.java index b65843c090dc..cd18ba7ec63c 100644 --- a/dotcms-integration/src/test/java/com/dotcms/TestBaseJunit5WeldInitiator.java +++ b/dotcms-integration/src/test/java/com/dotcms/TestBaseJunit5WeldInitiator.java @@ -11,7 +11,6 @@ import com.dotcms.jobs.business.error.RetryStrategy; import com.dotcms.jobs.business.error.RetryStrategyProducer; import com.dotcms.jobs.business.queue.JobQueue; -import com.dotcms.jobs.business.queue.JobQueueProducer; import com.dotcms.rest.api.v1.job.JobQueueHelper; import org.jboss.weld.bootstrap.api.helpers.RegistrySingletonProvider; import org.jboss.weld.junit5.WeldInitiator; @@ -29,7 +28,7 @@ public class TestBaseJunit5WeldInitiator { .containerId(RegistrySingletonProvider.STATIC_INSTANCE) .beanClasses(JobQueueManagerAPIImpl.class, JobQueueConfig.class, JobQueue.class, RetryStrategy.class, CircuitBreaker.class, - JobQueueProducer.class, JobQueueConfigProducer.class, + JobQueueConfigProducer.class, RetryStrategyProducer.class, RealTimeJobMonitor.class, EventProducer.class, JobProcessorFactory.class, JobQueueHelper.class, JobProcessorScanner.class diff --git a/dotcms-integration/src/test/java/com/dotcms/util/IntegrationTestInitService.java b/dotcms-integration/src/test/java/com/dotcms/util/IntegrationTestInitService.java index 9711a2000a10..a92d3f8d9ecb 100644 --- a/dotcms-integration/src/test/java/com/dotcms/util/IntegrationTestInitService.java +++ b/dotcms-integration/src/test/java/com/dotcms/util/IntegrationTestInitService.java @@ -13,7 +13,6 @@ import com.dotcms.jobs.business.error.RetryStrategy; import com.dotcms.jobs.business.error.RetryStrategyProducer; import com.dotcms.jobs.business.queue.JobQueue; -import com.dotcms.jobs.business.queue.JobQueueProducer; import com.dotcms.repackage.org.apache.struts.Globals; import com.dotcms.repackage.org.apache.struts.config.ModuleConfig; import com.dotcms.repackage.org.apache.struts.config.ModuleConfigFactory; @@ -69,7 +68,6 @@ public void init() throws Exception { JobQueue.class, RetryStrategy.class, CircuitBreaker.class, - JobQueueProducer.class, JobQueueConfigProducer.class, RetryStrategyProducer.class, RealTimeJobMonitor.class, diff --git a/dotcms-integration/src/test/resources/META-INF/beans.xml b/dotcms-integration/src/test/resources/META-INF/beans.xml index 1675ad7ab74c..0619c9e63ad0 100644 --- a/dotcms-integration/src/test/resources/META-INF/beans.xml +++ b/dotcms-integration/src/test/resources/META-INF/beans.xml @@ -1,9 +1,5 @@ - - - - + xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd" + version="1.1" bean-discovery-mode="all"> \ No newline at end of file