Skip to content

Commit

Permalink
[#10099] Remove WebApplicationType.SERVET from Batch module
Browse files Browse the repository at this point in the history
  • Loading branch information
emeroad committed Jun 29, 2023
1 parent a590c84 commit 2178e71
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.navercorp.pinpoint.batch;

import com.navercorp.pinpoint.common.server.starter.BasicStarter;
import org.springframework.boot.WebApplicationType;

public class BatchStarter extends BasicStarter {
public static final String EXTERNAL_PROPERTY_SOURCE_NAME = "BatchExternalEnvironment";
Expand All @@ -26,5 +27,6 @@ public BatchStarter(Class<?>... sources) {
super(sources);
this.externalPropertySourceName = EXTERNAL_PROPERTY_SOURCE_NAME;
this.externalConfigurationKey = EXTERNAL_CONFIGURATION_KEY;
setWebApplicationType(WebApplicationType.NONE);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
public class BasicStarter {
protected String externalPropertySourceName;
protected String externalConfigurationKey;
protected List<String> externalProfiles = new ArrayList<>();
private final List<String> externalProfiles = new ArrayList<>();

private WebApplicationType webApplicationType = WebApplicationType.SERVLET;

private final Class<?>[] sources;

Expand All @@ -45,11 +47,15 @@ public void addProfiles(String ...profiles) {
externalProfiles.addAll(List.of(profiles));
}

public void setWebApplicationType(WebApplicationType webApplicationType) {
this.webApplicationType = Objects.requireNonNull(webApplicationType, "webApplicationType");
}

public void start(String[] args) {
SpringApplicationBuilder builder = new SpringApplicationBuilder();

builder.sources(sources);
builder.web(WebApplicationType.SERVLET);
builder.web(webApplicationType);
builder.bannerMode(Banner.Mode.OFF);

builder.listeners(new AdditionalProfileListener(externalProfiles));
Expand Down

0 comments on commit 2178e71

Please sign in to comment.