From 08d39bffa73df58172300cf31ddf704865cce283 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Thu, 31 Mar 2022 11:01:33 -0500 Subject: [PATCH] Fixes #6756 - Deprecate `jetty-spring` sub-project (#7813) * Deprecate jetty-spring * Bump spring-beans to 5.3.18 Signed-off-by: Joakim Erdfelt --- jetty-spring/pom.xml | 2 +- .../src/main/java/org/eclipse/jetty/spring/Main.java | 3 +++ .../jetty/spring/SpringConfigurationProcessor.java | 9 ++++++++- .../spring/SpringConfigurationProcessorFactory.java | 2 ++ .../main/java/org/eclipse/jetty/spring/package-info.java | 3 ++- .../resources/org/eclipse/jetty/spring/configure.xml | 4 ++-- 6 files changed, 18 insertions(+), 5 deletions(-) diff --git a/jetty-spring/pom.xml b/jetty-spring/pom.xml index b66961f82588..d9f73b51933f 100644 --- a/jetty-spring/pom.xml +++ b/jetty-spring/pom.xml @@ -9,7 +9,7 @@ Example :: Jetty Spring - 3.2.18.RELEASE + 5.3.18 target/dependencies ${project.groupId}.spring true diff --git a/jetty-spring/src/main/java/org/eclipse/jetty/spring/Main.java b/jetty-spring/src/main/java/org/eclipse/jetty/spring/Main.java index 7961c3726c7d..1cb03b73bbde 100644 --- a/jetty-spring/src/main/java/org/eclipse/jetty/spring/Main.java +++ b/jetty-spring/src/main/java/org/eclipse/jetty/spring/Main.java @@ -23,11 +23,14 @@ /** * Runs Jetty from a Spring configuration file passed as argument. + * @deprecated Has been removed in Jetty 10+ */ +@Deprecated public class Main { public static void main(String[] args) throws Exception { + System.err.println("DEPRECATION WARNING - The `jetty-spring` project will see no further updates, and has been fully removed from Jetty 10 onwards"); Resource config = Resource.newResource(args.length == 1 ? args[0] : "etc/jetty-spring.xml"); XmlConfiguration.main(config.getFile().getAbsolutePath()); } diff --git a/jetty-spring/src/main/java/org/eclipse/jetty/spring/SpringConfigurationProcessor.java b/jetty-spring/src/main/java/org/eclipse/jetty/spring/SpringConfigurationProcessor.java index 056f04f5de84..b63847abfe6b 100644 --- a/jetty-spring/src/main/java/org/eclipse/jetty/spring/SpringConfigurationProcessor.java +++ b/jetty-spring/src/main/java/org/eclipse/jetty/spring/SpringConfigurationProcessor.java @@ -58,7 +58,9 @@ *

* This processor is returned by the {@link SpringConfigurationProcessorFactory} for any XML document whos first * element is "beans". The factory is discovered by a {@link ServiceLoader} for {@link ConfigurationProcessorFactory}. + * @deprecated Has been removed in Jetty 10+ */ +@Deprecated public class SpringConfigurationProcessor implements ConfigurationProcessor { private static final Logger LOG = Log.getLogger(SpringConfigurationProcessor.class); @@ -67,6 +69,11 @@ public class SpringConfigurationProcessor implements ConfigurationProcessor private DefaultListableBeanFactory _beanFactory; private String _main; + public SpringConfigurationProcessor() + { + LOG.warn("DEPRECATION WARNING - The `jetty-spring` project will see no further updates, and has been fully removed from Jetty 10 onwards"); + } + @Override public void init(URL url, XmlParser.Node root, XmlConfiguration configuration) { @@ -141,7 +148,7 @@ private void doConfigure() { LOG.debug("{} - {}", bean, Arrays.asList(_beanFactory.getAliases(bean))); String[] aliases = _beanFactory.getAliases(bean); - if ("Main".equals(bean) || aliases != null && Arrays.asList(aliases).contains("Main")) + if ("Main".equals(bean) || Arrays.asList(aliases).contains("Main")) { _main = bean; break; diff --git a/jetty-spring/src/main/java/org/eclipse/jetty/spring/SpringConfigurationProcessorFactory.java b/jetty-spring/src/main/java/org/eclipse/jetty/spring/SpringConfigurationProcessorFactory.java index 43e78c7bedbd..6d9acb9e53aa 100644 --- a/jetty-spring/src/main/java/org/eclipse/jetty/spring/SpringConfigurationProcessorFactory.java +++ b/jetty-spring/src/main/java/org/eclipse/jetty/spring/SpringConfigurationProcessorFactory.java @@ -30,7 +30,9 @@ * * @see SpringConfigurationProcessor * @see XmlConfiguration + * @deprecated Has been removed in Jetty 10+ */ +@Deprecated public class SpringConfigurationProcessorFactory implements ConfigurationProcessorFactory { @Override diff --git a/jetty-spring/src/main/java/org/eclipse/jetty/spring/package-info.java b/jetty-spring/src/main/java/org/eclipse/jetty/spring/package-info.java index e8e3f8c22951..dee635683a3f 100644 --- a/jetty-spring/src/main/java/org/eclipse/jetty/spring/package-info.java +++ b/jetty-spring/src/main/java/org/eclipse/jetty/spring/package-info.java @@ -17,7 +17,8 @@ // /** - * Jetty Spring : Spring IoC Configuration for Jetty + * Jetty Spring : (Deprecated) Spring IoC Configuration for Jetty + * @deprecated */ package org.eclipse.jetty.spring; diff --git a/jetty-spring/src/test/resources/org/eclipse/jetty/spring/configure.xml b/jetty-spring/src/test/resources/org/eclipse/jetty/spring/configure.xml index 978c1dfc5983..dd81bf901df7 100644 --- a/jetty-spring/src/test/resources/org/eclipse/jetty/spring/configure.xml +++ b/jetty-spring/src/test/resources/org/eclipse/jetty/spring/configure.xml @@ -1,14 +1,14 @@ + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd"> - + test