diff --git a/solarnet/common/src/main/java/net/solarnetwork/central/web/PingController.java b/solarnet/common/src/main/java/net/solarnetwork/central/web/PingController.java index 54edeaa16..9f3e2ffa9 100644 --- a/solarnet/common/src/main/java/net/solarnetwork/central/web/PingController.java +++ b/solarnet/common/src/main/java/net/solarnetwork/central/web/PingController.java @@ -36,7 +36,6 @@ import java.util.concurrent.TimeoutException; import org.springframework.http.MediaType; import org.springframework.scheduling.concurrent.CustomizableThreadFactory; -import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @@ -54,14 +53,23 @@ * @author matt * @version 3.1 */ -@Controller -@RequestMapping("/ping") public class PingController { private static final ExecutorService EXECUTOR = Executors .newCachedThreadPool(new CustomizableThreadFactory("Ping-")); - private List tests = null; + private final List tests; + + /** + * Constructor. + * + * @param tests + * the tests + */ + public PingController(List tests) { + super(); + this.tests = tests; + } private PingResults executeTests() { final Instant now = Instant.now(); @@ -186,12 +194,13 @@ public boolean isAllGood() { } + /** + * Get the ping tests. + * + * @return the tests + */ public List getTests() { return tests; } - public void setTests(List tests) { - this.tests = tests; - } - } diff --git a/solarnet/oscp-fp/src/main/java/net/solarnetwork/central/oscp/fp/config/WebConfig.java b/solarnet/oscp-fp/src/main/java/net/solarnetwork/central/oscp/fp/config/WebConfig.java index 9232f6a83..bfb129c08 100644 --- a/solarnet/oscp-fp/src/main/java/net/solarnetwork/central/oscp/fp/config/WebConfig.java +++ b/solarnet/oscp-fp/src/main/java/net/solarnetwork/central/oscp/fp/config/WebConfig.java @@ -25,7 +25,6 @@ import static net.solarnetwork.central.oscp.web.OscpWebUtils.RESPONSE_SENT; import java.util.List; import java.util.concurrent.TimeUnit; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @@ -45,26 +44,20 @@ * Web layer configuration. * * @author matt - * @version 1.0 + * @version 1.1 */ @Configuration @Import({ WebServiceErrorAttributes.class }) public class WebConfig implements WebMvcConfigurer { - @Autowired(required = false) - private List pingTests; - - @Bean - public PingController pingController() { - PingController controller = new PingController(); - controller.setTests(pingTests); - return controller; - } - @Controller @RequestMapping("/ping") static class SolarOscpFpPingController extends PingController { - // nothing new + + public SolarOscpFpPingController(List tests) { + super(tests); + } + } @Override diff --git a/solarnet/oscp-sim-cp/src/main/java/net/solarnetwork/oscp/sim/cp/config/WebConfig.java b/solarnet/oscp-sim-cp/src/main/java/net/solarnetwork/oscp/sim/cp/config/WebConfig.java index e03e9994f..5d84a8f11 100644 --- a/solarnet/oscp-sim-cp/src/main/java/net/solarnetwork/oscp/sim/cp/config/WebConfig.java +++ b/solarnet/oscp-sim-cp/src/main/java/net/solarnetwork/oscp/sim/cp/config/WebConfig.java @@ -25,7 +25,6 @@ import static net.solarnetwork.central.oscp.web.OscpWebUtils.RESPONSE_SENT; import java.util.List; import java.util.concurrent.TimeUnit; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @@ -45,26 +44,20 @@ * Web layer configuration. * * @author matt - * @version 1.0 + * @version 1.1 */ @Configuration @Import({ WebServiceErrorAttributes.class, WebServiceGlobalControllerSupport.class }) public class WebConfig implements WebMvcConfigurer { - @Autowired(required = false) - private List pingTests; - - @Bean - public PingController pingController() { - PingController controller = new PingController(); - controller.setTests(pingTests); - return controller; - } - @Controller @RequestMapping("/ping") static class SolarOscpSimCpPingController extends PingController { - // nothing new + + public SolarOscpSimCpPingController(List tests) { + super(tests); + } + } @Override diff --git a/solarnet/solardnp3/src/main/java/net/solarnetwork/central/dnp3/app/config/WebConfig.java b/solarnet/solardnp3/src/main/java/net/solarnetwork/central/dnp3/app/config/WebConfig.java index 8585c8068..6b16d3c81 100644 --- a/solarnet/solardnp3/src/main/java/net/solarnetwork/central/dnp3/app/config/WebConfig.java +++ b/solarnet/solardnp3/src/main/java/net/solarnetwork/central/dnp3/app/config/WebConfig.java @@ -24,8 +24,6 @@ import java.util.List; import java.util.concurrent.TimeUnit; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.stereotype.Controller; @@ -41,26 +39,20 @@ * Web layer configuration. * * @author matt - * @version 1.0 + * @version 1.1 */ @Configuration @Import({ WebServiceErrorAttributes.class }) public class WebConfig implements WebMvcConfigurer { - @Autowired(required = false) - private List pingTests; - - @Bean - public PingController pingController() { - SolarDnp3PingController controller = new SolarDnp3PingController(); - controller.setTests(pingTests); - return controller; - } - @Controller @RequestMapping("/ping") static class SolarDnp3PingController extends PingController { - // nothing new + + public SolarDnp3PingController(List tests) { + super(tests); + } + } @Override diff --git a/solarnet/solarin/src/main/java/net/solarnetwork/central/in/config/WebConfig.java b/solarnet/solarin/src/main/java/net/solarnetwork/central/in/config/WebConfig.java index 4af1ff905..25bfed37e 100644 --- a/solarnet/solarin/src/main/java/net/solarnetwork/central/in/config/WebConfig.java +++ b/solarnet/solarin/src/main/java/net/solarnetwork/central/in/config/WebConfig.java @@ -28,12 +28,12 @@ import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.http.CacheControl; import org.springframework.http.MediaType; +import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; @@ -55,26 +55,21 @@ * Web layer configuration. * * @author matt - * @version 1.0 + * @version 1.1 */ @Configuration @Import({ WebServiceErrorAttributes.class, WebServiceControllerSupport.class, WebServiceGlobalControllerSupport.class }) public class WebConfig implements WebMvcConfigurer { - @Autowired(required = false) - private List pingTests; - - @Bean - public PingController pingController() { - SolarInPingController controller = new SolarInPingController(); - controller.setTests(pingTests); - return controller; - } - + @Controller @RequestMapping("/solarin/ping") static class SolarInPingController extends PingController { - // nothing new + + public SolarInPingController(List tests) { + super(tests); + } + } @SuppressWarnings("deprecation") diff --git a/solarnet/solarjobs/src/main/java/net/solarnetwork/central/jobs/config/WebConfig.java b/solarnet/solarjobs/src/main/java/net/solarnetwork/central/jobs/config/WebConfig.java index e2d51484e..d3b0e0004 100644 --- a/solarnet/solarjobs/src/main/java/net/solarnetwork/central/jobs/config/WebConfig.java +++ b/solarnet/solarjobs/src/main/java/net/solarnetwork/central/jobs/config/WebConfig.java @@ -23,10 +23,10 @@ package net.solarnetwork.central.jobs.config; import java.util.List; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import net.solarnetwork.central.web.PingController; import net.solarnetwork.central.web.support.WebServiceControllerSupport; @@ -38,21 +38,21 @@ * Web layer configuration. * * @author matt - * @version 1.0 + * @version 1.1 */ @Configuration @Import({ WebServiceErrorAttributes.class, WebServiceControllerSupport.class, WebServiceGlobalControllerSupport.class }) public class WebConfig implements WebMvcConfigurer { - @Autowired(required = false) - private List pingTests; + @Controller + @RequestMapping("/ping") + static class SolarJobsPingController extends PingController { + + public SolarJobsPingController(List tests) { + super(tests); + } - @Bean - public PingController pingController() { - PingController controller = new PingController(); - controller.setTests(pingTests); - return controller; } } diff --git a/solarnet/solarocpp/src/main/java/net/solarnetwork/central/in/ocpp/config/WebConfig.java b/solarnet/solarocpp/src/main/java/net/solarnetwork/central/in/ocpp/config/WebConfig.java index 5a72dae4d..e1865600d 100644 --- a/solarnet/solarocpp/src/main/java/net/solarnetwork/central/in/ocpp/config/WebConfig.java +++ b/solarnet/solarocpp/src/main/java/net/solarnetwork/central/in/ocpp/config/WebConfig.java @@ -28,12 +28,12 @@ import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.http.CacheControl; import org.springframework.http.MediaType; +import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; @@ -55,26 +55,21 @@ * Web layer configuration. * * @author matt - * @version 1.0 + * @version 1.1 */ @Configuration @Import({ WebServiceErrorAttributes.class, WebServiceControllerSupport.class, WebServiceGlobalControllerSupport.class }) public class WebConfig implements WebMvcConfigurer { - @Autowired(required = false) - private List pingTests; - - @Bean - public PingController pingController() { - SolarOcppPingController controller = new SolarOcppPingController(); - controller.setTests(pingTests); - return controller; - } - + @Controller @RequestMapping("/solarocpp/ping") static class SolarOcppPingController extends PingController { - // nothing new + + public SolarOcppPingController(List tests) { + super(tests); + } + } @SuppressWarnings("deprecation") diff --git a/solarnet/solarquery/src/main/java/net/solarnetwork/central/query/config/WebConfig.java b/solarnet/solarquery/src/main/java/net/solarnetwork/central/query/config/WebConfig.java index 5b4fd68a8..85d43b33f 100644 --- a/solarnet/solarquery/src/main/java/net/solarnetwork/central/query/config/WebConfig.java +++ b/solarnet/solarquery/src/main/java/net/solarnetwork/central/query/config/WebConfig.java @@ -45,8 +45,10 @@ import org.springframework.format.datetime.standard.TemporalAccessorParser; import org.springframework.format.datetime.standard.TemporalAccessorPrinter; import org.springframework.http.converter.HttpMessageConverter; +import org.springframework.stereotype.Controller; import org.springframework.util.AntPathMatcher; import org.springframework.util.PathMatcher; +import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @@ -72,7 +74,7 @@ * Web layer configuration. * * @author matt - * @version 1.0 + * @version 1.1 */ @Configuration @Import({ WebServiceErrorAttributes.class, WebServiceControllerSupport.class, @@ -82,9 +84,6 @@ public class WebConfig implements WebMvcConfigurer { /** A qualifier for the source ID path matcher. */ public static final String SOURCE_ID_PATH_MATCHER = "source-id"; - @Autowired(required = false) - private List pingTests; - @Autowired(required = false) @Qualifier(QUERY_CACHE) private ContentCachingService contentCachingService; @@ -98,11 +97,14 @@ public PathMatcher sourceIdPathMatcher() { return matcher; } - @Bean - public PingController pingController() { - PingController controller = new PingController(); - controller.setTests(pingTests); - return controller; + @Controller + @RequestMapping("/ping") + static class SolarQueryPingController extends PingController { + + public SolarQueryPingController(List tests) { + super(tests); + } + } @Override diff --git a/solarnet/solaruser/src/main/java/net/solarnetwork/central/reg/config/WebConfig.java b/solarnet/solaruser/src/main/java/net/solarnetwork/central/reg/config/WebConfig.java index e10f1c457..1c4a932a3 100644 --- a/solarnet/solaruser/src/main/java/net/solarnetwork/central/reg/config/WebConfig.java +++ b/solarnet/solaruser/src/main/java/net/solarnetwork/central/reg/config/WebConfig.java @@ -40,6 +40,8 @@ import org.springframework.format.datetime.standard.TemporalAccessorParser; import org.springframework.format.datetime.standard.TemporalAccessorPrinter; import org.springframework.http.converter.HttpMessageConverter; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer; import org.springframework.web.servlet.config.annotation.CorsRegistry; @@ -65,16 +67,13 @@ * Web layer configuration. * * @author matt - * @version 1.2 + * @version 1.3 */ @Configuration @Import({ WebServiceErrorAttributes.class, WebServiceControllerSupport.class, WebServiceGlobalControllerSupport.class }) public class WebConfig implements WebMvcConfigurer { - @Autowired(required = false) - private List pingTests; - @Autowired private AsyncTaskExecutor taskExecutor; @@ -83,11 +82,14 @@ public void configureAsyncSupport(AsyncSupportConfigurer configurer) { configurer.setTaskExecutor(taskExecutor); } - @Bean - public PingController pingController() { - PingController controller = new PingController(); - controller.setTests(pingTests); - return controller; + @Controller + @RequestMapping("/ping") + static class SolarUserPingController extends PingController { + + public SolarUserPingController(List tests) { + super(tests); + } + } @Override