Ensure classpath checks can be evaluated at build-time
Closes gh-29352
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -67,9 +67,12 @@ public class ProtobufMessageConverter extends AbstractMessageConverter {
|
||||
*/
|
||||
public static final MimeType PROTOBUF = new MimeType("application", "x-protobuf", DEFAULT_CHARSET);
|
||||
|
||||
private static final boolean protobufJsonFormatPresent =
|
||||
ClassUtils.isPresent("com.google.protobuf.util.JsonFormat", ProtobufMessageConverter.class.getClassLoader());
|
||||
|
||||
private static final Map<Class<?>, Method> methodCache = new ConcurrentReferenceHashMap<>();
|
||||
|
||||
|
||||
final ExtensionRegistry extensionRegistry;
|
||||
|
||||
@Nullable
|
||||
@@ -98,7 +101,7 @@ public class ProtobufMessageConverter extends AbstractMessageConverter {
|
||||
if (formatSupport != null) {
|
||||
this.protobufFormatSupport = formatSupport;
|
||||
}
|
||||
else if (ClassUtils.isPresent("com.google.protobuf.util.JsonFormat", getClass().getClassLoader())) {
|
||||
else if (protobufJsonFormatPresent) {
|
||||
this.protobufFormatSupport = new ProtobufJavaUtilSupport(null, null);
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user