This commit is contained in:
Phillip Webb
2017-04-27 12:03:44 -07:00
parent 42e24136ef
commit 45dd9f7144
20 changed files with 75 additions and 71 deletions

View File

@@ -63,8 +63,7 @@ public class ReactiveCassandraDataAutoConfiguration {
@Bean
@ConditionalOnMissingBean
public ReactiveCassandraTemplate reactiveCassandraTemplate(
ReactiveSession reactiveCassandraSession,
CassandraConverter converter) {
ReactiveSession reactiveCassandraSession, CassandraConverter converter) {
return new ReactiveCassandraTemplate(reactiveCassandraSession, converter);
}

View File

@@ -29,8 +29,8 @@ import org.springframework.data.cassandra.repository.config.EnableReactiveCassan
import org.springframework.data.cassandra.repository.support.ReactiveCassandraRepositoryFactoryBean;
/**
* {@link EnableAutoConfiguration Auto-configuration} for Spring Data's Cassandra
* Reactive Repositories.
* {@link EnableAutoConfiguration Auto-configuration} for Spring Data's Cassandra Reactive
* Repositories.
*
* @author Eddú Meléndez
* @since 2.0.0

View File

@@ -35,7 +35,7 @@ public class ErrorProperties {
private String path = "/error";
/**
* Set whether to include the "exception" attribute.
* Include the "exception" attribute.
*/
private boolean includeException;

View File

@@ -959,7 +959,7 @@ public class ServerProperties {
/**
* Number of days before rotated log files are deleted.
*/
private int retentionPeriod = 31; // no days
private int retentionPeriod = 31; // no days
/**
* Append to log.

View File

@@ -544,7 +544,7 @@ public class DefaultServletWebServerFactoryCustomizer
serverProperties.getConnectionTimeout());
}
if (jettyProperties.getAccesslog().isEnabled()) {
customizeAccesslog(factory, jettyProperties.getAccesslog());
customizeAccessLog(factory, jettyProperties.getAccesslog());
}
}
@@ -643,32 +643,32 @@ public class DefaultServletWebServerFactoryCustomizer
});
}
private static void customizeAccesslog(JettyServletWebServerFactory factory,
final ServerProperties.Jetty.Accesslog accesslog) {
private static void customizeAccessLog(JettyServletWebServerFactory factory,
final ServerProperties.Jetty.Accesslog properties) {
factory.addServerCustomizers(server -> {
NCSARequestLog requestLog = new NCSARequestLog();
if (accesslog.getFilename() != null) {
requestLog.setFilename(accesslog.getFilename());
NCSARequestLog log = new NCSARequestLog();
if (properties.getFilename() != null) {
log.setFilename(properties.getFilename());
}
if (accesslog.getFileDateFormat() != null) {
requestLog.setFilenameDateFormat(accesslog.getFileDateFormat());
if (properties.getFileDateFormat() != null) {
log.setFilenameDateFormat(properties.getFileDateFormat());
}
requestLog.setRetainDays(accesslog.getRetentionPeriod());
requestLog.setAppend(accesslog.isAppend());
requestLog.setExtended(accesslog.isExtendedFormat());
if (accesslog.getDateFormat() != null) {
requestLog.setLogDateFormat(accesslog.getDateFormat());
log.setRetainDays(properties.getRetentionPeriod());
log.setAppend(properties.isAppend());
log.setExtended(properties.isExtendedFormat());
if (properties.getDateFormat() != null) {
log.setLogDateFormat(properties.getDateFormat());
}
if (accesslog.getLocale() != null) {
requestLog.setLogLocale(accesslog.getLocale());
if (properties.getLocale() != null) {
log.setLogLocale(properties.getLocale());
}
if (accesslog.getTimeZone() != null) {
requestLog.setLogTimeZone(accesslog.getTimeZone().getID());
if (properties.getTimeZone() != null) {
log.setLogTimeZone(properties.getTimeZone().getID());
}
requestLog.setLogCookies(accesslog.isLogCookies());
requestLog.setLogServer(accesslog.isLogServer());
requestLog.setLogLatency(accesslog.isLogLatency());
server.setRequestLog(requestLog);
log.setLogCookies(properties.isLogCookies());
log.setLogServer(properties.isLogServer());
log.setLogLatency(properties.isLogLatency());
server.setRequestLog(log);
});
}
}

View File

@@ -65,7 +65,15 @@ public class DefaultErrorAttributes
private static final String ERROR_ATTRIBUTE = DefaultErrorAttributes.class.getName()
+ ".ERROR";
private boolean includeException;
private final boolean includeException;
/**
* Create a new {@link DefaultErrorAttributes} instance that does not include the
* "exception" attribute.
*/
public DefaultErrorAttributes() {
this(false);
}
/**
* Create a new {@link DefaultErrorAttributes} instance.
@@ -75,14 +83,6 @@ public class DefaultErrorAttributes
this.includeException = includeException;
}
/**
* Create a new {@link DefaultErrorAttributes} instance that does not
* include the "exception" attribute.
*/
public DefaultErrorAttributes() {
this(false);
}
@Override
public int getOrder() {
return Ordered.HIGHEST_PRECEDENCE;

View File

@@ -19,6 +19,7 @@ package org.springframework.boot.autoconfigure.data.alt.cassandra;
import org.springframework.boot.autoconfigure.data.cassandra.city.City;
import org.springframework.data.repository.reactive.ReactiveCrudRepository;
public interface ReactiveCityCassandraRepository extends ReactiveCrudRepository<City, Long> {
public interface ReactiveCityCassandraRepository
extends ReactiveCrudRepository<City, Long> {
}

View File

@@ -79,7 +79,8 @@ public class ReactiveCassandraRepositoriesAutoConfigurationTests {
@Test
public void doesNotTriggerDefaultRepositoryDetectionIfCustomized() {
load(TestExcludeConfiguration.class, CustomizedConfiguration.class);
assertThat(this.context.getBean(ReactiveCityCassandraRepository.class)).isNotNull();
assertThat(this.context.getBean(ReactiveCityCassandraRepository.class))
.isNotNull();
assertThat(getInitialEntitySet()).hasSize(1).containsOnly(City.class);
}

View File

@@ -412,7 +412,7 @@ public class DefaultServletWebServerFactoryCustomizerTests {
embeddedFactory.start();
try {
assertThat(embeddedFactory.getTomcat().getConnector().getMaxPostSize())
.isEqualTo(-1);
.isEqualTo(-1);
}
finally {
embeddedFactory.stop();
@@ -556,11 +556,11 @@ public class DefaultServletWebServerFactoryCustomizerTests {
@Test
public void jettyAccessLogCanBeCustomized() throws IOException {
File f = File.createTempFile("jetty_log", ".log");
File logFile = File.createTempFile("jetty_log", ".log");
JettyServletWebServerFactory factory = new JettyServletWebServerFactory(0);
Map<String, String> map = new HashMap<>();
map.put("server.jetty.accesslog.enabled", "true");
map.put("server.jetty.accesslog.filename", f.getAbsolutePath());
map.put("server.jetty.accesslog.filename", logFile.getAbsolutePath());
map.put("server.jetty.accesslog.file-date-format", "yyyy-MM-dd");
map.put("server.jetty.accesslog.retention-period", "42");
map.put("server.jetty.accesslog.append", "true");
@@ -576,7 +576,7 @@ public class DefaultServletWebServerFactoryCustomizerTests {
JettyWebServer webServer = (JettyWebServer) factory.getWebServer();
NCSARequestLog requestLog = getNCSARequestLog(webServer);
try {
assertThat(requestLog.getFilename()).isEqualTo(f.getAbsolutePath());
assertThat(requestLog.getFilename()).isEqualTo(logFile.getAbsolutePath());
assertThat(requestLog.getFilenameDateFormat()).isEqualTo("yyyy-MM-dd");
assertThat(requestLog.getRetainDays()).isEqualTo(42);
assertThat(requestLog.isAppend()).isTrue();

View File

@@ -100,8 +100,8 @@ public class BasicErrorControllerIntegrationTests {
load();
ResponseEntity<Map> entity = new TestRestTemplate()
.getForEntity(createUrl("?trace=true"), Map.class);
assertErrorAttributes(entity.getBody(), "500", "Internal Server Error",
null, "Expected!", "/");
assertErrorAttributes(entity.getBody(), "500", "Internal Server Error", null,
"Expected!", "/");
assertThat(entity.getBody().containsKey("trace")).isFalse();
}
@@ -123,8 +123,8 @@ public class BasicErrorControllerIntegrationTests {
load("--server.error.include-stacktrace=never");
ResponseEntity<Map> entity = new TestRestTemplate()
.getForEntity(createUrl("?trace=true"), Map.class);
assertErrorAttributes(entity.getBody(), "500", "Internal Server Error",
null, "Expected!", "/");
assertErrorAttributes(entity.getBody(), "500", "Internal Server Error", null,
"Expected!", "/");
assertThat(entity.getBody().containsKey("trace")).isFalse();
}
@@ -134,8 +134,8 @@ public class BasicErrorControllerIntegrationTests {
load("--server.error.include-stacktrace=always");
ResponseEntity<Map> entity = new TestRestTemplate()
.getForEntity(createUrl("?trace=false"), Map.class);
assertErrorAttributes(entity.getBody(), "500", "Internal Server Error",
null, "Expected!", "/");
assertErrorAttributes(entity.getBody(), "500", "Internal Server Error", null,
"Expected!", "/");
assertThat(entity.getBody().containsKey("trace")).isTrue();
}
@@ -272,7 +272,7 @@ public class BasicErrorControllerIntegrationTests {
@Override
protected void renderMergedOutputModel(Map<String, Object> model,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
throws Exception {
response.getWriter().write("ERROR_BEAN");
}
};