Commit 4993f32d authored by Andy Wilkinson's avatar Andy Wilkinson

Merge branch '1.5.x'

parents de98c4b3 f823599d
...@@ -20,7 +20,6 @@ import java.net.InetAddress; ...@@ -20,7 +20,6 @@ import java.net.InetAddress;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import javax.annotation.PostConstruct;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
import org.springframework.boot.autoconfigure.security.SecurityPrerequisite; 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(); 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 * Returns the management port or {@code null} if the
* {@link ServerProperties#getPort() server port} should be used. * {@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) { public void setContextPath(String contextPath) {
Assert.notNull(contextPath, "ContextPath must not be null");
this.contextPath = cleanContextPath(contextPath); this.contextPath = cleanContextPath(contextPath);
} }
......
...@@ -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 java.util.regex.Pattern;
import javax.annotation.PostConstruct;
import org.springframework.context.EnvironmentAware; import org.springframework.context.EnvironmentAware;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import org.springframework.util.Assert; 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; 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 * Create a new sensitive endpoint instance. The endpoint will enabled flag will be
* based on the spring {@link Environment} unless explicitly set. * 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 * @param sensitive if the endpoint is sensitive by default
*/ */
public AbstractEndpoint(String id, boolean sensitive) { public AbstractEndpoint(String id, boolean sensitive) {
this.id = id; setId(id);
this.sensitiveDefault = sensitive; 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. * @param enabled if the endpoint is enabled or not.
*/ */
public AbstractEndpoint(String id, boolean sensitive, boolean enabled) { public AbstractEndpoint(String id, boolean sensitive, boolean enabled) {
this.id = id; setId(id);
this.sensitiveDefault = sensitive; this.sensitiveDefault = sensitive;
this.enabled = enabled; 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) { 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; this.id = id;
} }
......
...@@ -16,8 +16,6 @@ ...@@ -16,8 +16,6 @@
package org.springframework.boot.actuate.endpoint.mvc; package org.springframework.boot.actuate.endpoint.mvc;
import javax.annotation.PostConstruct;
import org.springframework.boot.actuate.endpoint.Endpoint; import org.springframework.boot.actuate.endpoint.Endpoint;
import org.springframework.boot.actuate.endpoint.EndpointProperties; import org.springframework.boot.actuate.endpoint.EndpointProperties;
import org.springframework.context.EnvironmentAware; 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; private final boolean sensitiveDefault;
public AbstractMvcEndpoint(String path, boolean sensitive) { public AbstractMvcEndpoint(String path, boolean sensitive) {
this.path = path; setPath(path);
this.sensitiveDefault = sensitive; this.sensitiveDefault = sensitive;
} }
public AbstractMvcEndpoint(String path, boolean sensitive, boolean enabled) { public AbstractMvcEndpoint(String path, boolean sensitive, boolean enabled) {
this.path = path; setPath(path);
this.sensitiveDefault = sensitive; this.sensitiveDefault = sensitive;
this.enabled = enabled; 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 @Override
public void setEnvironment(Environment environment) { public void setEnvironment(Environment environment) {
this.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) { 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; this.path = path;
} }
......
...@@ -16,8 +16,6 @@ ...@@ -16,8 +16,6 @@
package org.springframework.boot.autoconfigure.h2; package org.springframework.boot.autoconfigure.h2;
import javax.annotation.PostConstruct;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.util.Assert; 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(); 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() { public String getPath() {
return this.path; return this.path;
} }
public void setPath(String 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; this.path = path;
} }
......
...@@ -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.io.File;
import java.util.Map; import java.util.Map;
import javax.annotation.PostConstruct;
import liquibase.integration.spring.SpringLiquibase; import liquibase.integration.spring.SpringLiquibase;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
...@@ -96,16 +94,12 @@ public class LiquibaseProperties { ...@@ -96,16 +94,12 @@ public class LiquibaseProperties {
*/ */
private File rollbackFile; private File rollbackFile;
@PostConstruct
private void validate() {
Assert.notNull(this.changeLog, "ChangeLog must not be null");
}
public String getChangeLog() { public String getChangeLog() {
return this.changeLog; return this.changeLog;
} }
public void setChangeLog(String changeLog) { public void setChangeLog(String changeLog) {
Assert.notNull(changeLog, "ChangeLog must not be null");
this.changeLog = changeLog; this.changeLog = changeLog;
} }
......
...@@ -26,7 +26,6 @@ import java.util.List; ...@@ -26,7 +26,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import javax.annotation.PostConstruct;
import javax.servlet.ServletContext; import javax.servlet.ServletContext;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.SessionCookieConfig; import javax.servlet.SessionCookieConfig;
...@@ -171,11 +170,6 @@ public class ServerProperties ...@@ -171,11 +170,6 @@ public class ServerProperties
private Environment environment; private Environment environment;
@PostConstruct
private void validate() {
Assert.notNull(this.servletPath, "ServletPath must not be null");
}
@Override @Override
public int getOrder() { public int getOrder() {
return 0; return 0;
...@@ -331,6 +325,7 @@ public class ServerProperties ...@@ -331,6 +325,7 @@ public class ServerProperties
} }
public void setServletPath(String servletPath) { public void setServletPath(String servletPath) {
Assert.notNull(servletPath, "ServletPath must not be null");
this.servletPath = servletPath; this.servletPath = servletPath;
} }
......
...@@ -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.HashMap;
import java.util.Map; import java.util.Map;
import javax.annotation.PostConstruct;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.util.Assert; 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(); 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() { public String getPath() {
return this.path; return this.path;
} }
public void setPath(String 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; this.path = path;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment