|
|
|
@ -31,6 +31,8 @@ import java.util.regex.Pattern; |
|
|
|
|
|
|
|
|
|
|
|
import org.jspecify.annotations.Nullable; |
|
|
|
import org.jspecify.annotations.Nullable; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.util.Assert; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Default implementation of {@link LaunchScript}. Provides the default Spring Boot launch |
|
|
|
* Default implementation of {@link LaunchScript}. Provides the default Spring Boot launch |
|
|
|
* script or can load a specific script File. Also support mustache style template |
|
|
|
* script or can load a specific script File. Also support mustache style template |
|
|
|
@ -63,7 +65,9 @@ public class DefaultLaunchScript implements LaunchScript { |
|
|
|
|
|
|
|
|
|
|
|
private String loadContent(@Nullable File file) throws IOException { |
|
|
|
private String loadContent(@Nullable File file) throws IOException { |
|
|
|
if (file == null) { |
|
|
|
if (file == null) { |
|
|
|
return loadContent(getClass().getResourceAsStream("launch.script")); |
|
|
|
InputStream stream = getClass().getResourceAsStream("launch.script"); |
|
|
|
|
|
|
|
Assert.state(stream != null, "Unable to load resource 'launch.script'"); |
|
|
|
|
|
|
|
return loadContent(stream); |
|
|
|
} |
|
|
|
} |
|
|
|
return loadContent(new FileInputStream(file)); |
|
|
|
return loadContent(new FileInputStream(file)); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -85,7 +89,7 @@ public class DefaultLaunchScript implements LaunchScript { |
|
|
|
outputStream.flush(); |
|
|
|
outputStream.flush(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private String expandPlaceholders(@Nullable String content, Map<?, ?> properties) throws IOException { |
|
|
|
private String expandPlaceholders(String content, @Nullable Map<?, ?> properties) throws IOException { |
|
|
|
StringBuilder expanded = new StringBuilder(); |
|
|
|
StringBuilder expanded = new StringBuilder(); |
|
|
|
Matcher matcher = PLACEHOLDER_PATTERN.matcher(content); |
|
|
|
Matcher matcher = PLACEHOLDER_PATTERN.matcher(content); |
|
|
|
while (matcher.find()) { |
|
|
|
while (matcher.find()) { |
|
|
|
|