Polishing
This commit is contained in:
@@ -80,8 +80,8 @@ public class DefaultConversionService extends GenericConversionService {
|
||||
|
||||
/**
|
||||
* Add converters appropriate for most environments.
|
||||
* @param converterRegistry the registry of converters to add to (must also be castable to ConversionService,
|
||||
* e.g. being a {@link ConfigurableConversionService})
|
||||
* @param converterRegistry the registry of converters to add to
|
||||
* (must also be castable to ConversionService, e.g. being a {@link ConfigurableConversionService})
|
||||
* @throws ClassCastException if the given ConverterRegistry could not be cast to a ConversionService
|
||||
*/
|
||||
public static void addDefaultConverters(ConverterRegistry converterRegistry) {
|
||||
@@ -100,9 +100,9 @@ public class DefaultConversionService extends GenericConversionService {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add collection converters.
|
||||
* @param converterRegistry the registry of converters to add to (must also be castable to ConversionService,
|
||||
* e.g. being a {@link ConfigurableConversionService})
|
||||
* Add common collection converters.
|
||||
* @param converterRegistry the registry of converters to add to
|
||||
* (must also be castable to ConversionService, e.g. being a {@link ConfigurableConversionService})
|
||||
* @throws ClassCastException if the given ConverterRegistry could not be cast to a ConversionService
|
||||
* @since 4.2.3
|
||||
*/
|
||||
@@ -148,7 +148,7 @@ public class DefaultConversionService extends GenericConversionService {
|
||||
|
||||
converterRegistry.addConverterFactory(new StringToEnumConverterFactory());
|
||||
converterRegistry.addConverter(new EnumToStringConverter((ConversionService) converterRegistry));
|
||||
|
||||
|
||||
converterRegistry.addConverterFactory(new IntegerToEnumConverterFactory());
|
||||
converterRegistry.addConverter(new EnumToIntegerConverter((ConversionService) converterRegistry));
|
||||
|
||||
|
||||
@@ -27,8 +27,8 @@ import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
|
||||
*/
|
||||
public class OxmNamespaceHandler extends NamespaceHandlerSupport {
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public void init() {
|
||||
registerBeanDefinitionParser("jaxb2-marshaller", new Jaxb2MarshallerBeanDefinitionParser());
|
||||
registerBeanDefinitionParser("jibx-marshaller", new JibxMarshallerBeanDefinitionParser());
|
||||
|
||||
@@ -187,11 +187,9 @@ public class FormHttpMessageConverter implements HttpMessageConverter<MultiValue
|
||||
* Set the character set to use when writing multipart data to encode file
|
||||
* names. Encoding is based on the "encoded-word" syntax defined in RFC 2047
|
||||
* and relies on {@code MimeUtility} from "javax.mail".
|
||||
*
|
||||
* <p>As of 5.0 by default part headers, including Content-Disposition (and
|
||||
* its filename parameter) will be encoded based on the setting of
|
||||
* {@link #setCharset(Charset)} or {@code UTF-8} by default.
|
||||
*
|
||||
* @since 4.1.1
|
||||
* @see <a href="http://en.wikipedia.org/wiki/MIME#Encoded-Word">Encoded-Word</a>
|
||||
*/
|
||||
|
||||
@@ -125,29 +125,38 @@ import org.springframework.web.util.UriTemplateHandler;
|
||||
public class RestTemplate extends InterceptingHttpAccessor implements RestOperations {
|
||||
|
||||
private static boolean romePresent =
|
||||
ClassUtils.isPresent("com.rometools.rome.feed.WireFeed", RestTemplate.class.getClassLoader());
|
||||
ClassUtils.isPresent("com.rometools.rome.feed.WireFeed",
|
||||
RestTemplate.class.getClassLoader());
|
||||
|
||||
private static final boolean jaxb2Present =
|
||||
ClassUtils.isPresent("javax.xml.bind.Binder", RestTemplate.class.getClassLoader());
|
||||
ClassUtils.isPresent("javax.xml.bind.Binder",
|
||||
RestTemplate.class.getClassLoader());
|
||||
|
||||
private static final boolean jackson2Present =
|
||||
ClassUtils.isPresent("com.fasterxml.jackson.databind.ObjectMapper", RestTemplate.class.getClassLoader()) &&
|
||||
ClassUtils.isPresent("com.fasterxml.jackson.core.JsonGenerator", RestTemplate.class.getClassLoader());
|
||||
ClassUtils.isPresent("com.fasterxml.jackson.databind.ObjectMapper",
|
||||
RestTemplate.class.getClassLoader()) &&
|
||||
ClassUtils.isPresent("com.fasterxml.jackson.core.JsonGenerator",
|
||||
RestTemplate.class.getClassLoader());
|
||||
|
||||
private static final boolean jackson2XmlPresent =
|
||||
ClassUtils.isPresent("com.fasterxml.jackson.dataformat.xml.XmlMapper", RestTemplate.class.getClassLoader());
|
||||
ClassUtils.isPresent("com.fasterxml.jackson.dataformat.xml.XmlMapper",
|
||||
RestTemplate.class.getClassLoader());
|
||||
|
||||
private static final boolean jackson2SmilePresent =
|
||||
ClassUtils.isPresent("com.fasterxml.jackson.dataformat.smile.SmileFactory", RestTemplate.class.getClassLoader());
|
||||
ClassUtils.isPresent("com.fasterxml.jackson.dataformat.smile.SmileFactory",
|
||||
RestTemplate.class.getClassLoader());
|
||||
|
||||
private static final boolean jackson2CborPresent =
|
||||
ClassUtils.isPresent("com.fasterxml.jackson.dataformat.cbor.CBORFactory", RestTemplate.class.getClassLoader());
|
||||
ClassUtils.isPresent("com.fasterxml.jackson.dataformat.cbor.CBORFactory",
|
||||
RestTemplate.class.getClassLoader());
|
||||
|
||||
private static final boolean gsonPresent =
|
||||
ClassUtils.isPresent("com.google.gson.Gson", RestTemplate.class.getClassLoader());
|
||||
ClassUtils.isPresent("com.google.gson.Gson",
|
||||
RestTemplate.class.getClassLoader());
|
||||
|
||||
private static final boolean jsonbPresent =
|
||||
ClassUtils.isPresent("javax.json.bind.Jsonb", RestTemplate.class.getClassLoader());
|
||||
ClassUtils.isPresent("javax.json.bind.Jsonb",
|
||||
RestTemplate.class.getClassLoader());
|
||||
|
||||
|
||||
private final List<HttpMessageConverter<?>> messageConverters = new ArrayList<>();
|
||||
|
||||
@@ -105,9 +105,9 @@ import org.springframework.web.util.UrlPathHelper;
|
||||
* It is typically imported by adding {@link EnableWebMvc @EnableWebMvc} to an
|
||||
* application {@link Configuration @Configuration} class. An alternative more
|
||||
* advanced option is to extend directly from this class and override methods as
|
||||
* necessary remembering to add {@link Configuration @Configuration} to the
|
||||
* necessary, remembering to add {@link Configuration @Configuration} to the
|
||||
* subclass and {@link Bean @Bean} to overridden {@link Bean @Bean} methods.
|
||||
* For more details see the Javadoc of {@link EnableWebMvc @EnableWebMvc}.
|
||||
* For more details see the javadoc of {@link EnableWebMvc @EnableWebMvc}.
|
||||
*
|
||||
* <p>This class registers the following {@link HandlerMapping}s:</p>
|
||||
* <ul>
|
||||
@@ -175,10 +175,12 @@ import org.springframework.web.util.UrlPathHelper;
|
||||
public class WebMvcConfigurationSupport implements ApplicationContextAware, ServletContextAware {
|
||||
|
||||
private static boolean romePresent =
|
||||
ClassUtils.isPresent("com.rometools.rome.feed.WireFeed", WebMvcConfigurationSupport.class.getClassLoader());
|
||||
ClassUtils.isPresent("com.rometools.rome.feed.WireFeed",
|
||||
WebMvcConfigurationSupport.class.getClassLoader());
|
||||
|
||||
private static final boolean jaxb2Present =
|
||||
ClassUtils.isPresent("javax.xml.bind.Binder", WebMvcConfigurationSupport.class.getClassLoader());
|
||||
ClassUtils.isPresent("javax.xml.bind.Binder",
|
||||
WebMvcConfigurationSupport.class.getClassLoader());
|
||||
|
||||
private static final boolean jackson2Present =
|
||||
ClassUtils.isPresent("com.fasterxml.jackson.databind.ObjectMapper",
|
||||
@@ -199,10 +201,12 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
|
||||
WebMvcConfigurationSupport.class.getClassLoader());
|
||||
|
||||
private static final boolean gsonPresent =
|
||||
ClassUtils.isPresent("com.google.gson.Gson", WebMvcConfigurationSupport.class.getClassLoader());
|
||||
ClassUtils.isPresent("com.google.gson.Gson",
|
||||
WebMvcConfigurationSupport.class.getClassLoader());
|
||||
|
||||
private static final boolean jsonbPresent =
|
||||
ClassUtils.isPresent("javax.json.bind.Jsonb", WebMvcConfigurationSupport.class.getClassLoader());
|
||||
ClassUtils.isPresent("javax.json.bind.Jsonb",
|
||||
WebMvcConfigurationSupport.class.getClassLoader());
|
||||
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -1685,7 +1685,7 @@ The preceding example is equivalent to the following Java code:
|
||||
[source,java,indent=0]
|
||||
[subs="verbatim,quotes"]
|
||||
----
|
||||
exampleBean.setEmail("")
|
||||
exampleBean.setEmail("");
|
||||
----
|
||||
|
||||
The `<null/>` element handles `null` values. For example:
|
||||
@@ -1705,7 +1705,7 @@ The above configuration is equivalent to the following Java code:
|
||||
[source,java,indent=0]
|
||||
[subs="verbatim,quotes"]
|
||||
----
|
||||
exampleBean.setEmail(null)
|
||||
exampleBean.setEmail(null);
|
||||
----
|
||||
|
||||
|
||||
|
||||
@@ -3147,7 +3147,7 @@ framework.
|
||||
c:loginAction-ref="loginAction" />
|
||||
|
||||
<bean id="loginAction" class="com.example.LoginAction"
|
||||
c:username="\#{request.getParameter('user')}"
|
||||
c:username="#{request.getParameter('user')}"
|
||||
c:password="#{request.getParameter('pswd')}"
|
||||
scope="request">
|
||||
<aop:scoped-proxy />
|
||||
@@ -3602,8 +3602,8 @@ scripts against a `DataSource`.
|
||||
public void databaseTest {
|
||||
ResourceDatabasePopulator populator = new ResourceDatabasePopulator();
|
||||
populator.addScripts(
|
||||
new ClassPathResource("test-schema.sql"),
|
||||
new ClassPathResource("test-data.sql"));
|
||||
new ClassPathResource("test-schema.sql"),
|
||||
new ClassPathResource("test-data.sql"));
|
||||
populator.setSeparator("@@");
|
||||
populator.execute(this.dataSource);
|
||||
// execute code that uses the test schema and data
|
||||
|
||||
@@ -3818,6 +3818,7 @@ accepted as an argument in several Spring Web MVC APIs.
|
||||
----
|
||||
|
||||
|
||||
|
||||
[[mvc-caching-static-resources]]
|
||||
=== Static resources
|
||||
|
||||
@@ -3830,7 +3831,6 @@ metadata, but also `'Cache-Control'` headers if properly configured.
|
||||
You can set the `cachePeriod` attribute on a `ResourceHttpRequestHandler` or use
|
||||
a `CacheControl` instance, which supports more specific directives:
|
||||
|
||||
|
||||
[source,java,indent=0]
|
||||
[subs="verbatim"]
|
||||
----
|
||||
|
||||
@@ -995,7 +995,6 @@ broadcasting to other connected clients):
|
||||
config.setApplicationDestinationPrefixes("/app");
|
||||
config.enableSimpleBroker("/topic", "/queue");
|
||||
}
|
||||
|
||||
}
|
||||
----
|
||||
|
||||
|
||||
Reference in New Issue
Block a user