Skip to content

Commit

Permalink
GH-1069 Ensure 'spring.main.banner-mode' is honored by ServerlessWebA…
Browse files Browse the repository at this point in the history
…pplication

Resolves #1069
  • Loading branch information
olegz committed Sep 25, 2023
1 parent 42336c8 commit 1b0a5e3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,13 @@ private SpringApplicationRunListeners getRunListeners(String[] args) {
private Banner printBanner(ConfigurableEnvironment environment) {
ResourceLoader resourceLoader = (this.getResourceLoader() != null) ? this.getResourceLoader()
: new DefaultResourceLoader(null);
Banner.Mode bannerMode = environment.containsProperty("spring.main.banner-mode")
? Banner.Mode.valueOf(environment.getProperty("spring.main.banner-mode").trim().toUpperCase())
: Banner.Mode.CONSOLE;

if (bannerMode == Banner.Mode.OFF) {
return null;
}
SpringApplicationBannerPrinter bannerPrinter = new SpringApplicationBannerPrinter(resourceLoader, new SpringAwsBanner());
return bannerPrinter.print(environment, this.getMainApplicationClass(), System.out);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class RequestResponseTests {

@BeforeEach
public void before() {
System.setProperty("spring.main.banner-mode", "off");
this.mvc = ProxyMvc.INSTANCE(ProxyErrorController.class, PetStoreSpringAppConfig.class);
}

Expand Down Expand Up @@ -136,6 +137,7 @@ public void validatePostWithBody() throws Exception {

@Test
public void validatePostAsyncWithBody() throws Exception {
// System.setProperty("spring.main.banner-mode", "off");
ProxyHttpServletRequest request = new ProxyHttpServletRequest(null, "POST", "/petsAsync/");
String jsonPet = "{\n"
+ " \"id\":\"1234\",\n"
Expand Down

0 comments on commit 1b0a5e3

Please sign in to comment.