From a19a28062f4229acdf38ee97a8299f303ca1036d Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Fri, 30 Dec 2016 17:43:34 +0100 Subject: [PATCH] Fix actuator security in samples Closes gh-7637 --- .../src/main/resources/application.properties | 2 ++ .../spring-boot-sample-data-couchbase/pom.xml | 15 ++------ .../src/main/resources/application.properties | 2 ++ .../src/main/resources/application.properties | 4 ++- .../SampleHypermediaGsonApplicationTests.java | 3 +- .../SampleHypermediaJpaApplicationTests.java | 35 ------------------- .../src/main/resources/application.properties | 2 ++ .../src/main/resources/application.properties | 2 ++ .../spring-boot-sample-integration/pom.xml | 4 --- .../spring-boot-sample-jersey/pom.xml | 5 +-- .../src/main/resources/application.properties | 2 ++ ...Service.java => HelloWorldProperties.java} | 0 .../src/main/resources/application.properties | 4 ++- ...Service.java => HelloWorldProperties.java} | 0 .../src/main/resources/application.properties | 6 ++-- ...Service.java => HelloWorldProperties.java} | 0 .../src/main/resources/application.properties | 14 ++++---- .../spring-boot-sample-web-static/pom.xml | 4 --- .../pom.xml | 4 --- .../pom.xml | 4 --- .../pom.xml | 4 --- .../pom.xml | 4 --- 22 files changed, 32 insertions(+), 88 deletions(-) delete mode 100644 spring-boot-samples/spring-boot-sample-hypermedia-jpa/src/test/java/sample/hypermedia/jpa/SampleHypermediaJpaApplicationTests.java rename spring-boot-samples/spring-boot-sample-metrics-dropwizard/src/main/java/sample/metrics/dropwizard/{HelloWorldService.java => HelloWorldProperties.java} (100%) rename spring-boot-samples/spring-boot-sample-metrics-opentsdb/src/main/java/sample/metrics/opentsdb/{HelloWorldService.java => HelloWorldProperties.java} (100%) rename spring-boot-samples/spring-boot-sample-metrics-redis/src/main/java/sample/metrics/redis/{HelloWorldService.java => HelloWorldProperties.java} (100%) diff --git a/spring-boot-samples/spring-boot-sample-cache/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-cache/src/main/resources/application.properties index d913ffc2cc8..d4bfa887c96 100644 --- a/spring-boot-samples/spring-boot-sample-cache/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-cache/src/main/resources/application.properties @@ -1,3 +1,5 @@ +management.security.enabled=false + # # Infinispan configuration file location. # diff --git a/spring-boot-samples/spring-boot-sample-data-couchbase/pom.xml b/spring-boot-samples/spring-boot-sample-data-couchbase/pom.xml index b4b26133320..3073fa42056 100644 --- a/spring-boot-samples/spring-boot-sample-data-couchbase/pom.xml +++ b/spring-boot-samples/spring-boot-sample-data-couchbase/pom.xml @@ -18,23 +18,12 @@ ${basedir}/../.. - - org.springframework.boot - spring-boot-starter - org.springframework.boot spring-boot-starter-data-couchbase - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-actuator - - + + org.springframework.boot spring-boot-starter-test test diff --git a/spring-boot-samples/spring-boot-sample-flyway/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-flyway/src/main/resources/application.properties index d18bea2e53b..4c1570d1bee 100644 --- a/spring-boot-samples/spring-boot-sample-flyway/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-flyway/src/main/resources/application.properties @@ -1,3 +1,5 @@ +management.security.enabled=false + spring.jpa.hibernate.ddl-auto=validate spring.h2.console.enabled=true \ No newline at end of file diff --git a/spring-boot-samples/spring-boot-sample-hypermedia-gson/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-hypermedia-gson/src/main/resources/application.properties index 0ed692da147..c869a4aa589 100644 --- a/spring-boot-samples/spring-boot-sample-hypermedia-gson/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-hypermedia-gson/src/main/resources/application.properties @@ -1,2 +1,4 @@ # management.context-path=/admin -spring.http.converters.preferred-json-mapper: gson \ No newline at end of file +management.security.enabled=false + +spring.http.converters.preferred-json-mapper=gson \ No newline at end of file diff --git a/spring-boot-samples/spring-boot-sample-hypermedia-gson/src/test/java/sample/hypermedia/gson/SampleHypermediaGsonApplicationTests.java b/spring-boot-samples/spring-boot-sample-hypermedia-gson/src/test/java/sample/hypermedia/gson/SampleHypermediaGsonApplicationTests.java index 515d8886925..ef4702e13b9 100644 --- a/spring-boot-samples/spring-boot-sample-hypermedia-gson/src/test/java/sample/hypermedia/gson/SampleHypermediaGsonApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-hypermedia-gson/src/test/java/sample/hypermedia/gson/SampleHypermediaGsonApplicationTests.java @@ -35,8 +35,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @RunWith(SpringRunner.class) @SpringBootTest -@TestPropertySource(properties = { "endpoints.hypermedia.enabled: true", - "management.security.enabled: false" }) +@TestPropertySource(properties = "endpoints.hypermedia.enabled: true") public class SampleHypermediaGsonApplicationTests { @Autowired diff --git a/spring-boot-samples/spring-boot-sample-hypermedia-jpa/src/test/java/sample/hypermedia/jpa/SampleHypermediaJpaApplicationTests.java b/spring-boot-samples/spring-boot-sample-hypermedia-jpa/src/test/java/sample/hypermedia/jpa/SampleHypermediaJpaApplicationTests.java deleted file mode 100644 index cf414c85198..00000000000 --- a/spring-boot-samples/spring-boot-sample-hypermedia-jpa/src/test/java/sample/hypermedia/jpa/SampleHypermediaJpaApplicationTests.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2012-2016 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package sample.hypermedia.jpa; - -import org.junit.Test; -import org.junit.runner.RunWith; - -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.context.web.WebAppConfiguration; - -@RunWith(SpringRunner.class) -@SpringBootTest -@WebAppConfiguration -public class SampleHypermediaJpaApplicationTests { - - @Test - public void contextLoads() { - } - -} diff --git a/spring-boot-samples/spring-boot-sample-hypermedia-ui/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-hypermedia-ui/src/main/resources/application.properties index 8ccf953870d..6f334e794ae 100644 --- a/spring-boot-samples/spring-boot-sample-hypermedia-ui/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-hypermedia-ui/src/main/resources/application.properties @@ -1 +1,3 @@ +management.security.enabled=false + management.context-path=/admin \ No newline at end of file diff --git a/spring-boot-samples/spring-boot-sample-hypermedia/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-hypermedia/src/main/resources/application.properties index a9198b28f12..0bb2948d11e 100644 --- a/spring-boot-samples/spring-boot-sample-hypermedia/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-hypermedia/src/main/resources/application.properties @@ -1,2 +1,4 @@ # management.context-path=/admin +management.security.enabled=false + endpoints.docs.curies.enabled=true \ No newline at end of file diff --git a/spring-boot-samples/spring-boot-sample-integration/pom.xml b/spring-boot-samples/spring-boot-sample-integration/pom.xml index 6be63934d3a..e27be19beb6 100644 --- a/spring-boot-samples/spring-boot-sample-integration/pom.xml +++ b/spring-boot-samples/spring-boot-sample-integration/pom.xml @@ -23,10 +23,6 @@ org.springframework.boot spring-boot-starter-integration - - org.springframework.boot - spring-boot-starter-actuator - org.springframework.integration spring-integration-file diff --git a/spring-boot-samples/spring-boot-sample-jersey/pom.xml b/spring-boot-samples/spring-boot-sample-jersey/pom.xml index 1bb84fdd87f..63ba43078ce 100644 --- a/spring-boot-samples/spring-boot-sample-jersey/pom.xml +++ b/spring-boot-samples/spring-boot-sample-jersey/pom.xml @@ -29,10 +29,7 @@ spring-boot-starter-tomcat provided - - org.springframework.boot - spring-boot-starter-actuator - + org.springframework.boot spring-boot-starter-test diff --git a/spring-boot-samples/spring-boot-sample-liquibase/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-liquibase/src/main/resources/application.properties index 288b7e85ad7..42f0f812295 100644 --- a/spring-boot-samples/spring-boot-sample-liquibase/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-liquibase/src/main/resources/application.properties @@ -1,3 +1,5 @@ +management.security.enabled=false + spring.jpa.hibernate.ddl-auto=none spring.h2.console.enabled=true diff --git a/spring-boot-samples/spring-boot-sample-metrics-dropwizard/src/main/java/sample/metrics/dropwizard/HelloWorldService.java b/spring-boot-samples/spring-boot-sample-metrics-dropwizard/src/main/java/sample/metrics/dropwizard/HelloWorldProperties.java similarity index 100% rename from spring-boot-samples/spring-boot-sample-metrics-dropwizard/src/main/java/sample/metrics/dropwizard/HelloWorldService.java rename to spring-boot-samples/spring-boot-sample-metrics-dropwizard/src/main/java/sample/metrics/dropwizard/HelloWorldProperties.java diff --git a/spring-boot-samples/spring-boot-sample-metrics-dropwizard/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-metrics-dropwizard/src/main/resources/application.properties index 41071924755..119a68aa433 100644 --- a/spring-boot-samples/spring-boot-sample-metrics-dropwizard/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-metrics-dropwizard/src/main/resources/application.properties @@ -1 +1,3 @@ -service.name: Phil +management.security.enabled=false + +service.name=Phil diff --git a/spring-boot-samples/spring-boot-sample-metrics-opentsdb/src/main/java/sample/metrics/opentsdb/HelloWorldService.java b/spring-boot-samples/spring-boot-sample-metrics-opentsdb/src/main/java/sample/metrics/opentsdb/HelloWorldProperties.java similarity index 100% rename from spring-boot-samples/spring-boot-sample-metrics-opentsdb/src/main/java/sample/metrics/opentsdb/HelloWorldService.java rename to spring-boot-samples/spring-boot-sample-metrics-opentsdb/src/main/java/sample/metrics/opentsdb/HelloWorldProperties.java diff --git a/spring-boot-samples/spring-boot-sample-metrics-opentsdb/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-metrics-opentsdb/src/main/resources/application.properties index 22fc8604904..e092b8e642f 100644 --- a/spring-boot-samples/spring-boot-sample-metrics-opentsdb/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-metrics-opentsdb/src/main/resources/application.properties @@ -1,2 +1,4 @@ -service.name: Phil -metrics.names.tags.process: ${spring.application.name:application}:${random.value:0000} \ No newline at end of file +management.security.enabled=false + +service.name=Phil +metrics.names.tags.process=${spring.application.name:application}:${random.value:0000} \ No newline at end of file diff --git a/spring-boot-samples/spring-boot-sample-metrics-redis/src/main/java/sample/metrics/redis/HelloWorldService.java b/spring-boot-samples/spring-boot-sample-metrics-redis/src/main/java/sample/metrics/redis/HelloWorldProperties.java similarity index 100% rename from spring-boot-samples/spring-boot-sample-metrics-redis/src/main/java/sample/metrics/redis/HelloWorldService.java rename to spring-boot-samples/spring-boot-sample-metrics-redis/src/main/java/sample/metrics/redis/HelloWorldProperties.java diff --git a/spring-boot-samples/spring-boot-sample-metrics-redis/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-metrics-redis/src/main/resources/application.properties index 78f2c31ab4f..0cf56ec17f8 100644 --- a/spring-boot-samples/spring-boot-sample-metrics-redis/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-metrics-redis/src/main/resources/application.properties @@ -1,7 +1,9 @@ -service.name: Phil -spring.metrics.export.redis.prefix: metrics.sample.${spring.metrics.export.aggregate.prefix} -spring.metrics.export.redis.key: keys.metrics.sample -spring.metrics.export.aggregate.prefix: ${random.value:0000}.${spring.application.name:application} -spring.metrics.export.aggregate.key-pattern: d -spring.jmx.default-domain: org.springframework.boot +management.security.enabled=false + +service.name=Phil +spring.metrics.export.redis.prefix=metrics.sample.${spring.metrics.export.aggregate.prefix} +spring.metrics.export.redis.key=keys.metrics.sample +spring.metrics.export.aggregate.prefix=${random.value:0000}.${spring.application.name:application} +spring.metrics.export.aggregate.key-pattern=d +spring.jmx.default-domain=org.springframework.boot spring.data.redis.repositories.enabled=false \ No newline at end of file diff --git a/spring-boot-samples/spring-boot-sample-web-static/pom.xml b/spring-boot-samples/spring-boot-sample-web-static/pom.xml index 468f2b03eeb..b884ae1f915 100644 --- a/spring-boot-samples/spring-boot-sample-web-static/pom.xml +++ b/spring-boot-samples/spring-boot-sample-web-static/pom.xml @@ -24,10 +24,6 @@ org.springframework.boot spring-boot-starter-web - - org.springframework.boot - spring-boot-starter-actuator - org.springframework.boot spring-boot-starter-tomcat diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty/pom.xml b/spring-boot-samples/spring-boot-sample-websocket-jetty/pom.xml index 74651a247cf..3036f591bf1 100755 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty/pom.xml +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty/pom.xml @@ -33,10 +33,6 @@ org.springframework.boot spring-boot-starter-jetty - - org.springframework.boot - spring-boot-starter-actuator - org.springframework.boot spring-boot-starter-test diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty93/pom.xml b/spring-boot-samples/spring-boot-sample-websocket-jetty93/pom.xml index 9489b1328eb..b23e1483afc 100755 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty93/pom.xml +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty93/pom.xml @@ -35,10 +35,6 @@ org.springframework.boot spring-boot-starter-jetty - - org.springframework.boot - spring-boot-starter-actuator - org.springframework.boot spring-boot-starter-test diff --git a/spring-boot-samples/spring-boot-sample-websocket-tomcat/pom.xml b/spring-boot-samples/spring-boot-sample-websocket-tomcat/pom.xml index c061e77228d..f96d01ffe58 100755 --- a/spring-boot-samples/spring-boot-sample-websocket-tomcat/pom.xml +++ b/spring-boot-samples/spring-boot-sample-websocket-tomcat/pom.xml @@ -23,10 +23,6 @@ org.springframework.boot spring-boot-starter-websocket - - org.springframework.boot - spring-boot-starter-actuator - org.springframework.boot spring-boot-starter-test diff --git a/spring-boot-samples/spring-boot-sample-websocket-undertow/pom.xml b/spring-boot-samples/spring-boot-sample-websocket-undertow/pom.xml index 5332d4c9cde..1664af9da4e 100755 --- a/spring-boot-samples/spring-boot-sample-websocket-undertow/pom.xml +++ b/spring-boot-samples/spring-boot-sample-websocket-undertow/pom.xml @@ -33,10 +33,6 @@ org.springframework.boot spring-boot-starter-undertow - - org.springframework.boot - spring-boot-starter-actuator - org.springframework.boot spring-boot-starter-test