Allowed 'java.*', rather then just 'java.annotation' loading for jdk 11

This commit is contained in:
Oleg Zhurakousky
2019-01-28 13:59:28 +01:00
parent a2df13d1b3
commit de73c51462
3 changed files with 4 additions and 5 deletions

View File

@@ -42,6 +42,7 @@ import org.springframework.util.ClassUtils;
* {@link #run(String...)} it, cleaning up with a call to {@link #close()}.
*
* @author Dave Syer
* @author Oleg Zhurakousky
*/
public class ApplicationRunner {
@@ -69,7 +70,7 @@ public class ApplicationRunner {
try {
ClassUtils.overrideThreadContextClassLoader(this.classLoader);
Class<?> cls = this.classLoader.loadClass(ContextRunner.class.getName());
this.app = new StandardEvaluationContext(cls.newInstance());
this.app = new StandardEvaluationContext(cls.getDeclaredConstructor().newInstance());
this.app.setTypeLocator(new StandardTypeLocator(this.classLoader));
runContext(this.source, defaultProperties(UUID.randomUUID().toString()),
args);

View File

@@ -81,6 +81,7 @@ import org.springframework.util.StringUtils;
* @author Eric Bottard
* @author Mark Fisher
* @author Dave Syer
* @author Oleg Zhurakousky
*/
@Configuration
class FunctionCreatorConfiguration {
@@ -557,7 +558,7 @@ class FunctionCreatorConfiguration {
protected Class<?> loadClass(String name, boolean resolve)
throws ClassNotFoundException {
try {
if (name.startsWith("javax.annotation") && JavaVersion.getJavaVersion().isEqualOrNewerThan(JavaVersion.NINE)) {
if (name.startsWith("javax.") && JavaVersion.getJavaVersion().isEqualOrNewerThan(JavaVersion.NINE)) {
return getClass().getClassLoader().loadClass(name);
}
return super.loadClass(name, resolve);

View File

@@ -19,15 +19,12 @@ package org.springframework.cloud.function.deployer;
import java.util.function.Function;
import java.util.function.Supplier;
import org.junit.Assume;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.system.JavaVersion;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.rule.OutputCapture;
import org.springframework.cloud.function.context.FunctionCatalog;