This commit is contained in:
Anthony Stirling
2024-12-24 09:36:48 +00:00
parent a58b4d2286
commit bf9a00868d
7 changed files with 14 additions and 8 deletions

View File

@@ -10,6 +10,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -40,7 +41,7 @@ public class SPdfApplication {
private String baseUrl;
public SPdfApplication(
Environment env, ApplicationProperties applicationProperties, WebBrowser webBrowser) {
Environment env, ApplicationProperties applicationProperties, @Autowired(required = false) WebBrowser webBrowser) {
this.env = env;
this.applicationProperties = applicationProperties;
this.webBrowser = webBrowser;

View File

@@ -1,5 +1,6 @@
package stirling.software.SPDF.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
@@ -15,7 +16,7 @@ class AppUpdateService {
private final ShowAdminInterface showAdmin;
public AppUpdateService(
ApplicationProperties applicationProperties, ShowAdminInterface showAdmin) {
ApplicationProperties applicationProperties, @Autowired(required = false) ShowAdminInterface showAdmin) {
this.applicationProperties = applicationProperties;
this.showAdmin = showAdmin;
}

View File

@@ -7,6 +7,7 @@ import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
@@ -34,7 +35,7 @@ public class ApiDocService {
Map<String, List<String>> outputToFileTypes = new HashMap<>();
JsonNode apiDocsJsonRootNode;
public ApiDocService(ServletContext servletContext, UserServiceInterface userService) {
public ApiDocService(ServletContext servletContext, @Autowired(required = false) UserServiceInterface userService) {
this.servletContext = servletContext;
this.userService = userService;
}

View File

@@ -15,6 +15,7 @@ import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ByteArrayResource;
import org.springframework.core.io.Resource;
import org.springframework.http.*;
@@ -46,7 +47,7 @@ public class PipelineProcessor {
public PipelineProcessor(
ApiDocService apiDocService,
UserServiceInterface userService,
@Autowired(required = false) UserServiceInterface userService,
ServletContext servletContext) {
this.apiDocService = apiDocService;
this.userService = userService;

View File

@@ -10,6 +10,7 @@ import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
import org.springframework.core.io.support.ResourcePatternUtils;
@@ -36,7 +37,7 @@ public class GeneralWebController {
private static final String SIGNATURE_BASE_PATH = "customFiles/static/signatures/";
private static final String ALL_USERS_FOLDER = "ALL_USERS";
private final SignatureService signatureService;
private final UserServiceInterface userService;
private final @Autowired(required = false) UserServiceInterface userService;
private final ResourceLoader resourceLoader;
public GeneralWebController(

View File

@@ -2,6 +2,7 @@ package stirling.software.SPDF.controller.web;
import java.io.IOException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
@@ -19,7 +20,7 @@ public class SignatureController {
private final SignatureService signatureService;
private final UserServiceInterface userService;
private final @Autowired(required = false) UserServiceInterface userService;
public SignatureController(
SignatureService signatureService, UserServiceInterface userService) {

View File

@@ -15,6 +15,7 @@ import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.core.env.Environment;
import stirling.software.SPDF.UI.WebBrowser;
import stirling.software.SPDF.model.ApplicationProperties;
@ExtendWith(MockitoExtension.class)
@@ -25,13 +26,12 @@ public class SPdfApplicationTest {
@Mock
private ApplicationProperties applicationProperties;
@InjectMocks
private SPdfApplication sPdfApplication;
@BeforeEach
public void setUp() {
sPdfApplication = new SPdfApplication(env, applicationProperties, null);
sPdfApplication.setServerPortStatic("8080");
}