Skip to content

Commit

Permalink
Merge pull request #610 from Frooodle/fix
Browse files Browse the repository at this point in the history
required false
  • Loading branch information
Frooodle committed Dec 30, 2023
2 parents bb1d41d + b32c28e commit 63eacf4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
}

group = 'stirling.software'
version = '0.18.0'
version = '0.18.1'
sourceCompatibility = '17'

repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
Expand All @@ -20,12 +21,14 @@
import stirling.software.SPDF.SPdfApplication;
import stirling.software.SPDF.model.ApiEndpoint;
import stirling.software.SPDF.model.Role;

import org.slf4j.Logger;
@Service
public class ApiDocService {

private final Map<String, ApiEndpoint> apiDocumentation = new HashMap<>();

private static final Logger logger = LoggerFactory.getLogger(ApiDocService.class);

@Autowired
private ServletContext servletContext;

Expand All @@ -51,6 +54,7 @@ private String getApiKeyForUser() {

//@EventListener(ApplicationReadyEvent.class)
private synchronized void loadApiDocumentation() {
String apiDocsJson = "";
try {
HttpHeaders headers = new HttpHeaders();
String apiKey = getApiKeyForUser();
Expand All @@ -61,7 +65,7 @@ private synchronized void loadApiDocumentation() {

RestTemplate restTemplate = new RestTemplate();
ResponseEntity<String> response = restTemplate.exchange(getApiDocsUrl(), HttpMethod.GET, entity, String.class);
String apiDocsJson = response.getBody();
apiDocsJson = response.getBody();

ObjectMapper mapper = new ObjectMapper();
apiDocsJsonRootNode = mapper.readTree(apiDocsJson);
Expand All @@ -78,7 +82,7 @@ private synchronized void loadApiDocumentation() {
});
} catch (Exception e) {
// Handle exceptions
e.printStackTrace();
logger.error("Error grabbing swagger doc, body result {}", apiDocsJson);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class PipelineProcessor {
@Autowired
private ApiDocService apiDocService;

@Autowired
@Autowired(required=false)
private UserServiceInterface userService;

@Autowired
Expand Down

0 comments on commit 63eacf4

Please sign in to comment.