Skip to content

Commit 6f24c0d

Browse files
committed
Consistent use of tabs for sample code in the reference documentation
1 parent 08c7855 commit 6f24c0d

18 files changed

+1206
-1228
lines changed

src/docs/asciidoc/core.adoc

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
:api-spring-framework: {doc-root}/spring-framework/docs/{spring-version}/javadoc-api/org/springframework
55
:toc: left
66
:toclevels: 4
7+
:tabsize: 4
78
:docinfo1:
89

910
This part of the reference documentation covers all of those technologies that are

src/docs/asciidoc/core/core-beans.adoc

+51-52
Original file line numberDiff line numberDiff line change
@@ -309,23 +309,23 @@ Typically, such configuration will live in a ".groovy" file with a structure as
309309
[source,java,indent=0]
310310
[subs="verbatim,quotes"]
311311
----
312-
beans {
313-
dataSource(BasicDataSource) {
314-
driverClassName = "org.hsqldb.jdbcDriver"
315-
url = "jdbc:hsqldb:mem:grailsDB"
316-
username = "sa"
317-
password = ""
318-
settings = [mynew:"setting"]
319-
}
320-
sessionFactory(SessionFactory) {
321-
dataSource = dataSource
322-
}
323-
myService(MyService) {
324-
nestedBean = { AnotherBean bean ->
325-
dataSource = dataSource
326-
}
327-
}
328-
}
312+
beans {
313+
dataSource(BasicDataSource) {
314+
driverClassName = "org.hsqldb.jdbcDriver"
315+
url = "jdbc:hsqldb:mem:grailsDB"
316+
username = "sa"
317+
password = ""
318+
settings = [mynew:"setting"]
319+
}
320+
sessionFactory(SessionFactory) {
321+
dataSource = dataSource
322+
}
323+
myService(MyService) {
324+
nestedBean = { AnotherBean bean ->
325+
dataSource = dataSource
326+
}
327+
}
328+
}
329329
----
330330

331331
This configuration style is largely equivalent to XML bean definitions and even
@@ -373,7 +373,7 @@ delegates, e.g. with `XmlBeanDefinitionReader` for XML files:
373373
----
374374
GenericApplicationContext context = new GenericApplicationContext();
375375
new XmlBeanDefinitionReader(context).loadBeanDefinitions("services.xml", "daos.xml");
376-
context.refresh();
376+
context.refresh();
377377
----
378378

379379
Or with `GroovyBeanDefinitionReader` for Groovy files:
@@ -383,7 +383,7 @@ Or with `GroovyBeanDefinitionReader` for Groovy files:
383383
----
384384
GenericApplicationContext context = new GenericApplicationContext();
385385
new GroovyBeanDefinitionReader(context).loadBeanDefinitions("services.groovy", "daos.groovy");
386-
context.refresh();
386+
context.refresh();
387387
----
388388

389389
Such reader delegates can be mixed and matched on the same `ApplicationContext`,
@@ -1685,7 +1685,7 @@ The preceding example is equivalent to the following Java code:
16851685
[source,java,indent=0]
16861686
[subs="verbatim,quotes"]
16871687
----
1688-
exampleBean.setEmail("")
1688+
exampleBean.setEmail("")
16891689
----
16901690

16911691
The `<null/>` element handles `null` values. For example:
@@ -3822,7 +3822,6 @@ Find below the custom `BeanPostProcessor` implementation class definition:
38223822
package scripting;
38233823
38243824
import org.springframework.beans.factory.config.BeanPostProcessor;
3825-
import org.springframework.beans.BeansException;
38263825
38273826
public class InstantiationTracingBeanPostProcessor implements BeanPostProcessor {
38283827
@@ -5400,7 +5399,7 @@ comma/semicolon/space-separated list that includes the parent package of each cl
54005399
@Configuration
54015400
@ComponentScan(basePackages = "org.example")
54025401
public class AppConfig {
5403-
...
5402+
...
54045403
}
54055404
----
54065405

@@ -5511,12 +5510,12 @@ and using "stub" repositories instead.
55115510
[subs="verbatim,quotes"]
55125511
----
55135512
@Configuration
5514-
@ComponentScan(basePackages = "org.example",
5515-
includeFilters = @Filter(type = FilterType.REGEX, pattern = ".*Stub.*Repository"),
5516-
excludeFilters = @Filter(Repository.class))
5517-
public class AppConfig {
5518-
...
5519-
}
5513+
@ComponentScan(basePackages = "org.example",
5514+
includeFilters = @Filter(type = FilterType.REGEX, pattern = ".*Stub.*Repository"),
5515+
excludeFilters = @Filter(Repository.class))
5516+
public class AppConfig {
5517+
...
5518+
}
55205519
----
55215520

55225521
and the equivalent using XML
@@ -5746,10 +5745,10 @@ fully-qualified class name when configuring the scanner:
57465745
[subs="verbatim,quotes"]
57475746
----
57485747
@Configuration
5749-
@ComponentScan(basePackages = "org.example", nameGenerator = MyNameGenerator.class)
5750-
public class AppConfig {
5751-
...
5752-
}
5748+
@ComponentScan(basePackages = "org.example", nameGenerator = MyNameGenerator.class)
5749+
public class AppConfig {
5750+
...
5751+
}
57535752
----
57545753

57555754
[source,xml,indent=0]
@@ -5803,8 +5802,8 @@ fully-qualified class name when configuring the scanner:
58035802
@Configuration
58045803
@ComponentScan(basePackages = "org.example", scopeResolver = MyScopeResolver.class)
58055804
public class AppConfig {
5806-
...
5807-
}
5805+
...
5806+
}
58085807
----
58095808

58105809
[source,xml,indent=0]
@@ -5828,8 +5827,8 @@ the following configuration will result in standard JDK dynamic proxies:
58285827
@Configuration
58295828
@ComponentScan(basePackages = "org.example", scopedProxy = ScopedProxyMode.INTERFACES)
58305829
public class AppConfig {
5831-
...
5832-
}
5830+
...
5831+
}
58335832
----
58345833

58355834
[source,xml,indent=0]
@@ -6144,7 +6143,7 @@ exact same way as when using Spring annotations:
61446143
@Configuration
61456144
@ComponentScan(basePackages = "org.example")
61466145
public class AppConfig {
6147-
...
6146+
...
61486147
}
61496148
----
61506149

@@ -6374,7 +6373,7 @@ To enable component scanning, just annotate your `@Configuration` class as follo
63746373
@Configuration
63756374
@ComponentScan(basePackages = "com.acme")
63766375
public class AppConfig {
6377-
...
6376+
...
63786377
}
63796378
----
63806379

@@ -6693,7 +6692,7 @@ method directly during construction:
66936692
public Foo foo() {
66946693
Foo foo = new Foo();
66956694
foo.init();
6696-
return foo;
6695+
return foo;
66976696
}
66986697
66996698
// ...
@@ -7011,7 +7010,7 @@ another configuration class:
70117010
@Configuration
70127011
public class ConfigA {
70137012
7014-
@Bean
7013+
@Bean
70157014
public A a() {
70167015
return new A();
70177016
}
@@ -8681,18 +8680,18 @@ environment provides:
86818680
[subs="verbatim,quotes"]
86828681
----
86838682
public class EntityCreatedEvent<T>
8684-
extends ApplicationEvent implements ResolvableTypeProvider {
8685-
8686-
public EntityCreatedEvent(T entity) {
8687-
super(entity);
8688-
}
8689-
8690-
@Override
8691-
public ResolvableType getResolvableType() {
8692-
return ResolvableType.forClassWithGenerics(getClass(),
8693-
ResolvableType.forInstance(getSource()));
8694-
}
8695-
}
8683+
extends ApplicationEvent implements ResolvableTypeProvider {
8684+
8685+
public EntityCreatedEvent(T entity) {
8686+
super(entity);
8687+
}
8688+
8689+
@Override
8690+
public ResolvableType getResolvableType() {
8691+
return ResolvableType.forClassWithGenerics(getClass(),
8692+
ResolvableType.forInstance(getSource()));
8693+
}
8694+
}
86968695
----
86978696

86988697
[TIP]

src/docs/asciidoc/core/core-databuffer-codec.adoc

+36-17
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
[[databuffers]]
22
= Data Buffers and Codecs
33

4+
5+
6+
47
== Introduction
58

69
The `DataBuffer` interface defines an abstraction over byte buffers.
@@ -9,6 +12,9 @@ Netty does not use `ByteBuffer`, but instead offers `ByteBuf` as an alternative.
912
Spring's `DataBuffer` is a simple abstraction over `ByteBuf` that can also be used on non-Netty
1013
platforms (i.e. Servlet 3.1+).
1114

15+
16+
17+
1218
== `DataBufferFactory`
1319

1420
The `DataBufferFactory` offers functionality to allocate new data buffers, as well as to wrap
@@ -25,6 +31,9 @@ to be used on Netty platforms, such as Reactor Netty.
2531
The other implementation, the `DefaultDataBufferFactory`, is used on other platforms, such as
2632
Servlet 3.1+ servers.
2733

34+
35+
36+
2837
== The `DataBuffer` interface
2938

3039
The `DataBuffer` interface is similar to `ByteBuffer`, but offers a number of advantages.
@@ -35,7 +44,7 @@ writing, and a separate `flip()` operation to switch between the two I/O operat
3544
In general, the following invariant holds for the read position, write position, and the capacity:
3645

3746
--
38-
`0` <= _read position_ <= _write position_ <= _capacity_
47+
`0` <= _read position_ <= _write position_ <= _capacity_
3948
--
4049

4150
When reading bytes from the `DataBuffer`, the read position is automatically updated in accordance with
@@ -54,6 +63,8 @@ Netty platforms, such as Reactor Netty.
5463
The other implementation, the `DefaultDataBuffer`, is used on other platforms, such as Servlet 3.1+
5564
servers.
5665

66+
67+
5768
=== `PooledDataBuffer`
5869

5970
The `PooledDataBuffer` is an extension to `DataBuffer` that adds methods for reference counting.
@@ -67,6 +78,7 @@ buffers.
6778
These methods take a plain `DataBuffer` as parameter, but only call `retain` or `release` if the
6879
passed data buffer is an instance of `PooledDataBuffer`.
6980

81+
7082
[[databuffer-reference-counting]]
7183
==== Reference Counting
7284

@@ -95,23 +107,25 @@ throw exceptions:
95107
[source,java,indent=0]
96108
[subs="verbatim,quotes"]
97109
----
98-
DataBufferFactory factory = ...
99-
DataBuffer buffer = factory.allocateBuffer(); <1>
100-
boolean release = true; <2>
101-
try {
102-
writeDataToBuffer(buffer); <3>
103-
putBufferInHttpBody(buffer);
104-
release = false; <4>
105-
} finally {
106-
if (release) {
107-
DataBufferUtils.release(buffer); <5>
108-
}
109-
}
110-
111-
private void writeDataToBuffer(DataBuffer buffer) throws IOException { <3>
112-
...
113-
}
110+
DataBufferFactory factory = ...
111+
DataBuffer buffer = factory.allocateBuffer(); <1>
112+
boolean release = true; <2>
113+
try {
114+
writeDataToBuffer(buffer); <3>
115+
putBufferInHttpBody(buffer);
116+
release = false; <4>
117+
}
118+
finally {
119+
if (release) {
120+
DataBufferUtils.release(buffer); <5>
121+
}
122+
}
123+
124+
private void writeDataToBuffer(DataBuffer buffer) throws IOException { <3>
125+
...
126+
}
114127
----
128+
115129
<1> A new buffer is allocated.
116130
<2> A boolean flag indicates whether the allocated buffer should be released.
117131
<3> This example method loads data into the buffer. Note that the method can throw an `IOException`,
@@ -121,6 +135,8 @@ released as part of sending the HTTP body across the wire.
121135
<5> If an exception did occur, the flag is still set to `true`, and the buffer will be released
122136
here.
123137

138+
139+
124140
=== DataBufferUtils
125141

126142
`DataBufferUtils` contains various utility methods that operate on data buffers.
@@ -129,6 +145,9 @@ It contains methods for reading a `Flux` of `DataBuffer` objects from an `InputS
129145
`DataBufferUtils` also exposes `retain` and `release` methods that operate on plain `DataBuffer`
130146
instances (so that casting to a `PooledDataBuffer` is not required).
131147

148+
149+
150+
132151
[codecs]
133152
== Codecs
134153

src/docs/asciidoc/core/core-resources.adoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,8 @@ this:
444444
----
445445
com/
446446
foo/
447-
services.xml
448-
daos.xml
447+
services.xml
448+
daos.xml
449449
MessengerService.class
450450
----
451451

0 commit comments

Comments
 (0)