From 4853477081f2719602cfec75fedbbda29dc31c0a Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Thu, 24 May 2018 16:13:51 -0700 Subject: [PATCH 1/2] Reformat code --- .../jersey/JerseyAutoConfiguration.java | 45 +++++--- .../autoconfigure/kafka/KafkaProperties.java | 108 +++++++++++------- ...toConfigurationCustomApplicationTests.java | 11 +- .../sample/ant/SampleAntApplicationIT.java | 8 +- .../java/sample/data/jpa/domain/City.java | 3 +- .../java/sample/data/jpa/domain/Hotel.java | 3 +- .../java/sample/data/jpa/domain/Rating.java | 4 +- .../java/sample/data/jpa/domain/Review.java | 3 +- .../sample/data/jpa/domain/ReviewDetails.java | 3 +- .../java/sample/data/jpa/domain/TripType.java | 4 +- .../data/jpa/service/CitySearchCriteria.java | 3 +- .../data/jpa/service/CityServiceImpl.java | 3 +- .../data/jpa/service/HotelServiceImpl.java | 4 +- .../CityRepositoryIntegrationTests.java | 3 +- .../HotelRepositoryIntegrationTests.java | 1 + .../main/java/sample/data/mongo/Customer.java | 3 +- .../main/java/sample/data/neo4j/Customer.java | 3 +- .../java/sample/data/rest/domain/City.java | 3 +- .../java/sample/data/rest/domain/Hotel.java | 3 +- .../data/rest/service/CitySearchCriteria.java | 3 +- .../rest/SampleDataRestApplicationTests.java | 1 + .../CityRepositoryIntegrationTests.java | 3 +- .../src/main/java/sample/flyway/Person.java | 6 +- .../java/sample/hibernate4/domain/City.java | 3 +- .../java/sample/hibernate4/domain/Hotel.java | 3 +- .../java/sample/hibernate4/domain/Rating.java | 4 +- .../java/sample/hibernate4/domain/Review.java | 3 +- .../hibernate4/domain/ReviewDetails.java | 3 +- .../sample/hibernate4/domain/TripType.java | 4 +- .../service/CitySearchCriteria.java | 3 +- .../hibernate4/service/CityServiceImpl.java | 3 +- .../hibernate4/service/HotelServiceImpl.java | 4 +- .../CityRepositoryIntegrationTests.java | 3 +- .../HotelRepositoryIntegrationTests.java | 4 +- .../java/sample/hibernate52/domain/City.java | 3 +- .../java/sample/hibernate52/domain/Hotel.java | 3 +- .../sample/hibernate52/domain/Rating.java | 4 +- .../sample/hibernate52/domain/Review.java | 3 +- .../hibernate52/domain/ReviewDetails.java | 3 +- .../sample/hibernate52/domain/TripType.java | 4 +- .../service/CitySearchCriteria.java | 3 +- .../hibernate52/service/CityServiceImpl.java | 3 +- .../hibernate52/service/HotelServiceImpl.java | 4 +- .../CityRepositoryIntegrationTests.java | 3 +- .../HotelRepositoryIntegrationTests.java | 4 +- ...pleHypermediaUiSecureApplicationTests.java | 3 +- .../ui/SampleHypermediaUiApplication.java | 3 +- .../SampleIntegrationApplicationTests.java | 3 +- .../main/java/sample/jooq/JooqExamples.java | 3 +- .../SampleLiquibaseApplicationTests.java | 3 +- .../metrics/opentsdb/SampleController.java | 3 +- .../metrics/redis/SampleController.java | 3 +- ...mpleIntegrationParentApplicationTests.java | 3 +- .../secure/SampleSecureApplicationTests.java | 3 +- .../SampleServletApplicationTests.java | 3 +- ...IdentificationNumberNotFoundException.java | 3 +- ...leTomcatTwoConnectorsApplicationTests.java | 3 +- .../sample/traditional/config/WebConfig.java | 3 +- .../java/sample/groovytemplates/Message.java | 3 +- .../java/sample/web/thymeleaf3/Message.java | 3 +- .../thymeleaf3/MessageControllerWebTests.java | 5 +- .../src/main/java/sample/web/ui/Message.java | 3 +- .../web/ui/MessageControllerWebTests.java | 5 +- .../reverse/ReverseWebSocketEndpoint.java | 3 +- .../websocket/jetty/snake/Direction.java | 2 + .../websocket/jetty/snake/Location.java | 5 + .../samples/websocket/jetty/snake/Snake.java | 1 + .../websocket/jetty/snake/SnakeTimer.java | 1 + .../websocket/jetty/snake/SnakeUtils.java | 2 + .../jetty/snake/SnakeWebSocketHandler.java | 5 + .../SampleWebSocketsApplicationTests.java | 3 +- .../reverse/ReverseWebSocketEndpoint.java | 3 +- .../websocket/jetty93/snake/Direction.java | 2 + .../websocket/jetty93/snake/Location.java | 5 + .../websocket/jetty93/snake/Snake.java | 1 + .../websocket/jetty93/snake/SnakeTimer.java | 1 + .../websocket/jetty93/snake/SnakeUtils.java | 2 + .../jetty93/snake/SnakeWebSocketHandler.java | 5 + .../SampleWebSocketsApplicationTests.java | 3 +- .../reverse/ReverseWebSocketEndpoint.java | 3 +- .../websocket/tomcat/snake/Direction.java | 2 + .../websocket/tomcat/snake/Location.java | 5 + .../samples/websocket/tomcat/snake/Snake.java | 1 + .../websocket/tomcat/snake/SnakeTimer.java | 1 + .../websocket/tomcat/snake/SnakeUtils.java | 2 + .../tomcat/snake/SnakeWebSocketHandler.java | 5 + .../tomcat/snake/SnakeTimerTests.java | 3 +- .../reverse/ReverseWebSocketEndpoint.java | 3 +- .../websocket/undertow/snake/Direction.java | 2 + .../websocket/undertow/snake/Location.java | 5 + .../websocket/undertow/snake/Snake.java | 1 + .../websocket/undertow/snake/SnakeTimer.java | 1 + .../websocket/undertow/snake/SnakeUtils.java | 2 + .../undertow/snake/SnakeWebSocketHandler.java | 5 + .../undertow/snake/SnakeTimerTests.java | 3 +- 95 files changed, 321 insertions(+), 130 deletions(-) diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfiguration.java index c219ccdf65..0ca1b69f19 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfiguration.java @@ -117,8 +117,8 @@ public class JerseyAutoConfiguration implements ServletContextAware { this.path = parseApplicationPath(this.jersey.getApplicationPath()); } else { - this.path = findApplicationPath( - AnnotationUtils.findAnnotation(this.config.getApplication().getClass(), ApplicationPath.class)); + this.path = findApplicationPath(AnnotationUtils.findAnnotation( + this.config.getApplication().getClass(), ApplicationPath.class)); } } @@ -149,7 +149,8 @@ public class JerseyAutoConfiguration implements ServletContextAware { registration.setFilter(new ServletContainer(this.config)); registration.setUrlPatterns(Arrays.asList(this.path)); registration.setOrder(this.jersey.getFilter().getOrder()); - registration.addInitParameter(ServletProperties.FILTER_CONTEXT_PATH, stripPattern(this.path)); + registration.addInitParameter(ServletProperties.FILTER_CONTEXT_PATH, + stripPattern(this.path)); addInitParameters(registration); registration.setName("jerseyFilter"); registration.setDispatcherTypes(EnumSet.allOf(DispatcherType.class)); @@ -167,8 +168,8 @@ public class JerseyAutoConfiguration implements ServletContextAware { @ConditionalOnMissingBean(name = "jerseyServletRegistration") @ConditionalOnProperty(prefix = "spring.jersey", name = "type", havingValue = "servlet", matchIfMissing = true) public ServletRegistrationBean jerseyServletRegistration() { - ServletRegistrationBean registration = new ServletRegistrationBean(new ServletContainer(this.config), - this.path); + ServletRegistrationBean registration = new ServletRegistrationBean( + new ServletContainer(this.config), this.path); addInitParameters(registration); registration.setName(getServletRegistrationName()); registration.setLoadOnStartup(this.jersey.getServlet().getLoadOnStartup()); @@ -203,18 +204,23 @@ public class JerseyAutoConfiguration implements ServletContextAware { @Override public void setServletContext(ServletContext servletContext) { String servletRegistrationName = getServletRegistrationName(); - ServletRegistration registration = servletContext.getServletRegistration(servletRegistrationName); + ServletRegistration registration = servletContext + .getServletRegistration(servletRegistrationName); if (registration != null) { if (logger.isInfoEnabled()) { - logger.info("Configuring existing registration for Jersey servlet '" + servletRegistrationName + "'"); + logger.info("Configuring existing registration for Jersey servlet '" + + servletRegistrationName + "'"); } registration.setInitParameters(this.jersey.getInit()); - registration.setInitParameter(CommonProperties.METAINF_SERVICES_LOOKUP_DISABLE, Boolean.TRUE.toString()); + registration.setInitParameter( + CommonProperties.METAINF_SERVICES_LOOKUP_DISABLE, + Boolean.TRUE.toString()); } } @Order(Ordered.HIGHEST_PRECEDENCE) - public static final class JerseyWebApplicationInitializer implements WebApplicationInitializer { + public static final class JerseyWebApplicationInitializer + implements WebApplicationInitializer { @Override public void onStartup(ServletContext servletContext) throws ServletException { @@ -233,19 +239,22 @@ public class JerseyAutoConfiguration implements ServletContextAware { private static final String JAXB_ANNOTATION_INTROSPECTOR_CLASS_NAME = "com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector"; @Bean - public ResourceConfigCustomizer resourceConfigCustomizer(final ObjectMapper objectMapper) { + public ResourceConfigCustomizer resourceConfigCustomizer( + final ObjectMapper objectMapper) { addJaxbAnnotationIntrospectorIfPresent(objectMapper); return new ResourceConfigCustomizer() { @Override public void customize(ResourceConfig config) { config.register(JacksonFeature.class); - config.register(new ObjectMapperContextResolver(objectMapper), ContextResolver.class); + config.register(new ObjectMapperContextResolver(objectMapper), + ContextResolver.class); } }; } private void addJaxbAnnotationIntrospectorIfPresent(ObjectMapper objectMapper) { - if (ClassUtils.isPresent(JAXB_ANNOTATION_INTROSPECTOR_CLASS_NAME, getClass().getClassLoader())) { + if (ClassUtils.isPresent(JAXB_ANNOTATION_INTROSPECTOR_CLASS_NAME, + getClass().getClassLoader())) { new ObjectMapperCustomizer().addJaxbAnnotationIntrospector(objectMapper); } } @@ -256,18 +265,22 @@ public class JerseyAutoConfiguration implements ServletContextAware { JaxbAnnotationIntrospector jaxbAnnotationIntrospector = new JaxbAnnotationIntrospector( objectMapper.getTypeFactory()); objectMapper.setAnnotationIntrospectors( - createPair(objectMapper.getSerializationConfig(), jaxbAnnotationIntrospector), - createPair(objectMapper.getDeserializationConfig(), jaxbAnnotationIntrospector)); + createPair(objectMapper.getSerializationConfig(), + jaxbAnnotationIntrospector), + createPair(objectMapper.getDeserializationConfig(), + jaxbAnnotationIntrospector)); } private AnnotationIntrospector createPair(MapperConfig config, JaxbAnnotationIntrospector jaxbAnnotationIntrospector) { - return AnnotationIntrospector.pair(config.getAnnotationIntrospector(), jaxbAnnotationIntrospector); + return AnnotationIntrospector.pair(config.getAnnotationIntrospector(), + jaxbAnnotationIntrospector); } } - private static final class ObjectMapperContextResolver implements ContextResolver { + private static final class ObjectMapperContextResolver + implements ContextResolver { private final ObjectMapper objectMapper; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaProperties.java index 1dc2b402fd..9b7e0f56c9 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaProperties.java @@ -53,7 +53,8 @@ public class KafkaProperties { * Comma-delimited list of host:port pairs to use for establishing the initial * connection to the Kafka cluster. */ - private List bootstrapServers = new ArrayList(Collections.singletonList("localhost:9092")); + private List bootstrapServers = new ArrayList( + Collections.singletonList("localhost:9092")); /** * Id to pass to the server when making requests; used for server-side logging. @@ -122,7 +123,8 @@ public class KafkaProperties { private Map buildCommonProperties() { Map properties = new HashMap(); if (this.bootstrapServers != null) { - properties.put(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG, this.bootstrapServers); + properties.put(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG, + this.bootstrapServers); } if (this.clientId != null) { properties.put(CommonClientConfigs.CLIENT_ID_CONFIG, this.clientId); @@ -131,16 +133,20 @@ public class KafkaProperties { properties.put(SslConfigs.SSL_KEY_PASSWORD_CONFIG, this.ssl.getKeyPassword()); } if (this.ssl.getKeystoreLocation() != null) { - properties.put(SslConfigs.SSL_KEYSTORE_LOCATION_CONFIG, resourceToPath(this.ssl.getKeystoreLocation())); + properties.put(SslConfigs.SSL_KEYSTORE_LOCATION_CONFIG, + resourceToPath(this.ssl.getKeystoreLocation())); } if (this.ssl.getKeystorePassword() != null) { - properties.put(SslConfigs.SSL_KEYSTORE_PASSWORD_CONFIG, this.ssl.getKeystorePassword()); + properties.put(SslConfigs.SSL_KEYSTORE_PASSWORD_CONFIG, + this.ssl.getKeystorePassword()); } if (this.ssl.getTruststoreLocation() != null) { - properties.put(SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG, resourceToPath(this.ssl.getTruststoreLocation())); + properties.put(SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG, + resourceToPath(this.ssl.getTruststoreLocation())); } if (this.ssl.getTruststorePassword() != null) { - properties.put(SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG, this.ssl.getTruststorePassword()); + properties.put(SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG, + this.ssl.getTruststorePassword()); } if (!CollectionUtils.isEmpty(this.properties)) { properties.putAll(this.properties); @@ -153,8 +159,8 @@ public class KafkaProperties { *

* This allows you to add additional properties, if necessary, and override the * default kafkaConsumerFactory bean. - * @return the consumer properties initialized with the customizations defined - * on this instance + * @return the consumer properties initialized with the customizations defined on this + * instance */ public Map buildConsumerProperties() { Map properties = buildCommonProperties(); @@ -167,8 +173,8 @@ public class KafkaProperties { *

* This allows you to add additional properties, if necessary, and override the * default kafkaProducerFactory bean. - * @return the producer properties initialized with the customizations defined - * on this instance + * @return the producer properties initialized with the customizations defined on this + * instance */ public Map buildProducerProperties() { Map properties = buildCommonProperties(); @@ -181,7 +187,8 @@ public class KafkaProperties { return resource.getFile().getAbsolutePath(); } catch (IOException ex) { - throw new IllegalStateException("Resource '" + resource + "' must be on a file system", ex); + throw new IllegalStateException( + "Resource '" + resource + "' must be on a file system", ex); } } @@ -190,8 +197,8 @@ public class KafkaProperties { private final Ssl ssl = new Ssl(); /** - * Frequency in milliseconds that the consumer offsets are auto-committed to - * Kafka if 'enable.auto.commit' true. + * Frequency in milliseconds that the consumer offsets are auto-committed to Kafka + * if 'enable.auto.commit' true. */ private Integer autoCommitInterval; @@ -213,8 +220,7 @@ public class KafkaProperties { private String clientId; /** - * If true the consumer's offset will be periodically committed in the - * background. + * If true the consumer's offset will be periodically committed in the background. */ private Boolean enableAutoCommit; @@ -358,22 +364,27 @@ public class KafkaProperties { public Map buildProperties() { Map properties = new HashMap(); if (this.autoCommitInterval != null) { - properties.put(ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG, this.autoCommitInterval); + properties.put(ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG, + this.autoCommitInterval); } if (this.autoOffsetReset != null) { - properties.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, this.autoOffsetReset); + properties.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, + this.autoOffsetReset); } if (this.bootstrapServers != null) { - properties.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, this.bootstrapServers); + properties.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, + this.bootstrapServers); } if (this.clientId != null) { properties.put(ConsumerConfig.CLIENT_ID_CONFIG, this.clientId); } if (this.enableAutoCommit != null) { - properties.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, this.enableAutoCommit); + properties.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, + this.enableAutoCommit); } if (this.fetchMaxWait != null) { - properties.put(ConsumerConfig.FETCH_MAX_WAIT_MS_CONFIG, this.fetchMaxWait); + properties.put(ConsumerConfig.FETCH_MAX_WAIT_MS_CONFIG, + this.fetchMaxWait); } if (this.fetchMinSize != null) { properties.put(ConsumerConfig.FETCH_MIN_BYTES_CONFIG, this.fetchMinSize); @@ -382,32 +393,40 @@ public class KafkaProperties { properties.put(ConsumerConfig.GROUP_ID_CONFIG, this.groupId); } if (this.heartbeatInterval != null) { - properties.put(ConsumerConfig.HEARTBEAT_INTERVAL_MS_CONFIG, this.heartbeatInterval); + properties.put(ConsumerConfig.HEARTBEAT_INTERVAL_MS_CONFIG, + this.heartbeatInterval); } if (this.keyDeserializer != null) { - properties.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, this.keyDeserializer); + properties.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, + this.keyDeserializer); } if (this.ssl.getKeyPassword() != null) { - properties.put(SslConfigs.SSL_KEY_PASSWORD_CONFIG, this.ssl.getKeyPassword()); + properties.put(SslConfigs.SSL_KEY_PASSWORD_CONFIG, + this.ssl.getKeyPassword()); } if (this.ssl.getKeystoreLocation() != null) { - properties.put(SslConfigs.SSL_KEYSTORE_LOCATION_CONFIG, resourceToPath(this.ssl.getKeystoreLocation())); + properties.put(SslConfigs.SSL_KEYSTORE_LOCATION_CONFIG, + resourceToPath(this.ssl.getKeystoreLocation())); } if (this.ssl.getKeystorePassword() != null) { - properties.put(SslConfigs.SSL_KEYSTORE_PASSWORD_CONFIG, this.ssl.getKeystorePassword()); + properties.put(SslConfigs.SSL_KEYSTORE_PASSWORD_CONFIG, + this.ssl.getKeystorePassword()); } if (this.ssl.getTruststoreLocation() != null) { properties.put(SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG, resourceToPath(this.ssl.getTruststoreLocation())); } if (this.ssl.getTruststorePassword() != null) { - properties.put(SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG, this.ssl.getTruststorePassword()); + properties.put(SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG, + this.ssl.getTruststorePassword()); } if (this.valueDeserializer != null) { - properties.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, this.valueDeserializer); + properties.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, + this.valueDeserializer); } if (this.maxPollRecords != null) { - properties.put(ConsumerConfig.MAX_POLL_RECORDS_CONFIG, this.maxPollRecords); + properties.put(ConsumerConfig.MAX_POLL_RECORDS_CONFIG, + this.maxPollRecords); } return properties; } @@ -425,9 +444,8 @@ public class KafkaProperties { private String acks; /** - * Default batch size in bytes. A small batch size will make batching less - * common and may reduce throughput (a batch size of zero disables batching - * entirely). + * Default batch size in bytes. A small batch size will make batching less common + * and may reduce throughput (a batch size of zero disables batching entirely). */ private Integer batchSize; @@ -438,8 +456,8 @@ public class KafkaProperties { private List bootstrapServers; /** - * Total bytes of memory the producer can use to buffer records waiting to be - * sent to the server. + * Total bytes of memory the producer can use to buffer records waiting to be sent + * to the server. */ private Long bufferMemory; @@ -553,7 +571,8 @@ public class KafkaProperties { properties.put(ProducerConfig.BATCH_SIZE_CONFIG, this.batchSize); } if (this.bootstrapServers != null) { - properties.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, this.bootstrapServers); + properties.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, + this.bootstrapServers); } if (this.bufferMemory != null) { properties.put(ProducerConfig.BUFFER_MEMORY_CONFIG, this.bufferMemory); @@ -562,32 +581,39 @@ public class KafkaProperties { properties.put(ProducerConfig.CLIENT_ID_CONFIG, this.clientId); } if (this.compressionType != null) { - properties.put(ProducerConfig.COMPRESSION_TYPE_CONFIG, this.compressionType); + properties.put(ProducerConfig.COMPRESSION_TYPE_CONFIG, + this.compressionType); } if (this.keySerializer != null) { - properties.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, this.keySerializer); + properties.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, + this.keySerializer); } if (this.retries != null) { properties.put(ProducerConfig.RETRIES_CONFIG, this.retries); } if (this.ssl.getKeyPassword() != null) { - properties.put(SslConfigs.SSL_KEY_PASSWORD_CONFIG, this.ssl.getKeyPassword()); + properties.put(SslConfigs.SSL_KEY_PASSWORD_CONFIG, + this.ssl.getKeyPassword()); } if (this.ssl.getKeystoreLocation() != null) { - properties.put(SslConfigs.SSL_KEYSTORE_LOCATION_CONFIG, resourceToPath(this.ssl.getKeystoreLocation())); + properties.put(SslConfigs.SSL_KEYSTORE_LOCATION_CONFIG, + resourceToPath(this.ssl.getKeystoreLocation())); } if (this.ssl.getKeystorePassword() != null) { - properties.put(SslConfigs.SSL_KEYSTORE_PASSWORD_CONFIG, this.ssl.getKeystorePassword()); + properties.put(SslConfigs.SSL_KEYSTORE_PASSWORD_CONFIG, + this.ssl.getKeystorePassword()); } if (this.ssl.getTruststoreLocation() != null) { properties.put(SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG, resourceToPath(this.ssl.getTruststoreLocation())); } if (this.ssl.getTruststorePassword() != null) { - properties.put(SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG, this.ssl.getTruststorePassword()); + properties.put(SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG, + this.ssl.getTruststorePassword()); } if (this.valueSerializer != null) { - properties.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, this.valueSerializer); + properties.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, + this.valueSerializer); } return properties; } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationCustomApplicationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationCustomApplicationTests.java index 019c14d096..8ac293ea88 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationCustomApplicationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationCustomApplicationTests.java @@ -43,8 +43,7 @@ import org.springframework.test.context.junit4.SpringRunner; import static org.assertj.core.api.Assertions.assertThat; /** - * Tests for {@link JerseyAutoConfiguration} when using a custom - * {@link Application}. + * Tests for {@link JerseyAutoConfiguration} when using a custom {@link Application}. * * @author Stephane Nicoll */ @@ -58,7 +57,8 @@ public class JerseyAutoConfigurationCustomApplicationTests { @Test public void contextLoads() { - ResponseEntity entity = this.restTemplate.getForEntity("/test/hello", String.class); + ResponseEntity entity = this.restTemplate.getForEntity("/test/hello", + String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); } @@ -78,8 +78,9 @@ public class JerseyAutoConfigurationCustomApplicationTests { } @Configuration - @Import({ EmbeddedServletContainerAutoConfiguration.class, ServerPropertiesAutoConfiguration.class, - JerseyAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class }) + @Import({ EmbeddedServletContainerAutoConfiguration.class, + ServerPropertiesAutoConfiguration.class, JerseyAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class }) static class TestConfiguration { @Configuration diff --git a/spring-boot-samples/spring-boot-sample-ant/src/test/java/sample/ant/SampleAntApplicationIT.java b/spring-boot-samples/spring-boot-sample-ant/src/test/java/sample/ant/SampleAntApplicationIT.java index bdc4e027ef..8dba95357b 100644 --- a/spring-boot-samples/spring-boot-sample-ant/src/test/java/sample/ant/SampleAntApplicationIT.java +++ b/spring-boot-samples/spring-boot-sample-ant/src/test/java/sample/ant/SampleAntApplicationIT.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -47,10 +47,12 @@ public class SampleAntApplicationIT { }); assertThat(jarFiles).hasSize(1); - Process process = new JavaExecutable().processBuilder("-jar", jarFiles[0].getName()).directory(target).start(); + Process process = new JavaExecutable() + .processBuilder("-jar", jarFiles[0].getName()).directory(target).start(); process.waitFor(5, TimeUnit.MINUTES); assertThat(process.exitValue()).isEqualTo(0); - String output = FileCopyUtils.copyToString(new InputStreamReader(process.getInputStream())); + String output = FileCopyUtils + .copyToString(new InputStreamReader(process.getInputStream())); assertThat(output).contains("Spring Boot Ant Example"); } diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/City.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/City.java index 55ebea8582..2e80bfc054 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/City.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/City.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2013 the original author or authors. + * Copyright 2012-2018 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. @@ -73,4 +73,5 @@ public class City implements Serializable { public String toString() { return getName() + "," + getState() + "," + getCountry(); } + } diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/Hotel.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/Hotel.java index f3cb6ab8bb..02f1c279c4 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/Hotel.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/Hotel.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2013 the original author or authors. + * Copyright 2012-2018 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. @@ -78,4 +78,5 @@ public class Hotel implements Serializable { public String getZip() { return this.zip; } + } diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/Rating.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/Rating.java index dfbb6c5601..4410189c4d 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/Rating.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/Rating.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2013 the original author or authors. + * Copyright 2012-2018 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. @@ -17,5 +17,7 @@ package sample.data.jpa.domain; public enum Rating { + TERRIBLE, POOR, AVERAGE, GOOD, EXCELLENT, + } diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/Review.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/Review.java index db2e2ab606..081d6623fa 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/Review.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/Review.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2013 the original author or authors. + * Copyright 2012-2018 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. @@ -126,4 +126,5 @@ public class Review implements Serializable { public void setDetails(String details) { this.details = details; } + } diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/ReviewDetails.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/ReviewDetails.java index c19c9cf5f6..0cdb85d501 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/ReviewDetails.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/ReviewDetails.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2013 the original author or authors. + * Copyright 2012-2018 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. @@ -75,4 +75,5 @@ public class ReviewDetails implements Serializable { public void setDetails(String details) { this.details = details; } + } diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/TripType.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/TripType.java index ca1cb6992f..00fa71802f 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/TripType.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/domain/TripType.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2013 the original author or authors. + * Copyright 2012-2018 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. @@ -17,5 +17,7 @@ package sample.data.jpa.domain; public enum TripType { + BUSINESS, COUPLES, FAMILY, FRIENDS, SOLO + } diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/CitySearchCriteria.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/CitySearchCriteria.java index cd74f536cd..4aafa8f71b 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/CitySearchCriteria.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/CitySearchCriteria.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2013 the original author or authors. + * Copyright 2012-2018 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. @@ -41,4 +41,5 @@ public class CitySearchCriteria implements Serializable { public void setName(String name) { this.name = name; } + } diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/CityServiceImpl.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/CityServiceImpl.java index eab39b23c1..51884556a7 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/CityServiceImpl.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/CityServiceImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -75,4 +75,5 @@ class CityServiceImpl implements CityService { Assert.notNull(city, "City must not be null"); return this.hotelRepository.findByCity(city, pageable); } + } diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/HotelServiceImpl.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/HotelServiceImpl.java index 85c05d22f9..0494bf980b 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/HotelServiceImpl.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/HotelServiceImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -94,5 +94,7 @@ class HotelServiceImpl implements HotelService { Long count = this.ratingCount.get(rating); return count == null ? 0 : count; } + } + } diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/service/CityRepositoryIntegrationTests.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/service/CityRepositoryIntegrationTests.java index 1e492c9572..f60b235998 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/service/CityRepositoryIntegrationTests.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/service/CityRepositoryIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -45,4 +45,5 @@ public class CityRepositoryIntegrationTests { Page cities = this.repository.findAll(new PageRequest(0, 10)); assertThat(cities.getTotalElements()).isGreaterThan(20L); } + } diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/service/HotelRepositoryIntegrationTests.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/service/HotelRepositoryIntegrationTests.java index 643c64146a..4093788e7b 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/service/HotelRepositoryIntegrationTests.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/test/java/sample/data/jpa/service/HotelRepositoryIntegrationTests.java @@ -67,4 +67,5 @@ public class HotelRepositoryIntegrationTests { assertThat(counts.get(0).getRating()).isEqualTo(Rating.AVERAGE); assertThat(counts.get(0).getCount()).isGreaterThan(1L); } + } diff --git a/spring-boot-samples/spring-boot-sample-data-mongodb/src/main/java/sample/data/mongo/Customer.java b/spring-boot-samples/spring-boot-sample-data-mongodb/src/main/java/sample/data/mongo/Customer.java index 09ba965ee2..a6ed82d6d5 100644 --- a/spring-boot-samples/spring-boot-sample-data-mongodb/src/main/java/sample/data/mongo/Customer.java +++ b/spring-boot-samples/spring-boot-sample-data-mongodb/src/main/java/sample/data/mongo/Customer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2013 the original author or authors. + * Copyright 2012-2018 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. @@ -24,6 +24,7 @@ public class Customer { private String id; private String firstName; + private String lastName; public Customer() { diff --git a/spring-boot-samples/spring-boot-sample-data-neo4j/src/main/java/sample/data/neo4j/Customer.java b/spring-boot-samples/spring-boot-sample-data-neo4j/src/main/java/sample/data/neo4j/Customer.java index a198914204..d48a9818cc 100644 --- a/spring-boot-samples/spring-boot-sample-data-neo4j/src/main/java/sample/data/neo4j/Customer.java +++ b/spring-boot-samples/spring-boot-sample-data-neo4j/src/main/java/sample/data/neo4j/Customer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -26,6 +26,7 @@ public class Customer { private Long id; private String firstName; + private String lastName; public Customer() { diff --git a/spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/rest/domain/City.java b/spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/rest/domain/City.java index 0de9f3d724..b493a757a3 100644 --- a/spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/rest/domain/City.java +++ b/spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/rest/domain/City.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2018 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. @@ -73,4 +73,5 @@ public class City implements Serializable { public String toString() { return getName() + "," + getState() + "," + getCountry(); } + } diff --git a/spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/rest/domain/Hotel.java b/spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/rest/domain/Hotel.java index f3c81a7371..6b62c0b2ea 100644 --- a/spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/rest/domain/Hotel.java +++ b/spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/rest/domain/Hotel.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2018 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. @@ -72,4 +72,5 @@ public class Hotel implements Serializable { public String getZip() { return this.zip; } + } diff --git a/spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/rest/service/CitySearchCriteria.java b/spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/rest/service/CitySearchCriteria.java index f237100c89..dc28459259 100644 --- a/spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/rest/service/CitySearchCriteria.java +++ b/spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/rest/service/CitySearchCriteria.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2018 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. @@ -41,4 +41,5 @@ public class CitySearchCriteria implements Serializable { public void setName(String name) { this.name = name; } + } diff --git a/spring-boot-samples/spring-boot-sample-data-rest/src/test/java/sample/data/rest/SampleDataRestApplicationTests.java b/spring-boot-samples/spring-boot-sample-data-rest/src/test/java/sample/data/rest/SampleDataRestApplicationTests.java index 2c307517b2..6a11fa7621 100644 --- a/spring-boot-samples/spring-boot-sample-data-rest/src/test/java/sample/data/rest/SampleDataRestApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-data-rest/src/test/java/sample/data/rest/SampleDataRestApplicationTests.java @@ -83,4 +83,5 @@ public class SampleDataRestApplicationTests { .andExpect(status().isOk()) .andExpect(jsonPath("_embedded.cities", hasSize(3))); } + } diff --git a/spring-boot-samples/spring-boot-sample-data-rest/src/test/java/sample/data/rest/service/CityRepositoryIntegrationTests.java b/spring-boot-samples/spring-boot-sample-data-rest/src/test/java/sample/data/rest/service/CityRepositoryIntegrationTests.java index 0dfc3361c3..8ab34eb1fd 100644 --- a/spring-boot-samples/spring-boot-sample-data-rest/src/test/java/sample/data/rest/service/CityRepositoryIntegrationTests.java +++ b/spring-boot-samples/spring-boot-sample-data-rest/src/test/java/sample/data/rest/service/CityRepositoryIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -63,4 +63,5 @@ public class CityRepositoryIntegrationTests { new PageRequest(0, 10)); assertThat(cities.getTotalElements()).isEqualTo(3L); } + } diff --git a/spring-boot-samples/spring-boot-sample-flyway/src/main/java/sample/flyway/Person.java b/spring-boot-samples/spring-boot-sample-flyway/src/main/java/sample/flyway/Person.java index f9c90eae84..a924e5d634 100644 --- a/spring-boot-samples/spring-boot-sample-flyway/src/main/java/sample/flyway/Person.java +++ b/spring-boot-samples/spring-boot-sample-flyway/src/main/java/sample/flyway/Person.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2018 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. @@ -22,10 +22,13 @@ import javax.persistence.Id; @Entity public class Person { + @Id @GeneratedValue private Long id; + private String firstName; + private String lastName; public String getFirstName() { @@ -49,4 +52,5 @@ public class Person { return "Person [firstName=" + this.firstName + ", lastName=" + this.lastName + "]"; } + } diff --git a/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/domain/City.java b/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/domain/City.java index 0e1feeb26b..7b2554353b 100644 --- a/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/domain/City.java +++ b/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/domain/City.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -74,4 +74,5 @@ public class City implements Serializable { public String toString() { return getName() + "," + getState() + "," + getCountry(); } + } diff --git a/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/domain/Hotel.java b/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/domain/Hotel.java index 7cca7fae04..6e425308aa 100644 --- a/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/domain/Hotel.java +++ b/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/domain/Hotel.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -79,4 +79,5 @@ public class Hotel implements Serializable { public String getZip() { return this.zip; } + } diff --git a/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/domain/Rating.java b/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/domain/Rating.java index 51f82422d8..63c2dd368b 100644 --- a/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/domain/Rating.java +++ b/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/domain/Rating.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -17,5 +17,7 @@ package sample.hibernate4.domain; public enum Rating { + TERRIBLE, POOR, AVERAGE, GOOD, EXCELLENT, + } diff --git a/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/domain/Review.java b/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/domain/Review.java index 08a8f21001..3df7547431 100644 --- a/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/domain/Review.java +++ b/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/domain/Review.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -127,4 +127,5 @@ public class Review implements Serializable { public void setDetails(String details) { this.details = details; } + } diff --git a/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/domain/ReviewDetails.java b/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/domain/ReviewDetails.java index 9639909750..26512eaefd 100644 --- a/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/domain/ReviewDetails.java +++ b/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/domain/ReviewDetails.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -75,4 +75,5 @@ public class ReviewDetails implements Serializable { public void setDetails(String details) { this.details = details; } + } diff --git a/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/domain/TripType.java b/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/domain/TripType.java index 5b342e1f86..bb5b47a117 100644 --- a/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/domain/TripType.java +++ b/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/domain/TripType.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -17,5 +17,7 @@ package sample.hibernate4.domain; public enum TripType { + BUSINESS, COUPLES, FAMILY, FRIENDS, SOLO + } diff --git a/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/service/CitySearchCriteria.java b/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/service/CitySearchCriteria.java index 9b356e9822..cfa46cc20c 100644 --- a/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/service/CitySearchCriteria.java +++ b/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/service/CitySearchCriteria.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -41,4 +41,5 @@ public class CitySearchCriteria implements Serializable { public void setName(String name) { this.name = name; } + } diff --git a/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/service/CityServiceImpl.java b/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/service/CityServiceImpl.java index f2ad078a7d..ef5a819fef 100644 --- a/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/service/CityServiceImpl.java +++ b/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/service/CityServiceImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -75,4 +75,5 @@ class CityServiceImpl implements CityService { Assert.notNull(city, "City must not be null"); return this.hotelRepository.findByCity(city, pageable); } + } diff --git a/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/service/HotelServiceImpl.java b/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/service/HotelServiceImpl.java index 65ffdca1c3..8a50c4c0db 100644 --- a/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/service/HotelServiceImpl.java +++ b/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/service/HotelServiceImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -94,5 +94,7 @@ class HotelServiceImpl implements HotelService { Long count = this.ratingCount.get(rating); return count == null ? 0 : count; } + } + } diff --git a/spring-boot-samples/spring-boot-sample-hibernate4/src/test/java/sample/hibernate4/service/CityRepositoryIntegrationTests.java b/spring-boot-samples/spring-boot-sample-hibernate4/src/test/java/sample/hibernate4/service/CityRepositoryIntegrationTests.java index 7e45da7ef3..0f410ae500 100644 --- a/spring-boot-samples/spring-boot-sample-hibernate4/src/test/java/sample/hibernate4/service/CityRepositoryIntegrationTests.java +++ b/spring-boot-samples/spring-boot-sample-hibernate4/src/test/java/sample/hibernate4/service/CityRepositoryIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -45,4 +45,5 @@ public class CityRepositoryIntegrationTests { Page cities = this.repository.findAll(new PageRequest(0, 10)); assertThat(cities.getTotalElements()).isGreaterThan(20L); } + } diff --git a/spring-boot-samples/spring-boot-sample-hibernate4/src/test/java/sample/hibernate4/service/HotelRepositoryIntegrationTests.java b/spring-boot-samples/spring-boot-sample-hibernate4/src/test/java/sample/hibernate4/service/HotelRepositoryIntegrationTests.java index be76a41ff5..64b0198348 100644 --- a/spring-boot-samples/spring-boot-sample-hibernate4/src/test/java/sample/hibernate4/service/HotelRepositoryIntegrationTests.java +++ b/spring-boot-samples/spring-boot-sample-hibernate4/src/test/java/sample/hibernate4/service/HotelRepositoryIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -45,6 +45,7 @@ public class HotelRepositoryIntegrationTests { @Autowired CityRepository cityRepository; + @Autowired HotelRepository repository; @@ -66,4 +67,5 @@ public class HotelRepositoryIntegrationTests { assertThat(counts.get(0).getRating()).isEqualTo(Rating.AVERAGE); assertThat(counts.get(0).getCount()).isGreaterThan(1L); } + } diff --git a/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/domain/City.java b/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/domain/City.java index 4d1de2ae87..d7abf4e734 100644 --- a/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/domain/City.java +++ b/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/domain/City.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -74,4 +74,5 @@ public class City implements Serializable { public String toString() { return getName() + "," + getState() + "," + getCountry(); } + } diff --git a/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/domain/Hotel.java b/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/domain/Hotel.java index d4099b769a..cf33e2c82a 100644 --- a/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/domain/Hotel.java +++ b/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/domain/Hotel.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -79,4 +79,5 @@ public class Hotel implements Serializable { public String getZip() { return this.zip; } + } diff --git a/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/domain/Rating.java b/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/domain/Rating.java index 841b7d39cf..460f0cae56 100644 --- a/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/domain/Rating.java +++ b/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/domain/Rating.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -17,5 +17,7 @@ package sample.hibernate52.domain; public enum Rating { + TERRIBLE, POOR, AVERAGE, GOOD, EXCELLENT, + } diff --git a/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/domain/Review.java b/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/domain/Review.java index 215e8b3c41..526f40dde5 100644 --- a/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/domain/Review.java +++ b/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/domain/Review.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -127,4 +127,5 @@ public class Review implements Serializable { public void setDetails(String details) { this.details = details; } + } diff --git a/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/domain/ReviewDetails.java b/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/domain/ReviewDetails.java index 7448ec7094..b0631efab5 100644 --- a/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/domain/ReviewDetails.java +++ b/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/domain/ReviewDetails.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -75,4 +75,5 @@ public class ReviewDetails implements Serializable { public void setDetails(String details) { this.details = details; } + } diff --git a/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/domain/TripType.java b/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/domain/TripType.java index d5998662e9..b72c4f0892 100644 --- a/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/domain/TripType.java +++ b/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/domain/TripType.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -17,5 +17,7 @@ package sample.hibernate52.domain; public enum TripType { + BUSINESS, COUPLES, FAMILY, FRIENDS, SOLO + } diff --git a/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/service/CitySearchCriteria.java b/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/service/CitySearchCriteria.java index 04c3faab19..165c6ff69d 100644 --- a/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/service/CitySearchCriteria.java +++ b/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/service/CitySearchCriteria.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -41,4 +41,5 @@ public class CitySearchCriteria implements Serializable { public void setName(String name) { this.name = name; } + } diff --git a/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/service/CityServiceImpl.java b/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/service/CityServiceImpl.java index e31c1e8bcc..203364fdce 100644 --- a/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/service/CityServiceImpl.java +++ b/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/service/CityServiceImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -75,4 +75,5 @@ class CityServiceImpl implements CityService { Assert.notNull(city, "City must not be null"); return this.hotelRepository.findByCity(city, pageable); } + } diff --git a/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/service/HotelServiceImpl.java b/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/service/HotelServiceImpl.java index 364688fa78..7f069f39e7 100644 --- a/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/service/HotelServiceImpl.java +++ b/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/service/HotelServiceImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -94,5 +94,7 @@ class HotelServiceImpl implements HotelService { Long count = this.ratingCount.get(rating); return count == null ? 0 : count; } + } + } diff --git a/spring-boot-samples/spring-boot-sample-hibernate52/src/test/java/sample/hibernate52/service/CityRepositoryIntegrationTests.java b/spring-boot-samples/spring-boot-sample-hibernate52/src/test/java/sample/hibernate52/service/CityRepositoryIntegrationTests.java index d5231c64b6..0248a5b9f5 100644 --- a/spring-boot-samples/spring-boot-sample-hibernate52/src/test/java/sample/hibernate52/service/CityRepositoryIntegrationTests.java +++ b/spring-boot-samples/spring-boot-sample-hibernate52/src/test/java/sample/hibernate52/service/CityRepositoryIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -45,4 +45,5 @@ public class CityRepositoryIntegrationTests { Page cities = this.repository.findAll(new PageRequest(0, 10)); assertThat(cities.getTotalElements()).isGreaterThan(20L); } + } diff --git a/spring-boot-samples/spring-boot-sample-hibernate52/src/test/java/sample/hibernate52/service/HotelRepositoryIntegrationTests.java b/spring-boot-samples/spring-boot-sample-hibernate52/src/test/java/sample/hibernate52/service/HotelRepositoryIntegrationTests.java index 065f5d0533..b5a6353df8 100644 --- a/spring-boot-samples/spring-boot-sample-hibernate52/src/test/java/sample/hibernate52/service/HotelRepositoryIntegrationTests.java +++ b/spring-boot-samples/spring-boot-sample-hibernate52/src/test/java/sample/hibernate52/service/HotelRepositoryIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -45,6 +45,7 @@ public class HotelRepositoryIntegrationTests { @Autowired CityRepository cityRepository; + @Autowired HotelRepository repository; @@ -66,4 +67,5 @@ public class HotelRepositoryIntegrationTests { assertThat(counts.get(0).getRating()).isEqualTo(Rating.AVERAGE); assertThat(counts.get(0).getCount()).isGreaterThan(1L); } + } diff --git a/spring-boot-samples/spring-boot-sample-hypermedia-ui-secure/src/test/java/sample/hypermedia/ui/secure/SampleHypermediaUiSecureApplicationTests.java b/spring-boot-samples/spring-boot-sample-hypermedia-ui-secure/src/test/java/sample/hypermedia/ui/secure/SampleHypermediaUiSecureApplicationTests.java index 651f87980f..a9a50061a0 100644 --- a/spring-boot-samples/spring-boot-sample-hypermedia-ui-secure/src/test/java/sample/hypermedia/ui/secure/SampleHypermediaUiSecureApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-hypermedia-ui-secure/src/test/java/sample/hypermedia/ui/secure/SampleHypermediaUiSecureApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -59,4 +59,5 @@ public class SampleHypermediaUiSecureApplicationTests { String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.UNAUTHORIZED); } + } diff --git a/spring-boot-samples/spring-boot-sample-hypermedia-ui/src/main/java/sample/hypermedia/ui/SampleHypermediaUiApplication.java b/spring-boot-samples/spring-boot-sample-hypermedia-ui/src/main/java/sample/hypermedia/ui/SampleHypermediaUiApplication.java index 51f8f89251..6a642fd577 100644 --- a/spring-boot-samples/spring-boot-sample-hypermedia-ui/src/main/java/sample/hypermedia/ui/SampleHypermediaUiApplication.java +++ b/spring-boot-samples/spring-boot-sample-hypermedia-ui/src/main/java/sample/hypermedia/ui/SampleHypermediaUiApplication.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2018 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. @@ -25,4 +25,5 @@ public class SampleHypermediaUiApplication { public static void main(String[] args) { SpringApplication.run(SampleHypermediaUiApplication.class, args); } + } diff --git a/spring-boot-samples/spring-boot-sample-integration/src/test/java/sample/integration/consumer/SampleIntegrationApplicationTests.java b/spring-boot-samples/spring-boot-sample-integration/src/test/java/sample/integration/consumer/SampleIntegrationApplicationTests.java index 76ace128a3..7d2e705a60 100644 --- a/spring-boot-samples/spring-boot-sample-integration/src/test/java/sample/integration/consumer/SampleIntegrationApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-integration/src/test/java/sample/integration/consumer/SampleIntegrationApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -123,4 +123,5 @@ public class SampleIntegrationApplicationTests { } return candidates; } + } diff --git a/spring-boot-samples/spring-boot-sample-jooq/src/main/java/sample/jooq/JooqExamples.java b/spring-boot-samples/spring-boot-sample-jooq/src/main/java/sample/jooq/JooqExamples.java index 3eae4b887d..d6399719a6 100644 --- a/spring-boot-samples/spring-boot-sample-jooq/src/main/java/sample/jooq/JooqExamples.java +++ b/spring-boot-samples/spring-boot-sample-jooq/src/main/java/sample/jooq/JooqExamples.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -76,4 +76,5 @@ public class JooqExamples implements CommandLineRunner { }); System.out.println("jOOQ SQL " + list); } + } diff --git a/spring-boot-samples/spring-boot-sample-liquibase/src/test/java/sample/liquibase/SampleLiquibaseApplicationTests.java b/spring-boot-samples/spring-boot-sample-liquibase/src/test/java/sample/liquibase/SampleLiquibaseApplicationTests.java index 2e490bc0da..8759c38688 100644 --- a/spring-boot-samples/spring-boot-sample-liquibase/src/test/java/sample/liquibase/SampleLiquibaseApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-liquibase/src/test/java/sample/liquibase/SampleLiquibaseApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -68,4 +68,5 @@ public class SampleLiquibaseApplicationTests { } return false; } + } diff --git a/spring-boot-samples/spring-boot-sample-metrics-opentsdb/src/main/java/sample/metrics/opentsdb/SampleController.java b/spring-boot-samples/spring-boot-sample-metrics-opentsdb/src/main/java/sample/metrics/opentsdb/SampleController.java index 4a64b48097..e0a5290135 100644 --- a/spring-boot-samples/spring-boot-sample-metrics-opentsdb/src/main/java/sample/metrics/opentsdb/SampleController.java +++ b/spring-boot-samples/spring-boot-sample-metrics-opentsdb/src/main/java/sample/metrics/opentsdb/SampleController.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -55,6 +55,7 @@ public class SampleController { public void setValue(String value) { this.value = value; } + } } diff --git a/spring-boot-samples/spring-boot-sample-metrics-redis/src/main/java/sample/metrics/redis/SampleController.java b/spring-boot-samples/spring-boot-sample-metrics-redis/src/main/java/sample/metrics/redis/SampleController.java index 0f7ef3ded6..95b56de52a 100644 --- a/spring-boot-samples/spring-boot-sample-metrics-redis/src/main/java/sample/metrics/redis/SampleController.java +++ b/spring-boot-samples/spring-boot-sample-metrics-redis/src/main/java/sample/metrics/redis/SampleController.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -55,6 +55,7 @@ public class SampleController { public void setValue(String value) { this.value = value; } + } } diff --git a/spring-boot-samples/spring-boot-sample-parent-context/src/test/java/sample/parent/consumer/SampleIntegrationParentApplicationTests.java b/spring-boot-samples/spring-boot-sample-parent-context/src/test/java/sample/parent/consumer/SampleIntegrationParentApplicationTests.java index 5251b2f7af..fd094890ad 100644 --- a/spring-boot-samples/spring-boot-sample-parent-context/src/test/java/sample/parent/consumer/SampleIntegrationParentApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-parent-context/src/test/java/sample/parent/consumer/SampleIntegrationParentApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2018 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. @@ -99,4 +99,5 @@ public class SampleIntegrationParentApplicationTests { } return builder.toString(); } + } diff --git a/spring-boot-samples/spring-boot-sample-secure/src/test/java/sample/secure/SampleSecureApplicationTests.java b/spring-boot-samples/spring-boot-sample-secure/src/test/java/sample/secure/SampleSecureApplicationTests.java index cdb339f609..ae83f9b055 100644 --- a/spring-boot-samples/spring-boot-sample-secure/src/test/java/sample/secure/SampleSecureApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-secure/src/test/java/sample/secure/SampleSecureApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -93,6 +93,7 @@ public class SampleSecureApplicationTests { @PropertySource("classpath:test.properties") @Configuration protected static class TestConfiguration { + } } diff --git a/spring-boot-samples/spring-boot-sample-servlet/src/test/java/sample/servlet/SampleServletApplicationTests.java b/spring-boot-samples/spring-boot-sample-servlet/src/test/java/sample/servlet/SampleServletApplicationTests.java index b36fc2653a..1dd809457d 100644 --- a/spring-boot-samples/spring-boot-sample-servlet/src/test/java/sample/servlet/SampleServletApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-servlet/src/test/java/sample/servlet/SampleServletApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -64,4 +64,5 @@ public class SampleServletApplicationTests { private String getPassword() { return this.security.getUser().getPassword(); } + } diff --git a/spring-boot-samples/spring-boot-sample-test/src/main/java/sample/test/service/VehicleIdentificationNumberNotFoundException.java b/spring-boot-samples/spring-boot-sample-test/src/main/java/sample/test/service/VehicleIdentificationNumberNotFoundException.java index cfa7b59047..c43ed67a7f 100644 --- a/spring-boot-samples/spring-boot-sample-test/src/main/java/sample/test/service/VehicleIdentificationNumberNotFoundException.java +++ b/spring-boot-samples/spring-boot-sample-test/src/main/java/sample/test/service/VehicleIdentificationNumberNotFoundException.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -40,4 +40,5 @@ public class VehicleIdentificationNumberNotFoundException extends RuntimeExcepti public VehicleIdentificationNumber getVehicleIdentificationNumber() { return this.vehicleIdentificationNumber; } + } diff --git a/spring-boot-samples/spring-boot-sample-tomcat-multi-connectors/src/test/java/sample/tomcat/multiconnector/SampleTomcatTwoConnectorsApplicationTests.java b/spring-boot-samples/spring-boot-sample-tomcat-multi-connectors/src/test/java/sample/tomcat/multiconnector/SampleTomcatTwoConnectorsApplicationTests.java index 199fda9c51..54fde7d800 100644 --- a/spring-boot-samples/spring-boot-sample-tomcat-multi-connectors/src/test/java/sample/tomcat/multiconnector/SampleTomcatTwoConnectorsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-tomcat-multi-connectors/src/test/java/sample/tomcat/multiconnector/SampleTomcatTwoConnectorsApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -139,6 +139,7 @@ public class SampleTomcatTwoConnectorsApplicationTests { } super.prepareConnection(connection, httpMethod); } + } } diff --git a/spring-boot-samples/spring-boot-sample-traditional/src/main/java/sample/traditional/config/WebConfig.java b/spring-boot-samples/spring-boot-sample-traditional/src/main/java/sample/traditional/config/WebConfig.java index 5f605eb76c..2672d2149c 100644 --- a/spring-boot-samples/spring-boot-sample-traditional/src/main/java/sample/traditional/config/WebConfig.java +++ b/spring-boot-samples/spring-boot-sample-traditional/src/main/java/sample/traditional/config/WebConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2013 the original author or authors. + * Copyright 2012-2018 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. @@ -55,4 +55,5 @@ public class WebConfig extends WebMvcConfigurerAdapter { DefaultServletHandlerConfigurer configurer) { configurer.enable(); } + } diff --git a/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/main/java/sample/groovytemplates/Message.java b/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/main/java/sample/groovytemplates/Message.java index 62d674330f..57bf1d3d1d 100644 --- a/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/main/java/sample/groovytemplates/Message.java +++ b/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/main/java/sample/groovytemplates/Message.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2018 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. @@ -63,4 +63,5 @@ public class Message { public void setSummary(String summary) { this.summary = summary; } + } diff --git a/spring-boot-samples/spring-boot-sample-web-thymeleaf3/src/main/java/sample/web/thymeleaf3/Message.java b/spring-boot-samples/spring-boot-sample-web-thymeleaf3/src/main/java/sample/web/thymeleaf3/Message.java index e73a6cc777..1b554efc33 100644 --- a/spring-boot-samples/spring-boot-sample-web-thymeleaf3/src/main/java/sample/web/thymeleaf3/Message.java +++ b/spring-boot-samples/spring-boot-sample-web-thymeleaf3/src/main/java/sample/web/thymeleaf3/Message.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -66,4 +66,5 @@ public class Message { public void setSummary(String summary) { this.summary = summary; } + } diff --git a/spring-boot-samples/spring-boot-sample-web-thymeleaf3/src/test/java/sample/web/thymeleaf3/MessageControllerWebTests.java b/spring-boot-samples/spring-boot-sample-web-thymeleaf3/src/test/java/sample/web/thymeleaf3/MessageControllerWebTests.java index 9e6e5a9004..e671fa5fa2 100644 --- a/spring-boot-samples/spring-boot-sample-web-thymeleaf3/src/test/java/sample/web/thymeleaf3/MessageControllerWebTests.java +++ b/spring-boot-samples/spring-boot-sample-web-thymeleaf3/src/test/java/sample/web/thymeleaf3/MessageControllerWebTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -81,6 +81,7 @@ public class MessageControllerWebTests { } private static class RegexMatcher extends TypeSafeMatcher { + private final String regex; public RegexMatcher(String regex) { @@ -106,5 +107,7 @@ public class MessageControllerWebTests { description.appendText("a string that matches regex: ") .appendText(this.regex); } + } + } diff --git a/spring-boot-samples/spring-boot-sample-web-ui/src/main/java/sample/web/ui/Message.java b/spring-boot-samples/spring-boot-sample-web-ui/src/main/java/sample/web/ui/Message.java index 75e7ceb838..1310106ea5 100644 --- a/spring-boot-samples/spring-boot-sample-web-ui/src/main/java/sample/web/ui/Message.java +++ b/spring-boot-samples/spring-boot-sample-web-ui/src/main/java/sample/web/ui/Message.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2018 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 @@ -63,4 +63,5 @@ public class Message { public void setSummary(String summary) { this.summary = summary; } + } diff --git a/spring-boot-samples/spring-boot-sample-web-ui/src/test/java/sample/web/ui/MessageControllerWebTests.java b/spring-boot-samples/spring-boot-sample-web-ui/src/test/java/sample/web/ui/MessageControllerWebTests.java index 007e52173e..54585b0ecd 100644 --- a/spring-boot-samples/spring-boot-sample-web-ui/src/test/java/sample/web/ui/MessageControllerWebTests.java +++ b/spring-boot-samples/spring-boot-sample-web-ui/src/test/java/sample/web/ui/MessageControllerWebTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -81,6 +81,7 @@ public class MessageControllerWebTests { } private static class RegexMatcher extends TypeSafeMatcher { + private final String regex; public RegexMatcher(String regex) { @@ -106,5 +107,7 @@ public class MessageControllerWebTests { description.appendText("a string that matches regex: ") .appendText(this.regex); } + } + } diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/reverse/ReverseWebSocketEndpoint.java b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/reverse/ReverseWebSocketEndpoint.java index 049835bd59..76837c7e09 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/reverse/ReverseWebSocketEndpoint.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/reverse/ReverseWebSocketEndpoint.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2018 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. @@ -30,4 +30,5 @@ public class ReverseWebSocketEndpoint { session.getBasicRemote() .sendText("Reversed: " + new StringBuilder(message).reverse()); } + } diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/Direction.java b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/Direction.java index 96871610ff..a1c67ec1db 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/Direction.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/Direction.java @@ -18,5 +18,7 @@ package samples.websocket.jetty.snake; public enum Direction { + NONE, NORTH, SOUTH, EAST, WEST + } diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/Location.java b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/Location.java index f2abe5faeb..aa1f883d35 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/Location.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/Location.java @@ -20,9 +20,13 @@ package samples.websocket.jetty.snake; public class Location { public int x; + public int y; + public static final int GRID_SIZE = 10; + public static final int PLAYFIELD_HEIGHT = 480; + public static final int PLAYFIELD_WIDTH = 640; public Location(int x, int y) { @@ -74,4 +78,5 @@ public class Location { result = 31 * result + this.y; return result; } + } diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/Snake.java b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/Snake.java index a819650835..d281d72b98 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/Snake.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/Snake.java @@ -157,4 +157,5 @@ public class Snake { public String getHexColor() { return this.hexColor; } + } diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/SnakeTimer.java b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/SnakeTimer.java index d78a40ff9e..676e1a2c40 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/SnakeTimer.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/SnakeTimer.java @@ -112,4 +112,5 @@ public class SnakeTimer { gameTimer.cancel(); } } + } diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/SnakeUtils.java b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/SnakeUtils.java index 01e4d7e80b..90aee0f7d0 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/SnakeUtils.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/SnakeUtils.java @@ -23,7 +23,9 @@ import java.util.Random; public class SnakeUtils { public static final int PLAYFIELD_WIDTH = 640; + public static final int PLAYFIELD_HEIGHT = 480; + public static final int GRID_SIZE = 10; private static final Random random = new Random(); diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/SnakeWebSocketHandler.java b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/SnakeWebSocketHandler.java index da2d135182..6e826c7f5b 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/SnakeWebSocketHandler.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/SnakeWebSocketHandler.java @@ -30,13 +30,17 @@ import org.springframework.web.socket.handler.TextWebSocketHandler; public class SnakeWebSocketHandler extends TextWebSocketHandler { public static final int PLAYFIELD_WIDTH = 640; + public static final int PLAYFIELD_HEIGHT = 480; + public static final int GRID_SIZE = 10; private static final AtomicInteger snakeIds = new AtomicInteger(0); + private static final Random random = new Random(); private final int id; + private Snake snake; public static String getRandomHexColor() { @@ -109,4 +113,5 @@ public class SnakeWebSocketHandler extends TextWebSocketHandler { SnakeTimer.broadcast( String.format("{'type': 'leave', 'id': %d}", Integer.valueOf(this.id))); } + } diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/jetty/SampleWebSocketsApplicationTests.java b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/jetty/SampleWebSocketsApplicationTests.java index 134d8767e1..5e07df25d7 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/jetty/SampleWebSocketsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/test/java/samples/websocket/jetty/SampleWebSocketsApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -132,6 +132,7 @@ public class SampleWebSocketsApplicationTests { public GreetingService greetingService() { return new SimpleGreetingService(); } + } } diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/reverse/ReverseWebSocketEndpoint.java b/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/reverse/ReverseWebSocketEndpoint.java index cd032aa70b..dad15e6feb 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/reverse/ReverseWebSocketEndpoint.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/reverse/ReverseWebSocketEndpoint.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -30,4 +30,5 @@ public class ReverseWebSocketEndpoint { session.getBasicRemote() .sendText("Reversed: " + new StringBuilder(message).reverse()); } + } diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/Direction.java b/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/Direction.java index 5b416b780b..4b60b9485b 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/Direction.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/Direction.java @@ -18,5 +18,7 @@ package samples.websocket.jetty93.snake; public enum Direction { + NONE, NORTH, SOUTH, EAST, WEST + } diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/Location.java b/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/Location.java index 4f56cbe7be..c238b9c26e 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/Location.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/Location.java @@ -20,9 +20,13 @@ package samples.websocket.jetty93.snake; public class Location { public int x; + public int y; + public static final int GRID_SIZE = 10; + public static final int PLAYFIELD_HEIGHT = 480; + public static final int PLAYFIELD_WIDTH = 640; public Location(int x, int y) { @@ -74,4 +78,5 @@ public class Location { result = 31 * result + this.y; return result; } + } diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/Snake.java b/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/Snake.java index af9ad2033f..ba179a8b64 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/Snake.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/Snake.java @@ -157,4 +157,5 @@ public class Snake { public String getHexColor() { return this.hexColor; } + } diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/SnakeTimer.java b/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/SnakeTimer.java index 962dfea0e9..7a1502fc93 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/SnakeTimer.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/SnakeTimer.java @@ -112,4 +112,5 @@ public class SnakeTimer { gameTimer.cancel(); } } + } diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/SnakeUtils.java b/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/SnakeUtils.java index 7c25906128..9367d93276 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/SnakeUtils.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/SnakeUtils.java @@ -23,7 +23,9 @@ import java.util.Random; public class SnakeUtils { public static final int PLAYFIELD_WIDTH = 640; + public static final int PLAYFIELD_HEIGHT = 480; + public static final int GRID_SIZE = 10; private static final Random random = new Random(); diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/SnakeWebSocketHandler.java b/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/SnakeWebSocketHandler.java index 3630947367..2c45302c37 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/SnakeWebSocketHandler.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/SnakeWebSocketHandler.java @@ -30,13 +30,17 @@ import org.springframework.web.socket.handler.TextWebSocketHandler; public class SnakeWebSocketHandler extends TextWebSocketHandler { public static final int PLAYFIELD_WIDTH = 640; + public static final int PLAYFIELD_HEIGHT = 480; + public static final int GRID_SIZE = 10; private static final AtomicInteger snakeIds = new AtomicInteger(0); + private static final Random random = new Random(); private final int id; + private Snake snake; public static String getRandomHexColor() { @@ -109,4 +113,5 @@ public class SnakeWebSocketHandler extends TextWebSocketHandler { SnakeTimer.broadcast( String.format("{'type': 'leave', 'id': %d}", Integer.valueOf(this.id))); } + } diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/test/java/samples/websocket/jetty93/SampleWebSocketsApplicationTests.java b/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/test/java/samples/websocket/jetty93/SampleWebSocketsApplicationTests.java index 6e2cac26e7..c2f4b31ad1 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/test/java/samples/websocket/jetty93/SampleWebSocketsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/test/java/samples/websocket/jetty93/SampleWebSocketsApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -132,6 +132,7 @@ public class SampleWebSocketsApplicationTests { public GreetingService greetingService() { return new SimpleGreetingService(); } + } } diff --git a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/reverse/ReverseWebSocketEndpoint.java b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/reverse/ReverseWebSocketEndpoint.java index f0fb893dae..9911653e30 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/reverse/ReverseWebSocketEndpoint.java +++ b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/reverse/ReverseWebSocketEndpoint.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2018 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. @@ -30,4 +30,5 @@ public class ReverseWebSocketEndpoint { session.getBasicRemote() .sendText("Reversed: " + new StringBuilder(message).reverse()); } + } diff --git a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/Direction.java b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/Direction.java index bd2c2e71b9..83739039e7 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/Direction.java +++ b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/Direction.java @@ -18,5 +18,7 @@ package samples.websocket.tomcat.snake; public enum Direction { + NONE, NORTH, SOUTH, EAST, WEST + } diff --git a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/Location.java b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/Location.java index 2d86ff41ba..8879da0bef 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/Location.java +++ b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/Location.java @@ -20,9 +20,13 @@ package samples.websocket.tomcat.snake; public class Location { public int x; + public int y; + public static final int GRID_SIZE = 10; + public static final int PLAYFIELD_HEIGHT = 480; + public static final int PLAYFIELD_WIDTH = 640; public Location(int x, int y) { @@ -74,4 +78,5 @@ public class Location { result = 31 * result + this.y; return result; } + } diff --git a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/Snake.java b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/Snake.java index ce0eec69d8..628b4b2ca9 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/Snake.java +++ b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/Snake.java @@ -157,4 +157,5 @@ public class Snake { public String getHexColor() { return this.hexColor; } + } diff --git a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/SnakeTimer.java b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/SnakeTimer.java index 07f5ecc558..3aa50ce6cc 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/SnakeTimer.java +++ b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/SnakeTimer.java @@ -112,4 +112,5 @@ public class SnakeTimer { gameTimer.cancel(); } } + } diff --git a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/SnakeUtils.java b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/SnakeUtils.java index f6ae703060..872716fb30 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/SnakeUtils.java +++ b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/SnakeUtils.java @@ -23,7 +23,9 @@ import java.util.Random; public class SnakeUtils { public static final int PLAYFIELD_WIDTH = 640; + public static final int PLAYFIELD_HEIGHT = 480; + public static final int GRID_SIZE = 10; private static final Random random = new Random(); diff --git a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/SnakeWebSocketHandler.java b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/SnakeWebSocketHandler.java index 8bdd45e3bc..a8e7d3e94d 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/SnakeWebSocketHandler.java +++ b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/SnakeWebSocketHandler.java @@ -30,13 +30,17 @@ import org.springframework.web.socket.handler.TextWebSocketHandler; public class SnakeWebSocketHandler extends TextWebSocketHandler { public static final int PLAYFIELD_WIDTH = 640; + public static final int PLAYFIELD_HEIGHT = 480; + public static final int GRID_SIZE = 10; private static final AtomicInteger snakeIds = new AtomicInteger(0); + private static final Random random = new Random(); private final int id; + private Snake snake; public static String getRandomHexColor() { @@ -109,4 +113,5 @@ public class SnakeWebSocketHandler extends TextWebSocketHandler { SnakeTimer.broadcast( String.format("{'type': 'leave', 'id': %d}", Integer.valueOf(this.id))); } + } diff --git a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/tomcat/snake/SnakeTimerTests.java b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/tomcat/snake/SnakeTimerTests.java index c204d1c006..a51187bae6 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/tomcat/snake/SnakeTimerTests.java +++ b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/test/java/samples/websocket/tomcat/snake/SnakeTimerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -36,4 +36,5 @@ public class SnakeTimerTests { SnakeTimer.broadcast(""); assertThat(SnakeTimer.getSnakes()).hasSize(0); } + } diff --git a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/reverse/ReverseWebSocketEndpoint.java b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/reverse/ReverseWebSocketEndpoint.java index 5b9421366a..6512fed42b 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/reverse/ReverseWebSocketEndpoint.java +++ b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/reverse/ReverseWebSocketEndpoint.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2018 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. @@ -30,4 +30,5 @@ public class ReverseWebSocketEndpoint { session.getBasicRemote() .sendText("Reversed: " + new StringBuilder(message).reverse()); } + } diff --git a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/Direction.java b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/Direction.java index c3542eaa99..88eaa4c6dc 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/Direction.java +++ b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/Direction.java @@ -18,5 +18,7 @@ package samples.websocket.undertow.snake; public enum Direction { + NONE, NORTH, SOUTH, EAST, WEST + } diff --git a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/Location.java b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/Location.java index ffe1e2dde2..28ece3d755 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/Location.java +++ b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/Location.java @@ -20,9 +20,13 @@ package samples.websocket.undertow.snake; public class Location { public int x; + public int y; + public static final int GRID_SIZE = 10; + public static final int PLAYFIELD_HEIGHT = 480; + public static final int PLAYFIELD_WIDTH = 640; public Location(int x, int y) { @@ -74,4 +78,5 @@ public class Location { result = 31 * result + this.y; return result; } + } diff --git a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/Snake.java b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/Snake.java index ba95f12688..d8bbc488cf 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/Snake.java +++ b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/Snake.java @@ -157,4 +157,5 @@ public class Snake { public String getHexColor() { return this.hexColor; } + } diff --git a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/SnakeTimer.java b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/SnakeTimer.java index 3f76cbe03a..3d95c06aa4 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/SnakeTimer.java +++ b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/SnakeTimer.java @@ -112,4 +112,5 @@ public class SnakeTimer { gameTimer.cancel(); } } + } diff --git a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/SnakeUtils.java b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/SnakeUtils.java index 7fab90d8a1..956f2327a1 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/SnakeUtils.java +++ b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/SnakeUtils.java @@ -23,7 +23,9 @@ import java.util.Random; public class SnakeUtils { public static final int PLAYFIELD_WIDTH = 640; + public static final int PLAYFIELD_HEIGHT = 480; + public static final int GRID_SIZE = 10; private static final Random random = new Random(); diff --git a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/SnakeWebSocketHandler.java b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/SnakeWebSocketHandler.java index 30557bdfb8..d7396d83e5 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/SnakeWebSocketHandler.java +++ b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/SnakeWebSocketHandler.java @@ -30,13 +30,17 @@ import org.springframework.web.socket.handler.TextWebSocketHandler; public class SnakeWebSocketHandler extends TextWebSocketHandler { public static final int PLAYFIELD_WIDTH = 640; + public static final int PLAYFIELD_HEIGHT = 480; + public static final int GRID_SIZE = 10; private static final AtomicInteger snakeIds = new AtomicInteger(0); + private static final Random random = new Random(); private final int id; + private Snake snake; public static String getRandomHexColor() { @@ -109,4 +113,5 @@ public class SnakeWebSocketHandler extends TextWebSocketHandler { SnakeTimer.broadcast( String.format("{'type': 'leave', 'id': %d}", Integer.valueOf(this.id))); } + } diff --git a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/undertow/snake/SnakeTimerTests.java b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/undertow/snake/SnakeTimerTests.java index 173353dc5d..17d5ef3012 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/undertow/snake/SnakeTimerTests.java +++ b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/test/java/samples/websocket/undertow/snake/SnakeTimerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -36,4 +36,5 @@ public class SnakeTimerTests { SnakeTimer.broadcast(""); assertThat(SnakeTimer.getSnakes()).hasSize(0); } + } From e69296d7d37ed9535cdfb96f0ab0e0dc63438a8e Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Fri, 25 May 2018 15:57:29 -0700 Subject: [PATCH 2/2] Fix checkstyle violations in samples --- .../checkstyle/checkstyle-suppressions.xml | 7 ++-- .../src/main/resources/application.properties | 3 +- .../src/main/resources/application.properties | 2 +- .../resources/application-cors.properties | 2 +- .../application-endpoints.properties | 2 +- .../sample/ant/SampleAntApplicationIT.java | 5 +-- .../src/test/resources/application.properties | 2 +- .../src/main/resources/application.properties | 2 +- .../SampleAtmosphereApplication.java | 10 +++--- .../main/java/sample/cache/SampleClient.java | 4 +-- .../main/java/sample/layout/SampleLayout.java | 6 ++-- .../data/cassandra/CustomerRepository.java | 6 ++-- .../elasticsearch/CustomerRepository.java | 6 ++-- .../data/jpa/service/CityServiceImpl.java | 3 +- .../data/jpa/service/HotelServiceImpl.java | 7 ++-- .../resources/application-scratch.properties | 2 +- .../main/java/sample/data/mongo/Customer.java | 4 +-- .../src/main/resources/application.properties | 0 .../main/java/sample/data/neo4j/Customer.java | 4 +-- .../sample/data/neo4j/CustomerRepository.java | 6 ++-- .../src/main/resources/application.properties | 0 .../neo4j/SampleNeo4jApplicationTests.java | 7 ++-- .../src/main/resources/application.properties | 2 +- .../main/java/sample/devtools/Message.java | 10 ++++-- .../src/main/resources/application.properties | 4 +-- .../hibernate4/service/CityServiceImpl.java | 3 +- .../hibernate4/service/HotelServiceImpl.java | 7 ++-- .../resources/application-scratch.properties | 2 +- .../hibernate52/service/CityServiceImpl.java | 3 +- .../hibernate52/service/HotelServiceImpl.java | 7 ++-- .../resources/application-scratch.properties | 2 +- .../src/main/resources/application.properties | 3 +- .../src/main/resources/application.properties | 2 +- .../src/main/resources/application.properties | 3 +- .../src/main/resources/application.properties | 3 +- .../src/main/resources/application.properties | 0 .../src/main/resources/application.properties | 2 +- .../src/main/resources/application.properties | 2 +- .../src/main/resources/application.properties | 2 +- .../src/main/resources/application.properties | 2 +- .../src/main/resources/application.properties | 2 +- .../src/main/resources/application.properties | 3 +- .../src/main/resources/application.properties | 2 +- .../SampleParentContextApplication.java | 12 +++---- .../src/main/resources/application.properties | 2 +- .../profile/service/MessageService.java | 5 +-- .../src/main/resources/application.properties | 2 +- ...SampleSecureOAuth2ActuatorApplication.java | 4 +-- ...eSecureOAuth2ActuatorApplicationTests.java | 7 ++-- .../sample/secure/oauth2/resource/Flight.java | 4 +-- .../oauth2/resource/FlightRepository.java | 4 +-- ...eSecureOAuth2ResourceApplicationTests.java | 9 ++--- .../java/sample/secure/oauth2/Flight.java | 4 +-- .../secure/oauth2/FlightRepository.java | 4 +-- .../SampleSecureOAuth2ApplicationTests.java | 7 ++-- .../java/sample/secure/SampleService.java | 6 +--- .../src/main/resources/application.properties | 2 +- .../src/test/resources/test.properties | 2 +- ...IdentificationNumberNotFoundException.java | 2 +- .../test/web/UserNameNotFoundException.java | 4 +-- .../src/main/resources/application.properties | 2 +- .../SampleTomcatTwoConnectorsApplication.java | 4 +-- ...leTomcatTwoConnectorsApplicationTests.java | 2 +- ...igurationSampleTomcatApplicationTests.java | 16 ++++----- .../src/main/resources/application.properties | 2 +- .../src/main/resources/application.properties | 2 +- .../src/main/resources/application.properties | 2 +- .../java/sample/war/SampleWarApplication.java | 7 ++-- .../src/main/resources/application.properties | 2 +- .../src/main/resources/application.properties | 2 +- .../MessageControllerWebTests.java | 12 +++---- .../src/main/resources/application.properties | 2 +- .../SampleMethodSecurityApplication.java | 22 ++++++------ .../src/main/resources/application.properties | 2 +- .../src/main/resources/application.properties | 2 +- .../src/main/resources/application.properties | 2 +- .../src/main/resources/application.properties | 2 +- .../src/main/resources/application.properties | 2 +- .../thymeleaf3/InMemoryMessageRepository.java | 5 +-- .../java/sample/web/thymeleaf3/Message.java | 3 -- .../web/thymeleaf3/MessageRepository.java | 5 +-- .../web/thymeleaf3/mvc/MessageController.java | 10 ++---- .../thymeleaf3/MessageControllerWebTests.java | 10 +++--- .../web/ui/InMemoryMessageRepository.java | 5 +-- .../src/main/java/sample/web/ui/Message.java | 16 ++++----- .../java/sample/web/ui/MessageRepository.java | 18 +++++----- .../sample/web/ui/mvc/MessageController.java | 10 ++---- .../src/main/resources/application.properties | 2 +- .../web/ui/MessageControllerWebTests.java | 10 +++--- .../jetty/echo/DefaultEchoService.java | 4 +-- .../websocket/jetty/snake/Direction.java | 11 +++--- .../websocket/jetty/snake/Location.java | 34 ++++++++----------- .../samples/websocket/jetty/snake/Snake.java | 11 +++--- .../websocket/jetty/snake/SnakeTimer.java | 16 +++++---- .../websocket/jetty/snake/SnakeUtils.java | 25 ++++++++++---- .../jetty/snake/SnakeWebSocketHandler.java | 27 ++++++--------- .../jetty93/echo/DefaultEchoService.java | 4 +-- .../websocket/jetty93/snake/Direction.java | 11 +++--- .../websocket/jetty93/snake/Location.java | 34 ++++++++----------- .../websocket/jetty93/snake/Snake.java | 11 +++--- .../websocket/jetty93/snake/SnakeTimer.java | 16 +++++---- .../websocket/jetty93/snake/SnakeUtils.java | 25 ++++++++++---- .../jetty93/snake/SnakeWebSocketHandler.java | 27 ++++++--------- .../tomcat/echo/DefaultEchoService.java | 4 +-- .../websocket/tomcat/snake/Direction.java | 11 +++--- .../websocket/tomcat/snake/Location.java | 34 ++++++++----------- .../samples/websocket/tomcat/snake/Snake.java | 11 +++--- .../websocket/tomcat/snake/SnakeTimer.java | 22 ++++++------ .../websocket/tomcat/snake/SnakeUtils.java | 25 ++++++++++---- .../tomcat/snake/SnakeWebSocketHandler.java | 27 ++++++--------- .../undertow/echo/DefaultEchoService.java | 4 +-- .../websocket/undertow/snake/Direction.java | 11 +++--- .../websocket/undertow/snake/Location.java | 34 ++++++++----------- .../websocket/undertow/snake/Snake.java | 11 +++--- .../websocket/undertow/snake/SnakeTimer.java | 16 +++++---- .../websocket/undertow/snake/SnakeUtils.java | 25 ++++++++++---- .../undertow/snake/SnakeWebSocketHandler.java | 27 ++++++--------- 117 files changed, 453 insertions(+), 482 deletions(-) delete mode 100644 spring-boot-samples/spring-boot-sample-data-mongodb/src/main/resources/application.properties delete mode 100644 spring-boot-samples/spring-boot-sample-data-neo4j/src/main/resources/application.properties delete mode 100644 spring-boot-samples/spring-boot-sample-jersey1/src/main/resources/application.properties diff --git a/spring-boot-parent/src/checkstyle/checkstyle-suppressions.xml b/spring-boot-parent/src/checkstyle/checkstyle-suppressions.xml index bc589ec0da..180e593695 100644 --- a/spring-boot-parent/src/checkstyle/checkstyle-suppressions.xml +++ b/spring-boot-parent/src/checkstyle/checkstyle-suppressions.xml @@ -5,8 +5,7 @@ - - + @@ -23,4 +22,8 @@ + + + + diff --git a/spring-boot-samples/spring-boot-sample-actuator-log4j2/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-actuator-log4j2/src/main/resources/application.properties index efe0d6cd97..424db250f4 100644 --- a/spring-boot-samples/spring-boot-sample-actuator-log4j2/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-actuator-log4j2/src/main/resources/application.properties @@ -1,3 +1,2 @@ endpoints.shutdown.enabled=true - -management.security.enabled=false \ No newline at end of file +management.security.enabled=false diff --git a/spring-boot-samples/spring-boot-sample-actuator-ui/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-actuator-ui/src/main/resources/application.properties index 4b4a816113..3a89595752 100644 --- a/spring-boot-samples/spring-boot-sample-actuator-ui/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-actuator-ui/src/main/resources/application.properties @@ -1 +1 @@ -health.diskspace.enabled=false \ No newline at end of file +health.diskspace.enabled=false diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/resources/application-cors.properties b/spring-boot-samples/spring-boot-sample-actuator/src/test/resources/application-cors.properties index 2bfb6b6cdb..570057b576 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/resources/application-cors.properties +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/resources/application-cors.properties @@ -1,2 +1,2 @@ endpoints.cors.allowed-origins=http://localhost:8080 -endpoints.cors.allowed-methods=GET \ No newline at end of file +endpoints.cors.allowed-methods=GET diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/resources/application-endpoints.properties b/spring-boot-samples/spring-boot-sample-actuator/src/test/resources/application-endpoints.properties index 9803d5a610..176070331d 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/resources/application-endpoints.properties +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/resources/application-endpoints.properties @@ -1,3 +1,3 @@ server.error.path: /oops management.context-path: /admin -endpoints.health.sensitive: false \ No newline at end of file +endpoints.health.sensitive: false diff --git a/spring-boot-samples/spring-boot-sample-ant/src/test/java/sample/ant/SampleAntApplicationIT.java b/spring-boot-samples/spring-boot-sample-ant/src/test/java/sample/ant/SampleAntApplicationIT.java index 8dba95357b..8fe33752ac 100644 --- a/spring-boot-samples/spring-boot-sample-ant/src/test/java/sample/ant/SampleAntApplicationIT.java +++ b/spring-boot-samples/spring-boot-sample-ant/src/test/java/sample/ant/SampleAntApplicationIT.java @@ -16,17 +16,18 @@ package sample.ant; -import static org.assertj.core.api.Assertions.assertThat; - import java.io.File; import java.io.FileFilter; import java.io.InputStreamReader; import java.util.concurrent.TimeUnit; import org.junit.Test; + import org.springframework.boot.loader.tools.JavaExecutable; import org.springframework.util.FileCopyUtils; +import static org.assertj.core.api.Assertions.assertThat; + /** * Integration Tests for {@code SampleAntApplication}. * diff --git a/spring-boot-samples/spring-boot-sample-ant/src/test/resources/application.properties b/spring-boot-samples/spring-boot-sample-ant/src/test/resources/application.properties index 4dfe84cedc..b04cdc39b5 100644 --- a/spring-boot-samples/spring-boot-sample-ant/src/test/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-ant/src/test/resources/application.properties @@ -1 +1 @@ -name: Phil \ No newline at end of file +name: Phil diff --git a/spring-boot-samples/spring-boot-sample-aop/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-aop/src/main/resources/application.properties index 4dfe84cedc..b04cdc39b5 100644 --- a/spring-boot-samples/spring-boot-sample-aop/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-aop/src/main/resources/application.properties @@ -1 +1 @@ -name: Phil \ No newline at end of file +name: Phil diff --git a/spring-boot-samples/spring-boot-sample-atmosphere/src/main/java/sample/atmosphere/SampleAtmosphereApplication.java b/spring-boot-samples/spring-boot-sample-atmosphere/src/main/java/sample/atmosphere/SampleAtmosphereApplication.java index b38cd46d23..100565d480 100644 --- a/spring-boot-samples/spring-boot-sample-atmosphere/src/main/java/sample/atmosphere/SampleAtmosphereApplication.java +++ b/spring-boot-samples/spring-boot-sample-atmosphere/src/main/java/sample/atmosphere/SampleAtmosphereApplication.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -59,6 +59,10 @@ public class SampleAtmosphereApplication { return registration; } + public static void main(String[] args) throws Exception { + SpringApplication.run(SampleAtmosphereApplication.class, args); + } + @Configuration static class MvcConfiguration extends WebMvcConfigurerAdapter { @@ -79,8 +83,4 @@ public class SampleAtmosphereApplication { } - public static void main(String[] args) throws Exception { - SpringApplication.run(SampleAtmosphereApplication.class, args); - } - } diff --git a/spring-boot-samples/spring-boot-sample-cache/src/main/java/sample/cache/SampleClient.java b/spring-boot-samples/spring-boot-sample-cache/src/main/java/sample/cache/SampleClient.java index b3c27a3a4f..8703725c55 100644 --- a/spring-boot-samples/spring-boot-sample-cache/src/main/java/sample/cache/SampleClient.java +++ b/spring-boot-samples/spring-boot-sample-cache/src/main/java/sample/cache/SampleClient.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -53,7 +53,7 @@ class SampleClient { private final Random random; - public SampleClient(CountryRepository countryService) { + SampleClient(CountryRepository countryService) { this.countryService = countryService; this.random = new Random(); } diff --git a/spring-boot-samples/spring-boot-sample-custom-layout/src/main/java/sample/layout/SampleLayout.java b/spring-boot-samples/spring-boot-sample-custom-layout/src/main/java/sample/layout/SampleLayout.java index ce993bf9b4..8c9b8b729f 100644 --- a/spring-boot-samples/spring-boot-sample-custom-layout/src/main/java/sample/layout/SampleLayout.java +++ b/spring-boot-samples/spring-boot-sample-custom-layout/src/main/java/sample/layout/SampleLayout.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -24,7 +24,9 @@ import org.springframework.boot.loader.tools.Layouts; import org.springframework.boot.loader.tools.LoaderClassesWriter; /** - * @author pwebb + * An example layout. + * + * @author Phillip Webb */ public class SampleLayout extends Layouts.Jar implements CustomLoaderLayout { diff --git a/spring-boot-samples/spring-boot-sample-data-cassandra/src/main/java/sample/data/cassandra/CustomerRepository.java b/spring-boot-samples/spring-boot-sample-data-cassandra/src/main/java/sample/data/cassandra/CustomerRepository.java index 55eb59c456..8c4b317d8e 100644 --- a/spring-boot-samples/spring-boot-sample-data-cassandra/src/main/java/sample/data/cassandra/CustomerRepository.java +++ b/spring-boot-samples/spring-boot-sample-data-cassandra/src/main/java/sample/data/cassandra/CustomerRepository.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2013 the original author or authors. + * Copyright 2012-2018 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. @@ -24,9 +24,9 @@ import org.springframework.data.repository.CrudRepository; public interface CustomerRepository extends CrudRepository { @Query("Select * from customer where firstname=?0") - public Customer findByFirstName(String firstName); + Customer findByFirstName(String firstName); @Query("Select * from customer where lastname=?0") - public List findByLastName(String lastName); + List findByLastName(String lastName); } diff --git a/spring-boot-samples/spring-boot-sample-data-elasticsearch/src/main/java/sample/data/elasticsearch/CustomerRepository.java b/spring-boot-samples/spring-boot-sample-data-elasticsearch/src/main/java/sample/data/elasticsearch/CustomerRepository.java index 295768e7ec..7c95b50a46 100644 --- a/spring-boot-samples/spring-boot-sample-data-elasticsearch/src/main/java/sample/data/elasticsearch/CustomerRepository.java +++ b/spring-boot-samples/spring-boot-sample-data-elasticsearch/src/main/java/sample/data/elasticsearch/CustomerRepository.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2013 the original author or authors. + * Copyright 2012-2018 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. @@ -22,8 +22,8 @@ import org.springframework.data.elasticsearch.repository.ElasticsearchRepository public interface CustomerRepository extends ElasticsearchRepository { - public Customer findByFirstName(String firstName); + Customer findByFirstName(String firstName); - public List findByLastName(String lastName); + List findByLastName(String lastName); } diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/CityServiceImpl.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/CityServiceImpl.java index 51884556a7..6e57098b4a 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/CityServiceImpl.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/CityServiceImpl.java @@ -34,8 +34,7 @@ class CityServiceImpl implements CityService { private final HotelRepository hotelRepository; - public CityServiceImpl(CityRepository cityRepository, - HotelRepository hotelRepository) { + CityServiceImpl(CityRepository cityRepository, HotelRepository hotelRepository) { this.cityRepository = cityRepository; this.hotelRepository = hotelRepository; } diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/HotelServiceImpl.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/HotelServiceImpl.java index 0494bf980b..e575741f23 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/HotelServiceImpl.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/sample/data/jpa/service/HotelServiceImpl.java @@ -41,8 +41,7 @@ class HotelServiceImpl implements HotelService { private final ReviewRepository reviewRepository; - public HotelServiceImpl(HotelRepository hotelRepository, - ReviewRepository reviewRepository) { + HotelServiceImpl(HotelRepository hotelRepository, ReviewRepository reviewRepository) { this.hotelRepository = hotelRepository; this.reviewRepository = reviewRepository; } @@ -82,7 +81,7 @@ class HotelServiceImpl implements HotelService { private final Map ratingCount; - public ReviewsSummaryImpl(List ratingCounts) { + ReviewsSummaryImpl(List ratingCounts) { this.ratingCount = new HashMap(); for (RatingCount ratingCount : ratingCounts) { this.ratingCount.put(ratingCount.getRating(), ratingCount.getCount()); @@ -92,7 +91,7 @@ class HotelServiceImpl implements HotelService { @Override public long getNumberOfReviewsWithRating(Rating rating) { Long count = this.ratingCount.get(rating); - return count == null ? 0 : count; + return (count != null ? count : 0); } } diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/test/resources/application-scratch.properties b/spring-boot-samples/spring-boot-sample-data-jpa/src/test/resources/application-scratch.properties index 782bef1f1a..151dd486c1 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/test/resources/application-scratch.properties +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/test/resources/application-scratch.properties @@ -1,2 +1,2 @@ spring.datasource.name=scratchdb -spring.jmx.default-domain=jpa.sample \ No newline at end of file +spring.jmx.default-domain=jpa.sample diff --git a/spring-boot-samples/spring-boot-sample-data-mongodb/src/main/java/sample/data/mongo/Customer.java b/spring-boot-samples/spring-boot-sample-data-mongodb/src/main/java/sample/data/mongo/Customer.java index a6ed82d6d5..f701e36368 100644 --- a/spring-boot-samples/spring-boot-sample-data-mongodb/src/main/java/sample/data/mongo/Customer.java +++ b/spring-boot-samples/spring-boot-sample-data-mongodb/src/main/java/sample/data/mongo/Customer.java @@ -37,8 +37,8 @@ public class Customer { @Override public String toString() { - return String.format("Customer[id=%s, firstName='%s', lastName='%s']", id, - firstName, lastName); + return String.format("Customer[id=%s, firstName='%s', lastName='%s']", this.id, + this.firstName, this.lastName); } } diff --git a/spring-boot-samples/spring-boot-sample-data-mongodb/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-data-mongodb/src/main/resources/application.properties deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/spring-boot-samples/spring-boot-sample-data-neo4j/src/main/java/sample/data/neo4j/Customer.java b/spring-boot-samples/spring-boot-sample-data-neo4j/src/main/java/sample/data/neo4j/Customer.java index d48a9818cc..8724d8aece 100644 --- a/spring-boot-samples/spring-boot-sample-data-neo4j/src/main/java/sample/data/neo4j/Customer.java +++ b/spring-boot-samples/spring-boot-sample-data-neo4j/src/main/java/sample/data/neo4j/Customer.java @@ -39,8 +39,8 @@ public class Customer { @Override public String toString() { - return String.format("Customer[id=%s, firstName='%s', lastName='%s']", id, - firstName, lastName); + return String.format("Customer[id=%s, firstName='%s', lastName='%s']", this.id, + this.firstName, this.lastName); } } diff --git a/spring-boot-samples/spring-boot-sample-data-neo4j/src/main/java/sample/data/neo4j/CustomerRepository.java b/spring-boot-samples/spring-boot-sample-data-neo4j/src/main/java/sample/data/neo4j/CustomerRepository.java index bff25dddcf..187d26732f 100644 --- a/spring-boot-samples/spring-boot-sample-data-neo4j/src/main/java/sample/data/neo4j/CustomerRepository.java +++ b/spring-boot-samples/spring-boot-sample-data-neo4j/src/main/java/sample/data/neo4j/CustomerRepository.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -22,8 +22,8 @@ import org.springframework.data.neo4j.repository.GraphRepository; public interface CustomerRepository extends GraphRepository { - public Customer findByFirstName(String firstName); + Customer findByFirstName(String firstName); - public List findByLastName(String lastName); + List findByLastName(String lastName); } diff --git a/spring-boot-samples/spring-boot-sample-data-neo4j/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-data-neo4j/src/main/resources/application.properties deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/spring-boot-samples/spring-boot-sample-data-neo4j/src/test/java/sample/data/neo4j/SampleNeo4jApplicationTests.java b/spring-boot-samples/spring-boot-sample-data-neo4j/src/test/java/sample/data/neo4j/SampleNeo4jApplicationTests.java index 728fde7ce1..cf256ee8f4 100644 --- a/spring-boot-samples/spring-boot-sample-data-neo4j/src/test/java/sample/data/neo4j/SampleNeo4jApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-data-neo4j/src/test/java/sample/data/neo4j/SampleNeo4jApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -23,7 +23,7 @@ import org.junit.Test; import org.springframework.boot.test.rule.OutputCapture; -import static org.junit.Assert.assertTrue; +import static org.assertj.core.api.Assertions.assertThat; /** * Tests for {@link SampleNeo4jApplication}. @@ -46,8 +46,7 @@ public class SampleNeo4jApplicationTests { } } String output = this.outputCapture.toString(); - assertTrue("Wrong output: " + output, - output.contains("firstName='Alice', lastName='Smith'")); + assertThat(output).contains("firstName='Alice', lastName='Smith'"); } private boolean neo4jServerRunning(Throwable ex) { diff --git a/spring-boot-samples/spring-boot-sample-data-rest/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-data-rest/src/main/resources/application.properties index d329a65ebd..6846da4e63 100644 --- a/spring-boot-samples/spring-boot-sample-data-rest/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-data-rest/src/main/resources/application.properties @@ -1 +1 @@ -spring.data.rest.base-path=/api \ No newline at end of file +spring.data.rest.base-path=/api diff --git a/spring-boot-samples/spring-boot-sample-devtools/src/main/java/sample/devtools/Message.java b/spring-boot-samples/spring-boot-sample-devtools/src/main/java/sample/devtools/Message.java index ea16b5c136..24340365ed 100644 --- a/spring-boot-samples/spring-boot-sample-devtools/src/main/java/sample/devtools/Message.java +++ b/spring-boot-samples/spring-boot-sample-devtools/src/main/java/sample/devtools/Message.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2018 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. @@ -16,8 +16,14 @@ package sample.devtools; -public class Message { +public final class Message { + /** + * Sample message. + */ public static String MESSAGE = "Message"; + private Message() { + } + } 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 4c1570d1be..5262186a2b 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,5 +1,3 @@ management.security.enabled=false - spring.jpa.hibernate.ddl-auto=validate - -spring.h2.console.enabled=true \ No newline at end of file +spring.h2.console.enabled=true diff --git a/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/service/CityServiceImpl.java b/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/service/CityServiceImpl.java index ef5a819fef..5a1d76dff1 100644 --- a/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/service/CityServiceImpl.java +++ b/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/service/CityServiceImpl.java @@ -34,8 +34,7 @@ class CityServiceImpl implements CityService { private final HotelRepository hotelRepository; - public CityServiceImpl(CityRepository cityRepository, - HotelRepository hotelRepository) { + CityServiceImpl(CityRepository cityRepository, HotelRepository hotelRepository) { this.cityRepository = cityRepository; this.hotelRepository = hotelRepository; } diff --git a/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/service/HotelServiceImpl.java b/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/service/HotelServiceImpl.java index 8a50c4c0db..e42947f1db 100644 --- a/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/service/HotelServiceImpl.java +++ b/spring-boot-samples/spring-boot-sample-hibernate4/src/main/java/sample/hibernate4/service/HotelServiceImpl.java @@ -41,8 +41,7 @@ class HotelServiceImpl implements HotelService { private final ReviewRepository reviewRepository; - public HotelServiceImpl(HotelRepository hotelRepository, - ReviewRepository reviewRepository) { + HotelServiceImpl(HotelRepository hotelRepository, ReviewRepository reviewRepository) { this.hotelRepository = hotelRepository; this.reviewRepository = reviewRepository; } @@ -82,7 +81,7 @@ class HotelServiceImpl implements HotelService { private final Map ratingCount; - public ReviewsSummaryImpl(List ratingCounts) { + ReviewsSummaryImpl(List ratingCounts) { this.ratingCount = new HashMap(); for (RatingCount ratingCount : ratingCounts) { this.ratingCount.put(ratingCount.getRating(), ratingCount.getCount()); @@ -92,7 +91,7 @@ class HotelServiceImpl implements HotelService { @Override public long getNumberOfReviewsWithRating(Rating rating) { Long count = this.ratingCount.get(rating); - return count == null ? 0 : count; + return (count != null ? count : 0); } } diff --git a/spring-boot-samples/spring-boot-sample-hibernate4/src/test/resources/application-scratch.properties b/spring-boot-samples/spring-boot-sample-hibernate4/src/test/resources/application-scratch.properties index 782bef1f1a..151dd486c1 100644 --- a/spring-boot-samples/spring-boot-sample-hibernate4/src/test/resources/application-scratch.properties +++ b/spring-boot-samples/spring-boot-sample-hibernate4/src/test/resources/application-scratch.properties @@ -1,2 +1,2 @@ spring.datasource.name=scratchdb -spring.jmx.default-domain=jpa.sample \ No newline at end of file +spring.jmx.default-domain=jpa.sample diff --git a/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/service/CityServiceImpl.java b/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/service/CityServiceImpl.java index 203364fdce..bb98f01b6a 100644 --- a/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/service/CityServiceImpl.java +++ b/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/service/CityServiceImpl.java @@ -34,8 +34,7 @@ class CityServiceImpl implements CityService { private final HotelRepository hotelRepository; - public CityServiceImpl(CityRepository cityRepository, - HotelRepository hotelRepository) { + CityServiceImpl(CityRepository cityRepository, HotelRepository hotelRepository) { this.cityRepository = cityRepository; this.hotelRepository = hotelRepository; } diff --git a/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/service/HotelServiceImpl.java b/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/service/HotelServiceImpl.java index 7f069f39e7..f1664ef116 100644 --- a/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/service/HotelServiceImpl.java +++ b/spring-boot-samples/spring-boot-sample-hibernate52/src/main/java/sample/hibernate52/service/HotelServiceImpl.java @@ -41,8 +41,7 @@ class HotelServiceImpl implements HotelService { private final ReviewRepository reviewRepository; - public HotelServiceImpl(HotelRepository hotelRepository, - ReviewRepository reviewRepository) { + HotelServiceImpl(HotelRepository hotelRepository, ReviewRepository reviewRepository) { this.hotelRepository = hotelRepository; this.reviewRepository = reviewRepository; } @@ -82,7 +81,7 @@ class HotelServiceImpl implements HotelService { private final Map ratingCount; - public ReviewsSummaryImpl(List ratingCounts) { + ReviewsSummaryImpl(List ratingCounts) { this.ratingCount = new HashMap(); for (RatingCount ratingCount : ratingCounts) { this.ratingCount.put(ratingCount.getRating(), ratingCount.getCount()); @@ -92,7 +91,7 @@ class HotelServiceImpl implements HotelService { @Override public long getNumberOfReviewsWithRating(Rating rating) { Long count = this.ratingCount.get(rating); - return count == null ? 0 : count; + return (count != null ? count : 0); } } diff --git a/spring-boot-samples/spring-boot-sample-hibernate52/src/test/resources/application-scratch.properties b/spring-boot-samples/spring-boot-sample-hibernate52/src/test/resources/application-scratch.properties index 782bef1f1a..151dd486c1 100644 --- a/spring-boot-samples/spring-boot-sample-hibernate52/src/test/resources/application-scratch.properties +++ b/spring-boot-samples/spring-boot-sample-hibernate52/src/test/resources/application-scratch.properties @@ -1,2 +1,2 @@ spring.datasource.name=scratchdb -spring.jmx.default-domain=jpa.sample \ No newline at end of file +spring.jmx.default-domain=jpa.sample 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 c869a4aa58..e6189a4a3b 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,4 +1,3 @@ # management.context-path=/admin management.security.enabled=false - -spring.http.converters.preferred-json-mapper=gson \ No newline at end of file +spring.http.converters.preferred-json-mapper=gson diff --git a/spring-boot-samples/spring-boot-sample-hypermedia-jpa/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-hypermedia-jpa/src/main/resources/application.properties index 0bc7f732df..f5914109e2 100644 --- a/spring-boot-samples/spring-boot-sample-hypermedia-jpa/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-hypermedia-jpa/src/main/resources/application.properties @@ -1,2 +1,2 @@ management.context-path=/admin -endpoints.docs.curies.enabled=true \ No newline at end of file +endpoints.docs.curies.enabled=true 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 6f334e794a..010b3a6da7 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,3 +1,2 @@ management.security.enabled=false - -management.context-path=/admin \ No newline at end of file +management.context-path=/admin 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 0bb2948d11..a873096ade 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,4 +1,3 @@ # management.context-path=/admin management.security.enabled=false - -endpoints.docs.curies.enabled=true \ No newline at end of file +endpoints.docs.curies.enabled=true diff --git a/spring-boot-samples/spring-boot-sample-jersey1/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-jersey1/src/main/resources/application.properties deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/spring-boot-samples/spring-boot-sample-jetty-ssl/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-jetty-ssl/src/main/resources/application.properties index 953abe0d6c..37199bfd25 100644 --- a/spring-boot-samples/spring-boot-sample-jetty-ssl/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-jetty-ssl/src/main/resources/application.properties @@ -1,4 +1,4 @@ server.port = 8443 server.ssl.key-store = classpath:sample.jks server.ssl.key-store-password = secret -server.ssl.key-password = password \ No newline at end of file +server.ssl.key-password = password diff --git a/spring-boot-samples/spring-boot-sample-jetty8-ssl/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-jetty8-ssl/src/main/resources/application.properties index 953abe0d6c..37199bfd25 100644 --- a/spring-boot-samples/spring-boot-sample-jetty8-ssl/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-jetty8-ssl/src/main/resources/application.properties @@ -1,4 +1,4 @@ server.port = 8443 server.ssl.key-store = classpath:sample.jks server.ssl.key-store-password = secret -server.ssl.key-password = password \ No newline at end of file +server.ssl.key-password = password diff --git a/spring-boot-samples/spring-boot-sample-jta-atomikos/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-jta-atomikos/src/main/resources/application.properties index 8889971d3d..cd3bef00c5 100644 --- a/spring-boot-samples/spring-boot-sample-jta-atomikos/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-jta-atomikos/src/main/resources/application.properties @@ -1,2 +1,2 @@ logging.level.com.atomikos=WARN -spring.artemis.embedded.queues=accounts \ No newline at end of file +spring.artemis.embedded.queues=accounts diff --git a/spring-boot-samples/spring-boot-sample-jta-bitronix/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-jta-bitronix/src/main/resources/application.properties index 66db4c7ada..552bd2a40d 100644 --- a/spring-boot-samples/spring-boot-sample-jta-bitronix/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-jta-bitronix/src/main/resources/application.properties @@ -1 +1 @@ -spring.artemis.embedded.queues=accounts \ No newline at end of file +spring.artemis.embedded.queues=accounts diff --git a/spring-boot-samples/spring-boot-sample-jta-narayana/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-jta-narayana/src/main/resources/application.properties index c7c3a91e59..72c9118529 100644 --- a/spring-boot-samples/spring-boot-sample-jta-narayana/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-jta-narayana/src/main/resources/application.properties @@ -1,2 +1,2 @@ spring.artemis.embedded.queues=accounts -logging.level.com.arjuna=INFO \ No newline at end of file +logging.level.com.arjuna=INFO 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 e092b8e642..95953b08cb 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,4 +1,3 @@ management.security.enabled=false - service.name=Phil -metrics.names.tags.process=${spring.application.name:application}:${random.value:0000} \ No newline at end of file +metrics.names.tags.process=${spring.application.name:application}:${random.value:0000} 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 0cf56ec17f..659ad55535 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 @@ -6,4 +6,4 @@ 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 +spring.data.redis.repositories.enabled=false diff --git a/spring-boot-samples/spring-boot-sample-parent-context/src/main/java/sample/parent/SampleParentContextApplication.java b/spring-boot-samples/spring-boot-sample-parent-context/src/main/java/sample/parent/SampleParentContextApplication.java index cbf890079d..617fee62a0 100644 --- a/spring-boot-samples/spring-boot-sample-parent-context/src/main/java/sample/parent/SampleParentContextApplication.java +++ b/spring-boot-samples/spring-boot-sample-parent-context/src/main/java/sample/parent/SampleParentContextApplication.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -36,6 +36,11 @@ import org.springframework.integration.file.FileWritingMessageHandler; @EnableConfigurationProperties(ServiceProperties.class) public class SampleParentContextApplication { + public static void main(String[] args) throws Exception { + new SpringApplicationBuilder(Parent.class) + .child(SampleParentContextApplication.class).run(args); + } + @EnableAutoConfiguration protected static class Parent { @@ -83,9 +88,4 @@ public class SampleParentContextApplication { } - public static void main(String[] args) throws Exception { - new SpringApplicationBuilder(Parent.class) - .child(SampleParentContextApplication.class).run(args); - } - } diff --git a/spring-boot-samples/spring-boot-sample-parent-context/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-parent-context/src/main/resources/application.properties index b04af6c76a..503d925fb6 100644 --- a/spring-boot-samples/spring-boot-sample-parent-context/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-parent-context/src/main/resources/application.properties @@ -1 +1 @@ -service.greeting=Hello \ No newline at end of file +service.greeting=Hello diff --git a/spring-boot-samples/spring-boot-sample-profile/src/main/java/sample/profile/service/MessageService.java b/spring-boot-samples/spring-boot-sample-profile/src/main/java/sample/profile/service/MessageService.java index d322b7a50e..0199208bfc 100644 --- a/spring-boot-samples/spring-boot-sample-profile/src/main/java/sample/profile/service/MessageService.java +++ b/spring-boot-samples/spring-boot-sample-profile/src/main/java/sample/profile/service/MessageService.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2013 the original author or authors. + * Copyright 2012-2018 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. @@ -16,9 +16,6 @@ package sample.profile.service; -/** - * @author Dave Syer - */ public interface MessageService { String getMessage(); diff --git a/spring-boot-samples/spring-boot-sample-property-validation/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-property-validation/src/main/resources/application.properties index b28381563f..db673a3796 100644 --- a/spring-boot-samples/spring-boot-sample-property-validation/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-property-validation/src/main/resources/application.properties @@ -1,2 +1,2 @@ sample.host=192.168.0.1 -sample.port=7070 \ No newline at end of file +sample.port=7070 diff --git a/spring-boot-samples/spring-boot-sample-secure-oauth2-actuator/src/main/java/sample/secure/oauth2/actuator/SampleSecureOAuth2ActuatorApplication.java b/spring-boot-samples/spring-boot-sample-secure-oauth2-actuator/src/main/java/sample/secure/oauth2/actuator/SampleSecureOAuth2ActuatorApplication.java index 40bafd66f8..6ea907de8d 100644 --- a/spring-boot-samples/spring-boot-sample-secure-oauth2-actuator/src/main/java/sample/secure/oauth2/actuator/SampleSecureOAuth2ActuatorApplication.java +++ b/spring-boot-samples/spring-boot-sample-secure-oauth2-actuator/src/main/java/sample/secure/oauth2/actuator/SampleSecureOAuth2ActuatorApplication.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -44,7 +44,7 @@ public class SampleSecureOAuth2ActuatorApplication { private String value; - public Message(String value) { + Message(String value) { this.value = value; } diff --git a/spring-boot-samples/spring-boot-sample-secure-oauth2-actuator/src/test/java/sample/secure/oauth2/actuator/SampleSecureOAuth2ActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-secure-oauth2-actuator/src/test/java/sample/secure/oauth2/actuator/SampleSecureOAuth2ActuatorApplicationTests.java index 55338463c4..9c0549d0af 100644 --- a/spring-boot-samples/spring-boot-sample-secure-oauth2-actuator/src/test/java/sample/secure/oauth2/actuator/SampleSecureOAuth2ActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-secure-oauth2-actuator/src/test/java/sample/secure/oauth2/actuator/SampleSecureOAuth2ActuatorApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -27,6 +27,7 @@ import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.web.FilterChainProxy; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.util.Base64Utils; import org.springframework.web.context.WebApplicationContext; @@ -35,7 +36,6 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -import static org.springframework.test.web.servlet.setup.MockMvcBuilders.webAppContextSetup; /** * Series of automated integration tests to verify proper behavior of auto-configured, @@ -57,7 +57,8 @@ public class SampleSecureOAuth2ActuatorApplicationTests { @Before public void setUp() { - this.mvc = webAppContextSetup(this.context).addFilters(this.filterChain).build(); + this.mvc = MockMvcBuilders.webAppContextSetup(this.context) + .addFilters(this.filterChain).build(); SecurityContextHolder.clearContext(); } diff --git a/spring-boot-samples/spring-boot-sample-secure-oauth2-resource/src/main/java/sample/secure/oauth2/resource/Flight.java b/spring-boot-samples/spring-boot-sample-secure-oauth2-resource/src/main/java/sample/secure/oauth2/resource/Flight.java index 3f2c24449b..ba612495a7 100644 --- a/spring-boot-samples/spring-boot-sample-secure-oauth2-resource/src/main/java/sample/secure/oauth2/resource/Flight.java +++ b/spring-boot-samples/spring-boot-sample-secure-oauth2-resource/src/main/java/sample/secure/oauth2/resource/Flight.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -26,7 +26,7 @@ import javax.persistence.Id; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; /** - * Domain object for tracking flights + * Domain object for tracking flights. * * @author Craig Walls * @author Greg Turnquist diff --git a/spring-boot-samples/spring-boot-sample-secure-oauth2-resource/src/main/java/sample/secure/oauth2/resource/FlightRepository.java b/spring-boot-samples/spring-boot-sample-secure-oauth2-resource/src/main/java/sample/secure/oauth2/resource/FlightRepository.java index 9c94301679..410745c544 100644 --- a/spring-boot-samples/spring-boot-sample-secure-oauth2-resource/src/main/java/sample/secure/oauth2/resource/FlightRepository.java +++ b/spring-boot-samples/spring-boot-sample-secure-oauth2-resource/src/main/java/sample/secure/oauth2/resource/FlightRepository.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -19,7 +19,7 @@ package sample.secure.oauth2.resource; import org.springframework.data.repository.CrudRepository; /** - * Spring Data interface with secured methods + * Spring Data interface with secured methods. * * @author Craig Walls * @author Greg Turnquist diff --git a/spring-boot-samples/spring-boot-sample-secure-oauth2-resource/src/test/java/sample/secure/oauth2/resource/SampleSecureOAuth2ResourceApplicationTests.java b/spring-boot-samples/spring-boot-sample-secure-oauth2-resource/src/test/java/sample/secure/oauth2/resource/SampleSecureOAuth2ResourceApplicationTests.java index 964a2814a7..58b0c5389e 100644 --- a/spring-boot-samples/spring-boot-sample-secure-oauth2-resource/src/test/java/sample/secure/oauth2/resource/SampleSecureOAuth2ResourceApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-secure-oauth2-resource/src/test/java/sample/secure/oauth2/resource/SampleSecureOAuth2ResourceApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -28,16 +28,16 @@ import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.web.FilterChainProxy; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.web.context.WebApplicationContext; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -import static org.springframework.test.web.servlet.setup.MockMvcBuilders.webAppContextSetup; /** * Series of automated integration tests to verify proper behavior of auto-configured, - * OAuth2-secured system + * OAuth2-secured system. * * @author Greg Turnquist * @author Dave Syer @@ -56,7 +56,8 @@ public class SampleSecureOAuth2ResourceApplicationTests { @Before public void setUp() { - this.mvc = webAppContextSetup(this.context).addFilters(this.filterChain).build(); + this.mvc = MockMvcBuilders.webAppContextSetup(this.context) + .addFilters(this.filterChain).build(); SecurityContextHolder.clearContext(); } diff --git a/spring-boot-samples/spring-boot-sample-secure-oauth2/src/main/java/sample/secure/oauth2/Flight.java b/spring-boot-samples/spring-boot-sample-secure-oauth2/src/main/java/sample/secure/oauth2/Flight.java index f83eb6f2ef..55e0f48baa 100644 --- a/spring-boot-samples/spring-boot-sample-secure-oauth2/src/main/java/sample/secure/oauth2/Flight.java +++ b/spring-boot-samples/spring-boot-sample-secure-oauth2/src/main/java/sample/secure/oauth2/Flight.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2018 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. @@ -26,7 +26,7 @@ import javax.persistence.Id; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; /** - * Domain object for tracking flights + * Domain object for tracking flights. * * @author Craig Walls * @author Greg Turnquist diff --git a/spring-boot-samples/spring-boot-sample-secure-oauth2/src/main/java/sample/secure/oauth2/FlightRepository.java b/spring-boot-samples/spring-boot-sample-secure-oauth2/src/main/java/sample/secure/oauth2/FlightRepository.java index 96390d7c20..8b5df956c5 100644 --- a/spring-boot-samples/spring-boot-sample-secure-oauth2/src/main/java/sample/secure/oauth2/FlightRepository.java +++ b/spring-boot-samples/spring-boot-sample-secure-oauth2/src/main/java/sample/secure/oauth2/FlightRepository.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2018 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. @@ -20,7 +20,7 @@ import org.springframework.data.repository.CrudRepository; import org.springframework.security.access.prepost.PreAuthorize; /** - * Spring Data interface with secured methods + * Spring Data interface with secured methods. * * @author Craig Walls * @author Greg Turnquist diff --git a/spring-boot-samples/spring-boot-sample-secure-oauth2/src/test/java/sample/secure/oauth2/SampleSecureOAuth2ApplicationTests.java b/spring-boot-samples/spring-boot-sample-secure-oauth2/src/test/java/sample/secure/oauth2/SampleSecureOAuth2ApplicationTests.java index a87572c8f5..0b71243777 100644 --- a/spring-boot-samples/spring-boot-sample-secure-oauth2/src/test/java/sample/secure/oauth2/SampleSecureOAuth2ApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-secure-oauth2/src/test/java/sample/secure/oauth2/SampleSecureOAuth2ApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -34,6 +34,7 @@ import org.springframework.security.web.FilterChainProxy; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MvcResult; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.web.context.WebApplicationContext; import static org.assertj.core.api.Assertions.assertThat; @@ -42,7 +43,6 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -import static org.springframework.test.web.servlet.setup.MockMvcBuilders.webAppContextSetup; /** * Series of automated integration tests to verify proper behavior of auto-configured, @@ -66,7 +66,8 @@ public class SampleSecureOAuth2ApplicationTests { @Before public void setUp() { - this.mvc = webAppContextSetup(this.context).addFilters(this.filterChain).build(); + this.mvc = MockMvcBuilders.webAppContextSetup(this.context) + .addFilters(this.filterChain).build(); SecurityContextHolder.clearContext(); } diff --git a/spring-boot-samples/spring-boot-sample-secure/src/main/java/sample/secure/SampleService.java b/spring-boot-samples/spring-boot-sample-secure/src/main/java/sample/secure/SampleService.java index ff022dc9de..d8fb861e98 100644 --- a/spring-boot-samples/spring-boot-sample-secure/src/main/java/sample/secure/SampleService.java +++ b/spring-boot-samples/spring-boot-sample-secure/src/main/java/sample/secure/SampleService.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2014 the original author or authors. + * Copyright 2012-2018 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. @@ -20,10 +20,6 @@ import org.springframework.security.access.annotation.Secured; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.stereotype.Service; -/** - * @author Dave Syer - * - */ @Service public class SampleService { diff --git a/spring-boot-samples/spring-boot-sample-secure/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-secure/src/main/resources/application.properties index e5c8a7406c..a928972817 100644 --- a/spring-boot-samples/spring-boot-sample-secure/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-secure/src/main/resources/application.properties @@ -1 +1 @@ -# debug: true \ No newline at end of file +# debug: true diff --git a/spring-boot-samples/spring-boot-sample-secure/src/test/resources/test.properties b/spring-boot-samples/spring-boot-sample-secure/src/test/resources/test.properties index 2eef63c566..e2c9149447 100644 --- a/spring-boot-samples/spring-boot-sample-secure/src/test/resources/test.properties +++ b/spring-boot-samples/spring-boot-sample-secure/src/test/resources/test.properties @@ -1 +1 @@ -security.user.password=password \ No newline at end of file +security.user.password=password diff --git a/spring-boot-samples/spring-boot-sample-test/src/main/java/sample/test/service/VehicleIdentificationNumberNotFoundException.java b/spring-boot-samples/spring-boot-sample-test/src/main/java/sample/test/service/VehicleIdentificationNumberNotFoundException.java index c43ed67a7f..8e4d7306ea 100644 --- a/spring-boot-samples/spring-boot-sample-test/src/main/java/sample/test/service/VehicleIdentificationNumberNotFoundException.java +++ b/spring-boot-samples/spring-boot-sample-test/src/main/java/sample/test/service/VehicleIdentificationNumberNotFoundException.java @@ -25,7 +25,7 @@ import sample.test.domain.VehicleIdentificationNumber; */ public class VehicleIdentificationNumberNotFoundException extends RuntimeException { - private VehicleIdentificationNumber vehicleIdentificationNumber; + private final VehicleIdentificationNumber vehicleIdentificationNumber; public VehicleIdentificationNumberNotFoundException(VehicleIdentificationNumber vin) { this(vin, null); diff --git a/spring-boot-samples/spring-boot-sample-test/src/main/java/sample/test/web/UserNameNotFoundException.java b/spring-boot-samples/spring-boot-sample-test/src/main/java/sample/test/web/UserNameNotFoundException.java index 4c4a1e680b..a30292aced 100644 --- a/spring-boot-samples/spring-boot-sample-test/src/main/java/sample/test/web/UserNameNotFoundException.java +++ b/spring-boot-samples/spring-boot-sample-test/src/main/java/sample/test/web/UserNameNotFoundException.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -22,7 +22,7 @@ import org.springframework.web.bind.annotation.ResponseStatus; @ResponseStatus(HttpStatus.NOT_FOUND) public class UserNameNotFoundException extends RuntimeException { - private String username; + private final String username; public UserNameNotFoundException(String username) { this.username = username; diff --git a/spring-boot-samples/spring-boot-sample-tomcat-jsp/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-tomcat-jsp/src/main/resources/application.properties index 2af7f6e200..b4c95bf8e7 100644 --- a/spring-boot-samples/spring-boot-sample-tomcat-jsp/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-tomcat-jsp/src/main/resources/application.properties @@ -1,3 +1,3 @@ spring.mvc.view.prefix: /WEB-INF/jsp/ spring.mvc.view.suffix: .jsp -application.message: Hello Phil \ No newline at end of file +application.message: Hello Phil diff --git a/spring-boot-samples/spring-boot-sample-tomcat-multi-connectors/src/main/java/sample/tomcat/multiconnector/SampleTomcatTwoConnectorsApplication.java b/spring-boot-samples/spring-boot-sample-tomcat-multi-connectors/src/main/java/sample/tomcat/multiconnector/SampleTomcatTwoConnectorsApplication.java index 220bd12dfb..b68854b4cb 100644 --- a/spring-boot-samples/spring-boot-sample-tomcat-multi-connectors/src/main/java/sample/tomcat/multiconnector/SampleTomcatTwoConnectorsApplication.java +++ b/spring-boot-samples/spring-boot-sample-tomcat-multi-connectors/src/main/java/sample/tomcat/multiconnector/SampleTomcatTwoConnectorsApplication.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2018 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. @@ -26,7 +26,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.util.SocketUtils; /** - * Sample Application to show Tomcat running two connectors + * Sample Application to show Tomcat running two connectors. * * @author Brock Mills * @author Andy Wilkinson diff --git a/spring-boot-samples/spring-boot-sample-tomcat-multi-connectors/src/test/java/sample/tomcat/multiconnector/SampleTomcatTwoConnectorsApplicationTests.java b/spring-boot-samples/spring-boot-sample-tomcat-multi-connectors/src/test/java/sample/tomcat/multiconnector/SampleTomcatTwoConnectorsApplicationTests.java index 54fde7d800..02c2add1fb 100644 --- a/spring-boot-samples/spring-boot-sample-tomcat-multi-connectors/src/test/java/sample/tomcat/multiconnector/SampleTomcatTwoConnectorsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-tomcat-multi-connectors/src/test/java/sample/tomcat/multiconnector/SampleTomcatTwoConnectorsApplicationTests.java @@ -127,7 +127,7 @@ public class SampleTomcatTwoConnectorsApplicationTests { private final HostnameVerifier verifier; - public MySimpleClientHttpRequestFactory(final HostnameVerifier verifier) { + MySimpleClientHttpRequestFactory(final HostnameVerifier verifier) { this.verifier = verifier; } diff --git a/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/NonAutoConfigurationSampleTomcatApplicationTests.java b/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/NonAutoConfigurationSampleTomcatApplicationTests.java index d028fddc66..1d5232ea77 100644 --- a/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/NonAutoConfigurationSampleTomcatApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/NonAutoConfigurationSampleTomcatApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -55,6 +55,13 @@ public class NonAutoConfigurationSampleTomcatApplicationTests { @Autowired private TestRestTemplate restTemplate; + @Test + public void testHome() throws Exception { + ResponseEntity entity = this.restTemplate.getForEntity("/", String.class); + assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); + assertThat(entity.getBody()).isEqualTo("Hello World"); + } + @Configuration @Import({ EmbeddedServletContainerAutoConfiguration.class, DispatcherServletAutoConfiguration.class, @@ -71,11 +78,4 @@ public class NonAutoConfigurationSampleTomcatApplicationTests { } - @Test - public void testHome() throws Exception { - ResponseEntity entity = this.restTemplate.getForEntity("/", String.class); - assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); - assertThat(entity.getBody()).isEqualTo("Hello World"); - } - } diff --git a/spring-boot-samples/spring-boot-sample-tomcat7-jsp/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-tomcat7-jsp/src/main/resources/application.properties index 2af7f6e200..b4c95bf8e7 100644 --- a/spring-boot-samples/spring-boot-sample-tomcat7-jsp/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-tomcat7-jsp/src/main/resources/application.properties @@ -1,3 +1,3 @@ spring.mvc.view.prefix: /WEB-INF/jsp/ spring.mvc.view.suffix: .jsp -application.message: Hello Phil \ No newline at end of file +application.message: Hello Phil diff --git a/spring-boot-samples/spring-boot-sample-undertow-ssl/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-undertow-ssl/src/main/resources/application.properties index 953abe0d6c..37199bfd25 100644 --- a/spring-boot-samples/spring-boot-sample-undertow-ssl/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-undertow-ssl/src/main/resources/application.properties @@ -1,4 +1,4 @@ server.port = 8443 server.ssl.key-store = classpath:sample.jks server.ssl.key-store-password = secret -server.ssl.key-password = password \ No newline at end of file +server.ssl.key-password = password diff --git a/spring-boot-samples/spring-boot-sample-undertow/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-undertow/src/main/resources/application.properties index bb809f2a9c..7dfb55689a 100644 --- a/spring-boot-samples/spring-boot-sample-undertow/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-undertow/src/main/resources/application.properties @@ -2,4 +2,4 @@ server.undertow.accesslog.enabled=true server.undertow.accesslog.dir=target/logs server.undertow.accesslog.pattern=combined server.compression.enabled=true -server.compression.min-response-size=1 \ No newline at end of file +server.compression.min-response-size=1 diff --git a/spring-boot-samples/spring-boot-sample-war/src/main/java/sample/war/SampleWarApplication.java b/spring-boot-samples/spring-boot-sample-war/src/main/java/sample/war/SampleWarApplication.java index 74b3b52d8d..fa73c8b2a5 100644 --- a/spring-boot-samples/spring-boot-sample-war/src/main/java/sample/war/SampleWarApplication.java +++ b/spring-boot-samples/spring-boot-sample-war/src/main/java/sample/war/SampleWarApplication.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -21,11 +21,8 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.web.support.SpringBootServletInitializer; import org.springframework.context.annotation.PropertySource; -/** - * Sample WAR application - */ @SpringBootApplication -@PropertySource(value = { "WEB-INF/custom.properties" }) +@PropertySource("WEB-INF/custom.properties") public class SampleWarApplication extends SpringBootServletInitializer { public static void main(String[] args) { diff --git a/spring-boot-samples/spring-boot-sample-web-freemarker/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-web-freemarker/src/main/resources/application.properties index edea37a1cf..e504f79eb9 100644 --- a/spring-boot-samples/spring-boot-sample-web-freemarker/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-web-freemarker/src/main/resources/application.properties @@ -1 +1 @@ -application.message: Hello, Andy \ No newline at end of file +application.message: Hello, Andy diff --git a/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/main/resources/application.properties index 14bc33fa92..097a5a4fbe 100644 --- a/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/main/resources/application.properties @@ -1,3 +1,3 @@ # Allow templates to be reloaded at dev time spring.groovy.template.cache: false -logging.level.org.springframework.web: INFO \ No newline at end of file +logging.level.org.springframework.web: INFO diff --git a/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/test/java/sample/groovytemplates/MessageControllerWebTests.java b/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/test/java/sample/groovytemplates/MessageControllerWebTests.java index ff6726214e..d7e1589f63 100755 --- a/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/test/java/sample/groovytemplates/MessageControllerWebTests.java +++ b/spring-boot-samples/spring-boot-sample-web-groovy-templates/src/test/java/sample/groovytemplates/MessageControllerWebTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -84,14 +84,10 @@ public class MessageControllerWebTests { private final String regex; - public RegexMatcher(String regex) { + RegexMatcher(String regex) { this.regex = regex; } - public static org.hamcrest.Matcher matches(String regex) { - return new RegexMatcher(regex); - } - @Override public boolean matchesSafely(String item) { return Pattern.compile(this.regex).matcher(item).find(); @@ -108,6 +104,10 @@ public class MessageControllerWebTests { .appendText(this.regex); } + public static org.hamcrest.Matcher matches(String regex) { + return new RegexMatcher(regex); + } + } } diff --git a/spring-boot-samples/spring-boot-sample-web-jsp/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-web-jsp/src/main/resources/application.properties index 2af7f6e200..b4c95bf8e7 100644 --- a/spring-boot-samples/spring-boot-sample-web-jsp/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-web-jsp/src/main/resources/application.properties @@ -1,3 +1,3 @@ spring.mvc.view.prefix: /WEB-INF/jsp/ spring.mvc.view.suffix: .jsp -application.message: Hello Phil \ No newline at end of file +application.message: Hello Phil diff --git a/spring-boot-samples/spring-boot-sample-web-method-security/src/main/java/sample/security/method/SampleMethodSecurityApplication.java b/spring-boot-samples/spring-boot-sample-web-method-security/src/main/java/sample/security/method/SampleMethodSecurityApplication.java index 6f38b7f82c..5de3f69258 100644 --- a/spring-boot-samples/spring-boot-sample-web-method-security/src/main/java/sample/security/method/SampleMethodSecurityApplication.java +++ b/spring-boot-samples/spring-boot-sample-web-method-security/src/main/java/sample/security/method/SampleMethodSecurityApplication.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -41,6 +41,16 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter @EnableGlobalMethodSecurity(securedEnabled = true) public class SampleMethodSecurityApplication extends WebMvcConfigurerAdapter { + @Override + public void addViewControllers(ViewControllerRegistry registry) { + registry.addViewController("/login").setViewName("login"); + registry.addViewController("/access").setViewName("access"); + } + + public static void main(String[] args) throws Exception { + new SpringApplicationBuilder(SampleMethodSecurityApplication.class).run(args); + } + @Controller protected static class HomeController { @@ -55,16 +65,6 @@ public class SampleMethodSecurityApplication extends WebMvcConfigurerAdapter { } - @Override - public void addViewControllers(ViewControllerRegistry registry) { - registry.addViewController("/login").setViewName("login"); - registry.addViewController("/access").setViewName("access"); - } - - public static void main(String[] args) throws Exception { - new SpringApplicationBuilder(SampleMethodSecurityApplication.class).run(args); - } - @Order(Ordered.HIGHEST_PRECEDENCE) @Configuration protected static class AuthenticationSecurity diff --git a/spring-boot-samples/spring-boot-sample-web-method-security/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-web-method-security/src/main/resources/application.properties index c19741f86f..30a06d321b 100644 --- a/spring-boot-samples/spring-boot-sample-web-method-security/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-web-method-security/src/main/resources/application.properties @@ -1,2 +1,2 @@ spring.thymeleaf.cache: false -logging.level.org.springframework.security: INFO \ No newline at end of file +logging.level.org.springframework.security: INFO diff --git a/spring-boot-samples/spring-boot-sample-web-mustache/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-web-mustache/src/main/resources/application.properties index edea37a1cf..e504f79eb9 100644 --- a/spring-boot-samples/spring-boot-sample-web-mustache/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-web-mustache/src/main/resources/application.properties @@ -1 +1 @@ -application.message: Hello, Andy \ No newline at end of file +application.message: Hello, Andy diff --git a/spring-boot-samples/spring-boot-sample-web-secure-custom/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-web-secure-custom/src/main/resources/application.properties index ba708f6bfa..f97ec90361 100644 --- a/spring-boot-samples/spring-boot-sample-web-secure-custom/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-web-secure-custom/src/main/resources/application.properties @@ -1,3 +1,3 @@ spring.thymeleaf.cache: false security.basic.enabled: false -logging.level.org.springframework.security: INFO \ No newline at end of file +logging.level.org.springframework.security: INFO diff --git a/spring-boot-samples/spring-boot-sample-web-secure-jdbc/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-web-secure-jdbc/src/main/resources/application.properties index c031af36b7..1e6ef1a531 100644 --- a/spring-boot-samples/spring-boot-sample-web-secure-jdbc/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-web-secure-jdbc/src/main/resources/application.properties @@ -1,4 +1,4 @@ debug: true spring.thymeleaf.cache: false security.basic.enabled: false -logging.level.org.springframework.security: INFO \ No newline at end of file +logging.level.org.springframework.security: INFO diff --git a/spring-boot-samples/spring-boot-sample-web-secure/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-web-secure/src/main/resources/application.properties index e1935fa698..b74ac4df9e 100644 --- a/spring-boot-samples/spring-boot-sample-web-secure/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-web-secure/src/main/resources/application.properties @@ -3,4 +3,4 @@ security.basic.enabled: false # demo only: security.user.password: password logging.level.org.springframework.security: INFO -logging.level.org.springframework.boot.actuate.audit.listener.AuditListener: DEBUG \ No newline at end of file +logging.level.org.springframework.boot.actuate.audit.listener.AuditListener: DEBUG diff --git a/spring-boot-samples/spring-boot-sample-web-thymeleaf3/src/main/java/sample/web/thymeleaf3/InMemoryMessageRepository.java b/spring-boot-samples/spring-boot-sample-web-thymeleaf3/src/main/java/sample/web/thymeleaf3/InMemoryMessageRepository.java index 1dbebe89e6..bcc620b958 100755 --- a/spring-boot-samples/spring-boot-sample-web-thymeleaf3/src/main/java/sample/web/thymeleaf3/InMemoryMessageRepository.java +++ b/spring-boot-samples/spring-boot-sample-web-thymeleaf3/src/main/java/sample/web/thymeleaf3/InMemoryMessageRepository.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -20,9 +20,6 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.atomic.AtomicLong; -/** - * @author Dave Syer - */ public class InMemoryMessageRepository implements MessageRepository { private static AtomicLong counter = new AtomicLong(); diff --git a/spring-boot-samples/spring-boot-sample-web-thymeleaf3/src/main/java/sample/web/thymeleaf3/Message.java b/spring-boot-samples/spring-boot-sample-web-thymeleaf3/src/main/java/sample/web/thymeleaf3/Message.java index 1b554efc33..75652e7d53 100644 --- a/spring-boot-samples/spring-boot-sample-web-thymeleaf3/src/main/java/sample/web/thymeleaf3/Message.java +++ b/spring-boot-samples/spring-boot-sample-web-thymeleaf3/src/main/java/sample/web/thymeleaf3/Message.java @@ -20,9 +20,6 @@ import java.util.Calendar; import org.hibernate.validator.constraints.NotEmpty; -/** - * @author Rob Winch - */ public class Message { private Long id; diff --git a/spring-boot-samples/spring-boot-sample-web-thymeleaf3/src/main/java/sample/web/thymeleaf3/MessageRepository.java b/spring-boot-samples/spring-boot-sample-web-thymeleaf3/src/main/java/sample/web/thymeleaf3/MessageRepository.java index 852099c9b3..a86d10393b 100755 --- a/spring-boot-samples/spring-boot-sample-web-thymeleaf3/src/main/java/sample/web/thymeleaf3/MessageRepository.java +++ b/spring-boot-samples/spring-boot-sample-web-thymeleaf3/src/main/java/sample/web/thymeleaf3/MessageRepository.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -16,9 +16,6 @@ package sample.web.thymeleaf3; -/** - * @author Rob Winch - */ public interface MessageRepository { Iterable findAll(); diff --git a/spring-boot-samples/spring-boot-sample-web-thymeleaf3/src/main/java/sample/web/thymeleaf3/mvc/MessageController.java b/spring-boot-samples/spring-boot-sample-web-thymeleaf3/src/main/java/sample/web/thymeleaf3/mvc/MessageController.java index 4e81617521..db78e4ef2e 100755 --- a/spring-boot-samples/spring-boot-sample-web-thymeleaf3/src/main/java/sample/web/thymeleaf3/mvc/MessageController.java +++ b/spring-boot-samples/spring-boot-sample-web-thymeleaf3/src/main/java/sample/web/thymeleaf3/mvc/MessageController.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -31,10 +31,6 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.support.RedirectAttributes; -/** - * @author Rob Winch - * @author Doo-Hwan Kwak - */ @Controller @RequestMapping("/") public class MessageController { @@ -77,14 +73,14 @@ public class MessageController { throw new RuntimeException("Expected exception in controller"); } - @GetMapping(value = "delete/{id}") + @GetMapping("delete/{id}") public ModelAndView delete(@PathVariable("id") Long id) { this.messageRepository.deleteMessage(id); Iterable messages = this.messageRepository.findAll(); return new ModelAndView("messages/list", "messages", messages); } - @GetMapping(value = "modify/{id}") + @GetMapping("modify/{id}") public ModelAndView modifyForm(@PathVariable("id") Message message) { return new ModelAndView("messages/form", "message", message); } diff --git a/spring-boot-samples/spring-boot-sample-web-thymeleaf3/src/test/java/sample/web/thymeleaf3/MessageControllerWebTests.java b/spring-boot-samples/spring-boot-sample-web-thymeleaf3/src/test/java/sample/web/thymeleaf3/MessageControllerWebTests.java index e671fa5fa2..964917dbab 100644 --- a/spring-boot-samples/spring-boot-sample-web-thymeleaf3/src/test/java/sample/web/thymeleaf3/MessageControllerWebTests.java +++ b/spring-boot-samples/spring-boot-sample-web-thymeleaf3/src/test/java/sample/web/thymeleaf3/MessageControllerWebTests.java @@ -84,14 +84,10 @@ public class MessageControllerWebTests { private final String regex; - public RegexMatcher(String regex) { + RegexMatcher(String regex) { this.regex = regex; } - public static org.hamcrest.Matcher matches(String regex) { - return new RegexMatcher(regex); - } - @Override public boolean matchesSafely(String item) { return Pattern.compile(this.regex).matcher(item).find(); @@ -108,6 +104,10 @@ public class MessageControllerWebTests { .appendText(this.regex); } + public static org.hamcrest.Matcher matches(String regex) { + return new RegexMatcher(regex); + } + } } diff --git a/spring-boot-samples/spring-boot-sample-web-ui/src/main/java/sample/web/ui/InMemoryMessageRepository.java b/spring-boot-samples/spring-boot-sample-web-ui/src/main/java/sample/web/ui/InMemoryMessageRepository.java index af360eff42..c1687247f0 100755 --- a/spring-boot-samples/spring-boot-sample-web-ui/src/main/java/sample/web/ui/InMemoryMessageRepository.java +++ b/spring-boot-samples/spring-boot-sample-web-ui/src/main/java/sample/web/ui/InMemoryMessageRepository.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2018 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. @@ -20,9 +20,6 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.atomic.AtomicLong; -/** - * @author Dave Syer - */ public class InMemoryMessageRepository implements MessageRepository { private static AtomicLong counter = new AtomicLong(); diff --git a/spring-boot-samples/spring-boot-sample-web-ui/src/main/java/sample/web/ui/Message.java b/spring-boot-samples/spring-boot-sample-web-ui/src/main/java/sample/web/ui/Message.java index 1310106ea5..588f688a1e 100644 --- a/spring-boot-samples/spring-boot-sample-web-ui/src/main/java/sample/web/ui/Message.java +++ b/spring-boot-samples/spring-boot-sample-web-ui/src/main/java/sample/web/ui/Message.java @@ -1,14 +1,17 @@ /* * Copyright 2012-2018 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 + * 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. + * 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.web.ui; @@ -17,9 +20,6 @@ import java.util.Calendar; import org.hibernate.validator.constraints.NotEmpty; -/** - * @author Rob Winch - */ public class Message { private Long id; diff --git a/spring-boot-samples/spring-boot-sample-web-ui/src/main/java/sample/web/ui/MessageRepository.java b/spring-boot-samples/spring-boot-sample-web-ui/src/main/java/sample/web/ui/MessageRepository.java index 52c336c43a..abfa61ef62 100755 --- a/spring-boot-samples/spring-boot-sample-web-ui/src/main/java/sample/web/ui/MessageRepository.java +++ b/spring-boot-samples/spring-boot-sample-web-ui/src/main/java/sample/web/ui/MessageRepository.java @@ -1,21 +1,21 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2018 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 + * 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. + * 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.web.ui; -/** - * @author Rob Winch - */ public interface MessageRepository { Iterable findAll(); diff --git a/spring-boot-samples/spring-boot-sample-web-ui/src/main/java/sample/web/ui/mvc/MessageController.java b/spring-boot-samples/spring-boot-sample-web-ui/src/main/java/sample/web/ui/mvc/MessageController.java index 4f144fd288..f66f54df48 100755 --- a/spring-boot-samples/spring-boot-sample-web-ui/src/main/java/sample/web/ui/mvc/MessageController.java +++ b/spring-boot-samples/spring-boot-sample-web-ui/src/main/java/sample/web/ui/mvc/MessageController.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -31,10 +31,6 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.support.RedirectAttributes; -/** - * @author Rob Winch - * @author Doo-Hwan Kwak - */ @Controller @RequestMapping("/") public class MessageController { @@ -77,14 +73,14 @@ public class MessageController { throw new RuntimeException("Expected exception in controller"); } - @GetMapping(value = "delete/{id}") + @GetMapping("delete/{id}") public ModelAndView delete(@PathVariable("id") Long id) { this.messageRepository.deleteMessage(id); Iterable messages = this.messageRepository.findAll(); return new ModelAndView("messages/list", "messages", messages); } - @GetMapping(value = "modify/{id}") + @GetMapping("modify/{id}") public ModelAndView modifyForm(@PathVariable("id") Message message) { return new ModelAndView("messages/form", "message", message); } diff --git a/spring-boot-samples/spring-boot-sample-web-ui/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-web-ui/src/main/resources/application.properties index 6665cd62d3..c20caf35b1 100644 --- a/spring-boot-samples/spring-boot-sample-web-ui/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-web-ui/src/main/resources/application.properties @@ -1,4 +1,4 @@ # Allow Thymeleaf templates to be reloaded at dev time spring.thymeleaf.cache: false server.tomcat.access_log_enabled: true -server.tomcat.basedir: target/tomcat \ No newline at end of file +server.tomcat.basedir: target/tomcat diff --git a/spring-boot-samples/spring-boot-sample-web-ui/src/test/java/sample/web/ui/MessageControllerWebTests.java b/spring-boot-samples/spring-boot-sample-web-ui/src/test/java/sample/web/ui/MessageControllerWebTests.java index 54585b0ecd..76d2199051 100644 --- a/spring-boot-samples/spring-boot-sample-web-ui/src/test/java/sample/web/ui/MessageControllerWebTests.java +++ b/spring-boot-samples/spring-boot-sample-web-ui/src/test/java/sample/web/ui/MessageControllerWebTests.java @@ -84,14 +84,10 @@ public class MessageControllerWebTests { private final String regex; - public RegexMatcher(String regex) { + RegexMatcher(String regex) { this.regex = regex; } - public static org.hamcrest.Matcher matches(String regex) { - return new RegexMatcher(regex); - } - @Override public boolean matchesSafely(String item) { return Pattern.compile(this.regex).matcher(item).find(); @@ -108,6 +104,10 @@ public class MessageControllerWebTests { .appendText(this.regex); } + public static org.hamcrest.Matcher matches(String regex) { + return new RegexMatcher(regex); + } + } } diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/echo/DefaultEchoService.java b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/echo/DefaultEchoService.java index 572fb316ea..dcb00af08e 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/echo/DefaultEchoService.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/echo/DefaultEchoService.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2018 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. @@ -21,7 +21,7 @@ public class DefaultEchoService implements EchoService { private final String echoFormat; public DefaultEchoService(String echoFormat) { - this.echoFormat = (echoFormat != null) ? echoFormat : "%s"; + this.echoFormat = (echoFormat != null ? echoFormat : "%s"); } @Override diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/Direction.java b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/Direction.java index a1c67ec1db..64fafba56f 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/Direction.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/Direction.java @@ -1,10 +1,9 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 + * Copyright 2012-2018 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 * diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/Location.java b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/Location.java index aa1f883d35..4f18c3ee0c 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/Location.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/Location.java @@ -1,10 +1,9 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 + * Copyright 2012-2018 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 * @@ -19,16 +18,16 @@ package samples.websocket.jetty.snake; public class Location { + /** + * The X location. + */ public int x; + /** + * The Y location. + */ public int y; - public static final int GRID_SIZE = 10; - - public static final int PLAYFIELD_HEIGHT = 480; - - public static final int PLAYFIELD_WIDTH = 640; - public Location(int x, int y) { this.x = x; this.y = y; @@ -37,13 +36,13 @@ public class Location { public Location getAdjacentLocation(Direction direction) { switch (direction) { case NORTH: - return new Location(this.x, this.y - Location.GRID_SIZE); + return new Location(this.x, this.y - SnakeUtils.GRID_SIZE); case SOUTH: - return new Location(this.x, this.y + Location.GRID_SIZE); + return new Location(this.x, this.y + SnakeUtils.GRID_SIZE); case EAST: - return new Location(this.x + Location.GRID_SIZE, this.y); + return new Location(this.x + SnakeUtils.GRID_SIZE, this.y); case WEST: - return new Location(this.x - Location.GRID_SIZE, this.y); + return new Location(this.x - SnakeUtils.GRID_SIZE, this.y); case NONE: // fall through default: @@ -59,16 +58,13 @@ public class Location { if (o == null || getClass() != o.getClass()) { return false; } - Location location = (Location) o; - if (this.x != location.x) { return false; } if (this.y != location.y) { return false; } - return true; } diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/Snake.java b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/Snake.java index d281d72b98..d72a1b4d76 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/Snake.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/Snake.java @@ -1,10 +1,9 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 + * Copyright 2012-2018 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 * diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/SnakeTimer.java b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/SnakeTimer.java index 676e1a2c40..6d580345d6 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/SnakeTimer.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/SnakeTimer.java @@ -1,10 +1,9 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 + * Copyright 2012-2018 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 * @@ -31,7 +30,7 @@ import org.slf4j.LoggerFactory; /** * Sets up the timer for the multi-player snake game WebSocket example. */ -public class SnakeTimer { +public final class SnakeTimer { private static final long TICK_DELAY = 100; @@ -43,6 +42,9 @@ public class SnakeTimer { private static Timer gameTimer = null; + private SnakeTimer() { + } + public static void addSnake(Snake snake) { synchronized (MONITOR) { if (snakes.isEmpty()) { diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/SnakeUtils.java b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/SnakeUtils.java index 90aee0f7d0..c522d80a89 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/SnakeUtils.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/SnakeUtils.java @@ -1,10 +1,9 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 + * Copyright 2012-2018 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 * @@ -20,16 +19,28 @@ package samples.websocket.jetty.snake; import java.awt.Color; import java.util.Random; -public class SnakeUtils { +public final class SnakeUtils { + /** + * The width of the playfield. + */ public static final int PLAYFIELD_WIDTH = 640; + /** + * The height of the playfield. + */ public static final int PLAYFIELD_HEIGHT = 480; + /** + * The grid size. + */ public static final int GRID_SIZE = 10; private static final Random random = new Random(); + private SnakeUtils() { + } + public static String getRandomHexColor() { float hue = random.nextFloat(); // sat between 0.1 and 0.3 diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/SnakeWebSocketHandler.java b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/SnakeWebSocketHandler.java index 6e826c7f5b..50d0875c0a 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/SnakeWebSocketHandler.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty/src/main/java/samples/websocket/jetty/snake/SnakeWebSocketHandler.java @@ -1,10 +1,9 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 + * Copyright 2012-2018 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 * @@ -29,12 +28,6 @@ import org.springframework.web.socket.handler.TextWebSocketHandler; public class SnakeWebSocketHandler extends TextWebSocketHandler { - public static final int PLAYFIELD_WIDTH = 640; - - public static final int PLAYFIELD_HEIGHT = 480; - - public static final int GRID_SIZE = 10; - private static final AtomicInteger snakeIds = new AtomicInteger(0); private static final Random random = new Random(); @@ -54,15 +47,15 @@ public class SnakeWebSocketHandler extends TextWebSocketHandler { } public static Location getRandomLocation() { - int x = roundByGridSize(random.nextInt(PLAYFIELD_WIDTH)); - int y = roundByGridSize(random.nextInt(PLAYFIELD_HEIGHT)); + int x = roundByGridSize(random.nextInt(SnakeUtils.PLAYFIELD_WIDTH)); + int y = roundByGridSize(random.nextInt(SnakeUtils.PLAYFIELD_HEIGHT)); return new Location(x, y); } private static int roundByGridSize(int value) { - value = value + (GRID_SIZE / 2); - value = value / GRID_SIZE; - value = value * GRID_SIZE; + value = value + (SnakeUtils.GRID_SIZE / 2); + value = value / SnakeUtils.GRID_SIZE; + value = value * SnakeUtils.GRID_SIZE; return value; } diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/echo/DefaultEchoService.java b/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/echo/DefaultEchoService.java index 547154572c..ae2cc6cb98 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/echo/DefaultEchoService.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/echo/DefaultEchoService.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -21,7 +21,7 @@ public class DefaultEchoService implements EchoService { private final String echoFormat; public DefaultEchoService(String echoFormat) { - this.echoFormat = (echoFormat != null) ? echoFormat : "%s"; + this.echoFormat = (echoFormat != null ? echoFormat : "%s"); } @Override diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/Direction.java b/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/Direction.java index 4b60b9485b..c15657a0d0 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/Direction.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/Direction.java @@ -1,10 +1,9 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 + * Copyright 2012-2018 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 * diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/Location.java b/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/Location.java index c238b9c26e..4211585b25 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/Location.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/Location.java @@ -1,10 +1,9 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 + * Copyright 2012-2018 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 * @@ -19,16 +18,16 @@ package samples.websocket.jetty93.snake; public class Location { + /** + * The X location. + */ public int x; + /** + * The Y location. + */ public int y; - public static final int GRID_SIZE = 10; - - public static final int PLAYFIELD_HEIGHT = 480; - - public static final int PLAYFIELD_WIDTH = 640; - public Location(int x, int y) { this.x = x; this.y = y; @@ -37,13 +36,13 @@ public class Location { public Location getAdjacentLocation(Direction direction) { switch (direction) { case NORTH: - return new Location(this.x, this.y - Location.GRID_SIZE); + return new Location(this.x, this.y - SnakeUtils.GRID_SIZE); case SOUTH: - return new Location(this.x, this.y + Location.GRID_SIZE); + return new Location(this.x, this.y + SnakeUtils.GRID_SIZE); case EAST: - return new Location(this.x + Location.GRID_SIZE, this.y); + return new Location(this.x + SnakeUtils.GRID_SIZE, this.y); case WEST: - return new Location(this.x - Location.GRID_SIZE, this.y); + return new Location(this.x - SnakeUtils.GRID_SIZE, this.y); case NONE: // fall through default: @@ -59,16 +58,13 @@ public class Location { if (o == null || getClass() != o.getClass()) { return false; } - Location location = (Location) o; - if (this.x != location.x) { return false; } if (this.y != location.y) { return false; } - return true; } diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/Snake.java b/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/Snake.java index ba179a8b64..4eaaf705f1 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/Snake.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/Snake.java @@ -1,10 +1,9 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 + * Copyright 2012-2018 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 * diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/SnakeTimer.java b/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/SnakeTimer.java index 7a1502fc93..2778c91ba8 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/SnakeTimer.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/SnakeTimer.java @@ -1,10 +1,9 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 + * Copyright 2012-2018 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 * @@ -31,7 +30,7 @@ import org.slf4j.LoggerFactory; /** * Sets up the timer for the multi-player snake game WebSocket example. */ -public class SnakeTimer { +public final class SnakeTimer { private static final long TICK_DELAY = 100; @@ -43,6 +42,9 @@ public class SnakeTimer { private static Timer gameTimer = null; + private SnakeTimer() { + } + public static void addSnake(Snake snake) { synchronized (MONITOR) { if (snakes.isEmpty()) { diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/SnakeUtils.java b/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/SnakeUtils.java index 9367d93276..3efd999fee 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/SnakeUtils.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/SnakeUtils.java @@ -1,10 +1,9 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 + * Copyright 2012-2018 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 * @@ -20,16 +19,28 @@ package samples.websocket.jetty93.snake; import java.awt.Color; import java.util.Random; -public class SnakeUtils { +public final class SnakeUtils { + /** + * The width of the playfield. + */ public static final int PLAYFIELD_WIDTH = 640; + /** + * The height of the playfield. + */ public static final int PLAYFIELD_HEIGHT = 480; + /** + * The grid size. + */ public static final int GRID_SIZE = 10; private static final Random random = new Random(); + private SnakeUtils() { + } + public static String getRandomHexColor() { float hue = random.nextFloat(); // sat between 0.1 and 0.3 diff --git a/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/SnakeWebSocketHandler.java b/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/SnakeWebSocketHandler.java index 2c45302c37..0728e96536 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/SnakeWebSocketHandler.java +++ b/spring-boot-samples/spring-boot-sample-websocket-jetty93/src/main/java/samples/websocket/jetty93/snake/SnakeWebSocketHandler.java @@ -1,10 +1,9 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 + * Copyright 2012-2018 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 * @@ -29,12 +28,6 @@ import org.springframework.web.socket.handler.TextWebSocketHandler; public class SnakeWebSocketHandler extends TextWebSocketHandler { - public static final int PLAYFIELD_WIDTH = 640; - - public static final int PLAYFIELD_HEIGHT = 480; - - public static final int GRID_SIZE = 10; - private static final AtomicInteger snakeIds = new AtomicInteger(0); private static final Random random = new Random(); @@ -54,15 +47,15 @@ public class SnakeWebSocketHandler extends TextWebSocketHandler { } public static Location getRandomLocation() { - int x = roundByGridSize(random.nextInt(PLAYFIELD_WIDTH)); - int y = roundByGridSize(random.nextInt(PLAYFIELD_HEIGHT)); + int x = roundByGridSize(random.nextInt(SnakeUtils.PLAYFIELD_WIDTH)); + int y = roundByGridSize(random.nextInt(SnakeUtils.PLAYFIELD_HEIGHT)); return new Location(x, y); } private static int roundByGridSize(int value) { - value = value + (GRID_SIZE / 2); - value = value / GRID_SIZE; - value = value * GRID_SIZE; + value = value + (SnakeUtils.GRID_SIZE / 2); + value = value / SnakeUtils.GRID_SIZE; + value = value * SnakeUtils.GRID_SIZE; return value; } diff --git a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/echo/DefaultEchoService.java b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/echo/DefaultEchoService.java index 0bd2fd222b..d6b82ce10a 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/echo/DefaultEchoService.java +++ b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/echo/DefaultEchoService.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2018 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. @@ -21,7 +21,7 @@ public class DefaultEchoService implements EchoService { private final String echoFormat; public DefaultEchoService(String echoFormat) { - this.echoFormat = (echoFormat != null) ? echoFormat : "%s"; + this.echoFormat = (echoFormat != null ? echoFormat : "%s"); } @Override diff --git a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/Direction.java b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/Direction.java index 83739039e7..1dad076b01 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/Direction.java +++ b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/Direction.java @@ -1,10 +1,9 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 + * Copyright 2012-2018 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 * diff --git a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/Location.java b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/Location.java index 8879da0bef..b0e79a36c6 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/Location.java +++ b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/Location.java @@ -1,10 +1,9 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 + * Copyright 2012-2018 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 * @@ -19,16 +18,16 @@ package samples.websocket.tomcat.snake; public class Location { + /** + * The X location. + */ public int x; + /** + * The Y location. + */ public int y; - public static final int GRID_SIZE = 10; - - public static final int PLAYFIELD_HEIGHT = 480; - - public static final int PLAYFIELD_WIDTH = 640; - public Location(int x, int y) { this.x = x; this.y = y; @@ -37,13 +36,13 @@ public class Location { public Location getAdjacentLocation(Direction direction) { switch (direction) { case NORTH: - return new Location(this.x, this.y - Location.GRID_SIZE); + return new Location(this.x, this.y - SnakeUtils.GRID_SIZE); case SOUTH: - return new Location(this.x, this.y + Location.GRID_SIZE); + return new Location(this.x, this.y + SnakeUtils.GRID_SIZE); case EAST: - return new Location(this.x + Location.GRID_SIZE, this.y); + return new Location(this.x + SnakeUtils.GRID_SIZE, this.y); case WEST: - return new Location(this.x - Location.GRID_SIZE, this.y); + return new Location(this.x - SnakeUtils.GRID_SIZE, this.y); case NONE: // fall through default: @@ -59,16 +58,13 @@ public class Location { if (o == null || getClass() != o.getClass()) { return false; } - Location location = (Location) o; - if (this.x != location.x) { return false; } if (this.y != location.y) { return false; } - return true; } diff --git a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/Snake.java b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/Snake.java index 628b4b2ca9..3b99467b55 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/Snake.java +++ b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/Snake.java @@ -1,10 +1,9 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 + * Copyright 2012-2018 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 * diff --git a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/SnakeTimer.java b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/SnakeTimer.java index 3aa50ce6cc..6a76fb6691 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/SnakeTimer.java +++ b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/SnakeTimer.java @@ -1,10 +1,9 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 + * Copyright 2012-2018 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 * @@ -25,24 +24,27 @@ import java.util.TimerTask; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CopyOnWriteArrayList; -import org.apache.juli.logging.Log; -import org.apache.juli.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Sets up the timer for the multi-player snake game WebSocket example. */ -public class SnakeTimer { +public final class SnakeTimer { private static final long TICK_DELAY = 100; private static final Object MONITOR = new Object(); - private static final Log log = LogFactory.getLog(SnakeTimer.class); + private static final Logger log = LoggerFactory.getLogger(SnakeTimer.class); private static final ConcurrentHashMap snakes = new ConcurrentHashMap(); private static Timer gameTimer = null; + private SnakeTimer() { + } + public static void addSnake(Snake snake) { synchronized (MONITOR) { if (snakes.isEmpty()) { diff --git a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/SnakeUtils.java b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/SnakeUtils.java index 872716fb30..44922a92cc 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/SnakeUtils.java +++ b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/SnakeUtils.java @@ -1,10 +1,9 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 + * Copyright 2012-2018 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 * @@ -20,16 +19,28 @@ package samples.websocket.tomcat.snake; import java.awt.Color; import java.util.Random; -public class SnakeUtils { +public final class SnakeUtils { + /** + * The width of the playfield. + */ public static final int PLAYFIELD_WIDTH = 640; + /** + * The height of the playfield. + */ public static final int PLAYFIELD_HEIGHT = 480; + /** + * The grid size. + */ public static final int GRID_SIZE = 10; private static final Random random = new Random(); + private SnakeUtils() { + } + public static String getRandomHexColor() { float hue = random.nextFloat(); // sat between 0.1 and 0.3 diff --git a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/SnakeWebSocketHandler.java b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/SnakeWebSocketHandler.java index a8e7d3e94d..4f7565299f 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/SnakeWebSocketHandler.java +++ b/spring-boot-samples/spring-boot-sample-websocket-tomcat/src/main/java/samples/websocket/tomcat/snake/SnakeWebSocketHandler.java @@ -1,10 +1,9 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 + * Copyright 2012-2018 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 * @@ -29,12 +28,6 @@ import org.springframework.web.socket.handler.TextWebSocketHandler; public class SnakeWebSocketHandler extends TextWebSocketHandler { - public static final int PLAYFIELD_WIDTH = 640; - - public static final int PLAYFIELD_HEIGHT = 480; - - public static final int GRID_SIZE = 10; - private static final AtomicInteger snakeIds = new AtomicInteger(0); private static final Random random = new Random(); @@ -54,15 +47,15 @@ public class SnakeWebSocketHandler extends TextWebSocketHandler { } public static Location getRandomLocation() { - int x = roundByGridSize(random.nextInt(PLAYFIELD_WIDTH)); - int y = roundByGridSize(random.nextInt(PLAYFIELD_HEIGHT)); + int x = roundByGridSize(random.nextInt(SnakeUtils.PLAYFIELD_WIDTH)); + int y = roundByGridSize(random.nextInt(SnakeUtils.PLAYFIELD_HEIGHT)); return new Location(x, y); } private static int roundByGridSize(int value) { - value = value + (GRID_SIZE / 2); - value = value / GRID_SIZE; - value = value * GRID_SIZE; + value = value + (SnakeUtils.GRID_SIZE / 2); + value = value / SnakeUtils.GRID_SIZE; + value = value * SnakeUtils.GRID_SIZE; return value; } diff --git a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/echo/DefaultEchoService.java b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/echo/DefaultEchoService.java index 40d5e67e51..0326a0a2d7 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/echo/DefaultEchoService.java +++ b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/echo/DefaultEchoService.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2018 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. @@ -21,7 +21,7 @@ public class DefaultEchoService implements EchoService { private final String echoFormat; public DefaultEchoService(String echoFormat) { - this.echoFormat = (echoFormat != null) ? echoFormat : "%s"; + this.echoFormat = (echoFormat != null ? echoFormat : "%s"); } @Override diff --git a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/Direction.java b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/Direction.java index 88eaa4c6dc..b67728acce 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/Direction.java +++ b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/Direction.java @@ -1,10 +1,9 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 + * Copyright 2012-2018 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 * diff --git a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/Location.java b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/Location.java index 28ece3d755..9eb85994fb 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/Location.java +++ b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/Location.java @@ -1,10 +1,9 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 + * Copyright 2012-2018 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 * @@ -19,16 +18,16 @@ package samples.websocket.undertow.snake; public class Location { + /** + * The X location. + */ public int x; + /** + * The Y location. + */ public int y; - public static final int GRID_SIZE = 10; - - public static final int PLAYFIELD_HEIGHT = 480; - - public static final int PLAYFIELD_WIDTH = 640; - public Location(int x, int y) { this.x = x; this.y = y; @@ -37,13 +36,13 @@ public class Location { public Location getAdjacentLocation(Direction direction) { switch (direction) { case NORTH: - return new Location(this.x, this.y - Location.GRID_SIZE); + return new Location(this.x, this.y - SnakeUtils.GRID_SIZE); case SOUTH: - return new Location(this.x, this.y + Location.GRID_SIZE); + return new Location(this.x, this.y + SnakeUtils.GRID_SIZE); case EAST: - return new Location(this.x + Location.GRID_SIZE, this.y); + return new Location(this.x + SnakeUtils.GRID_SIZE, this.y); case WEST: - return new Location(this.x - Location.GRID_SIZE, this.y); + return new Location(this.x - SnakeUtils.GRID_SIZE, this.y); case NONE: // fall through default: @@ -59,16 +58,13 @@ public class Location { if (o == null || getClass() != o.getClass()) { return false; } - Location location = (Location) o; - if (this.x != location.x) { return false; } if (this.y != location.y) { return false; } - return true; } diff --git a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/Snake.java b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/Snake.java index d8bbc488cf..68fe4bce21 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/Snake.java +++ b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/Snake.java @@ -1,10 +1,9 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 + * Copyright 2012-2018 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 * diff --git a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/SnakeTimer.java b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/SnakeTimer.java index 3d95c06aa4..8cfa9eee7e 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/SnakeTimer.java +++ b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/SnakeTimer.java @@ -1,10 +1,9 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 + * Copyright 2012-2018 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 * @@ -31,7 +30,7 @@ import org.slf4j.LoggerFactory; /** * Sets up the timer for the multi-player snake game WebSocket example. */ -public class SnakeTimer { +public final class SnakeTimer { private static final long TICK_DELAY = 100; @@ -43,6 +42,9 @@ public class SnakeTimer { private static Timer gameTimer = null; + private SnakeTimer() { + } + public static void addSnake(Snake snake) { synchronized (MONITOR) { if (snakes.isEmpty()) { diff --git a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/SnakeUtils.java b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/SnakeUtils.java index 956f2327a1..de3757cb5a 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/SnakeUtils.java +++ b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/SnakeUtils.java @@ -1,10 +1,9 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 + * Copyright 2012-2018 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 * @@ -20,16 +19,28 @@ package samples.websocket.undertow.snake; import java.awt.Color; import java.util.Random; -public class SnakeUtils { +public final class SnakeUtils { + /** + * The width of the playfield. + */ public static final int PLAYFIELD_WIDTH = 640; + /** + * The height of the playfield. + */ public static final int PLAYFIELD_HEIGHT = 480; + /** + * The grid size. + */ public static final int GRID_SIZE = 10; private static final Random random = new Random(); + private SnakeUtils() { + } + public static String getRandomHexColor() { float hue = random.nextFloat(); // sat between 0.1 and 0.3 diff --git a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/SnakeWebSocketHandler.java b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/SnakeWebSocketHandler.java index d7396d83e5..195fab94d8 100644 --- a/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/SnakeWebSocketHandler.java +++ b/spring-boot-samples/spring-boot-sample-websocket-undertow/src/main/java/samples/websocket/undertow/snake/SnakeWebSocketHandler.java @@ -1,10 +1,9 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 + * Copyright 2012-2018 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 * @@ -29,12 +28,6 @@ import org.springframework.web.socket.handler.TextWebSocketHandler; public class SnakeWebSocketHandler extends TextWebSocketHandler { - public static final int PLAYFIELD_WIDTH = 640; - - public static final int PLAYFIELD_HEIGHT = 480; - - public static final int GRID_SIZE = 10; - private static final AtomicInteger snakeIds = new AtomicInteger(0); private static final Random random = new Random(); @@ -54,15 +47,15 @@ public class SnakeWebSocketHandler extends TextWebSocketHandler { } public static Location getRandomLocation() { - int x = roundByGridSize(random.nextInt(PLAYFIELD_WIDTH)); - int y = roundByGridSize(random.nextInt(PLAYFIELD_HEIGHT)); + int x = roundByGridSize(random.nextInt(SnakeUtils.PLAYFIELD_WIDTH)); + int y = roundByGridSize(random.nextInt(SnakeUtils.PLAYFIELD_HEIGHT)); return new Location(x, y); } private static int roundByGridSize(int value) { - value = value + (GRID_SIZE / 2); - value = value / GRID_SIZE; - value = value * GRID_SIZE; + value = value + (SnakeUtils.GRID_SIZE / 2); + value = value / SnakeUtils.GRID_SIZE; + value = value * SnakeUtils.GRID_SIZE; return value; }