Skip to content

Commit 8d7deb7

Browse files
committed
Polish "Expand documentation on remote devtools"
See spring-projectsgh-17780
1 parent ab33bc7 commit 8d7deb7

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

Diff for: spring-boot-project/spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc

+17-17
Original file line numberDiff line numberDiff line change
@@ -1143,15 +1143,14 @@ before starting the remote client, it is not pushed to the remote server.
11431143
==== Configuring File System Watcher
11441144
{sc-spring-boot-devtools}/filewatch/FileSystemWatcher.{sc-ext}[FileSystemWatcher] works
11451145
by polling the class changes with a certain time interval, and then waiting for a
1146-
predefined quiet period to make sure no more changes are coming from the compiler. The
1147-
changes are then being uploaded to the remote application. On a slower development
1148-
environment, it may happen that the quiet period is not enough, and the changes in the
1149-
classes appear to be split into two batches. The server is then restarted after the first
1150-
batch of class changes is uploaded, but the second batch can’t immediately be sent to the
1151-
application, since the server is restarting.
1146+
predefined quiet period to make sure there are no more changes. The changes are then
1147+
uploaded to the remote application. On a slower development environment, it may happen
1148+
that the quiet period is not enough, and the changes in the classes may be split into batches.
1149+
The server is restarted after the first batch of class changes is uploaded.
1150+
The next batch can’t be sent to the application, since the server is restarting.
11521151

11531152
This is typically manifested by a warning in the `RemoteSpringApplication` logs about
1154-
failing to upload some of the classes, and a consequent retry. But it may also lead to the
1153+
failing to upload some of the classes, and a consequent retry. But it may also lead to
11551154
application code inconsistency and failure to restart after the first batch of changes is
11561155
uploaded.
11571156

@@ -1165,12 +1164,12 @@ parameters to the values that fit your development environment:
11651164
spring.devtools.restart.quiet-period=1s
11661165
----
11671166

1168-
The monitored classpath folders are now being swept every 2 seconds, and a 1 second quiet
1169-
period is maintained to make sure no additional class changes are coming.
1167+
The monitored classpath folders are now polled every 2 seconds for changes, and a 1 second
1168+
quiet period is maintained to make sure there are no additional class changes.
11701169

11711170
[[security-configuration-for-devtools-remote]]
11721171
==== Security Configuration for Devtools Remote
1173-
If you use security configuration on the server, you may observe HTTP error 401 or 403 in
1172+
If you have Spring Security on the classpath, you may observe HTTP error 401 or 403 in
11741173
the logs of the `RemoteSpringApplication`:
11751174

11761175
[indent=0,subs="attributes"]
@@ -1179,9 +1178,8 @@ the logs of the `RemoteSpringApplication`:
11791178
----
11801179

11811180
The URL for class uploading should be exempted both from the web security and from the
1182-
csrf filter. Here’s an example `WebSecurityConfigurerAdapter` configuration that uses
1183-
HTTP Basic Auth to secure all URLs except the default one used by devtools for class
1184-
uploading:
1181+
csrf filter. The following example shows how anonymous access to the remote devtools endpoint
1182+
can be configured:
11851183

11861184
[source,java,indent=0]
11871185
----
@@ -1190,15 +1188,17 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
11901188
11911189
@Override
11921190
protected void configure(HttpSecurity http) throws Exception {
1193-
http.authorizeRequests().antMatchers("/.~~spring-boot!~/restart").anonymous()
1194-
.and().csrf().ignoringAntMatchers("/.~~spring-boot!~/restart")
1195-
.and().authorizeRequests().anyRequest().authenticated()
1196-
.and().httpBasic();
1191+
http.requestMatchers("/.~~spring-boot!~/restart").anyRequest().anonymous()
1192+
.and().csrf().disable();
11971193
}
11981194
11991195
}
12001196
----
12011197

1198+
NOTE: The above configuration will only affect the remote devtools endpoint. Spring Boot's default
1199+
security auto-configuration will still apply to the rest of the application. If the rest
1200+
of the application requires custom security, it needs to be configured separately.
1201+
12021202

12031203

12041204
[[using-boot-packaging-for-production]]

0 commit comments

Comments
 (0)