Polishing
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2020 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.
|
||||
@@ -41,12 +41,11 @@ import java.lang.annotation.Target;
|
||||
* regular constructors: i.e. lookup methods cannot get replaced on beans returned
|
||||
* from factory methods where we cannot dynamically provide a subclass for them.
|
||||
*
|
||||
* <p><b>Concrete limitations in typical Spring configuration scenarios:</b>
|
||||
* When used with component scanning or any other mechanism that filters out abstract
|
||||
* beans, provide stub implementations of your lookup methods to be able to declare
|
||||
* them as concrete classes. And please remember that lookup methods won't work on
|
||||
* beans returned from {@code @Bean} methods in configuration classes; you'll have
|
||||
* to resort to {@code @Inject Provider<TargetBean>} or the like instead.
|
||||
* <p><b>Recommendations for typical Spring configuration scenarios:</b>
|
||||
* When a concrete class may be needed in certain scenarios, consider providing stub
|
||||
* implementations of your lookup methods. And please remember that lookup methods
|
||||
* won't work on beans returned from {@code @Bean} methods in configuration classes;
|
||||
* you'll have to resort to {@code @Inject Provider<TargetBean>} or the like instead.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 4.1
|
||||
|
||||
@@ -887,7 +887,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
|
||||
/**
|
||||
* Return whether this factory holds a InstantiationAwareBeanPostProcessor
|
||||
* that will get applied to singleton beans on shutdown.
|
||||
* that will get applied to singleton beans on creation.
|
||||
* @see #addBeanPostProcessor
|
||||
* @see org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2020 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.validation.annotation.Validated;
|
||||
* at the type level of the containing target class, applying to all public service methods
|
||||
* of that class. By default, JSR-303 will validate against its default group only.
|
||||
*
|
||||
* <p>As of Spring 5.0, this functionality requires a Bean Validation 1.1 provider.
|
||||
* <p>As of Spring 5.0, this functionality requires a Bean Validation 1.1+ provider.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 3.1
|
||||
@@ -87,7 +87,6 @@ public class MethodValidationInterceptor implements MethodInterceptor {
|
||||
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object invoke(MethodInvocation invocation) throws Throwable {
|
||||
// Avoid Validator invocation on FactoryBean.getObjectType/isSingleton
|
||||
if (isFactoryBeanMetadataMethod(invocation.getMethod())) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2020 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.validation.annotation.Validated;
|
||||
* inline constraint annotations. Validation groups can be specified through {@code @Validated}
|
||||
* as well. By default, JSR-303 will validate against its default group only.
|
||||
*
|
||||
* <p>As of Spring 5.0, this functionality requires a Bean Validation 1.1 provider.
|
||||
* <p>As of Spring 5.0, this functionality requires a Bean Validation 1.1+ provider.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 3.1
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2020 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.
|
||||
@@ -46,12 +46,12 @@ import org.springframework.lang.Nullable;
|
||||
*/
|
||||
public class ServerSentEventHttpMessageReader implements HttpMessageReader<Object> {
|
||||
|
||||
private static final ResolvableType STRING_TYPE = ResolvableType.forClass(String.class);
|
||||
|
||||
private static final DataBufferFactory bufferFactory = new DefaultDataBufferFactory();
|
||||
|
||||
private static final StringDecoder stringDecoder = StringDecoder.textPlainOnly();
|
||||
|
||||
private static final ResolvableType STRING_TYPE = ResolvableType.forClass(String.class);
|
||||
|
||||
|
||||
@Nullable
|
||||
private final Decoder<?> decoder;
|
||||
@@ -129,7 +129,7 @@ public class ServerSentEventHttpMessageReader implements HttpMessageReader<Objec
|
||||
sseBuilder.event(line.substring(6).trim());
|
||||
}
|
||||
else if (line.startsWith("retry:")) {
|
||||
sseBuilder.retry(Duration.ofMillis(Long.valueOf(line.substring(6).trim())));
|
||||
sseBuilder.retry(Duration.ofMillis(Long.parseLong(line.substring(6).trim())));
|
||||
}
|
||||
else if (line.startsWith(":")) {
|
||||
comment = (comment != null ? comment : new StringBuilder());
|
||||
@@ -142,7 +142,7 @@ public class ServerSentEventHttpMessageReader implements HttpMessageReader<Objec
|
||||
|
||||
if (shouldWrap) {
|
||||
if (comment != null) {
|
||||
sseBuilder.comment(comment.toString().substring(0, comment.length() - 1));
|
||||
sseBuilder.comment(comment.substring(0, comment.length() - 1));
|
||||
}
|
||||
return decodedData.map(o -> {
|
||||
sseBuilder.data(o);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2020 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.
|
||||
@@ -184,7 +184,7 @@ public class ServerSentEventHttpMessageWriter implements HttpMessageWriter<Objec
|
||||
private Mono<DataBuffer> encodeText(CharSequence text, MediaType mediaType, DataBufferFactory bufferFactory) {
|
||||
Assert.notNull(mediaType.getCharset(), "Expected MediaType with charset");
|
||||
byte[] bytes = text.toString().getBytes(mediaType.getCharset());
|
||||
return Mono.just(bufferFactory.wrap(bytes)); // wrapping, not allocating
|
||||
return Mono.just(bufferFactory.wrap(bytes)); // wrapping, not allocating
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -436,8 +436,12 @@ example shows:
|
||||
----
|
||||
====
|
||||
|
||||
The `systemProperties` variable is predefined, so you can use it in your expressions, as
|
||||
the following example shows:
|
||||
All beans in the application context are available as predefined variables with their
|
||||
common bean name. This includes standard context beans such as `environment` (of type
|
||||
`org.springframework.core.env.Environment`) as well as `systemProperties` and
|
||||
`systemEnvironment` (of type `Map<String, Object>`) for access to the runtime environment.
|
||||
|
||||
The following example shows access to the `systemProperties` bean as a SpEL variable:
|
||||
|
||||
====
|
||||
[source,xml,indent=0]
|
||||
@@ -451,8 +455,7 @@ the following example shows:
|
||||
----
|
||||
====
|
||||
|
||||
Note that you do not have to prefix the predefined variable with the `#`
|
||||
symbol in this context.
|
||||
Note that you do not have to prefix the predefined variable with the `#` symbol here.
|
||||
|
||||
You can also refer to other bean properties by name, as the following example shows:
|
||||
|
||||
@@ -479,8 +482,8 @@ You can also refer to other bean properties by name, as the following example sh
|
||||
[[expressions-beandef-annotation-based]]
|
||||
=== Annotation Configuration
|
||||
|
||||
To specify a default value, you can place the `@Value` annotation on fields, methods, and method or constructor
|
||||
parameters.
|
||||
To specify a default value, you can place the `@Value` annotation on fields, methods,
|
||||
and method or constructor parameters.
|
||||
|
||||
The following example sets the default value of a field variable:
|
||||
|
||||
@@ -1265,7 +1268,7 @@ The following example shows how to use the Elvis operator:
|
||||
----
|
||||
ExpressionParser parser = new SpelExpressionParser();
|
||||
|
||||
String name = parser.parseExpression("name?:'Unknown'").getValue(String.class);
|
||||
String name = parser.parseExpression("name?:'Unknown'").getValue(new Inventor(), String.class);
|
||||
System.out.println(name); // 'Unknown'
|
||||
----
|
||||
====
|
||||
|
||||
Reference in New Issue
Block a user