Skip to content

Commit

Permalink
Skip ModuleFinder#ofSystem usage on native
Browse files Browse the repository at this point in the history
spring-projectsgh-28506 introduces a big footprint regression on
native, so it should for now be skipped when
compiling to native images. Such support could
potentially be re-introduced via spring-projectsgh-29081.

Closes spring-projectsgh-29183
  • Loading branch information
sdeleuze committed Sep 21, 2022
1 parent 39208ea commit 23a58e6
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import org.springframework.core.NativeDetector;
import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;
Expand Down Expand Up @@ -191,6 +192,7 @@
* @author Costin Leau
* @author Phillip Webb
* @author Sam Brannen
* @author Sebastien Deleuze
* @since 1.0.2
* @see #CLASSPATH_ALL_URL_PREFIX
* @see org.springframework.util.AntPathMatcher
Expand All @@ -206,8 +208,10 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
* @since 6.0
* @see #isNotSystemModule
*/
private static final Set<String> systemModuleNames = ModuleFinder.ofSystem().findAll().stream()
.map(moduleReference -> moduleReference.descriptor().name()).collect(Collectors.toSet());
private static final Set<String> systemModuleNames = NativeDetector.inNativeImage() ? Collections.emptySet() :
ModuleFinder.ofSystem().findAll().stream()
.map(moduleReference -> moduleReference.descriptor().name())
.collect(Collectors.toSet());

/**
* {@link Predicate} that tests whether the supplied {@link ResolvedModule}
Expand Down

0 comments on commit 23a58e6

Please sign in to comment.