Reference documentation updates

Issue: SPR-14087
Issue: SPR-14272
Issue: SPR-13535
Issue: SPR-13843
Issue: SPR-14164
Issue: SPR-14167
This commit is contained in:
Juergen Hoeller 2016-05-30 15:04:57 +02:00
parent 250d82768f
commit d6284202f1
3 changed files with 42 additions and 17 deletions

View File

@ -438,7 +438,7 @@ be &&'ed, ||'ed, and ! (negated) too.
====
Please note that the '++bean++' PCD is __only__ supported in Spring AOP - and __not__ in
native AspectJ weaving. It is a Spring-specific extension to the standard PCDs that
AspectJ defines.
AspectJ defines and therefore not available for aspects declared in the `@Aspect` model.
The '++bean++' PCD operates at the __instance__ level (building on the Spring bean name
concept) rather than at the type level only (which is what weaving-based AOP is limited
@ -2884,10 +2884,9 @@ A `@Transactional` annotation on a class specifies the default transaction seman
the execution of any __public__ operation in the class.
A `@Transactional` annotation on a method within the class overrides the default
transaction semantics given by the class annotation (if present). Methods with `public`,
`protected`, and default visibility may all be annotated. Annotating `protected` and
default visibility methods directly is the only way to get transaction demarcation for
the execution of such methods.
transaction semantics given by the class annotation (if present). Methods of any
visibility may be annotated, including private methods. Annotating non-public methods
directly is the only way to get transaction demarcation for the execution of such methods.
[TIP]
====

View File

@ -437,6 +437,16 @@ you are using Spring AOP it helps a lot when applying advice to a set of beans r
by name.
****
[NOTE]
====
With component scanning in the classpath, Spring generates bean names for unnamed
components, following the rules above: essentially, taking the simple class name
and turning its initial character to lower-case. However, in the (unusual) special
case when there is more than one character and both the first and second characters
are upper case, the original casing gets preserved. These are the same rules as
defined by `java.beans.Introspector.decapitalize` (which Spring is using here).
====
[[beans-beanname-alias]]
==== Aliasing a bean outside the bean definition
@ -5825,8 +5835,8 @@ It is very common to use `@Component` without specifying a name for the componen
}
----
When using `@Named`, it is possible to use
component-scanning in the exact same way as when using Spring annotations:
When using `@Named`, it is possible to use component scanning in the exact same way
as when using Spring annotations:
[source,java,indent=0]
[subs="verbatim,quotes"]
@ -5838,6 +5848,12 @@ component-scanning in the exact same way as when using Spring annotations:
}
----
[NOTE]
====
In contrast to `@Component`, the JSR-330 `@Named` annotation is not composable.
Please use Spring's stereotype model for building custom component annotations.
====
[[beans-standard-annotations-limitations]]

View File

@ -6498,7 +6498,7 @@ reference is provided for managing those methods annotated with `@Scheduled`.
[[scheduling-annotation-support-scheduled]]
==== The @Scheduled Annotation
The @Scheduled annotation can be added to a method along with trigger metadata. For
The `@Scheduled` annotation can be added to a method along with trigger metadata. For
example, the following method would be invoked every 5 seconds with a fixed delay,
meaning that the period will be measured from the completion time of each preceding
invocation.
@ -6562,13 +6562,15 @@ Context, then those would typically have been provided through dependency inject
[NOTE]
====
Make sure that you are not initializing multiple instances of the same @Scheduled
As of Spring Framework 4.3, `@Scheduled` methods are supported on beans of any scope.
Make sure that you are not initializing multiple instances of the same `@Scheduled`
annotation class at runtime, unless you do want to schedule callbacks to each such
instance. Related to this, make sure that you do not use @Configurable on bean classes
which are annotated with @Scheduled and registered as regular Spring beans with the
container: You would get double initialization otherwise, once through the container and
once through the @Configurable aspect, with the consequence of each @Scheduled method
being invoked twice.
instance. Related to this, make sure that you do not use `@Configurable` on bean
classes which are annotated with `@Scheduled` and registered as regular Spring beans
with the container: You would get double initialization otherwise, once through the
container and once through the `@Configurable` aspect, with the consequence of each
`@Scheduled` method being invoked twice.
====
@ -6619,8 +6621,8 @@ asynchronous execution so that the caller can perform other tasks prior to calli
----
`@Async` can not be used in conjunction with lifecycle callbacks such as
`@PostConstruct`. To asynchronously initialize Spring beans you currently have to use a
separate initializing Spring bean that invokes the `@Async` annotated method on the
`@PostConstruct`. To asynchronously initialize Spring beans you currently have to use
a separate initializing Spring bean that invokes the `@Async` annotated method on the
target then.
[source,java,indent=0]
@ -6635,7 +6637,7 @@ target then.
}
public class SampleBeanInititalizer {
public class SampleBeanInitializer {
private final SampleBean bean;
@ -6651,6 +6653,14 @@ target then.
}
----
[NOTE]
====
There is no direct XML equivalent for `@Async` since such methods should be designed
for asynchronous execution in the first place, not externally re-declared to be async.
However, you may manually set up Spring's `AsyncExecutionInterceptor` with Spring AOP,
in combination with a custom pointcut.
====
[[scheduling-annotation-support-qualification]]