diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/InfoEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/InfoEndpoint.java index e3a88c1659..a9d1696e19 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/InfoEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/InfoEndpoint.java @@ -60,7 +60,8 @@ public class InfoEndpoint extends AbstractEndpoint { /** * Return additional information to include in the output. * @return additional information - * @deprecated define an additional {@link InfoContributor} bean instead. + * @deprecated as of 1.4 in favor of defining an additional {@link InfoContributor} + * bean. */ @Deprecated protected Map getAdditionalInfo() { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfiguration.java index 9e5ffcc08b..82b223904c 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfiguration.java @@ -181,8 +181,8 @@ public class RabbitAutoConfiguration { } private boolean determineMandatoryFlag() { - Boolean flag = this.properties.getTemplate().getMandatory(); - return (flag != null ? flag : this.properties.isPublisherReturns()); + Boolean mandatory = this.properties.getTemplate().getMandatory(); + return (mandatory != null ? mandatory : this.properties.isPublisherReturns()); } private RetryTemplate createRetryTemplate(RabbitProperties.Retry properties) { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQProperties.java index 6342c43838..c50e51e235 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQProperties.java @@ -71,7 +71,7 @@ public class ActiveMQProperties { /** * Get if pooling is enabled. * @return if pooling is enabled - * @deprecated since 1.4 in favor of "spring.activemq.pool.enabled" + * @deprecated as of 1.4 in favor of "spring.activemq.pool.enabled" */ @Deprecated @DeprecatedConfigurationProperty(replacement = "spring.activemq.pool.enabled") @@ -82,7 +82,7 @@ public class ActiveMQProperties { /** * Set if pooling is enabled. * @param pooled the pooling enabled value - * @deprecated since 1.4 in favor of "spring.activemq.pool.enabled" + * @deprecated as of 1.4 in favor of "spring.activemq.pool.enabled" */ @Deprecated public void setPooled(boolean pooled) { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/test/ImportAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/test/ImportAutoConfiguration.java index 0241205be1..27c5518b93 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/test/ImportAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/test/ImportAutoConfiguration.java @@ -33,7 +33,7 @@ import org.springframework.core.annotation.AliasFor; * * @author Phillip Webb * @since 1.3.0 - * @deprecated since 1.4.0 in favor of + * @deprecated as of 1.4 in favor of * {@link org.springframework.boot.autoconfigure.ImportAutoConfiguration} */ @Target(ElementType.TYPE) diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/test/package-info.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/test/package-info.java index ca9b6767c6..bf58e313e3 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/test/package-info.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/test/package-info.java @@ -16,6 +16,6 @@ /** * Test utilities related to auto-configuration. - * @deprecated in 1.4.0 in favor of the {@code spring-boot-test-autoconfigure} module + * @deprecated as of 1.4 in favor of the {@code spring-boot-test-autoconfigure} module */ package org.springframework.boot.autoconfigure.test; diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityAutoConfiguration.java index 83e62992bb..6e3497134a 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityAutoConfiguration.java @@ -55,7 +55,7 @@ import org.springframework.web.servlet.view.velocity.VelocityConfigurer; * @author Andy Wilkinson * @author Brian Clozel * @since 1.1.0 - * @deprecated In 1.4.0 following the deprecation of Velocity support in Spring Framework + * @deprecated as of 1.4 following the deprecation of Velocity support in Spring Framework * 4.3 */ @Configuration diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityProperties.java index 567ac6ef73..c01878421d 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2014 the original author or authors. + * Copyright 2012-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +28,7 @@ import org.springframework.web.servlet.view.velocity.VelocityViewResolver; * * @author Andy Wilkinson * @since 1.1.0 - * @deprecated In 1.4.0 following the deprecation of Velocity support in Spring Framework + * @deprecated as of 1.4 following the deprecation of Velocity support in Spring Framework * 4.3 */ @Deprecated diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityTemplateAvailabilityProvider.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityTemplateAvailabilityProvider.java index 177136c820..1dd1791213 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityTemplateAvailabilityProvider.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityTemplateAvailabilityProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +29,7 @@ import org.springframework.util.ClassUtils; * * @author Andy Wilkinson * @since 1.1.0 - * @deprecated In 1.4.0 following the deprecation of Velocity support in Spring Framework + * @deprecated as of 1.4 following the deprecation of Velocity support in Spring Framework * 4.3 */ @Deprecated diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java index 4c334f0c95..6ddf2790ec 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java @@ -384,8 +384,8 @@ public class RabbitAutoConfigurationTests { @SuppressWarnings("unchecked") private boolean getMandatory(RabbitTemplate rabbitTemplate) { - ValueExpression expression = (ValueExpression) - new DirectFieldAccessor(rabbitTemplate).getPropertyValue("mandatoryExpression"); + ValueExpression expression = (ValueExpression) new DirectFieldAccessor( + rabbitTemplate).getPropertyValue("mandatoryExpression"); return expression.getValue(); } diff --git a/spring-boot-samples/spring-boot-sample-data-gemfire/src/main/java/sample/data/gemfire/SampleDataGemFireApplication.java b/spring-boot-samples/spring-boot-sample-data-gemfire/src/main/java/sample/data/gemfire/SampleDataGemFireApplication.java index 9c33171a79..53d85f89ce 100644 --- a/spring-boot-samples/spring-boot-sample-data-gemfire/src/main/java/sample/data/gemfire/SampleDataGemFireApplication.java +++ b/spring-boot-samples/spring-boot-sample-data-gemfire/src/main/java/sample/data/gemfire/SampleDataGemFireApplication.java @@ -47,71 +47,61 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; @EnableConfigurationProperties(SampleDataGemFireProperties.class) public class SampleDataGemFireApplication { - protected static final String GEMSTONES_REGION_NAME = "Gemstones"; + private static final String GEMSTONES_REGION_NAME = "Gemstones"; - private final SampleDataGemFireProperties applicationProperties; + private final SampleDataGemFireProperties properties; - public SampleDataGemFireApplication(SampleDataGemFireProperties applicationProperties) { - this.applicationProperties = applicationProperties; + public SampleDataGemFireApplication( + SampleDataGemFireProperties applicationProperties) { + this.properties = applicationProperties; + } + + @Bean + public CacheFactoryBean gemfireCache() { + CacheFactoryBean cache = new CacheFactoryBean(); + cache.setClose(true); + cache.setProperties(getCacheProperties()); + return cache; + } + + private Properties getCacheProperties() { + Properties properties = new Properties(); + properties.setProperty("name", + SampleDataGemFireApplication.class.getSimpleName()); + properties.setProperty("mcast-port", "0"); + properties.setProperty("locators", ""); + properties.setProperty("log-level", this.properties.getLogLevel()); + return properties; + } + + @Bean(name = GEMSTONES_REGION_NAME) + public ReplicatedRegionFactoryBean gemstonesRegion(Cache cache, + RegionAttributes attributes) { + ReplicatedRegionFactoryBean region = new ReplicatedRegionFactoryBean(); + region.setAttributes(attributes); + region.setClose(false); + region.setCache(cache); + region.setName(GEMSTONES_REGION_NAME); + region.setPersistent(false); + return region; + } + + @Bean + @SuppressWarnings({ "unchecked", "deprecation" }) + public RegionAttributesFactoryBean gemstonesRegionAttributes() { + RegionAttributesFactoryBean attributes = new RegionAttributesFactoryBean(); + attributes.setKeyConstraint(Long.class); + attributes.setValueConstraint(Gemstone.class); + return attributes; + } + + @Bean + public GemfireTransactionManager gemfireTransactionManager(Cache gemfireCache) { + return new GemfireTransactionManager(gemfireCache); } public static void main(final String[] args) { SpringApplication.run(SampleDataGemFireApplication.class, args); } - - @Bean - CacheFactoryBean gemfireCache() { - CacheFactoryBean gemfireCache = new CacheFactoryBean(); - - gemfireCache.setClose(true); - gemfireCache.setProperties(gemfireProperties()); - - return gemfireCache; - } - - private Properties gemfireProperties() { - Properties gemfireProperties = new Properties(); - - gemfireProperties.setProperty("name", SampleDataGemFireApplication.class.getSimpleName()); - gemfireProperties.setProperty("mcast-port", "0"); - gemfireProperties.setProperty("locators", ""); - gemfireProperties.setProperty("log-level", this.applicationProperties.getLogLevel()); - - return gemfireProperties; - } - - @Bean(name = GEMSTONES_REGION_NAME) - ReplicatedRegionFactoryBean gemstonesRegion(Cache gemfireCache, - RegionAttributes gemstonesRegionAttributes) { - - ReplicatedRegionFactoryBean gemstonesRegion = - new ReplicatedRegionFactoryBean(); - - gemstonesRegion.setAttributes(gemstonesRegionAttributes); - gemstonesRegion.setClose(false); - gemstonesRegion.setCache(gemfireCache); - gemstonesRegion.setName(GEMSTONES_REGION_NAME); - gemstonesRegion.setPersistent(false); - - return gemstonesRegion; - } - - @Bean - @SuppressWarnings("unchecked") - RegionAttributesFactoryBean gemstonesRegionAttributes() { - RegionAttributesFactoryBean gemstonesRegionAttributes = - new RegionAttributesFactoryBean(); - - gemstonesRegionAttributes.setKeyConstraint(Long.class); - gemstonesRegionAttributes.setValueConstraint(Gemstone.class); - - return gemstonesRegionAttributes; - } - - @Bean - GemfireTransactionManager gemfireTransactionManager(Cache gemfireCache) { - return new GemfireTransactionManager(gemfireCache); - } - } diff --git a/spring-boot-samples/spring-boot-sample-data-gemfire/src/main/java/sample/data/gemfire/domain/Gemstone.java b/spring-boot-samples/spring-boot-sample-data-gemfire/src/main/java/sample/data/gemfire/domain/Gemstone.java index c883476817..4dc7180154 100644 --- a/spring-boot-samples/spring-boot-sample-data-gemfire/src/main/java/sample/data/gemfire/domain/Gemstone.java +++ b/spring-boot-samples/spring-boot-sample-data-gemfire/src/main/java/sample/data/gemfire/domain/Gemstone.java @@ -18,6 +18,7 @@ package sample.data.gemfire.domain; import java.io.Serializable; +import org.springframework.core.style.ToStringCreator; import org.springframework.data.annotation.Id; import org.springframework.data.gemfire.mapping.Region; import org.springframework.util.ObjectUtils; @@ -39,11 +40,11 @@ public class Gemstone implements Serializable { public Gemstone() { } - public Gemstone(final Long id) { + public Gemstone(Long id) { this.id = id; } - public Gemstone(final Long id, final String name) { + public Gemstone(Long id, String name) { this.id = id; this.name = name; } @@ -52,7 +53,7 @@ public class Gemstone implements Serializable { return this.id; } - public void setId(final Long id) { + public void setId(Long id) { this.id = id; } @@ -60,36 +61,32 @@ public class Gemstone implements Serializable { return this.name; } - public void setName(final String name) { + public void setName(String name) { this.name = name; } @Override - public boolean equals(final Object obj) { + public boolean equals(Object obj) { if (obj == this) { return true; } - - if (!(obj instanceof Gemstone)) { + if (obj == null || !obj.getClass().equals(getClass())) { return false; } - - Gemstone that = (Gemstone) obj; - - return ObjectUtils.nullSafeEquals(this.getName(), that.getName()); + return ObjectUtils.nullSafeEquals(this.getName(), ((Gemstone) obj).getName()); } @Override public int hashCode() { - int hashValue = 17; - hashValue = 37 * hashValue + ObjectUtils.nullSafeHashCode(getName()); - return hashValue; + return ObjectUtils.nullSafeHashCode(getName()); } @Override public String toString() { - return String.format("{ @type = %1$s, id = %2$d, name = %3$s }", - getClass().getName(), getId(), getName()); + ToStringCreator creator = new ToStringCreator(this); + creator.append("id", this.id); + creator.append("name", this.name); + return creator.toString(); } } diff --git a/spring-boot-samples/spring-boot-sample-data-gemfire/src/main/java/sample/data/gemfire/service/GemstoneServiceImpl.java b/spring-boot-samples/spring-boot-sample-data-gemfire/src/main/java/sample/data/gemfire/service/GemstoneServiceImpl.java index a16d9fa8ed..4d21d94cf9 100644 --- a/spring-boot-samples/spring-boot-sample-data-gemfire/src/main/java/sample/data/gemfire/service/GemstoneServiceImpl.java +++ b/spring-boot-samples/spring-boot-sample-data-gemfire/src/main/java/sample/data/gemfire/service/GemstoneServiceImpl.java @@ -16,15 +16,14 @@ package sample.data.gemfire.service; -import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.List; import javax.annotation.PostConstruct; import sample.data.gemfire.domain.Gemstone; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.Assert; @@ -39,14 +38,18 @@ import org.springframework.util.Assert; @Service("gemstoneService") public class GemstoneServiceImpl implements GemstoneService { - protected static final List APPROVED_GEMS = new ArrayList( - Arrays.asList("ALEXANDRITE", "AQUAMARINE", "DIAMOND", "OPAL", "PEARL", "RUBY", - "SAPPHIRE", "SPINEL", "TOPAZ")); + protected static final List APPROVED_GEMS; - private final GemstoneRepository gemstoneRepository; + static { + APPROVED_GEMS = Collections.unmodifiableList( + Arrays.asList("ALEXANDRITE,AQUAMARINE,DIAMOND,OPAL,PEARL," + + "RUBY,SAPPHIRE,SPINEL,TOPAZ".split(","))); + } + + private final GemstoneRepository repository; public GemstoneServiceImpl(GemstoneRepository gemstoneRepository) { - this.gemstoneRepository = gemstoneRepository; + this.repository = gemstoneRepository; } @PostConstruct @@ -56,20 +59,16 @@ public class GemstoneServiceImpl implements GemstoneService { /** * Returns a count of the number of Gemstones in the GemFire Cache. - *

- * * @return a long value indicating the number of Gemstones in the GemFire Cache. */ @Override @Transactional(readOnly = true) public long count() { - return this.gemstoneRepository.count(); + return this.repository.count(); } /** * Gets a Gemstone by ID. - *

- * * @param id a long value indicating the identifier of the Gemstone. * @return a Gemstone with ID, or null if no Gemstone exists with ID. * @see sample.data.gemfire.domain.Gemstone @@ -77,13 +76,11 @@ public class GemstoneServiceImpl implements GemstoneService { @Override @Transactional(readOnly = true) public Gemstone get(Long id) { - return this.gemstoneRepository.findOne(id); + return this.repository.findOne(id); } /** * Gets a Gemstone by name. - *

- * * @param name a String value indicating the name of the Gemstone. * @return a Gemstone with name, or null if no Gemstone exists with name. * @see sample.data.gemfire.domain.Gemstone @@ -91,13 +88,11 @@ public class GemstoneServiceImpl implements GemstoneService { @Override @Transactional(readOnly = true) public Gemstone get(String name) { - return this.gemstoneRepository.findByName(name); + return this.repository.findByName(name); } /** * Return a listing of Gemstones currently stored in the GemFire Cache. - *

- * * @return an Iterable object to iterate over the list of Gemstones currently stored * in the GemFire Cache. * @see java.lang.Iterable @@ -106,13 +101,11 @@ public class GemstoneServiceImpl implements GemstoneService { @Override @Transactional(readOnly = true) public Iterable list() { - return this.gemstoneRepository.findAll(); + return this.repository.findAll(); } /** * Saves the specified Gemstone to the GemFire Cache. - *

- * * @param gemstone the Gemstone to save in the GemFire Cache. * @return the saved Gemstone. * @see sample.data.gemfire.domain.Gemstone @@ -122,17 +115,13 @@ public class GemstoneServiceImpl implements GemstoneService { public Gemstone save(Gemstone gemstone) { Assert.notNull(gemstone, "The Gemstone to save must not be null!"); Assert.notNull(gemstone.getName(), "The name of the Gemstone must be specified!"); - - // NOTE deliberately (& naively) validate the Gemstone after mutating data access in - // GemFire rather than before to demonstrate transactions in GemFire. - Gemstone savedGemstone = validate(this.gemstoneRepository.save(gemstone)); - - Assert.state(savedGemstone.equals(get(gemstone.getId())), String.format( - "Failed to find Gemstone (%1$s) in GemFire's Cache Region 'Gemstones'!", - gemstone)); - + // NOTE deliberately (& naively) validate the Gemstone after mutating data access + // in GemFire rather than before to demonstrate transactions in GemFire. + Gemstone savedGemstone = validate(this.repository.save(gemstone)); + Assert.state(savedGemstone.equals(get(gemstone.getId())), + String.format("Failed to find Gemstone (%1$s) in " + + "GemFire's Cache Region 'Gemstones'!", gemstone)); System.out.printf("Saved Gemstone [%1$s]%n", savedGemstone.getName()); - return gemstone; } @@ -144,16 +133,7 @@ public class GemstoneServiceImpl implements GemstoneService { throw new IllegalGemstoneException( String.format("[%1$s] is not a valid Gemstone!", gemstone.getName())); } - return gemstone; } - public static final class IllegalGemstoneException extends IllegalArgumentException { - - public IllegalGemstoneException(String message) { - super(message); - } - - } - } diff --git a/spring-boot-samples/spring-boot-sample-data-gemfire/src/main/java/sample/data/gemfire/service/IllegalGemstoneException.java b/spring-boot-samples/spring-boot-sample-data-gemfire/src/main/java/sample/data/gemfire/service/IllegalGemstoneException.java new file mode 100644 index 0000000000..1e288e76ff --- /dev/null +++ b/spring-boot-samples/spring-boot-sample-data-gemfire/src/main/java/sample/data/gemfire/service/IllegalGemstoneException.java @@ -0,0 +1,30 @@ +/* + * Copyright 2012-2016 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package sample.data.gemfire.service; + +/** + * Exception thrown from {@link GemstoneService}. + * + * @author John Blum + */ +public class IllegalGemstoneException extends IllegalArgumentException { + + public IllegalGemstoneException(String message) { + super(message); + } + +} diff --git a/spring-boot-samples/spring-boot-sample-data-gemfire/src/test/java/sample/data/gemfire/SampleDataGemFireApplicationTests.java b/spring-boot-samples/spring-boot-sample-data-gemfire/src/test/java/sample/data/gemfire/SampleDataGemFireApplicationTests.java index 38aed96983..ab372a4047 100644 --- a/spring-boot-samples/spring-boot-sample-data-gemfire/src/test/java/sample/data/gemfire/SampleDataGemFireApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-data-gemfire/src/test/java/sample/data/gemfire/SampleDataGemFireApplicationTests.java @@ -22,7 +22,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import sample.data.gemfire.domain.Gemstone; import sample.data.gemfire.service.GemstoneService; -import sample.data.gemfire.service.GemstoneServiceImpl.IllegalGemstoneException; +import sample.data.gemfire.service.IllegalGemstoneException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; @@ -40,54 +40,42 @@ import static org.assertj.core.api.Assertions.assertThat; public class SampleDataGemFireApplicationTests { @Autowired - private GemstoneService gemstoneService; + private GemstoneService service; private final AtomicLong idGenerator = new AtomicLong(0L); @Test public void gemstonesAppServiceEndpoints() { - assertThat(this.gemstoneService.count()).isEqualTo(0); - assertThat(this.gemstoneService.list()).isEmpty(); - - this.gemstoneService.save(createGemstone("Diamond")); - this.gemstoneService.save(createGemstone("Ruby")); - - assertThat(this.gemstoneService.count()).isEqualTo(2); - assertThat(this.gemstoneService.list()).contains( - getGemstones("Diamond", "Ruby")); - + assertThat(this.service.count()).isEqualTo(0); + assertThat(this.service.list()).isEmpty(); + this.service.save(createGemstone("Diamond")); + this.service.save(createGemstone("Ruby")); + assertThat(this.service.count()).isEqualTo(2); + assertThat(this.service.list()).contains(getGemstones("Diamond", "Ruby")); try { - this.gemstoneService.save(createGemstone("Coal")); + this.service.save(createGemstone("Coal")); } catch (IllegalGemstoneException ignore) { // expected } - - assertThat(this.gemstoneService.count()).isEqualTo(2); - assertThat(this.gemstoneService.list()).contains( - getGemstones("Diamond", "Ruby")); - - this.gemstoneService.save(createGemstone("Pearl")); - this.gemstoneService.save(createGemstone("Sapphire")); - - assertThat(this.gemstoneService.count()).isEqualTo(4); - assertThat(this.gemstoneService.list()).contains( - getGemstones("Diamond", "Ruby", "Pearl", "Sapphire")); - + assertThat(this.service.count()).isEqualTo(2); + assertThat(this.service.list()).contains(getGemstones("Diamond", "Ruby")); + this.service.save(createGemstone("Pearl")); + this.service.save(createGemstone("Sapphire")); + assertThat(this.service.count()).isEqualTo(4); + assertThat(this.service.list()) + .contains(getGemstones("Diamond", "Ruby", "Pearl", "Sapphire")); try { - this.gemstoneService.save(createGemstone("Quartz")); + this.service.save(createGemstone("Quartz")); } catch (IllegalGemstoneException ignore) { // expected } - - assertThat(this.gemstoneService.count()).isEqualTo(4); - assertThat(this.gemstoneService.list()).contains( - getGemstones("Diamond", "Ruby", "Pearl", "Sapphire")); - assertThat(this.gemstoneService.get("Diamond")).isEqualTo( - createGemstone("Diamond")); - assertThat(this.gemstoneService.get("Pearl")).isEqualTo( - createGemstone("Pearl")); + assertThat(this.service.count()).isEqualTo(4); + assertThat(this.service.list()) + .contains(getGemstones("Diamond", "Ruby", "Pearl", "Sapphire")); + assertThat(this.service.get("Diamond")).isEqualTo(createGemstone("Diamond")); + assertThat(this.service.get("Pearl")).isEqualTo(createGemstone("Pearl")); } private Gemstone[] getGemstones(String... names) { diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/ConfigFileApplicationContextInitializer.java b/spring-boot-test/src/main/java/org/springframework/boot/test/ConfigFileApplicationContextInitializer.java index 1f7be0a5c7..07cfcca717 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/ConfigFileApplicationContextInitializer.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/ConfigFileApplicationContextInitializer.java @@ -27,7 +27,7 @@ import org.springframework.test.context.ContextConfiguration; * * @author Phillip Webb * @see ConfigFileApplicationListener - * @deprecated since 1.4.0 in favor of + * @deprecated as of 1.4 in favor of * {@link org.springframework.boot.test.context.ConfigFileApplicationContextInitializer} */ @Deprecated diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/EnvironmentTestUtils.java b/spring-boot-test/src/main/java/org/springframework/boot/test/EnvironmentTestUtils.java index a07fede44f..afaabc44ce 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/EnvironmentTestUtils.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/EnvironmentTestUtils.java @@ -26,7 +26,7 @@ import org.springframework.core.env.Environment; * * @author Dave Syer * @author Stephane Nicoll - * @deprecated since 1.4.0 in favor of + * @deprecated as of 1.4 in favor of * {@link org.springframework.boot.test.util.EnvironmentTestUtils} */ @Deprecated diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/IntegrationTest.java b/spring-boot-test/src/main/java/org/springframework/boot/test/IntegrationTest.java index 9e1484a24d..4fa8c454e9 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/IntegrationTest.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/IntegrationTest.java @@ -41,7 +41,7 @@ import org.springframework.test.context.transaction.TransactionalTestExecutionLi * * @author Dave Syer * @see WebIntegrationTest - * @deprecated since 1.4.0 in favor of {@link SpringBootTest} + * @deprecated as of 1.4 in favor of {@link SpringBootTest} */ @Documented @Inherited diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/IntegrationTestPropertiesListener.java b/spring-boot-test/src/main/java/org/springframework/boot/test/IntegrationTestPropertiesListener.java index b121e9031d..2ecefb6a0c 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/IntegrationTestPropertiesListener.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/IntegrationTestPropertiesListener.java @@ -30,7 +30,7 @@ import org.springframework.test.util.ReflectionTestUtils; * @author Dave Syer * @author Phillip Webb * @since 1.2.0 - * @deprecated since 1.4.0 as no longer used by {@code @IntegrationTest}. + * @deprecated as of 1.4 as no longer used by {@code @IntegrationTest}. */ @Deprecated public class IntegrationTestPropertiesListener extends AbstractTestExecutionListener { diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/MergedContextConfigurationProperties.java b/spring-boot-test/src/main/java/org/springframework/boot/test/MergedContextConfigurationProperties.java index cc80cbac11..bdf8ef65cc 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/MergedContextConfigurationProperties.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/MergedContextConfigurationProperties.java @@ -27,7 +27,7 @@ import org.springframework.test.util.ReflectionTestUtils; * Provides access to {@link MergedContextConfiguration} properties. * * @author Phillip Webb - * @deprecated since 1.4.0 along with {@link IntegrationTestPropertiesListener} + * @deprecated as of 1.4 along with {@link IntegrationTestPropertiesListener} */ @Deprecated class MergedContextConfigurationProperties { diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/OutputCapture.java b/spring-boot-test/src/main/java/org/springframework/boot/test/OutputCapture.java index 608f193254..030ba3a89d 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/OutputCapture.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/OutputCapture.java @@ -21,7 +21,7 @@ package org.springframework.boot.test; * * @author Phillip Webb * @author Andy Wilkinson - * @deprecated since 1.4.0 in favor of + * @deprecated as of 1.4 in favor of * {@link org.springframework.boot.test.rule.OutputCapture} */ @Deprecated diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/SpringApplicationConfiguration.java b/spring-boot-test/src/main/java/org/springframework/boot/test/SpringApplicationConfiguration.java index 7d0547b2f5..0c70a5b86f 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/SpringApplicationConfiguration.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/SpringApplicationConfiguration.java @@ -41,7 +41,7 @@ import org.springframework.test.context.ContextConfiguration; * @author Sam Brannen * @see SpringBootContextLoader * @see ContextConfiguration - * @deprecated since 1.4.0 in favor of {@link SpringBootTest} or direct use of + * @deprecated as of 1.4 in favor of {@link SpringBootTest} or direct use of * {@link SpringBootContextLoader}. */ @ContextConfiguration(loader = SpringBootContextLoader.class) diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/SpringApplicationContextLoader.java b/spring-boot-test/src/main/java/org/springframework/boot/test/SpringApplicationContextLoader.java index 73c0e3495a..62de522a93 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/SpringApplicationContextLoader.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/SpringApplicationContextLoader.java @@ -70,10 +70,9 @@ import org.springframework.web.context.support.GenericWebApplicationContext; * @see org.springframework.boot.test.context.SpringBootTest * @see org.springframework.boot.test.IntegrationTest * @see org.springframework.boot.test.WebIntegrationTest - * @deprecated since 1.4.0 in favor of - * {@link SpringBootTest @SpringApplicationTest} - * {@link org.springframework.boot.test.context.SpringBootContextLoader} can also - * be considered if absolutely necessary. + * @deprecated as of 1.4 in favor of {@link SpringBootTest @SpringApplicationTest} + * {@link org.springframework.boot.test.context.SpringBootContextLoader} can also be + * considered if absolutely necessary. */ @Deprecated public class SpringApplicationContextLoader extends AbstractContextLoader { diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/SpringBootMockServletContext.java b/spring-boot-test/src/main/java/org/springframework/boot/test/SpringBootMockServletContext.java index 57d23dc746..98b14eb5be 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/SpringBootMockServletContext.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/SpringBootMockServletContext.java @@ -25,7 +25,7 @@ import org.springframework.mock.web.MockServletContext; * found. * * @author Phillip Webb - * @deprecated since 1.4.0 in favor of + * @deprecated as of 1.4 in favor of * {@link org.springframework.boot.test.mock.web.SpringBootMockServletContext} */ @Deprecated diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/TestRestTemplate.java b/spring-boot-test/src/main/java/org/springframework/boot/test/TestRestTemplate.java index 4618c69704..398a0735eb 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/TestRestTemplate.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/TestRestTemplate.java @@ -26,7 +26,7 @@ import org.springframework.web.client.RestTemplate; * * @author Dave Syer * @author Phillip Webb - * @deprecated since 1.4.0 in favor of + * @deprecated as of 1.4 in favor of * {@link org.springframework.boot.test.web.client.TestRestTemplate} */ @Deprecated diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/WebAppIntegrationTestContextBootstrapper.java b/spring-boot-test/src/main/java/org/springframework/boot/test/WebAppIntegrationTestContextBootstrapper.java index c80ad9a1bd..c2e6ab6fe9 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/WebAppIntegrationTestContextBootstrapper.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/WebAppIntegrationTestContextBootstrapper.java @@ -29,7 +29,7 @@ import org.springframework.test.context.web.WebMergedContextConfiguration; * * @author Phillip Webb * @since 1.2.1 - * @deprecated Since 1.4.0 + * @deprecated as of 1.4 along with {@link WebIntegrationTest} */ @Deprecated class WebAppIntegrationTestContextBootstrapper extends DefaultTestContextBootstrapper { diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/WebIntegrationTest.java b/spring-boot-test/src/main/java/org/springframework/boot/test/WebIntegrationTest.java index aa3cb01b27..4838216f22 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/WebIntegrationTest.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/WebIntegrationTest.java @@ -39,7 +39,7 @@ import org.springframework.test.context.BootstrapWith; * @author Phillip Webb * @since 1.2.1 * @see IntegrationTest - * @deprecated since 1.4.0 in favor of + * @deprecated as of 1.4 in favor of * {@link org.springframework.boot.test.context.SpringBootTest} with * {@code webEnvironment=RANDOM_PORT} or {@code webEnvironment=DEFINED_PORT}. */ diff --git a/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java b/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java index 49974ddfe6..6cba653da6 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java @@ -582,8 +582,8 @@ public class ConfigFileApplicationListener implements EnvironmentPostProcessor, } private Set asResolvedSet(String value, String fallback) { - List list = Arrays - .asList(StringUtils.trimArrayElements(StringUtils.commaDelimitedListToStringArray(value != null + List list = Arrays.asList(StringUtils.trimArrayElements( + StringUtils.commaDelimitedListToStringArray(value != null ? this.environment.resolvePlaceholders(value) : fallback))); Collections.reverse(list); return new LinkedHashSet(list); diff --git a/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationProperties.java b/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationProperties.java index dbf5a1fba5..5471a1ebd4 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationProperties.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationProperties.java @@ -90,7 +90,7 @@ public @interface ConfigurationProperties { * defined in the environment. * @return the path (or paths) of resources to bind to * @see #merge() - * @deprecated since 1.4 in favor of configuring the environment directly with + * @deprecated as of 1.4 in favor of configuring the environment directly with * additional locations */ @Deprecated @@ -101,7 +101,7 @@ public @interface ConfigurationProperties { * merged with the default configuration. * @return the flag value (default true) * @see #locations() - * @deprecated since 1.4 along with {@link #locations()} in favor of configuring the + * @deprecated as of 1.4 along with {@link #locations()} in favor of configuring the * environment directly with additional locations */ @Deprecated diff --git a/spring-boot/src/main/java/org/springframework/boot/orm/jpa/hibernate/SpringNamingStrategy.java b/spring-boot/src/main/java/org/springframework/boot/orm/jpa/hibernate/SpringNamingStrategy.java index 7ab2e36855..1eb7169138 100644 --- a/spring-boot/src/main/java/org/springframework/boot/orm/jpa/hibernate/SpringNamingStrategy.java +++ b/spring-boot/src/main/java/org/springframework/boot/orm/jpa/hibernate/SpringNamingStrategy.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2014 the original author or authors. + * Copyright 2012-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,7 +33,7 @@ import org.springframework.util.StringUtils; * @author Phillip Webb * @see "http://stackoverflow.com/questions/7689206/ejb3namingstrategy-vs-improvednamingstrategy-foreign-key-naming" * @since 1.2.0 - * @deprecated since 1.4.0 since {@link NamingStrategy} is no longer used by + * @deprecated as of 1.4 since {@link NamingStrategy} is no longer used by * {@link Hibernate}. Consider using {@link SpringPhysicalNamingStrategy} */ @Deprecated diff --git a/spring-boot/src/main/java/org/springframework/boot/web/servlet/view/velocity/EmbeddedVelocityViewResolver.java b/spring-boot/src/main/java/org/springframework/boot/web/servlet/view/velocity/EmbeddedVelocityViewResolver.java index c58a2225a6..b827cbedd7 100644 --- a/spring-boot/src/main/java/org/springframework/boot/web/servlet/view/velocity/EmbeddedVelocityViewResolver.java +++ b/spring-boot/src/main/java/org/springframework/boot/web/servlet/view/velocity/EmbeddedVelocityViewResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ import org.springframework.web.servlet.view.velocity.VelocityViewResolver; * * @author Phillip Webb * @since 1.2.5 - * @deprecated In 1.4.0 following the deprecation of Velocity support in Spring Framework + * @deprecated as of 1.4 following the deprecation of Velocity support in Spring Framework * 4.3 */ @Deprecated diff --git a/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java b/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java index 8716c216f8..8dac5d4a1c 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java @@ -534,14 +534,16 @@ public class ConfigFileApplicationListenerTests { public void yamlSetsMultiProfiles() throws Exception { this.initializer.setSearchNames("testsetmultiprofiles"); this.initializer.postProcessEnvironment(this.environment, this.application); - assertThat(this.environment.getActiveProfiles()).containsExactly("dev", "healthcheck"); + assertThat(this.environment.getActiveProfiles()).containsExactly("dev", + "healthcheck"); } @Test public void yamlSetsMultiProfilesWithWithespace() throws Exception { this.initializer.setSearchNames("testsetmultiprofileswhitespace"); this.initializer.postProcessEnvironment(this.environment, this.application); - assertThat(this.environment.getActiveProfiles()).containsExactly("dev", "healthcheck"); + assertThat(this.environment.getActiveProfiles()).containsExactly("dev", + "healthcheck"); } @Test