Change deprecate json mapper property

Resolves #693
This commit is contained in:
Oleg Zhurakousky
2021-05-11 15:51:09 +02:00
parent 566c3a93d6
commit cfec6eceec
2 changed files with 7 additions and 3 deletions

View File

@@ -30,6 +30,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer;
import org.springframework.cloud.function.context.config.ContextFunctionCatalogAutoConfiguration;
import org.springframework.messaging.Message;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.util.Assert;
@@ -68,8 +69,8 @@ public class FunctionInvoker extends AbstractSpringFunctionAdapterInitializer<Ht
}
// Default to GSON if implementation not specified.
if (!System.getenv().containsKey("spring.http.converters.preferred-json-mapper")) {
System.setProperty("spring.http.converters.preferred-json-mapper", "gson");
if (!System.getenv().containsKey(ContextFunctionCatalogAutoConfiguration.JSON_MAPPER_PROPERTY)) {
System.setProperty(ContextFunctionCatalogAutoConfiguration.JSON_MAPPER_PROPERTY, "gson");
}
Thread.currentThread() // TODO: remove after upgrading to 1.0.0-alpha-2-rc5

View File

@@ -79,7 +79,10 @@ public class ContextFunctionCatalogAutoConfiguration {
@Deprecated
static final String PREFERRED_MAPPER_PROPERTY = "spring.http.converters.preferred-json-mapper";
static final String JSON_MAPPER_PROPERTY = "spring.cloud.function.preferred-json-mapper";
/**
* The name of the property to specify desired JSON mapper. Available values are `jackson' and 'gson'.
*/
public static final String JSON_MAPPER_PROPERTY = "spring.cloud.function.preferred-json-mapper";
@Bean
public FunctionRegistry functionCatalog(List<MessageConverter> messageConverters, JsonMapper jsonMapper,