Browse Source

Merge branch '1.5.x'

pull/8089/merge
Andy Wilkinson 9 years ago
parent
commit
4993f32da8
  1. 7
      spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementServerProperties.java
  2. 16
      spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/AbstractEndpoint.java
  3. 16
      spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/AbstractMvcEndpoint.java
  4. 12
      spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/h2/H2ConsoleProperties.java
  5. 8
      spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseProperties.java
  6. 7
      spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java
  7. 12
      spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/webservices/WebServicesProperties.java

7
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementServerProperties.java

@ -20,7 +20,6 @@ import java.net.InetAddress; @@ -20,7 +20,6 @@ import java.net.InetAddress;
import java.util.Arrays;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.servlet.http.HttpSession;
import org.springframework.boot.autoconfigure.security.SecurityPrerequisite;
@ -88,11 +87,6 @@ public class ManagementServerProperties implements SecurityPrerequisite { @@ -88,11 +87,6 @@ public class ManagementServerProperties implements SecurityPrerequisite {
private final Security security = new Security();
@PostConstruct
private void validate() {
Assert.notNull(this.contextPath, "ContextPath must not be null");
}
/**
* Returns the management port or {@code null} if the
* {@link ServerProperties#getPort() server port} should be used.
@ -138,6 +132,7 @@ public class ManagementServerProperties implements SecurityPrerequisite { @@ -138,6 +132,7 @@ public class ManagementServerProperties implements SecurityPrerequisite {
}
public void setContextPath(String contextPath) {
Assert.notNull(contextPath, "ContextPath must not be null");
this.contextPath = cleanContextPath(contextPath);
}

16
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/AbstractEndpoint.java

@ -18,8 +18,6 @@ package org.springframework.boot.actuate.endpoint; @@ -18,8 +18,6 @@ package org.springframework.boot.actuate.endpoint;
import java.util.regex.Pattern;
import javax.annotation.PostConstruct;
import org.springframework.context.EnvironmentAware;
import org.springframework.core.env.Environment;
import org.springframework.util.Assert;
@ -55,13 +53,6 @@ public abstract class AbstractEndpoint<T> implements Endpoint<T>, EnvironmentAwa @@ -55,13 +53,6 @@ public abstract class AbstractEndpoint<T> implements Endpoint<T>, EnvironmentAwa
*/
private Boolean enabled;
@PostConstruct
private void validate() {
Assert.notNull(this.id, "Id must not be null");
Assert.isTrue(ID_PATTERN.matcher(this.id).matches(),
"ID must only contains letters, numbers and '_'");
}
/**
* Create a new sensitive endpoint instance. The endpoint will enabled flag will be
* based on the spring {@link Environment} unless explicitly set.
@ -78,7 +69,7 @@ public abstract class AbstractEndpoint<T> implements Endpoint<T>, EnvironmentAwa @@ -78,7 +69,7 @@ public abstract class AbstractEndpoint<T> implements Endpoint<T>, EnvironmentAwa
* @param sensitive if the endpoint is sensitive by default
*/
public AbstractEndpoint(String id, boolean sensitive) {
this.id = id;
setId(id);
this.sensitiveDefault = sensitive;
}
@ -89,7 +80,7 @@ public abstract class AbstractEndpoint<T> implements Endpoint<T>, EnvironmentAwa @@ -89,7 +80,7 @@ public abstract class AbstractEndpoint<T> implements Endpoint<T>, EnvironmentAwa
* @param enabled if the endpoint is enabled or not.
*/
public AbstractEndpoint(String id, boolean sensitive, boolean enabled) {
this.id = id;
setId(id);
this.sensitiveDefault = sensitive;
this.enabled = enabled;
}
@ -109,6 +100,9 @@ public abstract class AbstractEndpoint<T> implements Endpoint<T>, EnvironmentAwa @@ -109,6 +100,9 @@ public abstract class AbstractEndpoint<T> implements Endpoint<T>, EnvironmentAwa
}
public void setId(String id) {
Assert.notNull(id, "Id must not be null");
Assert.isTrue(ID_PATTERN.matcher(id).matches(),
"Id must only contains letters, numbers and '_'");
this.id = id;
}

16
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/AbstractMvcEndpoint.java

@ -16,8 +16,6 @@ @@ -16,8 +16,6 @@
package org.springframework.boot.actuate.endpoint.mvc;
import javax.annotation.PostConstruct;
import org.springframework.boot.actuate.endpoint.Endpoint;
import org.springframework.boot.actuate.endpoint.EndpointProperties;
import org.springframework.context.EnvironmentAware;
@ -56,23 +54,16 @@ public abstract class AbstractMvcEndpoint extends WebMvcConfigurerAdapter @@ -56,23 +54,16 @@ public abstract class AbstractMvcEndpoint extends WebMvcConfigurerAdapter
private final boolean sensitiveDefault;
public AbstractMvcEndpoint(String path, boolean sensitive) {
this.path = path;
setPath(path);
this.sensitiveDefault = sensitive;
}
public AbstractMvcEndpoint(String path, boolean sensitive, boolean enabled) {
this.path = path;
setPath(path);
this.sensitiveDefault = sensitive;
this.enabled = enabled;
}
@PostConstruct
private void validate() {
Assert.notNull(this.path, "Path must not be null");
Assert.isTrue(this.path.isEmpty() || this.path.startsWith("/"),
"Path must start with / or be empty");
}
@Override
public void setEnvironment(Environment environment) {
this.environment = environment;
@ -88,6 +79,9 @@ public abstract class AbstractMvcEndpoint extends WebMvcConfigurerAdapter @@ -88,6 +79,9 @@ public abstract class AbstractMvcEndpoint extends WebMvcConfigurerAdapter
}
public void setPath(String path) {
Assert.notNull(path, "Path must not be null");
Assert.isTrue(path.isEmpty() || path.startsWith("/"),
"Path must start with / or be empty");
this.path = path;
}

12
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/h2/H2ConsoleProperties.java

@ -16,8 +16,6 @@ @@ -16,8 +16,6 @@
package org.springframework.boot.autoconfigure.h2;
import javax.annotation.PostConstruct;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.util.Assert;
@ -44,18 +42,14 @@ public class H2ConsoleProperties { @@ -44,18 +42,14 @@ public class H2ConsoleProperties {
private final Settings settings = new Settings();
@PostConstruct
private void validate() {
Assert.notNull(this.path, "Path must not be null");
Assert.isTrue(this.path.isEmpty() || this.path.startsWith("/"),
"Path must start with / or be empty");
}
public String getPath() {
return this.path;
}
public void setPath(String path) {
Assert.notNull(path, "Path must not be null");
Assert.isTrue(path.isEmpty() || path.startsWith("/"),
"Path must start with / or be empty");
this.path = path;
}

8
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseProperties.java

@ -19,8 +19,6 @@ package org.springframework.boot.autoconfigure.liquibase; @@ -19,8 +19,6 @@ package org.springframework.boot.autoconfigure.liquibase;
import java.io.File;
import java.util.Map;
import javax.annotation.PostConstruct;
import liquibase.integration.spring.SpringLiquibase;
import org.springframework.boot.context.properties.ConfigurationProperties;
@ -96,16 +94,12 @@ public class LiquibaseProperties { @@ -96,16 +94,12 @@ public class LiquibaseProperties {
*/
private File rollbackFile;
@PostConstruct
private void validate() {
Assert.notNull(this.changeLog, "ChangeLog must not be null");
}
public String getChangeLog() {
return this.changeLog;
}
public void setChangeLog(String changeLog) {
Assert.notNull(changeLog, "ChangeLog must not be null");
this.changeLog = changeLog;
}

7
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java

@ -26,7 +26,6 @@ import java.util.List; @@ -26,7 +26,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.annotation.PostConstruct;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.SessionCookieConfig;
@ -171,11 +170,6 @@ public class ServerProperties @@ -171,11 +170,6 @@ public class ServerProperties
private Environment environment;
@PostConstruct
private void validate() {
Assert.notNull(this.servletPath, "ServletPath must not be null");
}
@Override
public int getOrder() {
return 0;
@ -331,6 +325,7 @@ public class ServerProperties @@ -331,6 +325,7 @@ public class ServerProperties
}
public void setServletPath(String servletPath) {
Assert.notNull(servletPath, "ServletPath must not be null");
this.servletPath = servletPath;
}

12
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/webservices/WebServicesProperties.java

@ -19,8 +19,6 @@ package org.springframework.boot.autoconfigure.webservices; @@ -19,8 +19,6 @@ package org.springframework.boot.autoconfigure.webservices;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.PostConstruct;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.util.Assert;
@ -41,18 +39,14 @@ public class WebServicesProperties { @@ -41,18 +39,14 @@ public class WebServicesProperties {
private final Servlet servlet = new Servlet();
@PostConstruct
private void validate() {
Assert.notNull(this.path, "Path must not be null");
Assert.isTrue(this.path.isEmpty() || this.path.startsWith("/"),
"Path must start with / or be empty");
}
public String getPath() {
return this.path;
}
public void setPath(String path) {
Assert.notNull(path, "Path must not be null");
Assert.isTrue(path.isEmpty() || path.startsWith("/"),
"Path must start with / or be empty");
this.path = path;
}

Loading…
Cancel
Save