diff --git a/spring-context-support/src/main/java/org/springframework/ui/freemarker/FreeMarkerConfigurationFactory.java b/spring-context-support/src/main/java/org/springframework/ui/freemarker/FreeMarkerConfigurationFactory.java index a5c8a1b1f4..f85fb5006d 100644 --- a/spring-context-support/src/main/java/org/springframework/ui/freemarker/FreeMarkerConfigurationFactory.java +++ b/spring-context-support/src/main/java/org/springframework/ui/freemarker/FreeMarkerConfigurationFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 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. @@ -316,12 +316,8 @@ public class FreeMarkerConfigurationFactory { * @throws TemplateException on FreeMarker initialization failure * @see #createConfiguration() */ - @SuppressWarnings("deprecation") protected Configuration newConfiguration() throws IOException, TemplateException { - // The default Configuration constructor is deprecated as of FreeMarker 2.3.21, - // in favor of specifying a compatibility version - which is a 2.3.21 feature. - // We won't be able to call that for a long while, but custom subclasses can. - return new Configuration(); + return new Configuration(Configuration.DEFAULT_INCOMPATIBLE_IMPROVEMENTS); } /** diff --git a/spring-jms/src/main/java/org/springframework/jms/support/converter/MappingJackson2MessageConverter.java b/spring-jms/src/main/java/org/springframework/jms/support/converter/MappingJackson2MessageConverter.java index b64abf2fce..c9805aedf4 100644 --- a/spring-jms/src/main/java/org/springframework/jms/support/converter/MappingJackson2MessageConverter.java +++ b/spring-jms/src/main/java/org/springframework/jms/support/converter/MappingJackson2MessageConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 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. @@ -50,7 +50,7 @@ import org.springframework.util.ClassUtils; *
Tested against Jackson 2.2; compatible with Jackson 2.0 and higher. + *
Compatible with Jackson 2.6 and higher, as of Spring 4.3. * * @author Mark Pollack * @author Dave Syer diff --git a/spring-messaging/src/main/java/org/springframework/messaging/converter/MappingJackson2MessageConverter.java b/spring-messaging/src/main/java/org/springframework/messaging/converter/MappingJackson2MessageConverter.java index 4283889bea..30a1612cff 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/converter/MappingJackson2MessageConverter.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/converter/MappingJackson2MessageConverter.java @@ -50,7 +50,7 @@ import org.springframework.util.MimeType; *
Compatible with Jackson 2.1 and higher. + *
Compatible with Jackson 2.6 and higher, as of Spring 4.3.
*
* @author Rossen Stoyanchev
* @author Juergen Hoeller
@@ -59,11 +59,6 @@ import org.springframework.util.MimeType;
*/
public class MappingJackson2MessageConverter extends AbstractMessageConverter {
- // Check for Jackson 2.3's overloaded canDeserialize/canSerialize variants with cause reference
- private static final boolean jackson23Available =
- ClassUtils.hasMethod(ObjectMapper.class, "canDeserialize", JavaType.class, AtomicReference.class);
-
-
private ObjectMapper objectMapper;
private Boolean prettyPrint;
@@ -146,7 +141,7 @@ public class MappingJackson2MessageConverter extends AbstractMessageConverter {
return false;
}
JavaType javaType = this.objectMapper.constructType(targetClass);
- if (!jackson23Available || !logger.isWarnEnabled()) {
+ if (!logger.isWarnEnabled()) {
return (this.objectMapper.canDeserialize(javaType) && supportsMimeType(message.getHeaders()));
}
AtomicReference This marshaller requires XStream 1.4 or higher, as of Spring 4.0.
+ * This marshaller requires XStream 1.4.5 or higher, as of Spring 4.3.
* Note that {@link XStream} construction has been reworked in 4.0, with the
* stream driver and the class loader getting passed into XStream itself now.
*
@@ -405,12 +406,9 @@ public class XStreamMarshaller extends AbstractMarshaller implements Initializin
* standard constructors or creating a custom subclass.
* @return the {@code XStream} instance
*/
- @SuppressWarnings("deprecation")
protected XStream constructXStream() {
- // The referenced XStream constructor has been deprecated as of 1.4.5.
- // We're preserving this call for broader XStream 1.4.x compatibility.
- return new XStream(this.reflectionProvider, getDefaultDriver(),
- this.beanClassLoader, this.mapper, this.converterLookup, this.converterRegistry) {
+ return new XStream(this.reflectionProvider, getDefaultDriver(), new ClassLoaderReference(this.beanClassLoader),
+ this.mapper, this.converterLookup, this.converterRegistry) {
@Override
protected MapperWrapper wrapMapper(MapperWrapper next) {
MapperWrapper mapperToWrap = next;
diff --git a/spring-web/src/main/java/org/springframework/http/converter/json/AbstractJackson2HttpMessageConverter.java b/spring-web/src/main/java/org/springframework/http/converter/json/AbstractJackson2HttpMessageConverter.java
index d648d0d070..c85dda4af0 100644
--- a/spring-web/src/main/java/org/springframework/http/converter/json/AbstractJackson2HttpMessageConverter.java
+++ b/spring-web/src/main/java/org/springframework/http/converter/json/AbstractJackson2HttpMessageConverter.java
@@ -48,7 +48,7 @@ import org.springframework.util.TypeUtils;
* Abstract base class for Jackson based and content type independent
* {@link HttpMessageConverter} implementations.
*
- * Compatible with Jackson 2.1 and higher.
+ * Compatible with Jackson 2.6 and higher, as of Spring 4.3.
*
* @author Arjen Poutsma
* @author Keith Donald
@@ -62,14 +62,6 @@ public abstract class AbstractJackson2HttpMessageConverter extends AbstractGener
public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8");
- // Check for Jackson 2.3's overloaded canDeserialize/canSerialize variants with cause reference
- private static final boolean jackson23Available = ClassUtils.hasMethod(ObjectMapper.class,
- "canDeserialize", JavaType.class, AtomicReference.class);
-
- // Check for Jackson 2.6+ for support of generic type aware serialization of polymorphic collections
- private static final boolean jackson26Available = ClassUtils.hasMethod(ObjectMapper.class,
- "setDefaultPrettyPrinter", PrettyPrinter.class);
-
protected ObjectMapper objectMapper;
@@ -144,7 +136,7 @@ public abstract class AbstractJackson2HttpMessageConverter extends AbstractGener
@Override
public boolean canRead(Type type, Class> contextClass, MediaType mediaType) {
JavaType javaType = getJavaType(type, contextClass);
- if (!jackson23Available || !logger.isWarnEnabled()) {
+ if (!logger.isWarnEnabled()) {
return (this.objectMapper.canDeserialize(javaType) && canRead(mediaType));
}
AtomicReference Tested against Jackson 2.4, 2.5, 2.6; compatible with Jackson 2.0 and higher.
+ * Compatible with Jackson 2.6 and higher, as of Spring 4.3.
*
* @author Sebastien Deleuze
* @author Juergen Hoeller
@@ -561,7 +561,6 @@ public class Jackson2ObjectMapperBuilder {
* settings. This can be applied to any number of {@code ObjectMappers}.
* @param objectMapper the ObjectMapper to configure
*/
- @SuppressWarnings("deprecation")
public void configure(ObjectMapper objectMapper) {
Assert.notNull(objectMapper, "ObjectMapper must not be null");
@@ -609,13 +608,11 @@ public class Jackson2ObjectMapperBuilder {
}
if (this.filters != null) {
- // Deprecated as of Jackson 2.6, but just in favor of a fluent variant.
- objectMapper.setFilters(this.filters);
+ objectMapper.setFilterProvider(this.filters);
}
for (Class> target : this.mixIns.keySet()) {
- // Deprecated as of Jackson 2.5, but just in favor of a fluent variant.
- objectMapper.addMixInAnnotations(target, this.mixIns.get(target));
+ objectMapper.addMixIn(target, this.mixIns.get(target));
}
if (!this.serializers.isEmpty() || !this.deserializers.isEmpty()) {
@@ -720,15 +717,7 @@ public class Jackson2ObjectMapperBuilder {
objectMapper.registerModule(BeanUtils.instantiate(javaTimeModule));
}
catch (ClassNotFoundException ex) {
- // jackson-datatype-jsr310 not available or older than 2.6
- try {
- Class extends Module> jsr310Module = (Class extends Module>)
- ClassUtils.forName("com.fasterxml.jackson.datatype.jsr310.JSR310Module", this.moduleClassLoader);
- objectMapper.registerModule(BeanUtils.instantiate(jsr310Module));
- }
- catch (ClassNotFoundException ex2) {
- // OK, jackson-datatype-jsr310 not available at all...
- }
+ // jackson-datatype-jsr310 not available
}
}
diff --git a/spring-web/src/main/java/org/springframework/http/converter/json/Jackson2ObjectMapperFactoryBean.java b/spring-web/src/main/java/org/springframework/http/converter/json/Jackson2ObjectMapperFactoryBean.java
index f17016e9cf..fa35579364 100644
--- a/spring-web/src/main/java/org/springframework/http/converter/json/Jackson2ObjectMapperFactoryBean.java
+++ b/spring-web/src/main/java/org/springframework/http/converter/json/Jackson2ObjectMapperFactoryBean.java
@@ -127,7 +127,7 @@ import org.springframework.context.ApplicationContextAware;
* </bean
*
*
- * Tested against Jackson 2.4, 2.5, 2.6; compatible with Jackson 2.0 and higher.
+ * Compatible with Jackson 2.6 and higher, as of Spring 4.3.
*
* @author Dmitry Katsubo
* @author Rossen Stoyanchev
diff --git a/spring-web/src/main/java/org/springframework/http/converter/json/MappingJackson2HttpMessageConverter.java b/spring-web/src/main/java/org/springframework/http/converter/json/MappingJackson2HttpMessageConverter.java
index 80f9b430a3..3cb3966600 100644
--- a/spring-web/src/main/java/org/springframework/http/converter/json/MappingJackson2HttpMessageConverter.java
+++ b/spring-web/src/main/java/org/springframework/http/converter/json/MappingJackson2HttpMessageConverter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2014 the original author or authors.
+ * Copyright 2002-2015 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.
@@ -35,7 +35,7 @@ import org.springframework.http.MediaType;
*
* The default constructor uses the default configuration provided by {@link Jackson2ObjectMapperBuilder}.
*
- * Compatible with Jackson 2.1 and higher.
+ * Compatible with Jackson 2.6 and higher, as of Spring 4.3.
*
* @author Arjen Poutsma
* @author Keith Donald
diff --git a/spring-web/src/main/java/org/springframework/http/converter/xml/MappingJackson2XmlHttpMessageConverter.java b/spring-web/src/main/java/org/springframework/http/converter/xml/MappingJackson2XmlHttpMessageConverter.java
index f6099585cc..f30fe118c1 100644
--- a/spring-web/src/main/java/org/springframework/http/converter/xml/MappingJackson2XmlHttpMessageConverter.java
+++ b/spring-web/src/main/java/org/springframework/http/converter/xml/MappingJackson2XmlHttpMessageConverter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2014 the original author or authors.
+ * Copyright 2002-2015 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.
@@ -35,7 +35,7 @@ import org.springframework.util.Assert;
*
* The default constructor uses the default configuration provided by {@link Jackson2ObjectMapperBuilder}.
*
- * Compatible with Jackson 2.1 and higher.
+ * Compatible with Jackson 2.6 and higher, as of Spring 4.3.
*
* @author Sebastien Deleuze
* @since 4.1
@@ -72,4 +72,5 @@ public class MappingJackson2XmlHttpMessageConverter extends AbstractJackson2Http
Assert.isAssignable(XmlMapper.class, objectMapper.getClass());
super.setObjectMapper(objectMapper);
}
+
}
diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/freemarker/FreeMarkerView.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/freemarker/FreeMarkerView.java
index f5e260eb26..991cea244f 100644
--- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/freemarker/FreeMarkerView.java
+++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/freemarker/FreeMarkerView.java
@@ -42,6 +42,7 @@ import freemarker.ext.servlet.HttpRequestParametersHashModel;
import freemarker.ext.servlet.HttpSessionHashModel;
import freemarker.ext.servlet.ServletContextHashModel;
import freemarker.template.Configuration;
+import freemarker.template.DefaultObjectWrapperBuilder;
import freemarker.template.ObjectWrapper;
import freemarker.template.SimpleHash;
import freemarker.template.Template;
@@ -186,10 +187,10 @@ public class FreeMarkerView extends AbstractTemplateView {
* {@link ObjectWrapper#DEFAULT_WRAPPER default wrapper} if none specified.
* @see freemarker.template.Configuration#getObjectWrapper()
*/
- @SuppressWarnings("deprecation")
protected ObjectWrapper getObjectWrapper() {
ObjectWrapper ow = getConfiguration().getObjectWrapper();
- return (ow != null ? ow : ObjectWrapper.DEFAULT_WRAPPER);
+ return (ow != null ? ow :
+ new DefaultObjectWrapperBuilder(Configuration.DEFAULT_INCOMPATIBLE_IMPROVEMENTS).build());
}
/**
diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/json/AbstractJackson2View.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/json/AbstractJackson2View.java
index 2069bbcd60..cf67ecc589 100644
--- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/json/AbstractJackson2View.java
+++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/json/AbstractJackson2View.java
@@ -38,7 +38,7 @@ import org.springframework.web.servlet.view.AbstractView;
* Abstract base class for Jackson based and content type independent
* {@link AbstractView} implementations.
*
- * Compatible with Jackson 2.1 and higher.
+ * Compatible with Jackson 2.6 and higher, as of Spring 4.3.
*
* @author Jeremy Grelle
* @author Arjen Poutsma
@@ -122,12 +122,6 @@ public abstract class AbstractJackson2View extends AbstractView {
}
}
- /**
- * Set the attribute in the model that should be rendered by this view.
- * When set, all other model attributes will be ignored.
- */
- public abstract void setModelKey(String modelKey);
-
/**
* Disables caching of the generated JSON.
* Default is {@code true}, which will prevent the client from caching the generated JSON.
@@ -187,23 +181,13 @@ public abstract class AbstractJackson2View extends AbstractView {
return value;
}
- /**
- * Filter out undesired attributes from the given model.
- * The return value can be either another {@link Map} or a single value object.
- * @param model the model, as passed on to {@link #renderMergedOutputModel}
- * @return the value to be rendered
- */
- protected abstract Object filterModel(Map The default constructor uses the default configuration provided by {@link Jackson2ObjectMapperBuilder}.
*
- * Compatible with Jackson 2.1 and higher.
+ * Compatible with Jackson 2.6 and higher, as of Spring 4.3.
*
* @author Jeremy Grelle
* @author Arjen Poutsma
diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/xml/MappingJackson2XmlView.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/xml/MappingJackson2XmlView.java
index dfcf59e523..ef40ba896d 100644
--- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/xml/MappingJackson2XmlView.java
+++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/xml/MappingJackson2XmlView.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2014 the original author or authors.
+ * Copyright 2002-2015 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.
@@ -36,7 +36,7 @@ import org.springframework.web.servlet.view.json.AbstractJackson2View;
*
* The default constructor uses the default configuration provided by {@link Jackson2ObjectMapperBuilder}.
*
- * Compatible with Jackson 2.1 and higher.
+ * Compatible with Jackson 2.6 and higher, as of Spring 4.3.
*
* @author Sebastien Deleuze
* @since 4.1
diff --git a/spring-websocket/src/main/java/org/springframework/web/socket/sockjs/frame/Jackson2SockJsMessageCodec.java b/spring-websocket/src/main/java/org/springframework/web/socket/sockjs/frame/Jackson2SockJsMessageCodec.java
index e879b26f8e..8ed46882c5 100644
--- a/spring-websocket/src/main/java/org/springframework/web/socket/sockjs/frame/Jackson2SockJsMessageCodec.java
+++ b/spring-websocket/src/main/java/org/springframework/web/socket/sockjs/frame/Jackson2SockJsMessageCodec.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2013 the original author or authors.
+ * Copyright 2002-2015 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.
@@ -28,7 +28,7 @@ import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
import org.springframework.util.Assert;
/**
- * A Jackson 2.x codec for encoding and decoding SockJS messages.
+ * A Jackson 2.6+ codec for encoding and decoding SockJS messages.
*
* It customizes Jackson's default properties with the following ones:
*