From 46b2bb8f314332d36151c46be15d424fb72523b4 Mon Sep 17 00:00:00 2001 From: lburgazzoli Date: Wed, 15 May 2019 12:10:34 +0200 Subject: [PATCH] remove spring boot support #55 --- camel-k-runtime-bom/pom.xml | 10 - camel-k-runtime-spring-boot-layout/pom.xml | 37 ---- .../camel/k/spring/boot/layout/Factory.java | 49 ----- .../main/resources/META-INF/spring.factories | 2 - camel-k-runtime-spring-boot/pom.xml | 177 ------------------ .../camel/k/spring/boot/Application.java | 65 ------- .../boot/ApplicationAutoConfiguration.java | 125 ------------- .../main/resources/META-INF/spring.factories | 2 - pom.xml | 13 -- 9 files changed, 480 deletions(-) delete mode 100644 camel-k-runtime-spring-boot-layout/pom.xml delete mode 100644 camel-k-runtime-spring-boot-layout/src/main/java/org/apache/camel/k/spring/boot/layout/Factory.java delete mode 100644 camel-k-runtime-spring-boot-layout/src/main/resources/META-INF/spring.factories delete mode 100644 camel-k-runtime-spring-boot/pom.xml delete mode 100644 camel-k-runtime-spring-boot/src/main/java/org/apache/camel/k/spring/boot/Application.java delete mode 100644 camel-k-runtime-spring-boot/src/main/java/org/apache/camel/k/spring/boot/ApplicationAutoConfiguration.java delete mode 100644 camel-k-runtime-spring-boot/src/main/resources/META-INF/spring.factories diff --git a/camel-k-runtime-bom/pom.xml b/camel-k-runtime-bom/pom.xml index a405ddfd0..c123fd674 100644 --- a/camel-k-runtime-bom/pom.xml +++ b/camel-k-runtime-bom/pom.xml @@ -120,16 +120,6 @@ camel-k-runtime-yaml ${project.version} - - org.apache.camel.k - camel-k-runtime-spring-boot - ${project.version} - - - org.apache.camel.k - camel-k-runtime-spring-boot-layout - ${project.version} - org.apache.camel.k camel-k-runtime-health diff --git a/camel-k-runtime-spring-boot-layout/pom.xml b/camel-k-runtime-spring-boot-layout/pom.xml deleted file mode 100644 index 4b76c942c..000000000 --- a/camel-k-runtime-spring-boot-layout/pom.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - org.apache.camel.k - camel-k-runtime-parent - 0.3.3-SNAPSHOT - - - 4.0.0 - camel-k-runtime-spring-boot-layout - - - - org.springframework.boot - spring-boot-loader-tools - ${spring-boot.version} - - - diff --git a/camel-k-runtime-spring-boot-layout/src/main/java/org/apache/camel/k/spring/boot/layout/Factory.java b/camel-k-runtime-spring-boot-layout/src/main/java/org/apache/camel/k/spring/boot/layout/Factory.java deleted file mode 100644 index 3367ec64e..000000000 --- a/camel-k-runtime-spring-boot-layout/src/main/java/org/apache/camel/k/spring/boot/layout/Factory.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.k.spring.boot.layout; - -import java.io.File; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -import org.springframework.boot.loader.tools.Layout; -import org.springframework.boot.loader.tools.Layouts; -import org.springframework.boot.loader.tools.LibraryScope; - -public class Factory implements org.springframework.boot.loader.tools.LayoutFactory { - private static final Set SCOPES = new HashSet<>( - Arrays.asList( - LibraryScope.COMPILE, - LibraryScope.RUNTIME, - LibraryScope.CUSTOM) - ); - - @Override - public Layout getLayout(File source) { - return new Layouts.Jar() { - @Override - public String getLibraryDestination(String libraryName, LibraryScope scope) { - if (SCOPES.contains(scope)) { - return super.getLibraryDestination(libraryName, scope); - } - - return null; - } - }; - } -} diff --git a/camel-k-runtime-spring-boot-layout/src/main/resources/META-INF/spring.factories b/camel-k-runtime-spring-boot-layout/src/main/resources/META-INF/spring.factories deleted file mode 100644 index d4c584890..000000000 --- a/camel-k-runtime-spring-boot-layout/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1,2 +0,0 @@ -org.springframework.boot.loader.tools.LayoutFactory=\ - org.apache.camel.k.spring.boot.layout.Factory \ No newline at end of file diff --git a/camel-k-runtime-spring-boot/pom.xml b/camel-k-runtime-spring-boot/pom.xml deleted file mode 100644 index 81a6da4f9..000000000 --- a/camel-k-runtime-spring-boot/pom.xml +++ /dev/null @@ -1,177 +0,0 @@ - - - - - org.apache.camel.k - camel-k-runtime-parent - 0.3.3-SNAPSHOT - - - 4.0.0 - camel-k-runtime-spring-boot - - - ${project.build.directory}/${project.build.finalName}.jar - - - - - - - - - - - - org.apache.camel.k - camel-k-runtime-jvm - - - org.apache.logging.log4j - log4j-core - - - org.apache.logging.log4j - log4j-slf4j-impl - - - - - - org.apache.camel - camel-spring-boot-starter - - - org.springframework.boot - spring-boot-starter-logging - - - - - - org.springframework.boot - spring-boot-starter-log4j2 - ${spring-boot.version} - - - org.springframework.boot - spring-boot-loader-tools - ${spring-boot.version} - true - - - - - - - - - - org.junit.jupiter - junit-jupiter-api - ${junit-jupiter.version} - test - - - org.junit.jupiter - junit-jupiter-engine - ${junit-jupiter.version} - test - - - - org.assertj - assertj-core - ${assertj.version} - test - - - - - - - org.springframework.boot - spring-boot-maven-plugin - ${spring-boot.version} - - - - repackage - - - - - org.apache.camel.k.spring.boot.Application - - - - - org.apache.camel.k - camel-k-runtime-spring-boot-layout - ${project.version} - - - - - - - - - camel3 - - - camel3 - - - - - - org.apache.camel.k - camel-k-adapter-camel-3 - provided - - - - org.apache.camel - camel-properties - test - - - - - camel2 - - - !camel3 - - - - - - org.apache.camel.k - camel-k-adapter-camel-2 - provided - - - - - diff --git a/camel-k-runtime-spring-boot/src/main/java/org/apache/camel/k/spring/boot/Application.java b/camel-k-runtime-spring-boot/src/main/java/org/apache/camel/k/spring/boot/Application.java deleted file mode 100644 index c5e8e3756..000000000 --- a/camel-k-runtime-spring-boot/src/main/java/org/apache/camel/k/spring/boot/Application.java +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.k.spring.boot; - -import java.util.Properties; - -import org.apache.camel.k.support.PlatformStreamHandler; -import org.apache.camel.k.support.RuntimeSupport; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.Bean; -import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; - -@SpringBootApplication -public class Application { - static { - // - // Install a custom protocol handler to support discovering resources - // from the platform i.e. in knative, resources are provided through - // env var as it is not possible to mount config maps / secrets. - // - // TODO: we should remove as soon as we get a knative version that - // includes https://github.com/knative/serving/pull/3061 - // - PlatformStreamHandler.configure(); - } - - public static void main(String[] args) { - SpringApplication.run(Application.class, args); - } - - @Bean - public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() { - // load properties using default behaviour - final Properties properties = RuntimeSupport.loadProperties(); - - // set spring boot specific properties - properties.put("camel.springboot.main-run-controller", "true"); - properties.put("camel.springboot.name", "camel-k"); - properties.put("camel.springboot.streamCachingEnabled", "true"); - properties.put("camel.springboot.xml-routes", "false"); - properties.put("camel.springboot.xml-rests", "false"); - properties.put("camel.springboot.jmx-enabled", "false"); - - // set loaded properties as default properties - PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer(); - configurer.setProperties(properties); - - return configurer; - } -} diff --git a/camel-k-runtime-spring-boot/src/main/java/org/apache/camel/k/spring/boot/ApplicationAutoConfiguration.java b/camel-k-runtime-spring-boot/src/main/java/org/apache/camel/k/spring/boot/ApplicationAutoConfiguration.java deleted file mode 100644 index b13410a0a..000000000 --- a/camel-k-runtime-spring-boot/src/main/java/org/apache/camel/k/spring/boot/ApplicationAutoConfiguration.java +++ /dev/null @@ -1,125 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.k.spring.boot; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.camel.CamelContext; -import org.apache.camel.k.InMemoryRegistry; -import org.apache.camel.k.Runtime; -import org.apache.camel.k.listener.ContextConfigurer; -import org.apache.camel.k.listener.RoutesConfigurer; -import org.apache.camel.k.listener.RoutesDumper; -import org.apache.camel.spring.boot.CamelContextConfiguration; -import org.springframework.context.ConfigurableApplicationContext; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -@Configuration -public class ApplicationAutoConfiguration { - - @Bean - public CamelContextConfiguration routesConfiguration(ConfigurableApplicationContext applicationContext) throws Exception { - return new CamelContextConfigurer(applicationContext, Arrays.asList(new ContextConfigurer(), new RoutesConfigurer(), new RoutesDumper())); - } - - // ***************************** - // - // - // - // ***************************** - - private static class CamelContextConfigurer implements CamelContextConfiguration { - private final ConfigurableApplicationContext applicationContext; - private final List listeners; - - public CamelContextConfigurer(ConfigurableApplicationContext applicationContext, List listeners) { - this.applicationContext = applicationContext; - this.listeners = listeners; - } - - @Override - public void beforeApplicationStart(CamelContext context) { - final Runtime.Registry registry = new RuntimeApplicationContextRegistry(applicationContext, context.getRegistry()); - final Runtime runtime = new Runtime() { - @Override - public CamelContext getContext() { - return context; - } - @Override - public Registry getRegistry() { - return registry; - } - }; - - listeners.forEach(l -> l.accept(Runtime.Phase.Starting, runtime)); - listeners.forEach(l -> l.accept(Runtime.Phase.ConfigureContext, runtime)); - listeners.forEach(l -> l.accept(Runtime.Phase.ConfigureRoutes, runtime)); - } - - @Override - public void afterApplicationStart(CamelContext context) { - final Runtime.Registry registry = new RuntimeApplicationContextRegistry(applicationContext, context.getRegistry()); - final Runtime runtime = new Runtime() { - @Override - public CamelContext getContext() { - return context; - } - @Override - public Registry getRegistry() { - return registry; - } - }; - - listeners.forEach(l -> l.accept(Runtime.Phase.Started, runtime)); - - } - } - - private static class RuntimeApplicationContextRegistry extends InMemoryRegistry { - private final ConfigurableApplicationContext applicationContext; - private final org.apache.camel.spi.Registry registry; - - public RuntimeApplicationContextRegistry(ConfigurableApplicationContext applicationContext, org.apache.camel.spi.Registry registry) { - this.applicationContext = applicationContext; - this.registry = registry; - } - - @Override - public Object lookupByName(String name) { - return registry.lookupByName(name); - } - - @Override - public T lookupByNameAndType(String name, Class type) { - return registry.lookupByNameAndType(name, type); - } - - @Override - public Map findByTypeWithName(Class type) { - return registry.findByTypeWithName(type); - } - - @Override - public Set findByType(Class type) { - return registry.findByType(type); - } - } -} diff --git a/camel-k-runtime-spring-boot/src/main/resources/META-INF/spring.factories b/camel-k-runtime-spring-boot/src/main/resources/META-INF/spring.factories deleted file mode 100644 index f6df31c27..000000000 --- a/camel-k-runtime-spring-boot/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1,2 +0,0 @@ -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ - org.apache.camel.k.spring.boot.ApplicationAutoConfiguration \ No newline at end of file diff --git a/pom.xml b/pom.xml index e861fd06d..083a8d430 100644 --- a/pom.xml +++ b/pom.xml @@ -53,7 +53,6 @@ 1.24 1.3-groovy-2.5 2.9.8 - 2.1.4.RELEASE 2.7.5 2.2.0 1.6.1 @@ -147,8 +146,6 @@ camel-k-runtime-groovy camel-k-runtime-kotlin camel-k-runtime-yaml - camel-k-runtime-spring-boot-layout - camel-k-runtime-spring-boot camel-k-runtime-health camel-knative-http camel-knative @@ -220,16 +217,6 @@ camel-k-runtime-yaml ${project.version} - - org.apache.camel.k - camel-k-runtime-spring-boot - ${project.version} - - - org.apache.camel.k - camel-k-runtime-spring-boot-layout - ${project.version} - org.apache.camel.k camel-k-runtime-health