Skip to content

Commit

Permalink
feat(core): implement review comment
Browse files Browse the repository at this point in the history
  • Loading branch information
timonback committed Jan 7, 2024
1 parent 9a5172f commit feb7609
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,23 @@
@Slf4j
@RequiredArgsConstructor
public class DefaultAsyncApiDocketService implements AsyncApiDocketService {

/**
* Docket definition in application.properties
*/
private final SpringwolfConfigProperties configProperties;

/**
* valid Docket instance, either reference to customDocket (if set) or environment based Docket.
* Lazy initialized on first invocation of getAsyncApiDocket().
* lazily initialized AsyncApiDocket instance.
*/
@Nullable
private AsyncApiDocket docket;

@Override
public AsyncApiDocket getAsyncApiDocket() {
if (docket == null) {
createDocket();
docket = createDocket();
}
return docket;
}

private void createDocket() {
private AsyncApiDocket createDocket() {
log.debug("Reading springwolf configuration from application.properties files");

if (configProperties.getDocket() == null || configProperties.getDocket().getBasePackage() == null) {
Expand All @@ -56,7 +51,7 @@ private void createDocket() {
builder.defaultContentType(configProperties.getDocket().getDefaultContentType());
}

docket = builder.build();
return builder.build();
}

private static Info buildInfo(@Nullable SpringwolfConfigProperties.ConfigDocket.Info configDocketInfo) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
import java.util.Map;
import java.util.stream.Collectors;

/**
* Springwolf configuration loaded from Spring <code>application.properties</code> file.
*/
@ConfigurationProperties(prefix = SpringwolfConfigConstants.SPRINGWOLF_CONFIG_PREFIX)
@Getter
@Setter
Expand Down

0 comments on commit feb7609

Please sign in to comment.