Skip to content

Commit 4724560

Browse files
committed
Document how to disable the formatter for a block
Closes gh-75
1 parent 13cbfbe commit 4724560

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

README.adoc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,21 @@ Spring Framework manually formats code, where as Spring Boot uses automatic form
199199
Formatting and Checkstyle alone are not enough to produce truly consistent code.
200200
Here are some tips that we've found useful when developing Spring Boot.
201201

202+
==== Disabling formatting for blocks of code
203+
Some code isn't particularly amenable to automatic formatting.
204+
For example, Spring Security configurations often work better when manually formatted.
205+
206+
If you need to disable formatting for a specific block of code you can enclose it in a `@formatter:off` / `@formatter:on` set:
207+
208+
[source,java]
209+
----
210+
// @formatter:off
211+
212+
... code not be formatted
213+
214+
// @formatter:on
215+
----
216+
202217
==== Wrapping
203218
The source formatter intentionally uses a low character count of 90 chars for wrapping.
204219
If you're used to longer lines, this can take some getting used to.

0 commit comments

Comments
 (0)