fix: use banners correctly

This commit is contained in:
Nanne Baars
2024-10-27 07:49:37 +01:00
parent cf5101a633
commit e5d5a370f9
6 changed files with 24 additions and 15 deletions

View File

@ -29,22 +29,30 @@ import lombok.extern.slf4j.Slf4j;
import org.owasp.webgoat.container.WebGoat;
import org.owasp.webgoat.webwolf.WebWolf;
import org.springframework.boot.Banner;
import org.springframework.boot.ResourceBanner;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ApplicationContext;
import org.springframework.core.io.ClassPathResource;
@Slf4j
public class StartWebGoat {
public static void main(String[] args) {
var parentBuilder =
new SpringApplicationBuilder()
.parent(ParentConfig.class)
.web(WebApplicationType.NONE)
.bannerMode(Banner.Mode.OFF);
parentBuilder.child(WebWolf.class).web(WebApplicationType.SERVLET).run(args);
new SpringApplicationBuilder().parent(ParentConfig.class).web(WebApplicationType.NONE);
parentBuilder
.child(WebWolf.class)
.banner(new ResourceBanner(new ClassPathResource("banner-webwolf.txt")))
.web(WebApplicationType.SERVLET)
.run(args);
ApplicationContext webGoatContext =
parentBuilder.child(WebGoat.class).web(WebApplicationType.SERVLET).run(args);
parentBuilder
.child(WebGoat.class)
.banner(new ResourceBanner(new ClassPathResource("banner-webgoat.txt")))
.web(WebApplicationType.SERVLET)
.run(args);
printStartUpMessage(webGoatContext);
}