diff --git a/pom.xml b/pom.xml index 324592ef2..28c256ea4 100644 --- a/pom.xml +++ b/pom.xml @@ -169,33 +169,21 @@ - + spring-snapshots Spring Snapshots https://repo.spring.io/libs-snapshot-local - - true - - - false - spring-milestones Spring Milestones https://repo.spring.io/libs-milestone-local - - false - spring-releases Spring Releases https://repo.spring.io/release - - false - @@ -203,28 +191,16 @@ spring-snapshots Spring Snapshots https://repo.spring.io/libs-snapshot-local - - true - - - false - spring-milestones Spring Milestones https://repo.spring.io/libs-milestone-local - - false - spring-releases Spring Releases https://repo.spring.io/libs-release-local - - false - diff --git a/spring-cloud-function-deployer/src/it/bootapp-multi/pom.xml b/spring-cloud-function-deployer/src/it/bootapp-multi/pom.xml index 06039d93c..0035dd7c0 100644 --- a/spring-cloud-function-deployer/src/it/bootapp-multi/pom.xml +++ b/spring-cloud-function-deployer/src/it/bootapp-multi/pom.xml @@ -12,7 +12,7 @@ org.springframework.boot spring-boot-starter-parent - 2.2.5.RELEASE + 2.3.0.BUILD-SNAPSHOT @@ -68,4 +68,38 @@ + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/libs-snapshot-local + + + spring-milestones + Spring Milestones + https://repo.spring.io/libs-milestone-local + + + spring-releases + Spring Releases + https://repo.spring.io/release + + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/libs-snapshot-local + + + spring-milestones + Spring Milestones + https://repo.spring.io/libs-milestone-local + + + spring-releases + Spring Releases + https://repo.spring.io/libs-release-local + + diff --git a/spring-cloud-function-deployer/src/it/bootapp-with-javax/pom.xml b/spring-cloud-function-deployer/src/it/bootapp-with-javax/pom.xml index 209000999..fb644d1ac 100644 --- a/spring-cloud-function-deployer/src/it/bootapp-with-javax/pom.xml +++ b/spring-cloud-function-deployer/src/it/bootapp-with-javax/pom.xml @@ -12,7 +12,7 @@ org.springframework.boot spring-boot-starter-parent - 2.2.5.RELEASE + 2.3.0.BUILD-SNAPSHOT @@ -68,4 +68,38 @@ + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/libs-snapshot-local + + + spring-milestones + Spring Milestones + https://repo.spring.io/libs-milestone-local + + + spring-releases + Spring Releases + https://repo.spring.io/release + + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/libs-snapshot-local + + + spring-milestones + Spring Milestones + https://repo.spring.io/libs-milestone-local + + + spring-releases + Spring Releases + https://repo.spring.io/libs-release-local + + diff --git a/spring-cloud-function-deployer/src/it/bootapp-with-scf/pom.xml b/spring-cloud-function-deployer/src/it/bootapp-with-scf/pom.xml index 64db2dd8a..88d7e401b 100644 --- a/spring-cloud-function-deployer/src/it/bootapp-with-scf/pom.xml +++ b/spring-cloud-function-deployer/src/it/bootapp-with-scf/pom.xml @@ -12,7 +12,7 @@ org.springframework.boot spring-boot-starter-parent - 2.2.5.RELEASE + 2.3.0.BUILD-SNAPSHOT @@ -68,4 +68,38 @@ + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/libs-snapshot-local + + + spring-milestones + Spring Milestones + https://repo.spring.io/libs-milestone-local + + + spring-releases + Spring Releases + https://repo.spring.io/release + + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/libs-snapshot-local + + + spring-milestones + Spring Milestones + https://repo.spring.io/libs-milestone-local + + + spring-releases + Spring Releases + https://repo.spring.io/libs-release-local + + diff --git a/spring-cloud-function-deployer/src/it/bootapp/pom.xml b/spring-cloud-function-deployer/src/it/bootapp/pom.xml index ec5c0ba04..fb5698b23 100644 --- a/spring-cloud-function-deployer/src/it/bootapp/pom.xml +++ b/spring-cloud-function-deployer/src/it/bootapp/pom.xml @@ -12,7 +12,7 @@ org.springframework.boot spring-boot-starter-parent - 2.2.5.RELEASE + 2.3.0.BUILD-SNAPSHOT @@ -63,4 +63,38 @@ + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/libs-snapshot-local + + + spring-milestones + Spring Milestones + https://repo.spring.io/libs-milestone-local + + + spring-releases + Spring Releases + https://repo.spring.io/release + + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/libs-snapshot-local + + + spring-milestones + Spring Milestones + https://repo.spring.io/libs-milestone-local + + + spring-releases + Spring Releases + https://repo.spring.io/libs-release-local + + diff --git a/spring-cloud-function-deployer/src/it/bootjar-multi/pom.xml b/spring-cloud-function-deployer/src/it/bootjar-multi/pom.xml index cee385f27..cf25f70e0 100644 --- a/spring-cloud-function-deployer/src/it/bootjar-multi/pom.xml +++ b/spring-cloud-function-deployer/src/it/bootjar-multi/pom.xml @@ -12,7 +12,7 @@ org.springframework.boot spring-boot-starter-parent - 2.2.5.RELEASE + 2.3.0.BUILD-SNAPSHOT @@ -69,4 +69,38 @@ + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/libs-snapshot-local + + + spring-milestones + Spring Milestones + https://repo.spring.io/libs-milestone-local + + + spring-releases + Spring Releases + https://repo.spring.io/release + + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/libs-snapshot-local + + + spring-milestones + Spring Milestones + https://repo.spring.io/libs-milestone-local + + + spring-releases + Spring Releases + https://repo.spring.io/libs-release-local + + diff --git a/spring-cloud-function-deployer/src/it/bootjar/pom.xml b/spring-cloud-function-deployer/src/it/bootjar/pom.xml index d24336bd5..0244dabe4 100644 --- a/spring-cloud-function-deployer/src/it/bootjar/pom.xml +++ b/spring-cloud-function-deployer/src/it/bootjar/pom.xml @@ -12,7 +12,7 @@ org.springframework.boot spring-boot-starter-parent - 2.2.5.RELEASE + 2.3.0.BUILD-SNAPSHOT @@ -63,4 +63,38 @@ + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/libs-snapshot-local + + + spring-milestones + Spring Milestones + https://repo.spring.io/libs-milestone-local + + + spring-releases + Spring Releases + https://repo.spring.io/release + + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/libs-snapshot-local + + + spring-milestones + Spring Milestones + https://repo.spring.io/libs-milestone-local + + + spring-releases + Spring Releases + https://repo.spring.io/libs-release-local + + diff --git a/spring-cloud-function-deployer/src/it/bootjarnostart/pom.xml b/spring-cloud-function-deployer/src/it/bootjarnostart/pom.xml index 87c5b2613..56714cd85 100644 --- a/spring-cloud-function-deployer/src/it/bootjarnostart/pom.xml +++ b/spring-cloud-function-deployer/src/it/bootjarnostart/pom.xml @@ -12,7 +12,7 @@ org.springframework.boot spring-boot-starter-parent - 2.2.5.RELEASE + 2.3.0.BUILD-SNAPSHOT @@ -75,4 +75,38 @@ + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/libs-snapshot-local + + + spring-milestones + Spring Milestones + https://repo.spring.io/libs-milestone-local + + + spring-releases + Spring Releases + https://repo.spring.io/release + + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/libs-snapshot-local + + + spring-milestones + Spring Milestones + https://repo.spring.io/libs-milestone-local + + + spring-releases + Spring Releases + https://repo.spring.io/libs-release-local + + diff --git a/spring-cloud-function-deployer/src/main/java/org/springframework/cloud/function/deployer/FunctionArchiveDeployer.java b/spring-cloud-function-deployer/src/main/java/org/springframework/cloud/function/deployer/FunctionArchiveDeployer.java index 6322bad32..f085e08a4 100644 --- a/spring-cloud-function-deployer/src/main/java/org/springframework/cloud/function/deployer/FunctionArchiveDeployer.java +++ b/spring-cloud-function-deployer/src/main/java/org/springframework/cloud/function/deployer/FunctionArchiveDeployer.java @@ -20,7 +20,10 @@ import java.io.IOException; import java.lang.reflect.Method; import java.lang.reflect.Type; import java.net.URL; +import java.net.URLClassLoader; +import java.util.ArrayList; import java.util.HashMap; +import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Map.Entry; @@ -71,7 +74,8 @@ class FunctionArchiveDeployer extends JarLauncher { ClassLoader currentLoader = Thread.currentThread().getContextClassLoader(); try { - Thread.currentThread().setContextClassLoader(createClassLoader(discoverClassPathAcrhives())); + ClassLoader cl = createClassLoader(discoverClassPathAcrhives().iterator()); + Thread.currentThread().setContextClassLoader(cl); evalContext.setTypeLocator(new StandardTypeLocator(Thread.currentThread().getContextClassLoader())); if (this.isBootApplicationWithMain()) { @@ -122,6 +126,13 @@ class FunctionArchiveDeployer extends JarLauncher { } } + // TODO remove this method all together once https://github.com/spring-projects/spring-boot/pull/20851 is addressed + @Override + protected ClassLoader createClassLoader(Iterator archives) throws Exception { + URLClassLoader cl = (URLClassLoader) super.createClassLoader(archives); + return this.createClassLoader(cl.getURLs()); + } + @Override protected ClassLoader createClassLoader(URL[] urls) throws Exception { String classAsPath = DeployerContextUtils.class.getName().replace('.', '/') + ".class"; @@ -195,7 +206,12 @@ class FunctionArchiveDeployer extends JarLauncher { } private List discoverClassPathAcrhives() throws Exception { - List classPathArchives = getClassPathArchives(); + Iterator iter = this.getClassPathArchivesIterator(); + List classPathArchives = new ArrayList<>(); + while (iter.hasNext()) { + classPathArchives.add(iter.next()); + } + if (CollectionUtils.isEmpty(classPathArchives)) { classPathArchives.add(this.getArchive()); }