You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As described earlier in the <<using#using.devtools.restart.restart-vs-reload>> section, restart functionality is implemented by using two classloaders.
232
-
If this causes issues, you might need to customize what gets loaded by which classloader.
232
+
If this causes issues, you can diagnose the problem by using the `spring.devtools.restart.enabled` system property, and if the app works with restart switched off, you might need to customize what gets loaded by which classloader.
233
233
234
234
By default, any open project in your IDE is loaded with the "`restart`" classloader, and any regular `.jar` file is loaded with the "`base`" classloader.
235
235
The same is true if you use `mvn spring-boot:run` or `gradle bootRun`: the project containing your `@SpringBootApplication` is loaded with the "`restart`" classloader, and everything else with the "`base`" classloader.
236
+
The classpath is printed on the console when you start the app, which can help to identify any problematic entries.
237
+
Classes used reflectively, especially annotations, can be loaded into the parent (fixed) classloader on startup before the application classes which uses them, and this might lead to them not being detected by Spring in the application.
236
238
237
239
You can instruct Spring Boot to load parts of your project with a different classloader by creating a `META-INF/spring-devtools.properties` file.
238
240
The `spring-devtools.properties` file can contain properties prefixed with `restart.exclude` and `restart.include`.
239
241
The `include` elements are items that should be pulled up into the "`restart`" classloader, and the `exclude` elements are items that should be pushed down into the "`base`" classloader.
240
-
The value of the property is a regex pattern that is applied to the classpath, as shown in the following example:
242
+
The value of the property is a regex pattern that is applied to the classpath passed to the JVM on startup.
243
+
Here is an example where some local class files are excluded and some extra libraries are included in the restart class loader:
0 commit comments