Browse Source

Polish sample package names

pull/3297/merge
Phillip Webb 11 years ago
parent
commit
1ce617f1ae
  1. 2
      spring-boot-samples/spring-boot-sample-actuator-noweb/src/main/java/sample/actuator/noweb/HelloWorldService.java
  2. 2
      spring-boot-samples/spring-boot-sample-actuator-noweb/src/main/java/sample/actuator/noweb/SampleActuatorNoWebApplication.java
  3. 2
      spring-boot-samples/spring-boot-sample-actuator-noweb/src/main/java/sample/actuator/noweb/ServiceProperties.java
  4. 3
      spring-boot-samples/spring-boot-sample-actuator-noweb/src/test/java/sample/actuator/noweb/SampleActuatorNoWebApplicationTests.java
  5. 8
      spring-boot-samples/spring-boot-sample-actuator-ui/src/main/java/sample/actuator/ui/SampleActuatorUiApplication.java
  6. 8
      spring-boot-samples/spring-boot-sample-actuator/src/main/java/sample/actuator/SampleActuatorApplication.java
  7. 1
      spring-boot-samples/spring-boot-sample-actuator/src/main/java/sample/actuator/SampleController.java
  8. 1
      spring-boot-samples/spring-boot-sample-amqp/src/main/java/sample/amqp/SampleAmqpSimpleApplication.java
  9. 1
      spring-boot-samples/spring-boot-sample-aop/src/main/java/sample/aop/SampleAopApplication.java
  10. 2
      spring-boot-samples/spring-boot-sample-atmosphere/src/main/java/sample/atmosphere/ChatService.java
  11. 3
      spring-boot-samples/spring-boot-sample-atmosphere/src/main/java/sample/atmosphere/Message.java
  12. 3
      spring-boot-samples/spring-boot-sample-atmosphere/src/main/java/sample/atmosphere/SampleAtmosphereApplication.java
  13. 3
      spring-boot-samples/spring-boot-sample-atmosphere/src/test/java/sample/atmosphere/SampleAtmosphereApplicationTests.java
  14. 1
      spring-boot-samples/spring-boot-sample-batch/src/main/java/sample/batch/SampleBatchApplication.java
  15. 9
      spring-boot-samples/spring-boot-sample-cache/src/main/java/sample/cache/CacheManagerCheck.java
  16. 2
      spring-boot-samples/spring-boot-sample-cache/src/main/java/sample/cache/Country.java
  17. 2
      spring-boot-samples/spring-boot-sample-cache/src/main/java/sample/cache/CountryRepository.java
  18. 6
      spring-boot-samples/spring-boot-sample-cache/src/main/java/sample/cache/SampleCacheApplication.java
  19. 2
      spring-boot-samples/spring-boot-sample-cache/src/main/java/sample/cache/SampleClient.java
  20. 5
      spring-boot-samples/spring-boot-sample-cache/src/test/java/sample/cache/SampleCacheApplicationTests.java
  21. 1
      spring-boot-samples/spring-boot-sample-data-elasticsearch/src/main/java/sample/data/elasticsearch/SampleElasticsearchApplication.java
  22. 1
      spring-boot-samples/spring-boot-sample-data-gemfire/src/main/java/sample/data/gemfire/service/GemstoneServiceImpl.java
  23. 3
      spring-boot-samples/spring-boot-sample-data-mongodb/src/main/java/sample/data/mongo/SampleMongoApplication.java
  24. 4
      spring-boot-samples/spring-boot-sample-data-mongodb/src/test/java/sample/data/mongo/SampleMongoApplicationTests.java
  25. 1
      spring-boot-samples/spring-boot-sample-data-redis/src/main/java/sample/data/redis/SampleRedisApplication.java
  26. 29
      spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/jpa/SampleDataRestApplication.java
  27. 76
      spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/jpa/domain/City.java
  28. 75
      spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/jpa/domain/Hotel.java
  29. 37
      spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/jpa/service/CityRepository.java
  30. 44
      spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/jpa/service/CitySearchCriteria.java
  31. 30
      spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/jpa/service/HotelRepository.java
  32. 87
      spring-boot-samples/spring-boot-sample-data-rest/src/test/java/sample/data/jpa/SampleDataRestApplicationTests.java
  33. 71
      spring-boot-samples/spring-boot-sample-data-rest/src/test/java/sample/data/jpa/service/CityRepositoryIntegrationTests.java
  34. 2
      spring-boot-samples/spring-boot-sample-devtools/src/main/java/sample/devtools/Message.java
  35. 2
      spring-boot-samples/spring-boot-sample-devtools/src/main/java/sample/devtools/MyController.java
  36. 2
      spring-boot-samples/spring-boot-sample-devtools/src/main/java/sample/devtools/SampleDevToolsApplication.java
  37. 52
      spring-boot-samples/spring-boot-sample-flyway/src/main/java/sample/flyway/Person.java
  38. 25
      spring-boot-samples/spring-boot-sample-flyway/src/main/java/sample/flyway/PersonRepository.java
  39. 41
      spring-boot-samples/spring-boot-sample-flyway/src/main/java/sample/flyway/SampleFlywayApplication.java
  40. 2
      spring-boot-samples/spring-boot-sample-hateoas/src/main/java/sample/hateoas/SampleHateoasApplication.java
  41. 2
      spring-boot-samples/spring-boot-sample-hateoas/src/main/java/sample/hateoas/domain/Customer.java
  42. 2
      spring-boot-samples/spring-boot-sample-hateoas/src/main/java/sample/hateoas/domain/CustomerRepository.java
  43. 2
      spring-boot-samples/spring-boot-sample-hateoas/src/main/java/sample/hateoas/domain/InMemoryCustomerRepository.java
  44. 6
      spring-boot-samples/spring-boot-sample-hateoas/src/main/java/sample/hateoas/web/CustomerController.java
  45. 3
      spring-boot-samples/spring-boot-sample-hateoas/src/test/java/sample/hateoas/SampleHateoasApplicationTests.java
  46. 1
      spring-boot-samples/spring-boot-sample-hornetq/src/main/java/sample/hornetq/SampleHornetQApplication.java
  47. 2
      spring-boot-samples/spring-boot-sample-jetty-ssl/src/main/java/sample/jetty/ssl/SampleJettySslApplication.java
  48. 2
      spring-boot-samples/spring-boot-sample-jetty-ssl/src/main/java/sample/jetty/ssl/service/HelloWorldService.java
  49. 4
      spring-boot-samples/spring-boot-sample-jetty-ssl/src/main/java/sample/jetty/ssl/web/SampleController.java
  50. 4
      spring-boot-samples/spring-boot-sample-jetty-ssl/src/test/java/sample/jetty/ssl/SampleJettySslApplicationTests.java
  51. 2
      spring-boot-samples/spring-boot-sample-jetty8-ssl/src/main/java/sample/jetty8/ssl/SampleJetty8SslApplication.java
  52. 2
      spring-boot-samples/spring-boot-sample-jetty8-ssl/src/main/java/sample/jetty8/ssl/service/HelloWorldService.java
  53. 4
      spring-boot-samples/spring-boot-sample-jetty8-ssl/src/main/java/sample/jetty8/ssl/web/SampleController.java
  54. 4
      spring-boot-samples/spring-boot-sample-jetty8-ssl/src/test/java/sample/jetty8/ssl/SampleJetty8SslApplicationTests.java
  55. 2
      spring-boot-samples/spring-boot-sample-jetty8/src/main/java/sample/jetty8/SampleJetty8Application.java
  56. 2
      spring-boot-samples/spring-boot-sample-jetty8/src/main/java/sample/jetty8/service/HelloWorldService.java
  57. 4
      spring-boot-samples/spring-boot-sample-jetty8/src/main/java/sample/jetty8/web/SampleController.java
  58. 3
      spring-boot-samples/spring-boot-sample-jetty8/src/test/java/sample/jetty8/SampleJetty8ApplicationTests.java
  59. 8
      spring-boot-samples/spring-boot-sample-metrics-opentsdb/src/main/java/sample/metrics/opentsdb/SampleOpenTsdbExportApplication.java
  60. 8
      spring-boot-samples/spring-boot-sample-metrics-redis/src/main/java/sample/metrics/redis/SampleRedisExportApplication.java
  61. 10
      spring-boot-samples/spring-boot-sample-parent-context/src/main/java/sample/parent/SampleParentContextApplication.java
  62. 1
      spring-boot-samples/spring-boot-sample-profile/src/main/java/sample/profile/SampleProfileApplication.java
  63. 8
      spring-boot-samples/spring-boot-sample-servlet/src/main/java/sample/servlet/SampleServletApplication.java
  64. 39
      spring-boot-samples/spring-boot-sample-session-redis/src/main/java/sample/session/redis/HelloRestController.java
  65. 19
      spring-boot-samples/spring-boot-sample-session-redis/src/main/java/sample/session/redis/SampleSessionRedisApplication.java
  66. 1
      spring-boot-samples/spring-boot-sample-simple/src/main/java/sample/simple/SampleSimpleApplication.java
  67. 2
      spring-boot-samples/spring-boot-sample-tomcat-jsp/src/main/java/sample/tomcat/jsp/SampleTomcatJspApplication.java
  68. 2
      spring-boot-samples/spring-boot-sample-tomcat-jsp/src/main/java/sample/tomcat/jsp/WelcomeController.java
  69. 3
      spring-boot-samples/spring-boot-sample-tomcat-jsp/src/test/java/sample/tomcat/jsp/SampleWebJspApplicationTests.java
  70. 2
      spring-boot-samples/spring-boot-sample-tomcat-multi-connectors/src/main/java/sample/tomcat/multiconnector/SampleTomcatTwoConnectorsApplication.java
  71. 2
      spring-boot-samples/spring-boot-sample-tomcat-multi-connectors/src/main/java/sample/tomcat/multiconnector/web/SampleController.java
  72. 3
      spring-boot-samples/spring-boot-sample-tomcat-multi-connectors/src/test/java/sample/tomcat/multiconnector/SampleTomcatTwoConnectorsApplicationTests.java
  73. 2
      spring-boot-samples/spring-boot-sample-tomcat-ssl/src/main/java/sample/tomcat/ssl/SampleTomcatSslApplication.java
  74. 2
      spring-boot-samples/spring-boot-sample-tomcat-ssl/src/main/java/sample/tomcat/ssl/web/SampleController.java
  75. 4
      spring-boot-samples/spring-boot-sample-tomcat-ssl/src/test/java/sample/tomcat/SampleTomcatSslApplicationTests.java
  76. 2
      spring-boot-samples/spring-boot-sample-tomcat7-jsp/src/main/java/sample/tomcat7/jsp/SampleTomcat7JspApplication.java
  77. 2
      spring-boot-samples/spring-boot-sample-tomcat7-jsp/src/main/java/sample/tomcat7/jsp/WelcomeController.java
  78. 3
      spring-boot-samples/spring-boot-sample-tomcat7-jsp/src/test/java/sample/tomcat7/jsp/SampleWebJspApplicationTests.java
  79. 2
      spring-boot-samples/spring-boot-sample-undertow-ssl/src/main/java/sample/undertow/ssl/SampleUndertowSslApplication.java
  80. 2
      spring-boot-samples/spring-boot-sample-undertow-ssl/src/main/java/sample/undertow/ssl/service/HelloWorldService.java
  81. 4
      spring-boot-samples/spring-boot-sample-undertow-ssl/src/main/java/sample/undertow/ssl/web/SampleController.java
  82. 4
      spring-boot-samples/spring-boot-sample-undertow-ssl/src/test/java/sample/undertow/ssl/SampleUndertowSslApplicationTests.java
  83. 2
      spring-boot-samples/spring-boot-sample-web-groovy-templates/src/main/java/sample/groovytemplates/InMemoryMessageRespository.java
  84. 2
      spring-boot-samples/spring-boot-sample-web-groovy-templates/src/main/java/sample/groovytemplates/Message.java
  85. 2
      spring-boot-samples/spring-boot-sample-web-groovy-templates/src/main/java/sample/groovytemplates/MessageRepository.java
  86. 2
      spring-boot-samples/spring-boot-sample-web-groovy-templates/src/main/java/sample/groovytemplates/SampleGroovyTemplateApplication.java
  87. 6
      spring-boot-samples/spring-boot-sample-web-groovy-templates/src/main/java/sample/groovytemplates/mvc/MessageController.java
  88. 3
      spring-boot-samples/spring-boot-sample-web-groovy-templates/src/test/java/sample/groovytemplates/MessageControllerWebTests.java
  89. 3
      spring-boot-samples/spring-boot-sample-web-groovy-templates/src/test/java/sample/groovytemplates/SampleGroovyTemplateApplicationTests.java
  90. 15
      spring-boot-samples/spring-boot-sample-web-method-security/src/main/java/sample/security/method/SampleMethodSecurityApplication.java
  91. 3
      spring-boot-samples/spring-boot-sample-web-method-security/src/test/java/sample/security/method/SampleMethodSecurityApplicationTests.java
  92. 10
      spring-boot-samples/spring-boot-sample-web-secure-custom/src/main/java/sample/web/secure/custom/SampleWebSecureCustomApplication.java
  93. 1
      spring-boot-samples/spring-boot-sample-web-secure-custom/src/test/java/sample/ui/secure/SampleWebSecureCustomApplicationTests.java
  94. 2
      spring-boot-samples/spring-boot-sample-web-secure-github/src/main/java/sample/web/secure/github/SampleGithubSecureApplication.java
  95. 3
      spring-boot-samples/spring-boot-sample-web-secure-github/src/test/java/sample/web/secure/github/SampleGithubApplicationTests.java
  96. 10
      spring-boot-samples/spring-boot-sample-web-secure-jdbc/src/main/java/sample/web/secure/jdbc/SampleWebSecureCustomApplication.java
  97. 3
      spring-boot-samples/spring-boot-sample-web-secure-jdbc/src/test/java/sample/web/secure/jdbc/SampleWebSecureCustomApplicationTests.java
  98. 10
      spring-boot-samples/spring-boot-sample-web-secure/src/main/java/sample/web/secure/SampleWebSecureApplication.java
  99. 3
      spring-boot-samples/spring-boot-sample-web-secure/src/test/java/sample/web/secure/SampleSecureApplicationTests.java
  100. 10
      spring-boot-samples/spring-boot-sample-web-static/src/main/java/sample/web/staticcontent/SampleWebStaticApplication.java
  101. Some files were not shown because too many files have changed in this diff Show More

2
spring-boot-samples/spring-boot-sample-actuator-noweb/src/main/java/sample/actuator/HelloWorldService.java → spring-boot-samples/spring-boot-sample-actuator-noweb/src/main/java/sample/actuator/noweb/HelloWorldService.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.actuator;
package sample.actuator.noweb;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

2
spring-boot-samples/spring-boot-sample-actuator-noweb/src/main/java/sample/actuator/SampleActuatorNoWebApplication.java → spring-boot-samples/spring-boot-sample-actuator-noweb/src/main/java/sample/actuator/noweb/SampleActuatorNoWebApplication.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.actuator;
package sample.actuator.noweb;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

2
spring-boot-samples/spring-boot-sample-actuator-noweb/src/main/java/sample/actuator/ServiceProperties.java → spring-boot-samples/spring-boot-sample-actuator-noweb/src/main/java/sample/actuator/noweb/ServiceProperties.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.actuator;
package sample.actuator.noweb;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

3
spring-boot-samples/spring-boot-sample-actuator-noweb/src/test/java/sample/actuator/SampleActuatorNoWebApplicationTests.java → spring-boot-samples/spring-boot-sample-actuator-noweb/src/test/java/sample/actuator/noweb/SampleActuatorNoWebApplicationTests.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.actuator;
package sample.actuator.noweb;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -24,6 +24,7 @@ import org.springframework.boot.test.SpringApplicationConfiguration; @@ -24,6 +24,7 @@ import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import sample.actuator.noweb.SampleActuatorNoWebApplication;
import static org.junit.Assert.assertNotNull;
/**

8
spring-boot-samples/spring-boot-sample-actuator-ui/src/main/java/sample/actuator/ui/SampleActuatorUiApplication.java

@ -45,10 +45,6 @@ public class SampleActuatorUiApplication { @@ -45,10 +45,6 @@ public class SampleActuatorUiApplication {
throw new RuntimeException("Expected exception in controller");
}
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleActuatorUiApplication.class, args);
}
@Bean
public SecurityProperties securityProperties() {
SecurityProperties security = new SecurityProperties();
@ -56,4 +52,8 @@ public class SampleActuatorUiApplication { @@ -56,4 +52,8 @@ public class SampleActuatorUiApplication {
return security;
}
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleActuatorUiApplication.class, args);
}
}

8
spring-boot-samples/spring-boot-sample-actuator/src/main/java/sample/actuator/SampleActuatorApplication.java

@ -24,13 +24,13 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -24,13 +24,13 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SampleActuatorApplication implements HealthIndicator {
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleActuatorApplication.class, args);
}
@Override
public Health health() {
return Health.up().withDetail("hello", "world").build();
}
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleActuatorApplication.class, args);
}
}

1
spring-boot-samples/spring-boot-sample-actuator/src/main/java/sample/actuator/SampleController.java

@ -72,6 +72,7 @@ public class SampleController { @@ -72,6 +72,7 @@ public class SampleController {
public void setValue(String value) {
this.value = value;
}
}
}

1
spring-boot-samples/spring-boot-sample-amqp/src/main/java/sample/amqp/SampleAmqpSimpleApplication.java

@ -64,4 +64,5 @@ public class SampleAmqpSimpleApplication { @@ -64,4 +64,5 @@ public class SampleAmqpSimpleApplication {
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleAmqpSimpleApplication.class, args);
}
}

1
spring-boot-samples/spring-boot-sample-aop/src/main/java/sample/aop/SampleAopApplication.java

@ -39,4 +39,5 @@ public class SampleAopApplication implements CommandLineRunner { @@ -39,4 +39,5 @@ public class SampleAopApplication implements CommandLineRunner {
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleAopApplication.class, args);
}
}

2
spring-boot-samples/spring-boot-sample-atmosphere/src/main/java/sample/ChatService.java → spring-boot-samples/spring-boot-sample-atmosphere/src/main/java/sample/atmosphere/ChatService.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample;
package sample.atmosphere;
import java.io.IOException;

3
spring-boot-samples/spring-boot-sample-atmosphere/src/main/java/sample/Message.java → spring-boot-samples/spring-boot-sample-atmosphere/src/main/java/sample/atmosphere/Message.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample;
package sample.atmosphere;
import java.util.Date;
@ -49,4 +49,5 @@ public class Message { @@ -49,4 +49,5 @@ public class Message {
public void setTime(long time) {
this.time = time;
}
}

3
spring-boot-samples/spring-boot-sample-atmosphere/src/main/java/sample/SampleAtmosphereApplication.java → spring-boot-samples/spring-boot-sample-atmosphere/src/main/java/sample/atmosphere/SampleAtmosphereApplication.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample;
package sample.atmosphere;
import java.util.Collections;
@ -80,4 +80,5 @@ public class SampleAtmosphereApplication { @@ -80,4 +80,5 @@ public class SampleAtmosphereApplication {
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleAtmosphereApplication.class, args);
}
}

3
spring-boot-samples/spring-boot-sample-atmosphere/src/test/java/sample/SampleAtmosphereApplicationTests.java → spring-boot-samples/spring-boot-sample-atmosphere/src/test/java/sample/atmosphere/SampleAtmosphereApplicationTests.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample;
package sample.atmosphere;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@ -41,6 +41,7 @@ import org.springframework.web.socket.client.WebSocketConnectionManager; @@ -41,6 +41,7 @@ import org.springframework.web.socket.client.WebSocketConnectionManager;
import org.springframework.web.socket.client.standard.StandardWebSocketClient;
import org.springframework.web.socket.handler.TextWebSocketHandler;
import sample.atmosphere.SampleAtmosphereApplication;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;

1
spring-boot-samples/spring-boot-sample-batch/src/main/java/sample/batch/SampleBatchApplication.java

@ -67,4 +67,5 @@ public class SampleBatchApplication { @@ -67,4 +67,5 @@ public class SampleBatchApplication {
System.exit(SpringApplication.exit(SpringApplication.run(
SampleBatchApplication.class, args)));
}
}

9
spring-boot-samples/spring-boot-sample-cache/src/main/java/sample/CacheManagerCheck.java → spring-boot-samples/spring-boot-sample-cache/src/main/java/sample/cache/CacheManagerCheck.java vendored

@ -14,8 +14,10 @@ @@ -14,8 +14,10 @@
* limitations under the License.
*/
package sample;
package sample.cache;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.cache.CacheManager;
@ -24,6 +26,9 @@ import org.springframework.stereotype.Component; @@ -24,6 +26,9 @@ import org.springframework.stereotype.Component;
@Component
public class CacheManagerCheck implements CommandLineRunner {
private static final Logger logger = LoggerFactory
.getLogger(SampleCacheApplication.class);
private final CacheManager cacheManager;
@Autowired
@ -33,7 +38,7 @@ public class CacheManagerCheck implements CommandLineRunner { @@ -33,7 +38,7 @@ public class CacheManagerCheck implements CommandLineRunner {
@Override
public void run(String... strings) throws Exception {
SampleCacheApplication.logger.info("\n\n"
logger.info("\n\n"
+ "=========================================================\n"
+ "Using cache manager: " + this.cacheManager.getClass().getName() + "\n"
+ "=========================================================\n\n");

2
spring-boot-samples/spring-boot-sample-cache/src/main/java/sample/Country.java → spring-boot-samples/spring-boot-sample-cache/src/main/java/sample/cache/Country.java vendored

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample;
package sample.cache;
import java.io.Serializable;

2
spring-boot-samples/spring-boot-sample-cache/src/main/java/sample/CountryRepository.java → spring-boot-samples/spring-boot-sample-cache/src/main/java/sample/cache/CountryRepository.java vendored

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample;
package sample.cache;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;

6
spring-boot-samples/spring-boot-sample-cache/src/main/java/sample/SampleCacheApplication.java → spring-boot-samples/spring-boot-sample-cache/src/main/java/sample/cache/SampleCacheApplication.java vendored

@ -14,10 +14,8 @@ @@ -14,10 +14,8 @@
* limitations under the License.
*/
package sample;
package sample.cache;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cache.annotation.EnableCaching;
@ -28,8 +26,6 @@ import org.springframework.scheduling.annotation.EnableScheduling; @@ -28,8 +26,6 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication
public class SampleCacheApplication {
static final Logger logger = LoggerFactory.getLogger(SampleCacheApplication.class);
public static void main(String[] args) {
new SpringApplicationBuilder().sources(SampleCacheApplication.class)
.profiles("app").run(args);

2
spring-boot-samples/spring-boot-sample-cache/src/main/java/sample/SampleClient.java → spring-boot-samples/spring-boot-sample-cache/src/main/java/sample/cache/SampleClient.java vendored

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample;
package sample.cache;
import java.util.Arrays;
import java.util.List;

5
spring-boot-samples/spring-boot-sample-cache/src/test/java/sample/SampleCacheApplicationTests.java → spring-boot-samples/spring-boot-sample-cache/src/test/java/sample/cache/SampleCacheApplicationTests.java vendored

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample;
package sample.cache;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -24,6 +24,9 @@ import org.springframework.cache.Cache; @@ -24,6 +24,9 @@ import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import sample.cache.Country;
import sample.cache.CountryRepository;
import sample.cache.SampleCacheApplication;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;

1
spring-boot-samples/spring-boot-sample-data-elasticsearch/src/main/java/sample/data/elasticsearch/SampleElasticsearchApplication.java

@ -64,4 +64,5 @@ public class SampleElasticsearchApplication implements CommandLineRunner { @@ -64,4 +64,5 @@ public class SampleElasticsearchApplication implements CommandLineRunner {
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleElasticsearchApplication.class, "--debug").close();
}
}

1
spring-boot-samples/spring-boot-sample-data-gemfire/src/main/java/sample/data/gemfire/service/GemstoneServiceImpl.java

@ -164,6 +164,7 @@ public class GemstoneServiceImpl implements GemstoneService { @@ -164,6 +164,7 @@ public class GemstoneServiceImpl implements GemstoneService {
public IllegalGemstoneException(final String message, final Throwable cause) {
super(message, cause);
}
}
}

3
spring-boot-samples/spring-boot-sample-data-mongodb/src/main/java/sample/data/mongo/SampleMongoApplication.java

@ -29,7 +29,6 @@ public class SampleMongoApplication implements CommandLineRunner { @@ -29,7 +29,6 @@ public class SampleMongoApplication implements CommandLineRunner {
@Override
public void run(String... args) throws Exception {
this.repository.deleteAll();
// save a couple of customers
@ -54,10 +53,10 @@ public class SampleMongoApplication implements CommandLineRunner { @@ -54,10 +53,10 @@ public class SampleMongoApplication implements CommandLineRunner {
for (Customer customer : this.repository.findByLastName("Smith")) {
System.out.println(customer);
}
}
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleMongoApplication.class, args);
}
}

4
spring-boot-samples/spring-boot-sample-data-mongodb/src/test/java/sample/data/mongo/SampleMongoApplicationTests.java

@ -23,7 +23,6 @@ import org.junit.Test; @@ -23,7 +23,6 @@ import org.junit.Test;
import org.springframework.boot.test.OutputCapture;
import org.springframework.core.NestedCheckedException;
import com.mongodb.MongoServerSelectionException;
import com.mongodb.MongoTimeoutException;
import static org.junit.Assert.assertTrue;
@ -61,8 +60,7 @@ public class SampleMongoApplicationTests { @@ -61,8 +60,7 @@ public class SampleMongoApplicationTests {
NestedCheckedException nested = new NestedCheckedException("failed", ex) {
};
Throwable root = nested.getRootCause();
if (root instanceof MongoServerSelectionException
|| root instanceof MongoTimeoutException) {
if (root instanceof MongoTimeoutException) {
if (root.getMessage().contains("Unable to connect to any server")) {
return true;
}

1
spring-boot-samples/spring-boot-sample-data-redis/src/main/java/sample/data/redis/SampleRedisApplication.java

@ -43,4 +43,5 @@ public class SampleRedisApplication implements CommandLineRunner { @@ -43,4 +43,5 @@ public class SampleRedisApplication implements CommandLineRunner {
// Close the context so it doesn't stay awake listening for redis
SpringApplication.run(SampleRedisApplication.class, args).close();
}
}

29
spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/jpa/SampleDataRestApplication.java

@ -1,29 +0,0 @@ @@ -1,29 +0,0 @@
/*
* Copyright 2012-2014 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.jpa;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SampleDataRestApplication {
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleDataRestApplication.class, args);
}
}

76
spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/jpa/domain/City.java

@ -1,76 +0,0 @@ @@ -1,76 +0,0 @@
/*
* Copyright 2012-2014 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.jpa.domain;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
@Entity
public class City implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
private Long id;
@Column(nullable = false)
private String name;
@Column(nullable = false)
private String state;
@Column(nullable = false)
private String country;
@Column(nullable = false)
private String map;
protected City() {
}
public City(String name, String country) {
super();
this.name = name;
this.country = country;
}
public String getName() {
return this.name;
}
public String getState() {
return this.state;
}
public String getCountry() {
return this.country;
}
public String getMap() {
return this.map;
}
@Override
public String toString() {
return getName() + "," + getState() + "," + getCountry();
}
}

75
spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/jpa/domain/Hotel.java

@ -1,75 +0,0 @@ @@ -1,75 +0,0 @@
/*
* Copyright 2012-2014 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.jpa.domain;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import org.hibernate.annotations.NaturalId;
@Entity
public class Hotel implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
private Long id;
@ManyToOne(optional = false)
@NaturalId
private City city;
@Column(nullable = false)
@NaturalId
private String name;
@Column(nullable = false)
private String address;
@Column(nullable = false)
private String zip;
protected Hotel() {
}
public Hotel(City city, String name) {
this.city = city;
this.name = name;
}
public City getCity() {
return this.city;
}
public String getName() {
return this.name;
}
public String getAddress() {
return this.address;
}
public String getZip() {
return this.zip;
}
}

37
spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/jpa/service/CityRepository.java

@ -1,37 +0,0 @@ @@ -1,37 +0,0 @@
/*
* Copyright 2012-2014 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.jpa.service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import sample.data.jpa.domain.City;
@RepositoryRestResource(collectionResourceRel = "citys", path = "cities")
interface CityRepository extends PagingAndSortingRepository<City, Long> {
Page<City> findByNameContainingAndCountryContainingAllIgnoringCase(
@Param("name") String name, @Param("country") String country,
Pageable pageable);
City findByNameAndCountryAllIgnoringCase(@Param("name") String name,
@Param("country") String country);
}

44
spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/jpa/service/CitySearchCriteria.java

@ -1,44 +0,0 @@ @@ -1,44 +0,0 @@
/*
* Copyright 2012-2014 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.jpa.service;
import java.io.Serializable;
import org.springframework.util.Assert;
public class CitySearchCriteria implements Serializable {
private static final long serialVersionUID = 1L;
private String name;
public CitySearchCriteria() {
}
public CitySearchCriteria(String name) {
Assert.notNull(name, "Name must not be null");
this.name = name;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
}

30
spring-boot-samples/spring-boot-sample-data-rest/src/main/java/sample/data/jpa/service/HotelRepository.java

@ -1,30 +0,0 @@ @@ -1,30 +0,0 @@
/*
* Copyright 2012-2014 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.jpa.service;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import sample.data.jpa.domain.City;
import sample.data.jpa.domain.Hotel;
@RepositoryRestResource(collectionResourceRel = "hotels", path = "hotels")
interface HotelRepository extends PagingAndSortingRepository<Hotel, Long> {
Hotel findByCityAndName(City city, String name);
}

87
spring-boot-samples/spring-boot-sample-data-rest/src/test/java/sample/data/jpa/SampleDataRestApplicationTests.java

@ -1,87 +0,0 @@ @@ -1,87 +0,0 @@
/*
* Copyright 2012-2015 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.jpa;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasSize;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
/**
* Integration test to run the application.
*
* @author Oliver Gierke
* @author Andy Wilkinson
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = SampleDataRestApplication.class)
@WebAppConfiguration
@ActiveProfiles("scratch")
// Separate profile for web tests to avoid clashing databases
public class SampleDataRestApplicationTests {
@Autowired
private WebApplicationContext context;
private MockMvc mvc;
@Before
public void setUp() {
this.mvc = MockMvcBuilders.webAppContextSetup(this.context).build();
}
@Test
public void testHome() throws Exception {
this.mvc.perform(get("/api")).andExpect(status().isOk())
.andExpect(content().string(containsString("hotels")));
}
@Test
public void findByNameAndCountry() throws Exception {
this.mvc.perform(
get("/api/cities/search/findByNameAndCountryAllIgnoringCase?name=Melbourne&country=Australia"))
.andExpect(status().isOk())
.andExpect(jsonPath("state", equalTo("Victoria")))
.andExpect(jsonPath("name", equalTo("Melbourne")));
}
@Test
public void findByContaining() throws Exception {
this.mvc.perform(
get("/api/cities/search/findByNameContainingAndCountryContainingAllIgnoringCase?name=&country=UK"))
.andExpect(status().isOk())
.andExpect(jsonPath("_embedded.citys", hasSize(3)));
}
}

71
spring-boot-samples/spring-boot-sample-data-rest/src/test/java/sample/data/jpa/service/CityRepositoryIntegrationTests.java

@ -1,71 +0,0 @@ @@ -1,71 +0,0 @@
/*
* Copyright 2012-2014 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.jpa.service;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import sample.data.jpa.SampleDataRestApplication;
import sample.data.jpa.domain.City;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertThat;
/**
* Integration tests for {@link CityRepository}.
*
* @author Oliver Gierke
* @author Andy Wilkinson
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = SampleDataRestApplication.class)
public class CityRepositoryIntegrationTests {
@Autowired
CityRepository repository;
@Test
public void findsFirstPageOfCities() {
Page<City> cities = this.repository.findAll(new PageRequest(0, 10));
assertThat(cities.getTotalElements(), is(greaterThan(20L)));
}
@Test
public void findByNameAndCountry() {
City city = this.repository.findByNameAndCountryAllIgnoringCase("Melbourne",
"Australia");
assertThat(city, notNullValue());
assertThat(city.getName(), is(equalTo("Melbourne")));
}
@Test
public void findContaining() {
Page<City> cities = this.repository
.findByNameContainingAndCountryContainingAllIgnoringCase("", "UK",
new PageRequest(0, 10));
assertThat(cities.getTotalElements(), is(equalTo(3L)));
}
}

2
spring-boot-samples/spring-boot-sample-devtools/src/main/java/demo/Message.java → spring-boot-samples/spring-boot-sample-devtools/src/main/java/sample/devtools/Message.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package demo;
package sample.devtools;
public class Message {

2
spring-boot-samples/spring-boot-sample-devtools/src/main/java/demo/MyController.java → spring-boot-samples/spring-boot-sample-devtools/src/main/java/sample/devtools/MyController.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package demo;
package sample.devtools;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;

2
spring-boot-samples/spring-boot-sample-devtools/src/main/java/demo/SampleDevToolsApplication.java → spring-boot-samples/spring-boot-sample-devtools/src/main/java/sample/devtools/SampleDevToolsApplication.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package demo;
package sample.devtools;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

52
spring-boot-samples/spring-boot-sample-flyway/src/main/java/sample/flyway/Person.java

@ -0,0 +1,52 @@ @@ -0,0 +1,52 @@
/*
* Copyright 2012-2015 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.flyway;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
@Entity
public class Person {
@Id
@GeneratedValue
private Long id;
private String firstName;
private String lastName;
public String getFirstName() {
return this.firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return this.lastName;
}
public void setLastName(String lastname) {
this.lastName = lastname;
}
@Override
public String toString() {
return "Person [firstName=" + this.firstName + ", lastName=" + this.lastName
+ "]";
}
}

25
spring-boot-samples/spring-boot-sample-flyway/src/main/java/sample/flyway/PersonRepository.java

@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
/*
* Copyright 2012-2015 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.flyway;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface PersonRepository extends CrudRepository<Person, Long> {
}

41
spring-boot-samples/spring-boot-sample-flyway/src/main/java/sample/flyway/SampleFlywayApplication.java

@ -16,16 +16,10 @@ @@ -16,16 +16,10 @@
package sample.flyway;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
@SpringBootApplication
public class SampleFlywayApplication implements CommandLineRunner {
@ -41,40 +35,5 @@ public class SampleFlywayApplication implements CommandLineRunner { @@ -41,40 +35,5 @@ public class SampleFlywayApplication implements CommandLineRunner {
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleFlywayApplication.class, args);
}
}
@Repository
interface PersonRepository extends CrudRepository<Person, Long> {
}
@Entity
class Person {
@Id
@GeneratedValue
private Long id;
private String firstName;
private String lastName;
public String getFirstName() {
return this.firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return this.lastName;
}
public void setLastName(String lastname) {
this.lastName = lastname;
}
@Override
public String toString() {
return "Person [firstName=" + this.firstName + ", lastName=" + this.lastName
+ "]";
}
}

2
spring-boot-samples/spring-boot-sample-hateoas/src/main/java/sample/SampleHateoasApplication.java → spring-boot-samples/spring-boot-sample-hateoas/src/main/java/sample/hateoas/SampleHateoasApplication.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample;
package sample.hateoas;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;

2
spring-boot-samples/spring-boot-sample-hateoas/src/main/java/sample/domain/Customer.java → spring-boot-samples/spring-boot-sample-hateoas/src/main/java/sample/hateoas/domain/Customer.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.domain;
package sample.hateoas.domain;
public class Customer {

2
spring-boot-samples/spring-boot-sample-hateoas/src/main/java/sample/domain/CustomerRepository.java → spring-boot-samples/spring-boot-sample-hateoas/src/main/java/sample/hateoas/domain/CustomerRepository.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.domain;
package sample.hateoas.domain;
import java.util.List;

2
spring-boot-samples/spring-boot-sample-hateoas/src/main/java/sample/domain/InMemoryCustomerRepository.java → spring-boot-samples/spring-boot-sample-hateoas/src/main/java/sample/hateoas/domain/InMemoryCustomerRepository.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.domain;
package sample.hateoas.domain;
import java.util.ArrayList;
import java.util.List;

6
spring-boot-samples/spring-boot-sample-hateoas/src/main/java/sample/web/CustomerController.java → spring-boot-samples/spring-boot-sample-hateoas/src/main/java/sample/hateoas/web/CustomerController.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.web;
package sample.hateoas.web;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.hateoas.EntityLinks;
@ -29,8 +29,8 @@ import org.springframework.web.bind.annotation.PathVariable; @@ -29,8 +29,8 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import sample.domain.Customer;
import sample.domain.CustomerRepository;
import sample.hateoas.domain.Customer;
import sample.hateoas.domain.CustomerRepository;
@Controller
@RequestMapping("/customers")

3
spring-boot-samples/spring-boot-sample-hateoas/src/test/java/sample/SampleHateoasApplicationTests.java → spring-boot-samples/spring-boot-sample-hateoas/src/test/java/sample/hateoas/SampleHateoasApplicationTests.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample;
package sample.hateoas;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -28,6 +28,7 @@ import org.springframework.test.annotation.DirtiesContext; @@ -28,6 +28,7 @@ import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import sample.hateoas.SampleHateoasApplication;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.startsWith;

1
spring-boot-samples/spring-boot-sample-hornetq/src/main/java/sample/hornetq/SampleHornetQApplication.java

@ -61,4 +61,5 @@ public class SampleHornetQApplication { @@ -61,4 +61,5 @@ public class SampleHornetQApplication {
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleHornetQApplication.class, args);
}
}

2
spring-boot-samples/spring-boot-sample-jetty-ssl/src/main/java/sample/jetty/SampleJettySslApplication.java → spring-boot-samples/spring-boot-sample-jetty-ssl/src/main/java/sample/jetty/ssl/SampleJettySslApplication.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.jetty;
package sample.jetty.ssl;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

2
spring-boot-samples/spring-boot-sample-jetty-ssl/src/main/java/sample/jetty/service/HelloWorldService.java → spring-boot-samples/spring-boot-sample-jetty-ssl/src/main/java/sample/jetty/ssl/service/HelloWorldService.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.jetty.service;
package sample.jetty.ssl.service;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

4
spring-boot-samples/spring-boot-sample-jetty8-ssl/src/main/java/sample/jetty/web/SampleController.java → spring-boot-samples/spring-boot-sample-jetty-ssl/src/main/java/sample/jetty/ssl/web/SampleController.java

@ -14,14 +14,14 @@ @@ -14,14 +14,14 @@
* limitations under the License.
*/
package sample.jetty.web;
package sample.jetty.ssl.web;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import sample.jetty.service.HelloWorldService;
import sample.jetty.ssl.service.HelloWorldService;
@Controller
public class SampleController {

4
spring-boot-samples/spring-boot-sample-jetty-ssl/src/test/java/sample/jetty/SampleJettySslApplicationTests.java → spring-boot-samples/spring-boot-sample-jetty-ssl/src/test/java/sample/jetty/ssl/SampleJettySslApplicationTests.java

@ -14,13 +14,13 @@ @@ -14,13 +14,13 @@
* limitations under the License.
*/
package sample.jetty;
package sample.jetty.ssl;
import org.apache.http.client.HttpClient;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.conn.ssl.SSLContextBuilder;
import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.ssl.SSLContextBuilder;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Value;

2
spring-boot-samples/spring-boot-sample-jetty8-ssl/src/main/java/sample/jetty/SampleJetty8SslApplication.java → spring-boot-samples/spring-boot-sample-jetty8-ssl/src/main/java/sample/jetty8/ssl/SampleJetty8SslApplication.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.jetty;
package sample.jetty8.ssl;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

2
spring-boot-samples/spring-boot-sample-jetty8/src/main/java/sample/jetty/service/HelloWorldService.java → spring-boot-samples/spring-boot-sample-jetty8-ssl/src/main/java/sample/jetty8/ssl/service/HelloWorldService.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.jetty.service;
package sample.jetty8.ssl.service;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

4
spring-boot-samples/spring-boot-sample-jetty-ssl/src/main/java/sample/jetty/web/SampleController.java → spring-boot-samples/spring-boot-sample-jetty8-ssl/src/main/java/sample/jetty8/ssl/web/SampleController.java

@ -14,14 +14,14 @@ @@ -14,14 +14,14 @@
* limitations under the License.
*/
package sample.jetty.web;
package sample.jetty8.ssl.web;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import sample.jetty.service.HelloWorldService;
import sample.jetty8.ssl.service.HelloWorldService;
@Controller
public class SampleController {

4
spring-boot-samples/spring-boot-sample-jetty8-ssl/src/test/java/sample/jetty/SampleJetty8SslApplicationTests.java → spring-boot-samples/spring-boot-sample-jetty8-ssl/src/test/java/sample/jetty8/ssl/SampleJetty8SslApplicationTests.java

@ -14,13 +14,13 @@ @@ -14,13 +14,13 @@
* limitations under the License.
*/
package sample.jetty;
package sample.jetty8.ssl;
import org.apache.http.client.HttpClient;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.conn.ssl.SSLContextBuilder;
import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.ssl.SSLContextBuilder;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Value;

2
spring-boot-samples/spring-boot-sample-jetty8/src/main/java/sample/jetty/SampleJetty8Application.java → spring-boot-samples/spring-boot-sample-jetty8/src/main/java/sample/jetty8/SampleJetty8Application.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.jetty;
package sample.jetty8;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

2
spring-boot-samples/spring-boot-sample-jetty8-ssl/src/main/java/sample/jetty/service/HelloWorldService.java → spring-boot-samples/spring-boot-sample-jetty8/src/main/java/sample/jetty8/service/HelloWorldService.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.jetty.service;
package sample.jetty8.service;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

4
spring-boot-samples/spring-boot-sample-jetty8/src/main/java/sample/jetty/web/SampleController.java → spring-boot-samples/spring-boot-sample-jetty8/src/main/java/sample/jetty8/web/SampleController.java

@ -14,14 +14,14 @@ @@ -14,14 +14,14 @@
* limitations under the License.
*/
package sample.jetty.web;
package sample.jetty8.web;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import sample.jetty.service.HelloWorldService;
import sample.jetty8.service.HelloWorldService;
@Controller
public class SampleController {

3
spring-boot-samples/spring-boot-sample-jetty8/src/test/java/sample/jetty/SampleJetty8ApplicationTests.java → spring-boot-samples/spring-boot-sample-jetty8/src/test/java/sample/jetty8/SampleJetty8ApplicationTests.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.jetty;
package sample.jetty8;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -28,6 +28,7 @@ import org.springframework.test.annotation.DirtiesContext; @@ -28,6 +28,7 @@ import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import sample.jetty8.SampleJetty8Application;
import static org.junit.Assert.assertEquals;
/**

8
spring-boot-samples/spring-boot-sample-metrics-opentsdb/src/main/java/sample/metrics/opentsdb/SampleOpenTsdbExportApplication.java

@ -28,10 +28,6 @@ import org.springframework.context.annotation.Bean; @@ -28,10 +28,6 @@ import org.springframework.context.annotation.Bean;
@SpringBootApplication
public class SampleOpenTsdbExportApplication {
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleOpenTsdbExportApplication.class, args);
}
@Bean
@ConfigurationProperties("metrics.export")
public MetricWriter openTsdbMetricWriter() {
@ -46,4 +42,8 @@ public class SampleOpenTsdbExportApplication { @@ -46,4 +42,8 @@ public class SampleOpenTsdbExportApplication {
return new DefaultOpenTsdbNamingStrategy();
}
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleOpenTsdbExportApplication.class, args);
}
}

8
spring-boot-samples/spring-boot-sample-metrics-redis/src/main/java/sample/metrics/redis/SampleRedisExportApplication.java

@ -34,10 +34,6 @@ public class SampleRedisExportApplication { @@ -34,10 +34,6 @@ public class SampleRedisExportApplication {
@Autowired
private MetricExportProperties export;
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleRedisExportApplication.class, args);
}
@Bean
@ExportMetricWriter
public RedisMetricRepository redisMetricWriter(
@ -53,4 +49,8 @@ public class SampleRedisExportApplication { @@ -53,4 +49,8 @@ public class SampleRedisExportApplication {
return new JmxMetricWriter(exporter);
}
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleRedisExportApplication.class, args);
}
}

10
spring-boot-samples/spring-boot-sample-parent-context/src/main/java/sample/parent/SampleParentContextApplication.java

@ -26,15 +26,15 @@ import org.springframework.context.annotation.ImportResource; @@ -26,15 +26,15 @@ import org.springframework.context.annotation.ImportResource;
@EnableConfigurationProperties(ServiceProperties.class)
public class SampleParentContextApplication {
public static void main(String[] args) throws Exception {
new SpringApplicationBuilder(Parent.class).child(
SampleParentContextApplication.class).run(args);
}
@EnableAutoConfiguration
@ImportResource("integration-context.xml")
protected static class Parent {
}
public static void main(String[] args) throws Exception {
new SpringApplicationBuilder(Parent.class).child(
SampleParentContextApplication.class).run(args);
}
}

1
spring-boot-samples/spring-boot-sample-profile/src/main/java/sample/profile/SampleProfileApplication.java

@ -41,4 +41,5 @@ public class SampleProfileApplication implements CommandLineRunner { @@ -41,4 +41,5 @@ public class SampleProfileApplication implements CommandLineRunner {
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleProfileApplication.class, args);
}
}

8
spring-boot-samples/spring-boot-sample-servlet/src/main/java/sample/servlet/SampleServletApplication.java

@ -48,13 +48,13 @@ public class SampleServletApplication extends SpringBootServletInitializer { @@ -48,13 +48,13 @@ public class SampleServletApplication extends SpringBootServletInitializer {
};
}
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleServletApplication.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(SampleServletApplication.class);
}
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleServletApplication.class, args);
}
}

39
spring-boot-samples/spring-boot-sample-session-redis/src/main/java/sample/session/redis/HelloRestController.java

@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
/*
* Copyright 2012-2015 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.session.redis;
import java.util.UUID;
import javax.servlet.http.HttpSession;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloRestController {
@RequestMapping("/")
String uid(HttpSession session) {
UUID uid = (UUID) session.getAttribute("uid");
if (uid == null) {
uid = UUID.randomUUID();
}
session.setAttribute("uid", uid);
return uid.toString();
}
}

19
spring-boot-samples/spring-boot-sample-session-redis/src/main/java/sample/session/redis/SampleSessionRedisApplication.java

@ -16,14 +16,8 @@ @@ -16,14 +16,8 @@
package sample.session.redis;
import java.util.UUID;
import javax.servlet.http.HttpSession;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@SpringBootApplication
public class SampleSessionRedisApplication {
@ -32,17 +26,4 @@ public class SampleSessionRedisApplication { @@ -32,17 +26,4 @@ public class SampleSessionRedisApplication {
SpringApplication.run(SampleSessionRedisApplication.class);
}
@RestController
static class HelloRestController {
@RequestMapping("/")
String uid(HttpSession session) {
UUID uid = (UUID) session.getAttribute("uid");
if (uid == null) {
uid = UUID.randomUUID();
}
session.setAttribute("uid", uid);
return uid.toString();
}
}
}

1
spring-boot-samples/spring-boot-sample-simple/src/main/java/sample/simple/SampleSimpleApplication.java

@ -41,4 +41,5 @@ public class SampleSimpleApplication implements CommandLineRunner { @@ -41,4 +41,5 @@ public class SampleSimpleApplication implements CommandLineRunner {
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleSimpleApplication.class, args);
}
}

2
spring-boot-samples/spring-boot-sample-tomcat-jsp/src/main/java/sample/jsp/SampleTomcatJspApplication.java → spring-boot-samples/spring-boot-sample-tomcat-jsp/src/main/java/sample/tomcat/jsp/SampleTomcatJspApplication.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.jsp;
package sample.tomcat.jsp;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

2
spring-boot-samples/spring-boot-sample-web-velocity/src/main/java/sample/velocity/WelcomeController.java → spring-boot-samples/spring-boot-sample-tomcat-jsp/src/main/java/sample/tomcat/jsp/WelcomeController.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.velocity;
package sample.tomcat.jsp;
import java.util.Date;
import java.util.Map;

3
spring-boot-samples/spring-boot-sample-tomcat-jsp/src/test/java/sample/jsp/SampleWebJspApplicationTests.java → spring-boot-samples/spring-boot-sample-tomcat-jsp/src/test/java/sample/tomcat/jsp/SampleWebJspApplicationTests.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.jsp;
package sample.tomcat.jsp;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -28,6 +28,7 @@ import org.springframework.test.annotation.DirtiesContext; @@ -28,6 +28,7 @@ import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import sample.tomcat.jsp.SampleTomcatJspApplication;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

2
spring-boot-samples/spring-boot-sample-tomcat-multi-connectors/src/main/java/sample/tomcat/SampleTomcatTwoConnectorsApplication.java → spring-boot-samples/spring-boot-sample-tomcat-multi-connectors/src/main/java/sample/tomcat/multiconnector/SampleTomcatTwoConnectorsApplication.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.tomcat;
package sample.tomcat.multiconnector;
import java.io.File;
import java.io.FileOutputStream;

2
spring-boot-samples/spring-boot-sample-tomcat-multi-connectors/src/main/java/sample/tomcat/web/SampleController.java → spring-boot-samples/spring-boot-sample-tomcat-multi-connectors/src/main/java/sample/tomcat/multiconnector/web/SampleController.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.tomcat.web;
package sample.tomcat.multiconnector.web;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

3
spring-boot-samples/spring-boot-sample-tomcat-multi-connectors/src/test/java/sample/tomcat/SampleTomcatTwoConnectorsApplicationTests.java → spring-boot-samples/spring-boot-sample-tomcat-multi-connectors/src/test/java/sample/tomcat/multiconnector/SampleTomcatTwoConnectorsApplicationTests.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.tomcat;
package sample.tomcat.multiconnector;
import java.io.IOException;
import java.net.HttpURLConnection;
@ -42,6 +42,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @@ -42,6 +42,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.web.client.RestTemplate;
import sample.tomcat.multiconnector.SampleTomcatTwoConnectorsApplication;
import static org.junit.Assert.assertEquals;
/**

2
spring-boot-samples/spring-boot-sample-tomcat-ssl/src/main/java/sample/tomcat/SampleTomcatSslApplication.java → spring-boot-samples/spring-boot-sample-tomcat-ssl/src/main/java/sample/tomcat/ssl/SampleTomcatSslApplication.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.tomcat;
package sample.tomcat.ssl;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

2
spring-boot-samples/spring-boot-sample-tomcat-ssl/src/main/java/sample/tomcat/web/SampleController.java → spring-boot-samples/spring-boot-sample-tomcat-ssl/src/main/java/sample/tomcat/ssl/web/SampleController.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.tomcat.web;
package sample.tomcat.ssl.web;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

4
spring-boot-samples/spring-boot-sample-tomcat-ssl/src/test/java/sample/tomcat/SampleTomcatSslApplicationTests.java

@ -18,9 +18,9 @@ package sample.tomcat; @@ -18,9 +18,9 @@ package sample.tomcat;
import org.apache.http.client.HttpClient;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.conn.ssl.SSLContextBuilder;
import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.ssl.SSLContextBuilder;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Value;
@ -34,6 +34,8 @@ import org.springframework.test.annotation.DirtiesContext; @@ -34,6 +34,8 @@ import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import sample.tomcat.ssl.SampleTomcatSslApplication;
import static org.junit.Assert.assertEquals;
@RunWith(SpringJUnit4ClassRunner.class)

2
spring-boot-samples/spring-boot-sample-tomcat7-jsp/src/main/java/sample/jsp/SampleTomcat7JspApplication.java → spring-boot-samples/spring-boot-sample-tomcat7-jsp/src/main/java/sample/tomcat7/jsp/SampleTomcat7JspApplication.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.jsp;
package sample.tomcat7.jsp;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

2
spring-boot-samples/spring-boot-sample-tomcat7-jsp/src/main/java/sample/jsp/WelcomeController.java → spring-boot-samples/spring-boot-sample-tomcat7-jsp/src/main/java/sample/tomcat7/jsp/WelcomeController.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.jsp;
package sample.tomcat7.jsp;
import java.util.Date;
import java.util.Map;

3
spring-boot-samples/spring-boot-sample-tomcat7-jsp/src/test/java/sample/jsp/SampleWebJspApplicationTests.java → spring-boot-samples/spring-boot-sample-tomcat7-jsp/src/test/java/sample/tomcat7/jsp/SampleWebJspApplicationTests.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.jsp;
package sample.tomcat7.jsp;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -28,6 +28,7 @@ import org.springframework.test.annotation.DirtiesContext; @@ -28,6 +28,7 @@ import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import sample.tomcat7.jsp.SampleTomcat7JspApplication;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

2
spring-boot-samples/spring-boot-sample-undertow-ssl/src/main/java/sample/undertow/SampleUndertowSslApplication.java → spring-boot-samples/spring-boot-sample-undertow-ssl/src/main/java/sample/undertow/ssl/SampleUndertowSslApplication.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.undertow;
package sample.undertow.ssl;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

2
spring-boot-samples/spring-boot-sample-undertow-ssl/src/main/java/sample/undertow/service/HelloWorldService.java → spring-boot-samples/spring-boot-sample-undertow-ssl/src/main/java/sample/undertow/ssl/service/HelloWorldService.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.undertow.service;
package sample.undertow.ssl.service;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

4
spring-boot-samples/spring-boot-sample-undertow-ssl/src/main/java/sample/undertow/web/SampleController.java → spring-boot-samples/spring-boot-sample-undertow-ssl/src/main/java/sample/undertow/ssl/web/SampleController.java

@ -14,14 +14,14 @@ @@ -14,14 +14,14 @@
* limitations under the License.
*/
package sample.undertow.web;
package sample.undertow.ssl.web;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import sample.undertow.service.HelloWorldService;
import sample.undertow.ssl.service.HelloWorldService;
@Controller
public class SampleController {

4
spring-boot-samples/spring-boot-sample-undertow-ssl/src/test/java/sample/undertow/SampleUndertowSslApplicationTests.java → spring-boot-samples/spring-boot-sample-undertow-ssl/src/test/java/sample/undertow/ssl/SampleUndertowSslApplicationTests.java

@ -14,13 +14,13 @@ @@ -14,13 +14,13 @@
* limitations under the License.
*/
package sample.undertow;
package sample.undertow.ssl;
import org.apache.http.client.HttpClient;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.conn.ssl.SSLContextBuilder;
import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.ssl.SSLContextBuilder;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Value;

2
spring-boot-samples/spring-boot-sample-web-groovy-templates/src/main/java/sample/ui/InMemoryMessageRespository.java → spring-boot-samples/spring-boot-sample-web-groovy-templates/src/main/java/sample/groovytemplates/InMemoryMessageRespository.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.ui;
package sample.groovytemplates;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

2
spring-boot-samples/spring-boot-sample-web-groovy-templates/src/main/java/sample/ui/Message.java → spring-boot-samples/spring-boot-sample-web-groovy-templates/src/main/java/sample/groovytemplates/Message.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.ui;
package sample.groovytemplates;
import java.util.Date;

2
spring-boot-samples/spring-boot-sample-web-groovy-templates/src/main/java/sample/ui/MessageRepository.java → spring-boot-samples/spring-boot-sample-web-groovy-templates/src/main/java/sample/groovytemplates/MessageRepository.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.ui;
package sample.groovytemplates;
public interface MessageRepository {

2
spring-boot-samples/spring-boot-sample-web-groovy-templates/src/main/java/sample/ui/SampleGroovyTemplateApplication.java → spring-boot-samples/spring-boot-sample-web-groovy-templates/src/main/java/sample/groovytemplates/SampleGroovyTemplateApplication.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.ui;
package sample.groovytemplates;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

6
spring-boot-samples/spring-boot-sample-web-groovy-templates/src/main/java/sample/ui/mvc/MessageController.java → spring-boot-samples/spring-boot-sample-web-groovy-templates/src/main/java/sample/groovytemplates/mvc/MessageController.java

@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package sample.ui.mvc;
package sample.groovytemplates.mvc;
import java.util.HashMap;
import java.util.Map;
@ -32,8 +32,8 @@ import org.springframework.web.bind.annotation.RequestMethod; @@ -32,8 +32,8 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import sample.ui.Message;
import sample.ui.MessageRepository;
import sample.groovytemplates.Message;
import sample.groovytemplates.MessageRepository;
@Controller
@RequestMapping("/")

3
spring-boot-samples/spring-boot-sample-web-groovy-templates/src/test/java/sample/ui/MessageControllerWebTests.java → spring-boot-samples/spring-boot-sample-web-groovy-templates/src/test/java/sample/groovytemplates/MessageControllerWebTests.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.ui;
package sample.groovytemplates;
import java.util.regex.Pattern;
@ -32,6 +32,7 @@ import org.springframework.test.web.servlet.MockMvc; @@ -32,6 +32,7 @@ import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
import sample.groovytemplates.SampleGroovyTemplateApplication;
import static org.hamcrest.Matchers.containsString;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;

3
spring-boot-samples/spring-boot-sample-web-groovy-templates/src/test/java/sample/ui/SampleGroovyTemplateApplicationTests.java → spring-boot-samples/spring-boot-sample-web-groovy-templates/src/test/java/sample/groovytemplates/SampleGroovyTemplateApplicationTests.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.ui;
package sample.groovytemplates;
import java.net.URI;
@ -32,6 +32,7 @@ import org.springframework.test.context.web.WebAppConfiguration; @@ -32,6 +32,7 @@ import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import sample.groovytemplates.SampleGroovyTemplateApplication;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

15
spring-boot-samples/spring-boot-sample-web-method-security/src/main/java/sample/ui/method/SampleMethodSecurityApplication.java → spring-boot-samples/spring-boot-sample-web-method-security/src/main/java/sample/security/method/SampleMethodSecurityApplication.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.ui.method;
package sample.security.method;
import java.util.Date;
import java.util.Map;
@ -58,10 +58,6 @@ public class SampleMethodSecurityApplication extends WebMvcConfigurerAdapter { @@ -58,10 +58,6 @@ public class SampleMethodSecurityApplication extends WebMvcConfigurerAdapter {
}
public static void main(String[] args) throws Exception {
new SpringApplicationBuilder(SampleMethodSecurityApplication.class).run(args);
}
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/login").setViewName("login");
@ -73,6 +69,10 @@ public class SampleMethodSecurityApplication extends WebMvcConfigurerAdapter { @@ -73,6 +69,10 @@ public class SampleMethodSecurityApplication extends WebMvcConfigurerAdapter {
return new ApplicationSecurity();
}
public static void main(String[] args) throws Exception {
new SpringApplicationBuilder(SampleMethodSecurityApplication.class).run(args);
}
@Order(Ordered.HIGHEST_PRECEDENCE)
@Configuration
protected static class AuthenticationSecurity extends
@ -80,12 +80,11 @@ public class SampleMethodSecurityApplication extends WebMvcConfigurerAdapter { @@ -80,12 +80,11 @@ public class SampleMethodSecurityApplication extends WebMvcConfigurerAdapter {
@Override
public void init(AuthenticationManagerBuilder auth) throws Exception {
// @formatter:off
auth.inMemoryAuthentication().withUser("admin").password("admin")
.roles("ADMIN", "USER").and().withUser("user").password("user")
.roles("USER");
// @formatter:on
}
}
@Order(SecurityProperties.ACCESS_OVERRIDE_ORDER)
@ -93,13 +92,11 @@ public class SampleMethodSecurityApplication extends WebMvcConfigurerAdapter { @@ -93,13 +92,11 @@ public class SampleMethodSecurityApplication extends WebMvcConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
// @formatter:off
http.authorizeRequests().antMatchers("/login").permitAll().anyRequest()
.fullyAuthenticated().and().formLogin().loginPage("/login")
.failureUrl("/login?error").and().logout()
.logoutRequestMatcher(new AntPathRequestMatcher("/logout")).and()
.exceptionHandling().accessDeniedPage("/access?error");
// @formatter:on
}
}

3
spring-boot-samples/spring-boot-sample-web-method-security/src/test/java/sample/ui/method/SampleMethodSecurityApplicationTests.java → spring-boot-samples/spring-boot-sample-web-method-security/src/test/java/sample/security/method/SampleMethodSecurityApplicationTests.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.ui.method;
package sample.security.method;
import java.util.Arrays;
import java.util.regex.Matcher;
@ -38,6 +38,7 @@ import org.springframework.test.context.web.WebAppConfiguration; @@ -38,6 +38,7 @@ import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import sample.security.method.SampleMethodSecurityApplication;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

10
spring-boot-samples/spring-boot-sample-web-secure-custom/src/main/java/sample/ui/secure/SampleWebSecureCustomApplication.java → spring-boot-samples/spring-boot-sample-web-secure-custom/src/main/java/sample/web/secure/custom/SampleWebSecureCustomApplication.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.ui.secure;
package sample.web.secure.custom;
import java.util.Date;
import java.util.Map;
@ -52,10 +52,6 @@ public class SampleWebSecureCustomApplication extends WebMvcConfigurerAdapter { @@ -52,10 +52,6 @@ public class SampleWebSecureCustomApplication extends WebMvcConfigurerAdapter {
throw new RuntimeException("Expected exception in controller");
}
public static void main(String[] args) throws Exception {
new SpringApplicationBuilder(SampleWebSecureCustomApplication.class).run(args);
}
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/login").setViewName("login");
@ -66,6 +62,10 @@ public class SampleWebSecureCustomApplication extends WebMvcConfigurerAdapter { @@ -66,6 +62,10 @@ public class SampleWebSecureCustomApplication extends WebMvcConfigurerAdapter {
return new ApplicationSecurity();
}
public static void main(String[] args) throws Exception {
new SpringApplicationBuilder(SampleWebSecureCustomApplication.class).run(args);
}
@Order(SecurityProperties.ACCESS_OVERRIDE_ORDER)
protected static class ApplicationSecurity extends WebSecurityConfigurerAdapter {

1
spring-boot-samples/spring-boot-sample-web-secure-custom/src/test/java/sample/ui/secure/SampleWebSecureCustomApplicationTests.java

@ -38,6 +38,7 @@ import org.springframework.test.context.web.WebAppConfiguration; @@ -38,6 +38,7 @@ import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import sample.web.secure.custom.SampleWebSecureCustomApplication;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

2
spring-boot-samples/spring-boot-sample-web-secure-github/src/main/java/sample/ui/github/SampleGithubSecureApplication.java → spring-boot-samples/spring-boot-sample-web-secure-github/src/main/java/sample/web/secure/github/SampleGithubSecureApplication.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.ui.github;
package sample.web.secure.github;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

3
spring-boot-samples/spring-boot-sample-web-secure-github/src/test/java/sample/ui/github/SampleGithubApplicationTests.java → spring-boot-samples/spring-boot-sample-web-secure-github/src/test/java/sample/web/secure/github/SampleGithubApplicationTests.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.ui.github;
package sample.web.secure.github;
import org.junit.Before;
import org.junit.Test;
@ -30,6 +30,7 @@ import org.springframework.test.context.web.WebAppConfiguration; @@ -30,6 +30,7 @@ import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.web.context.WebApplicationContext;
import sample.web.secure.github.SampleGithubSecureApplication;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.redirectedUrlPattern;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

10
spring-boot-samples/spring-boot-sample-web-secure-jdbc/src/main/java/sample/ui/secure/SampleWebSecureCustomApplication.java → spring-boot-samples/spring-boot-sample-web-secure-jdbc/src/main/java/sample/web/secure/jdbc/SampleWebSecureCustomApplication.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.ui.secure;
package sample.web.secure.jdbc;
import java.util.Date;
import java.util.Map;
@ -54,10 +54,6 @@ public class SampleWebSecureCustomApplication extends WebMvcConfigurerAdapter { @@ -54,10 +54,6 @@ public class SampleWebSecureCustomApplication extends WebMvcConfigurerAdapter {
throw new RuntimeException("Expected exception in controller");
}
public static void main(String[] args) throws Exception {
new SpringApplicationBuilder(SampleWebSecureCustomApplication.class).run(args);
}
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/login").setViewName("login");
@ -68,6 +64,10 @@ public class SampleWebSecureCustomApplication extends WebMvcConfigurerAdapter { @@ -68,6 +64,10 @@ public class SampleWebSecureCustomApplication extends WebMvcConfigurerAdapter {
return new ApplicationSecurity();
}
public static void main(String[] args) throws Exception {
new SpringApplicationBuilder(SampleWebSecureCustomApplication.class).run(args);
}
@Order(SecurityProperties.ACCESS_OVERRIDE_ORDER)
protected static class ApplicationSecurity extends WebSecurityConfigurerAdapter {

3
spring-boot-samples/spring-boot-sample-web-secure-jdbc/src/test/java/sample/ui/secure/SampleWebSecureCustomApplicationTests.java → spring-boot-samples/spring-boot-sample-web-secure-jdbc/src/test/java/sample/web/secure/jdbc/SampleWebSecureCustomApplicationTests.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.ui.secure;
package sample.web.secure.jdbc;
import java.util.Arrays;
import java.util.regex.Matcher;
@ -38,6 +38,7 @@ import org.springframework.test.context.web.WebAppConfiguration; @@ -38,6 +38,7 @@ import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import sample.web.secure.jdbc.SampleWebSecureCustomApplication;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

10
spring-boot-samples/spring-boot-sample-web-secure/src/main/java/sample/ui/secure/SampleWebSecureApplication.java → spring-boot-samples/spring-boot-sample-web-secure/src/main/java/sample/web/secure/SampleWebSecureApplication.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.ui.secure;
package sample.web.secure;
import java.util.Date;
import java.util.Map;
@ -52,15 +52,15 @@ public class SampleWebSecureApplication extends WebMvcConfigurerAdapter { @@ -52,15 +52,15 @@ public class SampleWebSecureApplication extends WebMvcConfigurerAdapter {
throw new RuntimeException("Expected exception in controller");
}
public static void main(String[] args) throws Exception {
new SpringApplicationBuilder(SampleWebSecureApplication.class).run(args);
}
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/login").setViewName("login");
}
public static void main(String[] args) throws Exception {
new SpringApplicationBuilder(SampleWebSecureApplication.class).run(args);
}
@Configuration
@Order(SecurityProperties.ACCESS_OVERRIDE_ORDER)
protected static class ApplicationSecurity extends WebSecurityConfigurerAdapter {

3
spring-boot-samples/spring-boot-sample-web-secure/src/test/java/sample/ui/secure/SampleSecureApplicationTests.java → spring-boot-samples/spring-boot-sample-web-secure/src/test/java/sample/web/secure/SampleSecureApplicationTests.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.ui.secure;
package sample.web.secure;
import java.util.Arrays;
import java.util.regex.Matcher;
@ -38,6 +38,7 @@ import org.springframework.test.context.web.WebAppConfiguration; @@ -38,6 +38,7 @@ import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import sample.web.secure.SampleWebSecureApplication;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

10
spring-boot-samples/spring-boot-sample-web-static/src/main/java/sample/ui/SampleWebStaticApplication.java → spring-boot-samples/spring-boot-sample-web-static/src/main/java/sample/web/staticcontent/SampleWebStaticApplication.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.ui;
package sample.web.staticcontent;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@ -24,13 +24,13 @@ import org.springframework.boot.context.web.SpringBootServletInitializer; @@ -24,13 +24,13 @@ import org.springframework.boot.context.web.SpringBootServletInitializer;
@SpringBootApplication
public class SampleWebStaticApplication extends SpringBootServletInitializer {
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleWebStaticApplication.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(SampleWebStaticApplication.class);
}
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleWebStaticApplication.class, args);
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save