Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix migration to asciidoctor tabs #30435

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions framework-docs/modules/ROOT/pages/core/aop/ataspectj/advice.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -605,11 +605,11 @@ Java::
// ...
}
----
======
<1> References the `publicMethod` named pointcut defined in xref:core/aop/ataspectj/pointcuts.adoc#aop-pointcuts-combining[Combining Pointcut Expressions].

Kotlin::
+
[source,kotlin,indent=0,subs="verbatim",role="secondary"]
.Kotlin
----
@Before("com.xyz.Pointcuts.publicMethod() && @annotation(auditable)") // <1>
fun audit(auditable: Auditable) {
Expand All @@ -618,6 +618,7 @@ Java::
}
----
<1> References the `publicMethod` named pointcut defined in xref:core/aop/ataspectj/pointcuts.adoc#aop-pointcuts-combining[Combining Pointcut Expressions].
======

[[aop-ataspectj-advice-params-generics]]
=== Advice Parameters and Generics
Expand Down Expand Up @@ -770,12 +771,12 @@ Java::
// ... use code and bean
}
----
======
<1> References the `publicMethod` named pointcut defined in xref:core/aop/ataspectj/pointcuts.adoc#aop-pointcuts-combining[Combining Pointcut Expressions].
<2> Declares `bean` and `auditable` as the argument names.

Kotlin::
+
[source,kotlin,indent=0,subs="verbatim",role="secondary"]
.Kotlin
----
@Before(
value = "com.xyz.Pointcuts.publicMethod() && target(bean) && @annotation(auditable)", // <1>
Expand All @@ -787,6 +788,7 @@ Java::
----
<1> References the `publicMethod` named pointcut defined in xref:core/aop/ataspectj/pointcuts.adoc#aop-pointcuts-combining[Combining Pointcut Expressions].
<2> Declares `bean` and `auditable` as the argument names.
======

If the first parameter is of type `JoinPoint`, `ProceedingJoinPoint`, or
`JoinPoint.StaticPart`, you can omit the name of the parameter from the value of the
Expand All @@ -807,12 +809,12 @@ Java::
// ... use code, bean, and jp
}
----
======
<1> References the `publicMethod` named pointcut defined in xref:core/aop/ataspectj/pointcuts.adoc#aop-pointcuts-combining[Combining Pointcut Expressions].
<2> Declares `bean` and `auditable` as the argument names.

Kotlin::
+
[source,kotlin,indent=0,subs="verbatim",role="secondary"]
.Kotlin
----
@Before(
value = "com.xyz.Pointcuts.publicMethod() && target(bean) && @annotation(auditable)", // <1>
Expand All @@ -824,6 +826,7 @@ Java::
----
<1> References the `publicMethod` named pointcut defined in xref:core/aop/ataspectj/pointcuts.adoc#aop-pointcuts-combining[Combining Pointcut Expressions].
<2> Declares `bean` and `auditable` as the argument names.
======

The special treatment given to the first parameter of type `JoinPoint`,
`ProceedingJoinPoint`, or `JoinPoint.StaticPart` is particularly convenient for advice
Expand All @@ -842,18 +845,19 @@ Java::
// ... use jp
}
----
======
<1> References the `publicMethod` named pointcut defined in xref:core/aop/ataspectj/pointcuts.adoc#aop-pointcuts-combining[Combining Pointcut Expressions].

Kotlin::
+
[source,kotlin,indent=0,subs="verbatim",role="secondary"]
.Kotlin
----
@Before("com.xyz.Pointcuts.publicMethod()") // <1>
fun audit(jp: JoinPoint) {
// ... use jp
}
----
<1> References the `publicMethod` named pointcut defined in xref:core/aop/ataspectj/pointcuts.adoc#aop-pointcuts-combining[Combining Pointcut Expressions].
======


[[aop-ataspectj-advice-proceeding-with-the-call]]
Expand All @@ -879,11 +883,11 @@ Java::
return pjp.proceed(new Object[] {newPattern});
}
----
======
<1> References the `inDataAccessLayer` named pointcut defined in xref:core/aop/ataspectj/pointcuts.adoc#aop-common-pointcuts[Sharing Named Pointcut Definitions].

Kotlin::
+
[source,kotlin,indent=0,subs="verbatim",role="secondary"]
.Kotlin
----
@Around("execution(List<Account> find*(..)) && " +
"com.xyz.CommonPointcuts.inDataAccessLayer() && " +
Expand All @@ -895,6 +899,7 @@ Java::
}
----
<1> References the `inDataAccessLayer` named pointcut defined in xref:core/aop/ataspectj/pointcuts.adoc#aop-common-pointcuts[Sharing Named Pointcut Definitions].
======

In many cases, you do this binding anyway (as in the preceding example).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ Java::
}
}
----
======
<1> References the `businessService` named pointcut defined in xref:core/aop/ataspectj/pointcuts.adoc#aop-common-pointcuts[Sharing Named Pointcut Definitions].

Kotlin::
+
[source,kotlin,indent=0,subs="verbatim",role="secondary"]
.Kotlin
----
@Aspect
class ConcurrentOperationExecutor : Ordered {
Expand Down Expand Up @@ -102,6 +102,7 @@ Java::
}
----
<1> References the `businessService` named pointcut defined in xref:core/aop/ataspectj/pointcuts.adoc#aop-common-pointcuts[Sharing Named Pointcut Definitions].
======

Note that the aspect implements the `Ordered` interface so that we can set the precedence of
the aspect higher than the transaction advice (we want a fresh transaction each time we
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,15 @@ Java::
public void tradingOperation() {} // <3>
}
----
======
<1> `publicMethod` matches if a method execution join point represents the execution
of any public method.
<2> `inTrading` matches if a method execution is in the trading module.
<3> `tradingOperation` matches if a method execution represents any public method in the
trading module.

Kotlin::
+
[source,kotlin,indent=0,subs="verbatim",role="secondary",chomp="-packages"]
.Kotlin
----
package com.xyz

Expand All @@ -197,6 +197,7 @@ of any public method.
<2> `inTrading` matches if a method execution is in the trading module.
<3> `tradingOperation` matches if a method execution represents any public method in the
trading module.
======

It is a best practice to build more complex pointcut expressions out of smaller _named
pointcuts_, as shown above. When referring to pointcuts by name, normal Java visibility
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,14 +233,14 @@ Java::

}
----
======
<1> We use the Spring-provided `AbstractSingleBeanDefinitionParser` to handle a lot of
the basic grunt work of creating a single `BeanDefinition`.
<2> We supply the `AbstractSingleBeanDefinitionParser` superclass with the type that our
single `BeanDefinition` represents.

Kotlin::
+
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary",chomp="-packages"]
.Kotlin
----
package org.springframework.samples.xml

Expand Down Expand Up @@ -274,6 +274,7 @@ single `BeanDefinition` represents.
the basic grunt work of creating a single `BeanDefinition`.
<2> We supply the `AbstractSingleBeanDefinitionParser` superclass with the type that our
single `BeanDefinition` represents.
======


In this simple case, this is all that we need to do. The creation of our single
Expand Down Expand Up @@ -540,7 +541,7 @@ Kotlin::
fun setChildren(children: List<Component>) {
this.children = children
}

override fun getObject(): Component? {
if (this.children != null && this.children!!.isNotEmpty()) {
for (child in children!!) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,11 +374,11 @@ Java::
// ...
}
----
======
<1> This line adds the `@Offline` annotation.

Kotlin::
+
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
.Kotlin
----
class MovieRecommender {

Expand All @@ -390,6 +390,7 @@ class MovieRecommender {
}
----
<1> This line adds the `@Offline` annotation.
======
--

Now the bean definition only needs a qualifier `type`, as shown in the following example:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ Java::
}
}
----
======
<1> This line injects a `@Resource`.

Kotlin::
+
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
.Kotlin
----
class SimpleMovieLister {

Expand All @@ -40,6 +40,7 @@ class SimpleMovieLister {
}
----
<1> This line injects a `@Resource`.
======
--


Expand Down Expand Up @@ -118,12 +119,12 @@ Java::
// ...
}
----
======
<1> The `context` field is injected based on the known resolvable dependency type:
`ApplicationContext`.

Kotlin::
+
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
.Kotlin
----
class MovieRecommender {

Expand All @@ -139,5 +140,6 @@ Java::
----
<1> The `context` field is injected based on the known resolvable dependency type:
`ApplicationContext`.
======
--

Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ Java::
// ...
}
----
======
<1> The `@Component` causes `@Service` to be treated in the same way as `@Component`.

Kotlin::
+
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
.Kotlin
----
@Target(AnnotationTarget.TYPE)
@Retention(AnnotationRetention.RUNTIME)
Expand All @@ -86,6 +86,7 @@ Java::
}
----
<1> The `@Component` causes `@Service` to be treated in the same way as `@Component`.
======

You can also combine meta-annotations to create "`composed annotations`". For example,
the `@RestController` annotation from Spring MVC is composed of `@Controller` and
Expand Down
10 changes: 6 additions & 4 deletions framework-docs/modules/ROOT/pages/core/beans/environment.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,11 @@ Java::
}
}
----
======
<1> `@Bean(destroyMethod = "")` disables default destroy method inference.

Kotlin::
+
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
.Kotlin
----
@Configuration
@Profile("production")
Expand All @@ -202,6 +202,7 @@ Java::
}
----
<1> `@Bean(destroyMethod = "")` disables default destroy method inference.
======
--

NOTE: As mentioned earlier, with `@Bean` methods, you typically choose to use programmatic
Expand Down Expand Up @@ -294,12 +295,12 @@ Java::
}
}
----
======
<1> The `standaloneDataSource` method is available only in the `development` profile.
<2> The `jndiDataSource` method is available only in the `production` profile.

Kotlin::
+
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
.Kotlin
----
@Configuration
class AppConfig {
Expand All @@ -322,6 +323,7 @@ Java::
----
<1> The `standaloneDataSource` method is available only in the `development` profile.
<2> The `jndiDataSource` method is available only in the `production` profile.
======
--

[NOTE]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,11 @@ Java::
// ...
}
----
======
<1> This annotation enables component scanning.

Kotlin::
+
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
.Kotlin
----
@Configuration
@ComponentScan(basePackages = ["com.acme"]) // <1>
Expand All @@ -157,6 +157,7 @@ Java::
}
----
<1> This annotation enables component scanning.
======


[TIP]
Expand Down
Loading