diff --git a/README.md b/README.md
index d20968b455..adb17ca7e5 100644
--- a/README.md
+++ b/README.md
@@ -2,41 +2,22 @@
The "REST with Spring" Classes
==============================
-Here's the Master Class of REST With Spring (price changes permanently next Friday):
-**[>> THE REST WITH SPRING MASTER CLASS](http://www.baeldung.com/rest-with-spring-course?utm_source=github&utm_medium=social&utm_content=tutorials&utm_campaign=rws#master-class)**
+Here's the Master Class of REST With Spring (along with the newly announced Boot 2 material):
+**[>> THE REST WITH SPRING - MASTER CLASS](http://www.baeldung.com/rest-with-spring-course?utm_source=github&utm_medium=social&utm_content=tutorials&utm_campaign=rws#master-class)**
And here's the Master Class of Learn Spring Security:
-**[>> LEARN SPRING SECURITY MASTER CLASS](http://www.baeldung.com/learn-spring-security-course?utm_source=github&utm_medium=social&utm_content=tutorials&utm_campaign=lss#master-class)**
+**[>> LEARN SPRING SECURITY - MASTER CLASS](http://www.baeldung.com/learn-spring-security-course?utm_source=github&utm_medium=social&utm_content=tutorials&utm_campaign=lss#master-class)**
-Spring Tutorials
+Java and Spring Tutorials
================
-This project is **a collection of small and focused tutorials** each covering a single and well defined area of development.
-Most of the tutorial projects are focused on the `Spring Framework` (and `Spring Security`).
+This project is **a collection of small and focused tutorials** - each covering a single and well defined area of development in the Java ecosystem.
+A strong focus of these is, of course, the Spring Framework - Spring, Spring Boot and Spring Securiyt.
In additional to Spring, the following technologies are in focus: `core Java`, `Jackson`, `HttpClient`, `Guava`.
+
Building the project
====================
To do the full build, do: `mvn install -Pdefault -Dgib.enabled=false`
-
-
-Working with the code in Eclipse
-================================
-Any IDE can be used to work with the projects, but if you're using Eclipse, consider the following.
-
-- import the included **formatter** in Eclipse:
-`https://github.com/eugenp/tutorials/tree/master/eclipse`
-
-
-CI - Jenkins
-================================
-This tutorials project is being built **[>> HERE](https://rest-security.ci.cloudbees.com/job/tutorials-unit/)**
-
-### Relevant Articles:
-================================
-
-- [Apache Maven Standard Directory Layout](http://www.baeldung.com/maven-directory-structure)
-- [Apache Maven Tutorial](http://www.baeldung.com/maven)
-- [Designing a User Friendly Java Library](http://www.baeldung.com/design-a-user-friendly-java-library)
diff --git a/algorithms/README.md b/algorithms/README.md
index 47ddd7028a..9b3bbcdee5 100644
--- a/algorithms/README.md
+++ b/algorithms/README.md
@@ -24,3 +24,7 @@
- [Practical Java Examples of the Big O Notation](http://www.baeldung.com/java-algorithm-complexity)
- [Find the Middle Element of a Linked List](http://www.baeldung.com/java-linked-list-middle-element)
- [An Introduction to the Theory of Big-O Notation](http://www.baeldung.com/big-o-notation)
+- [Check If Two Rectangles Overlap In Java](https://www.baeldung.com/java-check-if-two-rectangles-overlap)
+- [Calculate the Distance Between Two Points in Java](https://www.baeldung.com/java-distance-between-two-points)
+- [Find the Intersection of Two Lines in Java](https://www.baeldung.com/java-intersection-of-two-lines)
+- [Check If a String Contains All The Letters of The Alphabet](https://www.baeldung.com/java-string-contains-all-letters)
diff --git a/algorithms/src/main/java/com/baeldung/algorithms/kthlargest/FindKthLargest.java b/algorithms/src/main/java/com/baeldung/algorithms/kthlargest/FindKthLargest.java
index 822abdae02..7054979ada 100644
--- a/algorithms/src/main/java/com/baeldung/algorithms/kthlargest/FindKthLargest.java
+++ b/algorithms/src/main/java/com/baeldung/algorithms/kthlargest/FindKthLargest.java
@@ -98,7 +98,7 @@ public class FindKthLargest {
private int randomPartition(Integer arr[], int left, int right) {
int n = right - left + 1;
- int pivot = (int) (Math.random()) % n;
+ int pivot = (int) (Math.random() * n);
swap(arr, left + pivot, right);
return partition(arr, left, right);
}
diff --git a/algorithms/src/main/java/com/baeldung/algorithms/mergesort/MergeSort.java b/algorithms/src/main/java/com/baeldung/algorithms/mergesort/MergeSort.java
new file mode 100644
index 0000000000..0deb48b6a0
--- /dev/null
+++ b/algorithms/src/main/java/com/baeldung/algorithms/mergesort/MergeSort.java
@@ -0,0 +1,50 @@
+package com.baeldung.algorithms.mergesort;
+
+public class MergeSort {
+
+ public static void main(String[] args) {
+ int[] a = { 5, 1, 6, 2, 3, 4 };
+ mergeSort(a, a.length);
+ for (int i = 0; i < a.length; i++)
+ System.out.println(a[i]);
+ }
+
+ public static void mergeSort(int[] a, int n) {
+ if (n < 2)
+ return;
+ int mid = n / 2;
+ int[] l = new int[mid];
+ int[] r = new int[n - mid];
+
+ for (int i = 0; i < mid; i++) {
+ l[i] = a[i];
+ }
+ for (int i = mid; i < n; i++) {
+ r[i - mid] = a[i];
+ }
+ mergeSort(l, mid);
+ mergeSort(r, n - mid);
+
+ merge(a, l, r, mid, n - mid);
+ }
+
+ public static void merge(int[] a, int[] l, int[] r, int left, int right) {
+
+ int i = 0, j = 0, k = 0;
+
+ while (i < left && j < right) {
+
+ if (l[i] < r[j])
+ a[k++] = l[i++];
+ else
+ a[k++] = r[j++];
+
+ }
+
+ while (i < left)
+ a[k++] = l[i++];
+
+ while (j < right)
+ a[k++] = r[j++];
+ }
+}
diff --git a/algorithms/src/main/java/com/baeldung/algorithms/quicksort/QuickSort.java b/algorithms/src/main/java/com/baeldung/algorithms/quicksort/QuickSort.java
new file mode 100644
index 0000000000..e113cc3242
--- /dev/null
+++ b/algorithms/src/main/java/com/baeldung/algorithms/quicksort/QuickSort.java
@@ -0,0 +1,39 @@
+package com.baeldung.algorithms.quicksort;
+
+public class QuickSort {
+
+ public static void quickSort(int arr[], int begin, int end)
+ {
+ if (begin < end) {
+ int partitionIndex = partition(arr, begin, end);
+
+ // Recursively sort elements of the 2 sub-arrays
+ quickSort(arr, begin, partitionIndex-1);
+ quickSort(arr, partitionIndex+1, end);
+ }
+ }
+
+ private static int partition(int arr[], int begin, int end)
+ {
+ int pivot = arr[end];
+ int i = (begin-1);
+
+ for (int j=begin; jcom.baeldung
apache-avro
0.0.1-SNAPSHOT
- Apache Avro
+ Apache Avro
UTF-8
diff --git a/apache-avro/src/test/java/com/baeldung/avro/util/serealization/AvroSerealizerDeSerealizerTest.java b/apache-avro/src/test/java/com/baeldung/avro/util/serealization/AvroSerealizerDeSerealizerUnitTest.java
similarity index 98%
rename from apache-avro/src/test/java/com/baeldung/avro/util/serealization/AvroSerealizerDeSerealizerTest.java
rename to apache-avro/src/test/java/com/baeldung/avro/util/serealization/AvroSerealizerDeSerealizerUnitTest.java
index ecd15ccbbc..992ea806c3 100644
--- a/apache-avro/src/test/java/com/baeldung/avro/util/serealization/AvroSerealizerDeSerealizerTest.java
+++ b/apache-avro/src/test/java/com/baeldung/avro/util/serealization/AvroSerealizerDeSerealizerUnitTest.java
@@ -13,7 +13,7 @@ import java.util.Objects;
import static org.junit.Assert.*;
-public class AvroSerealizerDeSerealizerTest {
+public class AvroSerealizerDeSerealizerUnitTest {
AvroSerealizer serealizer;
AvroDeSerealizer deSerealizer;
diff --git a/apache-geode/pom.xml b/apache-geode/pom.xml
new file mode 100644
index 0000000000..a3f6604ac4
--- /dev/null
+++ b/apache-geode/pom.xml
@@ -0,0 +1,46 @@
+
+
+ 4.0.0
+
+ com.baeldung
+ apache-geode
+ 1.0-SNAPSHOT
+
+
+ com.baeldung
+ parent-modules
+ 1.0.0-SNAPSHOT
+
+
+
+ 1.6.0
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+ 1.8
+
+
+
+
+
+
+
+ org.apache.geode
+ geode-core
+ ${geode.core}
+
+
+ junit
+ junit
+ RELEASE
+
+
+
+
\ No newline at end of file
diff --git a/apache-geode/src/main/java/com/baeldung/geode/Customer.java b/apache-geode/src/main/java/com/baeldung/geode/Customer.java
new file mode 100644
index 0000000000..82ee5ecaeb
--- /dev/null
+++ b/apache-geode/src/main/java/com/baeldung/geode/Customer.java
@@ -0,0 +1,78 @@
+package com.baeldung.geode;
+
+import java.io.Serializable;
+import java.util.Objects;
+
+public class Customer implements Serializable {
+
+ private static final long serialVersionUID = -7482516011038799900L;
+
+ private CustomerKey key;
+ private String firstName;
+ private String lastName;
+ private Integer age;
+
+ public Customer() {
+ }
+
+ public Customer(String firstName, String lastName, int age) {
+ this.firstName = firstName;
+ this.lastName = lastName;
+ this.age = age;
+ }
+
+ public Customer(CustomerKey key, String firstName, String lastName, int age) {
+ this(firstName, lastName, age);
+ this.key = key;
+ }
+
+ // setters and getters
+
+ public static long getSerialVersionUID() {
+ return serialVersionUID;
+ }
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ public Integer getAge() {
+ return age;
+ }
+
+ public void setAge(Integer age) {
+ this.age = age;
+ }
+
+ @Override
+ public String toString() {
+ return "Customer{" + "firstName='" + firstName + '\'' + ", lastName='" + lastName + '\'' + ", age=" + age + '}';
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ Customer customer = (Customer) o;
+ return Objects.equals(firstName, customer.firstName) && Objects.equals(lastName, customer.lastName) && Objects.equals(age, customer.age);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(firstName, lastName, age);
+ }
+}
diff --git a/apache-geode/src/main/java/com/baeldung/geode/CustomerKey.java b/apache-geode/src/main/java/com/baeldung/geode/CustomerKey.java
new file mode 100644
index 0000000000..bfa64870c0
--- /dev/null
+++ b/apache-geode/src/main/java/com/baeldung/geode/CustomerKey.java
@@ -0,0 +1,57 @@
+package com.baeldung.geode;
+
+import java.io.Serializable;
+
+public class CustomerKey implements Serializable {
+
+ private static final long serialVersionUID = -3529253035303792458L;
+ private long id;
+ private String country;
+
+ public CustomerKey(long id) {
+ this.id = id;
+ this.country = "USA";
+ }
+
+ public CustomerKey(long id, String country) {
+ this.id = id;
+ this.country = country;
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public String getCountry() {
+ return country;
+ }
+
+ public void setCountry(String country) {
+ this.country = country;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+
+ CustomerKey that = (CustomerKey) o;
+
+ if (id != that.id)
+ return false;
+ return country != null ? country.equals(that.country) : that.country == null;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = (int) (id ^ (id >>> 32));
+ result = 31 * result + (country != null ? country.hashCode() : 0);
+ return result;
+ }
+}
diff --git a/apache-geode/src/main/java/com/baeldung/geode/functions/UpperCaseNames.java b/apache-geode/src/main/java/com/baeldung/geode/functions/UpperCaseNames.java
new file mode 100644
index 0000000000..5ff8e53da8
--- /dev/null
+++ b/apache-geode/src/main/java/com/baeldung/geode/functions/UpperCaseNames.java
@@ -0,0 +1,34 @@
+package com.baeldung.geode.functions;
+
+import com.baeldung.geode.Customer;
+import com.baeldung.geode.CustomerKey;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.execute.Function;
+import org.apache.geode.cache.execute.FunctionContext;
+import org.apache.geode.cache.execute.RegionFunctionContext;
+
+import java.util.Map;
+
+public class UpperCaseNames implements Function {
+ private static final long serialVersionUID = -8946294032165677602L;
+
+ @Override
+ public void execute(FunctionContext context) {
+ RegionFunctionContext regionContext = (RegionFunctionContext) context;
+ Region region = regionContext.getDataSet();
+
+ for (Map.Entry entry : region.entrySet()) {
+ Customer customer = entry.getValue();
+ customer.setFirstName(customer.getFirstName()
+ .toUpperCase());
+ }
+
+ context.getResultSender()
+ .lastResult(true);
+ }
+
+ @Override
+ public String getId() {
+ return getClass().getName();
+ }
+}
diff --git a/apache-geode/src/test/java/com/baeldung/geode/GeodeSamplesIntegrationTest.java b/apache-geode/src/test/java/com/baeldung/geode/GeodeSamplesIntegrationTest.java
new file mode 100644
index 0000000000..b96d2c9b6a
--- /dev/null
+++ b/apache-geode/src/test/java/com/baeldung/geode/GeodeSamplesIntegrationTest.java
@@ -0,0 +1,110 @@
+package com.baeldung.geode;
+
+import com.baeldung.geode.functions.UpperCaseNames;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.client.ClientCache;
+import org.apache.geode.cache.client.ClientCacheFactory;
+import org.apache.geode.cache.client.ClientRegionShortcut;
+import org.apache.geode.cache.execute.Execution;
+import org.apache.geode.cache.execute.FunctionService;
+import org.apache.geode.cache.query.*;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.function.Function;
+import java.util.function.Supplier;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import static org.junit.Assert.assertEquals;
+
+public class GeodeSamplesIntegrationTest {
+
+ ClientCache cache = null;
+ Region region = null;
+ Region queryRegion = null;
+ Region customerRegion = null;
+
+ @Before
+ public void connect() {
+ this.cache = new ClientCacheFactory().addPoolLocator("localhost", 10334)
+ .create();
+ this.region = this.cache. createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY)
+ .create("baeldung");
+ this.customerRegion = this.cache. createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY)
+ .create("baeldung-customers");
+ }
+
+ @After
+ public void cleanup() {
+ this.cache.close();
+ }
+
+ @Test
+ public void whenSendMessageToRegion_thenMessageSavedSuccessfully() {
+
+ this.region.put("1", "Hello");
+ this.region.put("2", "Baeldung");
+
+ assertEquals("Hello", region.get("1"));
+ assertEquals("Baeldung", region.get("2"));
+
+ }
+
+ @Test
+ public void whenPutMultipleValuesAtOnce_thenValuesSavedSuccessfully() {
+
+ Supplier> keys = () -> Stream.of("A", "B", "C", "D", "E");
+ Map values = keys.get()
+ .collect(Collectors.toMap(Function.identity(), String::toLowerCase));
+
+ this.region.putAll(values);
+
+ keys.get()
+ .forEach(k -> assertEquals(k.toLowerCase(), this.region.get(k)));
+
+ }
+
+ @Test
+ public void whenPutCustomKey_thenValuesSavedSuccessfully() {
+ CustomerKey key = new CustomerKey(123);
+ Customer customer = new Customer(key, "William", "Russell", 35);
+
+ Map customerInfo = new HashMap<>();
+ customerInfo.put(key, customer);
+
+ this.customerRegion.putAll(customerInfo);
+
+ Customer storedCustomer = this.customerRegion.get(key);
+ assertEquals("William", storedCustomer.getFirstName());
+ assertEquals("Russell", storedCustomer.getLastName());
+
+ }
+
+ @Test
+ public void whenFindACustomerUsingOQL_thenCorrectCustomerObject() throws NameResolutionException, TypeMismatchException, QueryInvocationTargetException, FunctionDomainException {
+
+ Map data = new HashMap<>();
+ data.put(new CustomerKey(1), new Customer("Gheorge", "Manuc", 36));
+ data.put(new CustomerKey(2), new Customer("Allan", "McDowell", 43));
+ this.customerRegion.putAll(data);
+
+ QueryService queryService = this.cache.getQueryService();
+ String query = "select * from /baeldung-customers c where c.firstName = 'Allan'";
+ SelectResults queryResults = (SelectResults) queryService.newQuery(query)
+ .execute();
+ assertEquals(1, queryResults.size());
+
+ }
+
+ @Test
+ public void whenExecuteUppercaseNames_thenCustomerNamesAreUppercased() {
+ Execution execution = FunctionService.onRegion(this.customerRegion);
+ execution.execute(UpperCaseNames.class.getName());
+ Customer customer = this.customerRegion.get(new CustomerKey(1));
+ assertEquals("GHEORGE", customer.getFirstName());
+ }
+}
diff --git a/asciidoctor/README.md b/asciidoctor/README.md
index aafd0bca17..2124907e87 100644
--- a/asciidoctor/README.md
+++ b/asciidoctor/README.md
@@ -1,5 +1,4 @@
### Relevant articles
-- [Introduction to Asciidoctor](http://www.baeldung.com/introduction-to-asciidoctor)
- [Generating a Book with Asciidoctor](http://www.baeldung.com/asciidoctor-book)
- [Introduction to Asciidoctor in Java](http://www.baeldung.com/asciidoctor)
diff --git a/asciidoctor/pom.xml b/asciidoctor/pom.xml
index 15de5ac913..42ee544eb0 100644
--- a/asciidoctor/pom.xml
+++ b/asciidoctor/pom.xml
@@ -61,9 +61,10 @@
- 1.5.5
- 1.5.4
- 1.5.0-alpha.11
+ 1.5.6
+ 1.5.6
+
+ 1.5.0-alpha.15
1.5.0-alpha.15
diff --git a/asciidoctor/src/test/java/com/baeldung/asciidoctor/AsciidoctorDemoTest.java b/asciidoctor/src/test/java/com/baeldung/asciidoctor/AsciidoctorDemoIntegrationTest.java
similarity index 89%
rename from asciidoctor/src/test/java/com/baeldung/asciidoctor/AsciidoctorDemoTest.java
rename to asciidoctor/src/test/java/com/baeldung/asciidoctor/AsciidoctorDemoIntegrationTest.java
index 3e312eb059..c4129e6441 100644
--- a/asciidoctor/src/test/java/com/baeldung/asciidoctor/AsciidoctorDemoTest.java
+++ b/asciidoctor/src/test/java/com/baeldung/asciidoctor/AsciidoctorDemoIntegrationTest.java
@@ -3,7 +3,7 @@ package com.baeldung.asciidoctor;
import org.junit.Assert;
import org.junit.Test;
-public class AsciidoctorDemoTest {
+public class AsciidoctorDemoIntegrationTest {
@Test
public void givenString_whenConverting_thenResultingHTMLCode() {
diff --git a/cdi-portable-extension/flyway-cdi/pom.xml b/cdi-portable-extension/flyway-cdi/pom.xml
new file mode 100644
index 0000000000..9fb781aaab
--- /dev/null
+++ b/cdi-portable-extension/flyway-cdi/pom.xml
@@ -0,0 +1,38 @@
+
+
+ 4.0.0
+
+ flyway-cdi
+
+
+ com.baeldung
+ cdi-portable-extension
+ 1.0-SNAPSHOT
+
+
+
+
+ javax.enterprise
+ cdi-api
+ 2.0.SP1
+
+
+ org.flywaydb
+ flyway-core
+ 5.1.4
+
+
+ org.apache.tomcat
+ tomcat-jdbc
+ 8.5.33
+
+
+ javax.annotation
+ javax.annotation-api
+ 1.3.2
+
+
+
+
diff --git a/cdi-portable-extension/flyway-cdi/src/main/java/com/baeldung/cdi/extension/FlywayExtension.java b/cdi-portable-extension/flyway-cdi/src/main/java/com/baeldung/cdi/extension/FlywayExtension.java
new file mode 100644
index 0000000000..a5019b82c1
--- /dev/null
+++ b/cdi-portable-extension/flyway-cdi/src/main/java/com/baeldung/cdi/extension/FlywayExtension.java
@@ -0,0 +1,74 @@
+package com.baeldung.cdi.extension;
+
+import org.apache.tomcat.jdbc.pool.DataSource;
+import org.flywaydb.core.Flyway;
+
+import javax.annotation.sql.DataSourceDefinition;
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.literal.InjectLiteral;
+import javax.enterprise.inject.spi.*;
+import javax.enterprise.util.AnnotationLiteral;
+
+
+/**
+ * Flyway is now under CDI container like:
+ *
+ * @ApplicationScoped
+ * @FlywayType public class Flyway{
+ * @Inject setDataSource(DataSource dataSource){
+ * //...
+ * }
+ * }
+ */
+
+public class FlywayExtension implements Extension {
+
+ DataSourceDefinition dataSourceDefinition = null;
+
+ public void registerFlywayType(@Observes BeforeBeanDiscovery bbdEvent) {
+ bbdEvent.addAnnotatedType(Flyway.class, Flyway.class.getName());
+ }
+
+ public void detectDataSourceDefinition(@Observes @WithAnnotations(DataSourceDefinition.class) ProcessAnnotatedType> patEvent) {
+ AnnotatedType at = patEvent.getAnnotatedType();
+ dataSourceDefinition = at.getAnnotation(DataSourceDefinition.class);
+ }
+
+ public void processAnnotatedType(@Observes ProcessAnnotatedType patEvent) {
+ patEvent.configureAnnotatedType()
+ //Add Scope
+ .add(ApplicationScoped.Literal.INSTANCE)
+ //Add Qualifier
+ .add(new AnnotationLiteral() {
+ })
+ //Decorate setDataSource(DataSource dataSource){} with @Inject
+ .filterMethods(annotatedMethod -> {
+ return annotatedMethod.getParameters().size() == 1 &&
+ annotatedMethod.getParameters().get(0).getBaseType().equals(javax.sql.DataSource.class);
+ })
+ .findFirst().get().add(InjectLiteral.INSTANCE);
+ }
+
+ void afterBeanDiscovery(@Observes AfterBeanDiscovery abdEvent, BeanManager bm) {
+ abdEvent.addBean()
+ .types(javax.sql.DataSource.class, DataSource.class)
+ .qualifiers(new AnnotationLiteral() {}, new AnnotationLiteral() {})
+ .scope(ApplicationScoped.class)
+ .name(DataSource.class.getName())
+ .beanClass(DataSource.class)
+ .createWith(creationalContext -> {
+ DataSource instance = new DataSource();
+ instance.setUrl(dataSourceDefinition.url());
+ instance.setDriverClassName(dataSourceDefinition.className());
+ return instance;
+ });
+ }
+
+ void runFlywayMigration(@Observes AfterDeploymentValidation adv, BeanManager manager) {
+ Flyway flyway = manager.createInstance().select(Flyway.class, new AnnotationLiteral() {}).get();
+ flyway.migrate();
+ }
+}
diff --git a/cdi-portable-extension/flyway-cdi/src/main/java/com/baeldung/cdi/extension/FlywayType.java b/cdi-portable-extension/flyway-cdi/src/main/java/com/baeldung/cdi/extension/FlywayType.java
new file mode 100644
index 0000000000..7c3a5affa6
--- /dev/null
+++ b/cdi-portable-extension/flyway-cdi/src/main/java/com/baeldung/cdi/extension/FlywayType.java
@@ -0,0 +1,14 @@
+package com.baeldung.cdi.extension;
+
+import javax.inject.Qualifier;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.*;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target({FIELD, METHOD, PARAMETER, TYPE})
+@Qualifier
+public @interface FlywayType {
+}
\ No newline at end of file
diff --git a/cdi-portable-extension/flyway-cdi/src/main/resources/META-INF/beans.xml b/cdi-portable-extension/flyway-cdi/src/main/resources/META-INF/beans.xml
new file mode 100644
index 0000000000..44959bfa99
--- /dev/null
+++ b/cdi-portable-extension/flyway-cdi/src/main/resources/META-INF/beans.xml
@@ -0,0 +1,6 @@
+
+
\ No newline at end of file
diff --git a/cdi-portable-extension/flyway-cdi/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension b/cdi-portable-extension/flyway-cdi/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
new file mode 100644
index 0000000000..a82dc47714
--- /dev/null
+++ b/cdi-portable-extension/flyway-cdi/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
@@ -0,0 +1,2 @@
+com.baeldung.cdi.extension.FlywayExtension
+
diff --git a/cdi-portable-extension/main-app/pom.xml b/cdi-portable-extension/main-app/pom.xml
new file mode 100644
index 0000000000..fab9b8bf07
--- /dev/null
+++ b/cdi-portable-extension/main-app/pom.xml
@@ -0,0 +1,52 @@
+
+
+ 4.0.0
+
+ main-app
+ jar
+
+
+ com.baeldung
+ cdi-portable-extension
+ 1.0-SNAPSHOT
+
+
+
+
+
+ javax.enterprise
+ cdi-api
+ 2.0.SP1
+
+
+ org.jboss.weld.se
+ weld-se-core
+ 3.0.5.Final
+ runtime
+
+
+
+ com.baeldung
+ flyway-cdi
+ 1.0-SNAPSHOT
+ runtime
+
+
+
+ com.h2database
+ h2
+ 1.4.197
+ runtime
+
+
+
+ javax.annotation
+ javax.annotation-api
+ 1.3.2
+
+
+
+
+
\ No newline at end of file
diff --git a/cdi-portable-extension/main-app/src/main/java/com/baeldung/cdi/extension/MainApp.java b/cdi-portable-extension/main-app/src/main/java/com/baeldung/cdi/extension/MainApp.java
new file mode 100644
index 0000000000..1f6c5b43ba
--- /dev/null
+++ b/cdi-portable-extension/main-app/src/main/java/com/baeldung/cdi/extension/MainApp.java
@@ -0,0 +1,16 @@
+package com.baeldung.cdi.extension;
+
+import javax.annotation.sql.DataSourceDefinition;
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.se.SeContainer;
+import javax.enterprise.inject.se.SeContainerInitializer;
+
+@ApplicationScoped
+@DataSourceDefinition(name = "ds", className = "org.h2.Driver", url = "jdbc:h2:mem:testdb")
+public class MainApp {
+ public static void main(String[] args) {
+ SeContainerInitializer initializer = SeContainerInitializer.newInstance();
+ try (SeContainer container = initializer.initialize()) {
+ }
+ }
+}
\ No newline at end of file
diff --git a/cdi-portable-extension/main-app/src/main/resources/META-INF/beans.xml b/cdi-portable-extension/main-app/src/main/resources/META-INF/beans.xml
new file mode 100644
index 0000000000..44959bfa99
--- /dev/null
+++ b/cdi-portable-extension/main-app/src/main/resources/META-INF/beans.xml
@@ -0,0 +1,6 @@
+
+
\ No newline at end of file
diff --git a/cdi-portable-extension/main-app/src/main/resources/db/migration/V1__Create_person_table.sql b/cdi-portable-extension/main-app/src/main/resources/db/migration/V1__Create_person_table.sql
new file mode 100644
index 0000000000..6bddc7689e
--- /dev/null
+++ b/cdi-portable-extension/main-app/src/main/resources/db/migration/V1__Create_person_table.sql
@@ -0,0 +1,4 @@
+create table PERSON (
+ ID int not null,
+ NAME varchar(100) not null
+);
diff --git a/cdi-portable-extension/main-app/src/main/resources/db/migration/V2__Add_people.sql b/cdi-portable-extension/main-app/src/main/resources/db/migration/V2__Add_people.sql
new file mode 100644
index 0000000000..d8f1d62667
--- /dev/null
+++ b/cdi-portable-extension/main-app/src/main/resources/db/migration/V2__Add_people.sql
@@ -0,0 +1,3 @@
+insert into PERSON (ID, NAME) values (1, 'Axel');
+insert into PERSON (ID, NAME) values (2, 'Mr. Foo');
+insert into PERSON (ID, NAME) values (3, 'Ms. Bar');
diff --git a/cdi-portable-extension/pom.xml b/cdi-portable-extension/pom.xml
new file mode 100644
index 0000000000..66913de84d
--- /dev/null
+++ b/cdi-portable-extension/pom.xml
@@ -0,0 +1,30 @@
+
+
+ 4.0.0
+
+ com.baeldung
+ cdi-portable-extension
+ 1.0-SNAPSHOT
+ pom
+
+
+ 1.8
+ 1.8
+
+
+
+ main-app
+ flyway-cdi
+
+
+
+
+ javax.enterprise
+ cdi-api
+ 2.0.SP1
+
+
+
+
\ No newline at end of file
diff --git a/core-java-8/src/test/java/com/baeldung/java8/Java8SortUnitTest.java b/core-java-8/src/test/java/com/baeldung/java8/Java8SortUnitTest.java
index f371c0d7da..71ec5b147f 100644
--- a/core-java-8/src/test/java/com/baeldung/java8/Java8SortUnitTest.java
+++ b/core-java-8/src/test/java/com/baeldung/java8/Java8SortUnitTest.java
@@ -1,16 +1,18 @@
package com.baeldung.java8;
-import com.baeldung.java8.entity.Human;
-import com.google.common.collect.Lists;
-import com.google.common.primitives.Ints;
-import org.junit.Assert;
-import org.junit.Test;
+import static org.hamcrest.Matchers.equalTo;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
+import java.util.stream.Collectors;
-import static org.hamcrest.Matchers.equalTo;
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.baeldung.java8.entity.Human;
+import com.google.common.collect.Lists;
+import com.google.common.primitives.Ints;
public class Java8SortUnitTest {
@@ -111,5 +113,22 @@ public class Java8SortUnitTest {
humans.sort(Comparator.comparing(Human::getName));
Assert.assertThat(humans.get(0), equalTo(new Human("Jack", 12)));
}
+
+ @Test
+ public final void givenStreamNaturalOrdering_whenSortingEntitiesByName_thenCorrectlySorted() {
+ final List letters = Lists.newArrayList("B", "A", "C");
+
+ final List sortedLetters = letters.stream().sorted().collect(Collectors.toList());
+ Assert.assertThat(sortedLetters.get(0), equalTo("A"));
+ }
+ @Test
+ public final void givenStreamCustomOrdering_whenSortingEntitiesByName_thenCorrectlySorted() {
+
+ final List humans = Lists.newArrayList(new Human("Sarah", 10), new Human("Jack", 12));
+ final Comparator nameComparator = (h1, h2) -> h1.getName().compareTo(h2.getName());
+
+ final List sortedHumans = humans.stream().sorted(nameComparator).collect(Collectors.toList());
+ Assert.assertThat(sortedHumans.get(0), equalTo(new Human("Jack", 12)));
+ }
}
diff --git a/core-java-8/src/test/java/com/baeldung/stream/conditional/StreamForEachIfElseUnitTest.java b/core-java-8/src/test/java/com/baeldung/stream/conditional/StreamForEachIfElseUnitTest.java
new file mode 100644
index 0000000000..b5d26eb6a8
--- /dev/null
+++ b/core-java-8/src/test/java/com/baeldung/stream/conditional/StreamForEachIfElseUnitTest.java
@@ -0,0 +1,41 @@
+package com.baeldung.stream.conditional;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Stream;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class StreamForEachIfElseUnitTest {
+
+ @Test
+ public final void givenIntegerStream_whenCheckingIntegerParityWithIfElse_thenEnsureCorrectParity() {
+ List ints = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
+
+ ints.stream()
+ .forEach(i -> {
+ if (i.intValue() % 2 == 0) {
+ Assert.assertTrue(i.intValue() + " is not even", i.intValue() % 2 == 0);
+ } else {
+ Assert.assertTrue(i.intValue() + " is not odd", i.intValue() % 2 != 0);
+ }
+ });
+
+ }
+
+ @Test
+ public final void givenIntegerStream_whenCheckingIntegerParityWithStreamFilter_thenEnsureCorrectParity() {
+ List ints = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
+
+ Stream evenIntegers = ints.stream()
+ .filter(i -> i.intValue() % 2 == 0);
+ Stream oddIntegers = ints.stream()
+ .filter(i -> i.intValue() % 2 != 0);
+
+ evenIntegers.forEach(i -> Assert.assertTrue(i.intValue() + " is not even", i.intValue() % 2 == 0));
+ oddIntegers.forEach(i -> Assert.assertTrue(i.intValue() + " is not odd", i.intValue() % 2 != 0));
+
+ }
+
+}
diff --git a/core-java-collections/README.md b/core-java-collections/README.md
index f187141712..ca275d7c09 100644
--- a/core-java-collections/README.md
+++ b/core-java-collections/README.md
@@ -48,4 +48,6 @@
- [Thread Safe LIFO Data Structure Implementations](https://www.baeldung.com/java-lifo-thread-safe)
- [Collections.emptyList() vs. New List Instance](https://www.baeldung.com/java-collections-emptylist-new-list)
- [Initialize a HashMap in Java](https://www.baeldung.com/java-initialize-hashmap)
-- [](https://www.baeldung.com/java-hashset-arraylist-contains-performance)
+- [Performance of contains() in a HashSet vs ArrayList](https://www.baeldung.com/java-hashset-arraylist-contains-performance)
+- [Get the Key for a Value from a Java Map](https://www.baeldung.com/java-map-key-from-value)
+- [Time Complexity of Java Collections](https://www.baeldung.com/java-collections-complexity)
diff --git a/core-java-collections/pom.xml b/core-java-collections/pom.xml
index 92e4278593..06b79fff22 100644
--- a/core-java-collections/pom.xml
+++ b/core-java-collections/pom.xml
@@ -63,6 +63,17 @@
jmh-generator-annprocess
${openjdk.jmh.version}
+
+ org.apache.commons
+ commons-exec
+ 1.3
+
+
+ one.util
+ streamex
+ 0.6.5
+
+
diff --git a/core-java-collections/src/main/java/com/baeldung/combiningcollections/CombiningArrays.java b/core-java-collections/src/main/java/com/baeldung/combiningcollections/CombiningArrays.java
new file mode 100644
index 0000000000..2ad48033c0
--- /dev/null
+++ b/core-java-collections/src/main/java/com/baeldung/combiningcollections/CombiningArrays.java
@@ -0,0 +1,39 @@
+package com.baeldung.combiningcollections;
+
+import java.util.Arrays;
+import java.util.stream.Stream;
+
+import org.apache.commons.lang3.ArrayUtils;
+
+import com.google.common.collect.ObjectArrays;
+
+public class CombiningArrays {
+
+ public static Object[] usingNativeJava(Object[] first, Object[] second) {
+ Object[] combined = new Object[first.length + second.length];
+ System.arraycopy(first, 0, combined, 0, first.length);
+ System.arraycopy(second, 0, combined, first.length, second.length);
+ return combined;
+ }
+
+ public static Object[] usingJava8ObjectStream(Object[] first, Object[] second) {
+ Object[] combined = Stream.concat(Arrays.stream(first), Arrays.stream(second)).toArray();
+ return combined;
+ }
+
+ public static Object[] usingJava8FlatMaps(Object[] first, Object[] second) {
+ Object[] combined = Stream.of(first, second).flatMap(Stream::of).toArray(String[]::new);
+ return combined;
+ }
+
+ public static Object[] usingApacheCommons(Object[] first, Object[] second) {
+ Object[] combined = ArrayUtils.addAll(first, second);
+ return combined;
+ }
+
+ public static Object[] usingGuava(Object[] first, Object[] second) {
+ Object [] combined = ObjectArrays.concat(first, second, Object.class);
+ return combined;
+ }
+
+}
diff --git a/core-java-collections/src/main/java/com/baeldung/combiningcollections/CombiningLists.java b/core-java-collections/src/main/java/com/baeldung/combiningcollections/CombiningLists.java
new file mode 100644
index 0000000000..3fdf672758
--- /dev/null
+++ b/core-java-collections/src/main/java/com/baeldung/combiningcollections/CombiningLists.java
@@ -0,0 +1,46 @@
+package com.baeldung.combiningcollections;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import org.apache.commons.collections4.ListUtils;
+
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+
+public class CombiningLists {
+
+ public static List
+
+
+ org.springframework.boot
+ spring-boot-starter-undertow
+
+
cc
-
-
- org.springframework.boot
- spring-boot-starter-undertow
-
-
- org.springframework.boot
- spring-boot-devtools
- true
-
-
-
- org.apache.maven.plugins
- maven-war-plugin
-
- src/main/webapp/
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
- true
- true
- true
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
-
- default-compile
- none
-
-
- default-testCompile
- none
-
-
-
net.alchim31.maven
scala-maven-plugin
@@ -758,6 +798,37 @@
${scala.version}
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+ default-compile
+ none
+
+
+ default-testCompile
+ none
+
+
+
+
+ org.apache.maven.plugins
+ maven-war-plugin
+
+ src/main/webapp/
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+ true
+ true
+ true
+
+
+
@@ -766,6 +837,17 @@
dev,swagger
+
+
+ org.springframework.boot
+ spring-boot-devtools
+ true
+
+
+ org.springframework.boot
+ spring-boot-starter-undertow
+
+
@@ -788,12 +870,12 @@
io.prometheus
- simpleclient_servlet
+ simpleclient_dropwizard
${prometheus-simpleclient.version}
io.prometheus
- simpleclient_dropwizard
+ simpleclient_servlet
${prometheus-simpleclient.version}
@@ -811,96 +893,4 @@
-
-
-
- org.springframework.cloud
- spring-cloud-dependencies
- ${spring-cloud.version}
- pom
- import
-
-
-
-
-
- ${maven.version}
-
-
-
- -Djava.security.egd=file:/dev/./urandom -Xmx256m
- 3.6.2
- 2.0.0
- 2.5
- 3.5
- 0.4.13
- 1.2
- 5.2.8.Final
- 2.6.0
- 0.7.9
- 3.21.0-GA
- 1.0.0
- 1.1.0
- 0.7.0
- 3.6
- 2.0.0
- 4.8
- jdt_apt
- 1.1.0.Final
- 1.4.1
- 3.0.1
- yyyyMMddHHmmss
- 3.0.0
- 3.1.3
- v6.10.0
-
-
-
- 0.0.20
-
- ${project.build.directory}/test-results
- false
- 3.2.2
- 2.12.1
- 3.2
-
- src/main/webapp/content/**/*.*, src/main/webapp/bower_components/**/*.*, src/main/webapp/i18n/*.js, target/www/**/*.*
-
- S3437,UndocumentedApi,BoldAndItalicTagsCheck
-
-
- src/main/webapp/app/**/*.*
- Web:BoldAndItalicTagsCheck
-
- src/main/java/**/*
- squid:S3437
-
- src/main/java/**/*
- squid:UndocumentedApi
-
- ${project.testresult.directory}/coverage/jacoco/jacoco-it.exec
- ${project.testresult.directory}/coverage/jacoco/jacoco.exec
- jacoco
-
- ${project.testresult.directory}/karma
-
- ${project.testresult.directory}/coverage/report-lcov/lcov.info
-
- ${project.testresult.directory}/coverage/report-lcov/lcov.info
-
- ${project.basedir}/src/main/
- ${project.testresult.directory}/surefire-reports
- ${project.basedir}/src/test/
-
- 2.5.0
-
- Camden.SR5
- 2.6.1
- 1.4.10.Final
- 1.1.0.Final
- v0.21.3
-
-
diff --git a/jhipster/jhipster-microservice/gateway-app/pom.xml b/jhipster/jhipster-microservice/gateway-app/pom.xml
index 0ae74e11bb..ed0c929027 100644
--- a/jhipster/jhipster-microservice/gateway-app/pom.xml
+++ b/jhipster/jhipster-microservice/gateway-app/pom.xml
@@ -1,53 +1,136 @@
-
+
4.0.0
+
+
+ jhipster-microservice
+ com.baeldung.jhipster
+ 1.0.0-SNAPSHOT
+
+
com.gateway
gateway-app
- 0.0.1-SNAPSHOT
war
gateway-app
-
- parent-boot-1
- com.baeldung
- 0.0.1-SNAPSHOT
- ../../../parent-boot-1
-
+
+ ${maven.version}
+
+
+
+ -Djava.security.egd=file:/dev/./urandom -Xmx256m
+ 3.6.2
+ 2.0.0
+ 3.6.0
+ 1.10
+ 2.5
+ 3.5
+ 0.4.13
+ 1.3
+ 1.2
+ 5.2.8.Final
+ 2.6.0
+ 0.7.9
+ 3.21.0-GA
+ 1.0.0
+ 1.1.0
+ 0.7.0
+ 3.6
+ 2.0.0
+ 3.6.2
+ 4.8
+ 1.3.0
+ jdt_apt
+ 1.1.0.Final
+ 2.10
+ 1.4.1
+ 3.0.1
+ yyyyMMddHHmmss
+ 3.0.0
+ 3.1.3
+ v6.10.0
+
+
+
+
+ ${project.build.directory}/test-results
+ 0.0.20
+ false
+ 3.2.2
+ 2.12.1
+ 3.2
+
+ src/main/webapp/content/**/*.*, src/main/webapp/bower_components/**/*.*, src/main/webapp/i18n/*.js, target/www/**/*.*
+
+ S3437,UndocumentedApi,BoldAndItalicTagsCheck
+
+
+ src/main/webapp/app/**/*.*
+ Web:BoldAndItalicTagsCheck
+
+ src/main/java/**/*
+ squid:S3437
+
+ src/main/java/**/*
+ squid:UndocumentedApi
+
+ ${project.testresult.directory}/coverage/jacoco/jacoco-it.exec
+ ${project.testresult.directory}/coverage/jacoco/jacoco.exec
+ jacoco
+
+ ${project.testresult.directory}/karma
+
+ ${project.testresult.directory}/coverage/report-lcov/lcov.info
+
+ ${project.testresult.directory}/coverage/report-lcov/lcov.info
+
+ ${project.basedir}/src/main/
+ ${project.testresult.directory}/surefire-reports
+ ${project.basedir}/src/test/
+
+ 2.5.0
+
+ Camden.SR5
+ 2.6.1
+ 1.4.10.Final
+ 1.1.0.Final
+ v0.21.3
+
+
+
+
+
+ org.springframework.cloud
+ spring-cloud-dependencies
+ ${spring-cloud.version}
+ pom
+ import
+
+
+
+
- io.github.jhipster
- jhipster
- ${jhipster.server.version}
+ com.datastax.cassandra
+ cassandra-driver-core
+
+
+ metrics-core
+ com.codahale.metrics
+
+
- io.dropwizard.metrics
- metrics-core
+ com.datastax.cassandra
+ cassandra-driver-extras
+ ${cassandra-driver.version}
- io.dropwizard.metrics
- metrics-annotation
- ${dropwizard-metrics.version}
-
-
- io.dropwizard.metrics
- metrics-json
- ${dropwizard-metrics.version}
-
-
- io.dropwizard.metrics
- metrics-jvm
- ${dropwizard-metrics.version}
-
-
- io.dropwizard.metrics
- metrics-servlet
- ${dropwizard-metrics.version}
-
-
- io.dropwizard.metrics
- metrics-servlets
+ com.datastax.cassandra
+ cassandra-driver-mapping
com.fasterxml.jackson.datatype
@@ -59,11 +142,11 @@
com.fasterxml.jackson.datatype
- jackson-datatype-jsr310
+ jackson-datatype-json-org
com.fasterxml.jackson.datatype
- jackson-datatype-json-org
+ jackson-datatype-jsr310
com.h2database
@@ -82,34 +165,12 @@
com.hazelcast
hazelcast-spring
-
- org.awaitility
- awaitility
- ${awaitility.version}
- test
-
com.jayway.jsonpath
json-path
test
-
- io.springfox
- springfox-swagger2
- ${springfox.version}
-
-
- org.mapstruct
- mapstruct
-
-
-
-
- io.springfox
- springfox-bean-validators
- ${springfox.version}
-
com.mattbertolini
liquibase-slf4j
@@ -121,16 +182,16 @@
${metrics-spring.version}
- com.codahale.metrics
metrics-annotation
+ com.codahale.metrics
- com.codahale.metrics
metrics-core
+ com.codahale.metrics
- com.codahale.metrics
metrics-healthchecks
+ com.codahale.metrics
@@ -148,17 +209,60 @@
commons-codec
commons-codec
- ${commons-codec.version}
commons-io
commons-io
- ${commons-io.version}
- org.apache.commons
- commons-lang3
- ${commons-lang.version}
+ io.dropwizard.metrics
+ metrics-annotation
+
+
+ io.dropwizard.metrics
+ metrics-core
+
+
+ io.dropwizard.metrics
+ metrics-json
+
+
+ io.dropwizard.metrics
+ metrics-jvm
+
+
+ io.dropwizard.metrics
+ metrics-servlet
+
+
+ io.dropwizard.metrics
+ metrics-servlets
+
+
+ io.github.jhipster
+ jhipster
+ ${jhipster.server.version}
+
+
+ io.jsonwebtoken
+ jjwt
+ ${jjwt.version}
+
+
+ io.springfox
+ springfox-bean-validators
+ ${springfox.version}
+
+
+ io.springfox
+ springfox-swagger2
+ ${springfox.version}
+
+
+ mapstruct
+ org.mapstruct
+
+
javax.cache
@@ -173,11 +277,41 @@
lz4
${lz4.version}
+
+ net.logstash.logback
+ logstash-logback-encoder
+ ${logstash-logback-encoder.version}
+
+
+ logback-core
+ ch.qos.logback
+
+
+ logback-classic
+ ch.qos.logback
+
+
+ logback-access
+ ch.qos.logback
+
+
+
+
+ org.apache.commons
+ commons-lang3
+ ${commons-lang.version}
+
org.assertj
assertj-core
test
+
+ org.awaitility
+ awaitility
+ ${awaitility.version}
+ test
+
org.hibernate
hibernate-envers
@@ -226,6 +360,10 @@
org.springframework.boot
spring-boot-starter-aop
+
+ org.springframework.boot
+ spring-boot-starter-cloud-connectors
+
org.springframework.boot
spring-boot-starter-data-jpa
@@ -247,16 +385,6 @@
spring-boot-starter-test
test
-
- org.springframework.security
- spring-security-test
- test
-
-
- org.springframework.boot
- spring-boot-test
- test
-
org.springframework.boot
spring-boot-starter-thymeleaf
@@ -266,40 +394,15 @@
spring-boot-starter-web
- org.springframework.boot
spring-boot-starter-tomcat
+ org.springframework.boot
- io.jsonwebtoken
- jjwt
- ${jjwt.version}
-
-
-
- com.datastax.cassandra
- cassandra-driver-core
-
-
- com.codahale.metrics
- metrics-core
-
-
-
-
- com.datastax.cassandra
- cassandra-driver-extras
- ${cassandra-driver.version}
-
-
- com.datastax.cassandra
- cassandra-driver-mapping
-
-
-
- org.springframework.cloud
- spring-cloud-starter-zuul
+ org.springframework.boot
+ spring-boot-test
+ test
org.springframework.cloud
@@ -307,72 +410,105 @@
org.springframework.cloud
- spring-cloud-starter-ribbon
-
-
-
- io.netty
- netty-transport-native-epoll
-
-
-
-
- org.springframework.cloud
- spring-cloud-starter-hystrix
-
-
- org.springframework.cloud
- spring-cloud-starter-spectator
-
-
- org.springframework.retry
- spring-retry
+ spring-cloud-starter-config
org.springframework.cloud
spring-cloud-starter-eureka
-
- org.springframework.cloud
- spring-cloud-starter-config
-
org.springframework.cloud
spring-cloud-starter-feign
- net.logstash.logback
- logstash-logback-encoder
- ${logstash-logback-encoder.version}
+ org.springframework.cloud
+ spring-cloud-starter-hystrix
+
+
+ org.springframework.cloud
+ spring-cloud-starter-ribbon
+
- ch.qos.logback
- logback-core
-
-
- ch.qos.logback
- logback-classic
-
-
- ch.qos.logback
- logback-access
+ netty-transport-native-epoll
+ io.netty
- org.springframework.boot
- spring-boot-starter-cloud-connectors
+ org.springframework.cloud
+ spring-cloud-starter-spectator
+
+
+
+ org.springframework.cloud
+ spring-cloud-starter-zuul
+
+
+ org.springframework.retry
+ spring-retry
org.springframework.security
spring-security-data
+
+ org.springframework.security
+ spring-security-test
+ test
+
spring-boot:run
+
+
+
+
+ org.eclipse.m2e
+ lifecycle-mapping
+ 1.0.0
+
+
+
+
+
+ org.jacoco
+ jacoco-maven-plugin
+ ${jacoco-maven-plugin.version}
+
+ prepare-agent
+
+
+
+
+
+
+
+
+ com.github.eirslett
+ frontend-maven-plugin
+ ${frontend-maven-plugin.version}
+
+ install-node-and-yarn
+ yarn
+ bower
+ gulp
+
+
+
+
+
+
+
+
+
+
+
+
com.github.ekryd.sortpom
@@ -395,6 +531,22 @@
false
+
+ com.spotify
+ docker-maven-plugin
+ ${docker-maven-plugin.version}
+
+ gateway
+ src/main/docker
+
+
+ /
+ ${project.build.directory}
+ ${project.build.finalName}.war
+
+
+
+
org.apache.maven.plugins
maven-compiler-plugin
@@ -412,6 +564,7 @@
org.apache.maven.plugins
maven-eclipse-plugin
+ ${maven-eclipse-plugin.version}
true
true
@@ -518,28 +671,16 @@
-
- org.sonarsource.scanner.maven
- sonar-maven-plugin
- ${sonar-maven-plugin.version}
-
org.liquibase
liquibase-maven-plugin
${liquibase.version}
-
- src/main/resources/config/liquibase/master.xml
- src/main/resources/config/liquibase/changelog/${maven.build.timestamp}_changelog.xml
- org.h2.Driver
- jdbc:h2:file:./target/h2db/db/gateway
-
- gateway
-
- hibernate:spring:com.gateway.domain?dialect=org.hibernate.dialect.H2Dialect&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy
- true
- debug
-
+
+ javax.validation
+ validation-api
+ ${validation-api.version}
+
org.javassist
javassist
@@ -555,12 +696,24 @@
spring-boot-starter-data-jpa
${project.parent.version}
-
- javax.validation
- validation-api
- ${validation-api.version}
-
+
+ src/main/resources/config/liquibase/master.xml
+ src/main/resources/config/liquibase/changelog/${maven.build.timestamp}_changelog.xml
+ org.h2.Driver
+ jdbc:h2:file:./target/h2db/db/gateway
+
+ gateway
+
+ hibernate:spring:com.gateway.domain?dialect=org.hibernate.dialect.H2Dialect&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy
+ true
+ debug
+
+
+
+ org.sonarsource.scanner.maven
+ sonar-maven-plugin
+ ${sonar-maven-plugin.version}
org.springframework.boot
@@ -571,74 +724,8 @@
-
- com.spotify
- docker-maven-plugin
- ${docker-maven-plugin.version}
-
- gateway
- src/main/docker
-
-
- /
- ${project.build.directory}
- ${project.build.finalName}.war
-
-
-
-
-
-
-
-
- org.eclipse.m2e
- lifecycle-mapping
- 1.0.0
-
-
-
-
-
- org.jacoco
-
- jacoco-maven-plugin
-
-
- ${jacoco-maven-plugin.version}
-
-
- prepare-agent
-
-
-
-
-
-
-
-
- com.github.eirslett
- frontend-maven-plugin
- ${frontend-maven-plugin.version}
-
- install-node-and-yarn
- yarn
- bower
- gulp
-
-
-
-
-
-
-
-
-
-
-
-
@@ -659,17 +746,6 @@
true
-
-
- org.springframework.boot
- spring-boot-starter-undertow
-
-
- org.springframework.boot
- spring-boot-devtools
- true
-
-
@@ -687,48 +763,22 @@
dev${profile.no-liquibase}
-
-
- prod
+
+ org.springframework.boot
+ spring-boot-devtools
+ true
+
org.springframework.boot
spring-boot-starter-undertow
+
+
+ prod
-
- maven-clean-plugin
-
-
-
- target/www/
-
-
-
-
-
- org.apache.maven.plugins
- maven-war-plugin
-
- target/www/
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
- true
-
-
-
-
- build-info
-
-
-
-
com.github.eirslett
frontend-maven-plugin
@@ -773,16 +823,47 @@
gulp test
+ test
gulp
- test
test --no-notification
+
+ maven-clean-plugin
+
+
+
+ target/www/
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-war-plugin
+
+ target/www/
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ build-info
+
+
+
+
+ true
+
+
@@ -791,56 +872,20 @@
prod${profile.swagger}${profile.no-liquibase}
+
+
+ org.springframework.boot
+ spring-boot-starter-undertow
+
+
cc
-
-
- org.springframework.boot
- spring-boot-starter-undertow
-
-
- org.springframework.boot
- spring-boot-devtools
- true
-
-
-
- org.apache.maven.plugins
- maven-war-plugin
-
- src/main/webapp/
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
- true
- true
- true
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
-
- default-compile
- none
-
-
- default-testCompile
- none
-
-
-
net.alchim31.maven
scala-maven-plugin
@@ -869,6 +914,37 @@
${scala.version}
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+ default-compile
+ none
+
+
+ default-testCompile
+ none
+
+
+
+
+ org.apache.maven.plugins
+ maven-war-plugin
+
+ src/main/webapp/
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+ true
+ true
+ true
+
+
+
@@ -877,6 +953,17 @@
dev,swagger
+
+
+ org.springframework.boot
+ spring-boot-devtools
+ true
+
+
+ org.springframework.boot
+ spring-boot-starter-undertow
+
+
@@ -899,12 +986,12 @@
io.prometheus
- simpleclient_servlet
+ simpleclient_dropwizard
${prometheus-simpleclient.version}
io.prometheus
- simpleclient_dropwizard
+ simpleclient_servlet
${prometheus-simpleclient.version}
@@ -922,99 +1009,4 @@
-
-
-
- org.springframework.cloud
- spring-cloud-dependencies
- ${spring-cloud.version}
- pom
- import
-
-
-
-
-
- ${maven.version}
-
-
-
- -Djava.security.egd=file:/dev/./urandom -Xmx256m
- 3.6.2
- 2.0.0
- 1.10
- 2.5
- 3.5
- 0.4.13
- 1.3
- 1.2
- 5.2.8.Final
- 2.6.0
- 0.7.9
- 3.21.0-GA
- 1.0.0
- 1.1.0
- 0.7.0
- 3.6
- 2.0.0
- 4.8
- 1.3.0
- jdt_apt
- 1.1.0.Final
- 1.4.1
- 3.0.1
- yyyyMMddHHmmss
- 3.0.0
- 3.1.3
- v6.10.0
-
-
-
- 0.0.20
-
- ${project.build.directory}/test-results
- false
- 3.2.2
- 2.12.1
- 3.2
-
- src/main/webapp/content/**/*.*, src/main/webapp/bower_components/**/*.*, src/main/webapp/i18n/*.js, target/www/**/*.*
-
- S3437,UndocumentedApi,BoldAndItalicTagsCheck
-
-
- src/main/webapp/app/**/*.*
- Web:BoldAndItalicTagsCheck
-
- src/main/java/**/*
- squid:S3437
-
- src/main/java/**/*
- squid:UndocumentedApi
-
- ${project.testresult.directory}/coverage/jacoco/jacoco-it.exec
- ${project.testresult.directory}/coverage/jacoco/jacoco.exec
- jacoco
-
- ${project.testresult.directory}/karma
-
- ${project.testresult.directory}/coverage/report-lcov/lcov.info
-
- ${project.testresult.directory}/coverage/report-lcov/lcov.info
-
- ${project.basedir}/src/main/
- ${project.testresult.directory}/surefire-reports
- ${project.basedir}/src/test/
-
- 2.5.0
-
- Camden.SR5
- 2.6.1
- 1.4.10.Final
- 1.1.0.Final
- v0.21.3
-
-
diff --git a/jhipster/jhipster-microservice/pom.xml b/jhipster/jhipster-microservice/pom.xml
new file mode 100644
index 0000000000..4a60e47f87
--- /dev/null
+++ b/jhipster/jhipster-microservice/pom.xml
@@ -0,0 +1,20 @@
+
+
+ 4.0.0
+ jhipster-microservice
+ pom
+ JHipster Microservice
+
+
+ jhipster
+ com.baeldung.jhipster
+ 1.0.0-SNAPSHOT
+
+
+
+ car-app
+ dealer-app
+ gateway-app
+
+
diff --git a/jhipster/jhipster-monolithic/pom.xml b/jhipster/jhipster-monolithic/pom.xml
index 9708b83a70..e242668759 100644
--- a/jhipster/jhipster-monolithic/pom.xml
+++ b/jhipster/jhipster-monolithic/pom.xml
@@ -6,10 +6,9 @@
JHipster Monolithic Application
- parent-boot-1
- com.baeldung
- 0.0.1-SNAPSHOT
- ../../parent-boot-1
+ jhipster
+ com.baeldung.jhipster
+ 1.0.0-SNAPSHOT
diff --git a/jhipster/pom.xml b/jhipster/pom.xml
new file mode 100644
index 0000000000..2bf7bcb233
--- /dev/null
+++ b/jhipster/pom.xml
@@ -0,0 +1,23 @@
+
+
+ 4.0.0
+ com.baeldung.jhipster
+ jhipster
+ 1.0.0-SNAPSHOT
+ pom
+ JHipster
+
+
+ parent-boot-1
+ com.baeldung
+ 0.0.1-SNAPSHOT
+ ../parent-boot-1
+
+
+
+ jhipster-monolithic
+ jhipster-microservice
+
+
+
diff --git a/jni/pom.xml b/jni/pom.xml
index 274b9b58c3..d4cc409d33 100644
--- a/jni/pom.xml
+++ b/jni/pom.xml
@@ -1,21 +1,12 @@
4.0.0
- com.baeldung
jni
- 0.0.1-SNAPSHOT
-
-
- junit
- junit
- ${junit.version}
- test
-
-
-
-
- 4.8.1
-
+
+ com.baeldung
+ parent-modules
+ 1.0.0-SNAPSHOT
+
\ No newline at end of file
diff --git a/jni/src/test/java/com/baeldung/jni/JNINativeTests.java b/jni/src/test/java/com/baeldung/jni/JNINativeManualTest.java
similarity index 98%
rename from jni/src/test/java/com/baeldung/jni/JNINativeTests.java
rename to jni/src/test/java/com/baeldung/jni/JNINativeManualTest.java
index 42e572d41b..8201945644 100644
--- a/jni/src/test/java/com/baeldung/jni/JNINativeTests.java
+++ b/jni/src/test/java/com/baeldung/jni/JNINativeManualTest.java
@@ -7,7 +7,7 @@ import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.Test;
-public class JNINativeTests {
+public class JNINativeManualTest {
@Before
public void setup() {
diff --git a/jooby/pom.xml b/jooby/pom.xml
index 2867b7f4b6..83dd650701 100644
--- a/jooby/pom.xml
+++ b/jooby/pom.xml
@@ -1,60 +1,63 @@
- 4.0.0
- jooby
- com.baeldung.jooby
- 1.0
- jooby
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ 4.0.0
+ jooby
+ com.baeldung.jooby
+ 1.0
+ jooby
-
- org.jooby
- modules
- 1.1.3
-
+
+ com.baeldung
+ parent-modules
+ 1.0.0-SNAPSHOT
+
-
-
- org.jooby
- jooby-netty
-
-
- org.jooby
- jooby-jedis
- ${jooby-jedis.version}
-
-
- ch.qos.logback
- logback-classic
-
-
- junit
- junit
- test
-
-
- io.rest-assured
- rest-assured
- test
-
-
+
+
+
+ org.jooby
+ modules
+ ${jooby.version}
+ pom
+
+
+
-
-
-
- org.apache.maven.plugins
- maven-shade-plugin
- ${maven-shade-plugin.version}
-
-
-
+
+
+ org.jooby
+ jooby-netty
+ ${jooby.version}
+
+
+ org.jooby
+ jooby-jedis
+ ${jooby.version}
+
+
+ io.rest-assured
+ rest-assured
+ test
+ ${rest-assured.version}
+
+
-
- 1.1.3
- com.baeldung.jooby.App
- 1.1.3
-
- 2.4.3
-
+
+
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+ ${maven-shade-plugin.version}
+
+
+
+
+
+ 1.1.3
+ 3.1.1
+ com.baeldung.jooby.App
+ 2.4.3
+
diff --git a/jooby/src/test/java/com/baeldung/jooby/AppTest.java b/jooby/src/test/java/com/baeldung/jooby/AppUnitTest.java
similarity index 96%
rename from jooby/src/test/java/com/baeldung/jooby/AppTest.java
rename to jooby/src/test/java/com/baeldung/jooby/AppUnitTest.java
index af2626c046..ab7388f5f4 100644
--- a/jooby/src/test/java/com/baeldung/jooby/AppTest.java
+++ b/jooby/src/test/java/com/baeldung/jooby/AppUnitTest.java
@@ -9,7 +9,7 @@ import org.jooby.test.MockRouter;
import org.junit.ClassRule;
import org.junit.Test;
-public class AppTest {
+public class AppUnitTest {
@ClassRule
public static JoobyRule app = new JoobyRule(new App());
diff --git a/jta/README.md b/jta/README.md
new file mode 100644
index 0000000000..445a291c8f
--- /dev/null
+++ b/jta/README.md
@@ -0,0 +1,2 @@
+### Relevant Articles:
+- [Guide to Java EE JTA](https://www.baeldung.com/jee-jta)
diff --git a/libraries-security/pom.xml b/libraries-security/pom.xml
index 8f8506172f..3077abc29c 100644
--- a/libraries-security/pom.xml
+++ b/libraries-security/pom.xml
@@ -8,23 +8,54 @@
com.baeldung
- parent-modules
- 1.0.0-SNAPSHOT
+ parent-boot-1
+ 0.0.1-SNAPSHOT
+ ../parent-boot-1
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.springframework.security.oauth
+ spring-security-oauth2
+ 2.3.3.RELEASE
+
+
+
+ com.github.scribejava
+ scribejava-apis
+ ${scribejava.version}
+
+
junit
junit
${junit.version}
test
+
+ org.passay
+ passay
+ 1.3.1
+
+
+ org.cryptacular
+ cryptacular
+ 1.2.2
+
4.12
+ 2.0.4.RELEASE
+ 5.6.0
+
diff --git a/libraries-security/src/main/java/com/baeldung/scribejava/ScribejavaApplication.java b/libraries-security/src/main/java/com/baeldung/scribejava/ScribejavaApplication.java
new file mode 100644
index 0000000000..bb86c497b0
--- /dev/null
+++ b/libraries-security/src/main/java/com/baeldung/scribejava/ScribejavaApplication.java
@@ -0,0 +1,15 @@
+package com.baeldung.scribejava;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+
+@SpringBootApplication
+public class ScribejavaApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(ScribejavaApplication.class, args);
+ }
+
+
+}
diff --git a/libraries-security/src/main/java/com/baeldung/scribejava/api/MyApi.java b/libraries-security/src/main/java/com/baeldung/scribejava/api/MyApi.java
new file mode 100644
index 0000000000..cf073d3035
--- /dev/null
+++ b/libraries-security/src/main/java/com/baeldung/scribejava/api/MyApi.java
@@ -0,0 +1,27 @@
+package com.baeldung.scribejava.api;
+
+import com.github.scribejava.core.builder.api.DefaultApi20;
+
+public class MyApi extends DefaultApi20 {
+
+ private MyApi() {
+ }
+
+ private static class InstanceHolder {
+ private static final MyApi INSTANCE = new MyApi();
+ }
+
+ public static MyApi instance() {
+ return InstanceHolder.INSTANCE;
+ }
+
+ @Override
+ public String getAccessTokenEndpoint() {
+ return "http://localhost:8080/oauth/token";
+ }
+
+ @Override
+ protected String getAuthorizationBaseUrl() {
+ return null;
+ }
+}
diff --git a/libraries-security/src/main/java/com/baeldung/scribejava/controller/GoogleController.java b/libraries-security/src/main/java/com/baeldung/scribejava/controller/GoogleController.java
new file mode 100644
index 0000000000..ffe4f0cc8a
--- /dev/null
+++ b/libraries-security/src/main/java/com/baeldung/scribejava/controller/GoogleController.java
@@ -0,0 +1,49 @@
+package com.baeldung.scribejava.controller;
+
+import com.baeldung.scribejava.service.GoogleService;
+import com.github.scribejava.core.model.OAuth2AccessToken;
+import com.github.scribejava.core.model.OAuthRequest;
+import com.github.scribejava.core.model.Response;
+import com.github.scribejava.core.model.Verb;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletResponse;
+
+@RestController
+public class GoogleController {
+
+ @Autowired
+ private GoogleService service;
+
+
+ @GetMapping(value ="/me/google")
+ public void me(HttpServletResponse response){
+ String auth = service.getService().getAuthorizationUrl();
+
+ response.setHeader("Location", auth);
+ response.setStatus(302);
+
+ }
+
+ @GetMapping(value = "/auth/google")
+ public String google(@RequestParam String code, HttpServletResponse servletResponse){
+
+ try {
+ OAuth2AccessToken token = service.getService().getAccessToken(code);
+
+ OAuthRequest request = new OAuthRequest(Verb.GET, "https://www.googleapis.com/oauth2/v1/userinfo?alt=json");
+ service.getService().signRequest(token, request);
+ Response response = service.getService().execute(request);
+ return response.getBody();
+
+ }catch (Exception e){
+ servletResponse.setStatus(HttpServletResponse.SC_BAD_REQUEST);
+ }
+
+ return null;
+ }
+
+}
diff --git a/libraries-security/src/main/java/com/baeldung/scribejava/controller/TwitterController.java b/libraries-security/src/main/java/com/baeldung/scribejava/controller/TwitterController.java
new file mode 100644
index 0000000000..bfcd6d960c
--- /dev/null
+++ b/libraries-security/src/main/java/com/baeldung/scribejava/controller/TwitterController.java
@@ -0,0 +1,57 @@
+package com.baeldung.scribejava.controller;
+
+import com.baeldung.scribejava.service.TwitterService;
+import com.github.scribejava.core.model.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.Scanner;
+import java.util.concurrent.ExecutionException;
+
+@RestController
+public class TwitterController {
+
+ @Autowired
+ private TwitterService service;
+
+
+ @GetMapping(value ="/me/twitter")
+ public String me(HttpServletResponse servletResponse){
+ try {
+ OAuth1RequestToken requestToken = service.getService().getRequestToken();
+
+ String auth = service.getService().getAuthorizationUrl(requestToken);
+
+ Runtime runtime = Runtime.getRuntime();
+ try {
+ runtime.exec("rundll32 url.dll,FileProtocolHandler " + auth);
+ } catch (IOException e) {
+ servletResponse.setStatus(HttpServletResponse.SC_BAD_REQUEST);
+ return null;
+ }
+
+ System.out.println("Insert twitter code:");
+ Scanner in = new Scanner(System.in);
+
+ String oauthverifier = in.nextLine();
+
+ final OAuth1AccessToken accessToken = service.getService().getAccessToken(requestToken,oauthverifier);
+
+ OAuthRequest request = new OAuthRequest(Verb.GET, "https://api.twitter.com/1.1/account/verify_credentials.json");
+ service.getService().signRequest(accessToken, request);
+ Response response = service.getService().execute(request);
+ return response.getBody();
+
+ } catch (IOException | InterruptedException | ExecutionException e) {
+ servletResponse.setStatus(HttpServletResponse.SC_BAD_REQUEST);
+ }
+
+ return null;
+ }
+
+
+
+}
diff --git a/libraries-security/src/main/java/com/baeldung/scribejava/controller/UserController.java b/libraries-security/src/main/java/com/baeldung/scribejava/controller/UserController.java
new file mode 100644
index 0000000000..68a11250de
--- /dev/null
+++ b/libraries-security/src/main/java/com/baeldung/scribejava/controller/UserController.java
@@ -0,0 +1,46 @@
+package com.baeldung.scribejava.controller;
+
+import com.baeldung.scribejava.service.MyService;
+import com.github.scribejava.core.model.OAuth2AccessToken;
+import com.github.scribejava.core.model.OAuthRequest;
+import com.github.scribejava.core.model.Response;
+import com.github.scribejava.core.model.Verb;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletResponse;
+import java.security.Principal;
+
+@RestController(value = "/user")
+public class UserController {
+
+ @Autowired
+ private MyService service;
+
+ @GetMapping("/me/myapi")
+ public String me(@RequestParam String username, @RequestParam String password, HttpServletResponse responsehttp) {
+
+ try {
+ OAuth2AccessToken token = service.getService().getAccessTokenPasswordGrant(username, password);
+
+ OAuthRequest request = new OAuthRequest(Verb.GET, "http://localhost:8080/me");
+ service.getService().signRequest(token, request);
+ Response response = service.getService().execute(request);
+
+ return response.getBody();
+
+ } catch (Exception e) {
+ responsehttp.setStatus(HttpServletResponse.SC_BAD_REQUEST);
+ }
+
+ return null;
+
+ }
+
+ @GetMapping("/me")
+ public Principal user(Principal principal) {
+ return principal;
+ }
+}
diff --git a/libraries-security/src/main/java/com/baeldung/scribejava/oauth/AuthServiceConfig.java b/libraries-security/src/main/java/com/baeldung/scribejava/oauth/AuthServiceConfig.java
new file mode 100644
index 0000000000..2c7162399b
--- /dev/null
+++ b/libraries-security/src/main/java/com/baeldung/scribejava/oauth/AuthServiceConfig.java
@@ -0,0 +1,45 @@
+package com.baeldung.scribejava.oauth;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.HttpMethod;
+import org.springframework.security.authentication.AuthenticationManager;
+import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer;
+import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter;
+import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer;
+import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerEndpointsConfigurer;
+import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerSecurityConfigurer;
+
+
+@Configuration
+@EnableAuthorizationServer
+public class AuthServiceConfig extends AuthorizationServerConfigurerAdapter {
+
+ @Autowired
+ @Qualifier("authenticationManagerBean")
+ private AuthenticationManager authenticationManager;
+
+ @Override
+ public void configure(AuthorizationServerSecurityConfigurer oauthServer) throws Exception {
+ oauthServer.tokenKeyAccess("permitAll()")
+ .checkTokenAccess("isAuthenticated()");
+ }
+
+ @Override
+ public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
+ clients.inMemory()
+ .withClient("baeldung_api_key")
+ .secret("baeldung_api_secret")
+ .authorizedGrantTypes("password","refresh_token")
+ .scopes("read","write").autoApprove(true);
+ }
+
+ @Override
+ public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
+ endpoints
+ .authenticationManager(authenticationManager)
+ .allowedTokenEndpointRequestMethods(HttpMethod.GET, HttpMethod.POST);
+ }
+
+}
diff --git a/libraries-security/src/main/java/com/baeldung/scribejava/oauth/WebSecurityConfig.java b/libraries-security/src/main/java/com/baeldung/scribejava/oauth/WebSecurityConfig.java
new file mode 100644
index 0000000000..7aa51400ea
--- /dev/null
+++ b/libraries-security/src/main/java/com/baeldung/scribejava/oauth/WebSecurityConfig.java
@@ -0,0 +1,53 @@
+package com.baeldung.scribejava.oauth;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.authentication.AuthenticationManager;
+import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
+import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
+import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
+
+@Configuration
+@EnableResourceServer
+public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
+
+ @Override
+ protected void configure(HttpSecurity http) throws Exception {
+ http
+ .headers().frameOptions().disable()
+ .and()
+ .csrf().disable();
+ }
+
+ @Override
+ protected void configure(AuthenticationManagerBuilder auth) throws Exception {
+ auth.inMemoryAuthentication()
+ .withUser("baeldung")
+ .password("scribejava")
+ .roles("USER");
+ }
+
+ @Override
+ @Bean
+ public AuthenticationManager authenticationManagerBean() throws Exception {
+ return super.authenticationManagerBean();
+ }
+
+
+ @EnableResourceServer
+ @Configuration
+ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
+
+ @Override
+ public void configure(HttpSecurity http) throws Exception {
+ http
+ .authorizeRequests()
+ .antMatchers("/user/me").authenticated()
+ .and()
+ .csrf().disable();
+ }
+ }
+
+}
diff --git a/libraries-security/src/main/java/com/baeldung/scribejava/service/GoogleService.java b/libraries-security/src/main/java/com/baeldung/scribejava/service/GoogleService.java
new file mode 100644
index 0000000000..fbcc39763c
--- /dev/null
+++ b/libraries-security/src/main/java/com/baeldung/scribejava/service/GoogleService.java
@@ -0,0 +1,31 @@
+package com.baeldung.scribejava.service;
+
+import com.github.scribejava.apis.GoogleApi20;
+import com.github.scribejava.core.builder.ServiceBuilder;
+import com.github.scribejava.core.oauth.OAuth20Service;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.PostConstruct;
+@Component
+public class GoogleService {
+
+ private OAuth20Service service;
+ private final String API_KEY = "api_key";
+ private final String API_SECRET = "api_secret";
+ private final String SCOPE = "https://www.googleapis.com/auth/userinfo.email";
+ private final String CALLBACK = "http://localhost:8080/auth/google";
+
+ @PostConstruct
+ private void init(){
+ this.service = new ServiceBuilder(API_KEY)
+ .apiSecret(API_SECRET)
+ .scope(SCOPE)
+ .callback(CALLBACK)
+ .build(GoogleApi20.instance());
+ }
+
+
+ public OAuth20Service getService() {
+ return service;
+ }
+}
diff --git a/libraries-security/src/main/java/com/baeldung/scribejava/service/MyService.java b/libraries-security/src/main/java/com/baeldung/scribejava/service/MyService.java
new file mode 100644
index 0000000000..739c82172c
--- /dev/null
+++ b/libraries-security/src/main/java/com/baeldung/scribejava/service/MyService.java
@@ -0,0 +1,29 @@
+package com.baeldung.scribejava.service;
+
+import com.baeldung.scribejava.api.MyApi;
+import com.github.scribejava.core.builder.ServiceBuilder;
+import com.github.scribejava.core.oauth.OAuth20Service;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.PostConstruct;
+
+@Component
+public class MyService {
+
+ private OAuth20Service service;
+ private final String API_KEY = "baeldung_api_key";
+ private final String API_SECRET = "baeldung_api_secret";
+
+ @PostConstruct
+ private void init(){
+ this.service = new ServiceBuilder(API_KEY)
+ .apiSecret(API_SECRET)
+ .scope("read write")
+ .build(MyApi.instance());
+ }
+
+
+ public OAuth20Service getService() {
+ return service;
+ }
+}
diff --git a/libraries-security/src/main/java/com/baeldung/scribejava/service/TwitterService.java b/libraries-security/src/main/java/com/baeldung/scribejava/service/TwitterService.java
new file mode 100644
index 0000000000..df49f74679
--- /dev/null
+++ b/libraries-security/src/main/java/com/baeldung/scribejava/service/TwitterService.java
@@ -0,0 +1,29 @@
+package com.baeldung.scribejava.service;
+
+import com.github.scribejava.apis.TwitterApi;
+import com.github.scribejava.core.builder.ServiceBuilder;
+import com.github.scribejava.core.oauth.OAuth10aService;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.PostConstruct;
+
+@Component
+public class TwitterService {
+
+ private final String API_KEY = "api_key";
+ private final String API_SECRET = "api_secret";
+ private OAuth10aService service;
+
+ @PostConstruct
+ private void init(){
+ this.service = new ServiceBuilder(API_KEY)
+ .apiSecret(API_SECRET)
+ .build(TwitterApi.instance());
+ }
+
+ public OAuth10aService getService(){
+ return service;
+ }
+
+
+}
diff --git a/libraries-security/src/main/resources/application.properties b/libraries-security/src/main/resources/application.properties
new file mode 100644
index 0000000000..71c6176533
--- /dev/null
+++ b/libraries-security/src/main/resources/application.properties
@@ -0,0 +1 @@
+security.oauth2.resource.filter-order = 3
\ No newline at end of file
diff --git a/libraries-security/src/test/java/com/baeldung/passay/NegativeMatchingRulesUnitTest.java b/libraries-security/src/test/java/com/baeldung/passay/NegativeMatchingRulesUnitTest.java
new file mode 100644
index 0000000000..5054a5880e
--- /dev/null
+++ b/libraries-security/src/test/java/com/baeldung/passay/NegativeMatchingRulesUnitTest.java
@@ -0,0 +1,149 @@
+package com.baeldung.passay;
+
+import org.cryptacular.bean.EncodingHashBean;
+import org.cryptacular.spec.CodecSpec;
+import org.cryptacular.spec.DigestSpec;
+import org.junit.Assert;
+import org.junit.Test;
+import org.passay.DictionaryRule;
+import org.passay.DictionarySubstringRule;
+import org.passay.DigestHistoryRule;
+import org.passay.EnglishSequenceData;
+import org.passay.HistoryRule;
+import org.passay.IllegalCharacterRule;
+import org.passay.IllegalRegexRule;
+import org.passay.IllegalSequenceRule;
+import org.passay.NumberRangeRule;
+import org.passay.PasswordData;
+import org.passay.PasswordValidator;
+import org.passay.RepeatCharacterRegexRule;
+import org.passay.RuleResult;
+import org.passay.SourceRule;
+import org.passay.UsernameRule;
+import org.passay.WhitespaceRule;
+import org.passay.dictionary.ArrayWordList;
+import org.passay.dictionary.WordListDictionary;
+
+import java.util.Arrays;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+
+public class NegativeMatchingRulesUnitTest {
+
+ @Test
+ public void givenDictionaryRules_whenValidatePassword_thenFoundIllegalWordsFromDictionary() {
+ ArrayWordList arrayWordList = new ArrayWordList(new String[] { "bar", "foobar" });
+
+ WordListDictionary wordListDictionary = new WordListDictionary(arrayWordList);
+
+ DictionaryRule dictionaryRule = new DictionaryRule(wordListDictionary);
+ DictionarySubstringRule dictionarySubstringRule = new DictionarySubstringRule(wordListDictionary);
+
+ PasswordValidator passwordValidator = new PasswordValidator(dictionaryRule, dictionarySubstringRule);
+ RuleResult validate = passwordValidator.validate(new PasswordData("foobar"));
+
+ assertFalse(validate.isValid());
+ assertEquals("ILLEGAL_WORD:{matchingWord=foobar}", getDetail(validate, 0));
+ assertEquals("ILLEGAL_WORD:{matchingWord=bar}", getDetail(validate, 1));
+ }
+
+ @Test
+ public void givenHistoryRule_whenValidatePassword_thenFoundIllegalWordsFromHistory() {
+ HistoryRule historyRule = new HistoryRule();
+
+ PasswordData passwordData = new PasswordData("123");
+ passwordData.setPasswordReferences(new PasswordData.HistoricalReference("12345"), new PasswordData.HistoricalReference("1234"), new PasswordData.HistoricalReference("123"));
+
+ PasswordValidator passwordValidator = new PasswordValidator(historyRule);
+
+ RuleResult validate = passwordValidator.validate(passwordData);
+
+ assertFalse(validate.isValid());
+ assertEquals("HISTORY_VIOLATION:{historySize=3}", getDetail(validate, 0));
+ }
+
+ @Test
+ public void givenSeveralIllegalRules_whenValidatePassword_thenFoundSeveralIllegalPatterns() {
+ IllegalCharacterRule illegalCharacterRule = new IllegalCharacterRule(new char[] { 'a' });
+ IllegalRegexRule illegalRegexRule = new IllegalRegexRule("\\w{2}\\d{2}");
+ IllegalSequenceRule illegalSequenceRule = new IllegalSequenceRule(EnglishSequenceData.Alphabetical, 3, true);
+ NumberRangeRule numberRangeRule = new NumberRangeRule(1, 10);
+ WhitespaceRule whitespaceRule = new WhitespaceRule();
+
+ PasswordValidator passwordValidator = new PasswordValidator(illegalCharacterRule, illegalRegexRule, illegalSequenceRule, numberRangeRule, whitespaceRule);
+
+ RuleResult validate = passwordValidator.validate(new PasswordData("abcd22 "));
+
+ assertFalse(validate.isValid());
+ assertEquals("ILLEGAL_CHAR:{illegalCharacter=a, matchBehavior=contains}", getDetail(validate, 0));
+ assertEquals("ILLEGAL_MATCH:{match=cd22, pattern=\\w{2}\\d{2}}", getDetail(validate, 1));
+ assertEquals("ILLEGAL_ALPHABETICAL_SEQUENCE:{sequence=abc}", getDetail(validate, 2));
+ assertEquals("ILLEGAL_ALPHABETICAL_SEQUENCE:{sequence=bcd}", getDetail(validate, 3));
+ assertEquals("ILLEGAL_NUMBER_RANGE:{number=2, matchBehavior=contains}", getDetail(validate, 4));
+ assertEquals("ILLEGAL_WHITESPACE:{whitespaceCharacter= , matchBehavior=contains}", getDetail(validate, 5));
+ }
+
+ @Test
+ public void givenSourceRule_whenValidatePassword_thenFoundIllegalWordsFromSource() {
+ SourceRule sourceRule = new SourceRule();
+
+ PasswordData passwordData = new PasswordData("password");
+ passwordData.setPasswordReferences(new PasswordData.SourceReference("source", "password"));
+
+ PasswordValidator passwordValidator = new PasswordValidator(sourceRule);
+ RuleResult validate = passwordValidator.validate(passwordData);
+
+ assertFalse(validate.isValid());
+ assertEquals("SOURCE_VIOLATION:{source=source}", getDetail(validate, 0));
+ }
+
+ @Test
+ public void givenRepeatCharacterRegexRuleRule_whenValidatePassword_thenFoundIllegalPatternMatches() {
+ RepeatCharacterRegexRule repeatCharacterRegexRule = new RepeatCharacterRegexRule(3);
+
+ PasswordValidator passwordValidator = new PasswordValidator(repeatCharacterRegexRule);
+
+ RuleResult validate = passwordValidator.validate(new PasswordData("aaabbb"));
+
+ assertFalse(validate.isValid());
+ assertEquals("ILLEGAL_MATCH:{match=aaa, pattern=([^\\x00-\\x1F])\\1{2}}", getDetail(validate, 0));
+ assertEquals("ILLEGAL_MATCH:{match=bbb, pattern=([^\\x00-\\x1F])\\1{2}}", getDetail(validate, 1));
+ }
+
+ @Test
+ public void givenUserNameRule_whenValidatePassword_thenFoundUserNameInPassword() {
+ PasswordValidator passwordValidator = new PasswordValidator(new UsernameRule());
+
+ PasswordData passwordData = new PasswordData("testuser1234");
+ passwordData.setUsername("testuser");
+
+ RuleResult validate = passwordValidator.validate(passwordData);
+
+ assertFalse(validate.isValid());
+ assertEquals("ILLEGAL_USERNAME:{username=testuser, matchBehavior=contains}", getDetail(validate, 0));
+ }
+
+ @Test
+ public void givenPasswordAndHashBeanAndEncryptedReferences_whenValidate_thenPasswordValidationShouldPass() {
+ List historicalReferences = Arrays.asList(new PasswordData.HistoricalReference("SHA256", "2e4551de804e27aacf20f9df5be3e8cd384ed64488b21ab079fb58e8c90068ab"));
+ PasswordData passwordData = new PasswordData("example!");
+ passwordData.setPasswordReferences(historicalReferences);
+
+ EncodingHashBean encodingHashBean = new EncodingHashBean(new CodecSpec("Base64"), new DigestSpec("SHA256"), 1, false);
+
+ PasswordValidator passwordValidator = new PasswordValidator(new DigestHistoryRule(encodingHashBean));
+
+ RuleResult validate = passwordValidator.validate(passwordData);
+
+ Assert.assertTrue(validate.isValid());
+ }
+
+ private String getDetail(RuleResult validate, int i) {
+ return validate.getDetails()
+ .get(i)
+ .toString();
+ }
+
+}
diff --git a/libraries-security/src/test/java/com/baeldung/passay/PasswordGeneratorUnitTest.java b/libraries-security/src/test/java/com/baeldung/passay/PasswordGeneratorUnitTest.java
new file mode 100644
index 0000000000..ff279e9317
--- /dev/null
+++ b/libraries-security/src/test/java/com/baeldung/passay/PasswordGeneratorUnitTest.java
@@ -0,0 +1,50 @@
+package com.baeldung.passay;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.passay.CharacterData;
+import org.passay.CharacterRule;
+import org.passay.EnglishCharacterData;
+import org.passay.PasswordGenerator;
+
+import java.util.stream.Stream;
+
+public class PasswordGeneratorUnitTest {
+
+ @Test
+ public void givenDigitsGenerator_whenGeneratingPassword_thenPasswordContainsDigitsHasLength10() {
+ CharacterRule digits = new CharacterRule(EnglishCharacterData.Digit);
+
+ PasswordGenerator passwordGenerator = new PasswordGenerator();
+ String password = passwordGenerator.generatePassword(10, digits);
+
+ Assert.assertTrue(password.length() == 10);
+ Assert.assertTrue(containsOnlyCharactersFromSet(password, "0123456789"));
+ }
+
+ @Test
+ public void givenCustomizedRule_whenGenerating_thenGeneratedPasswordContainsCustomizedCharacters() {
+ CharacterRule specialCharacterRule = new CharacterRule(new CharacterData() {
+ @Override
+ public String getErrorCode() {
+ return "SAMPLE_ERROR_CODE";
+ }
+
+ @Override
+ public String getCharacters() {
+ return "ABCxyz123!@#";
+ }
+ });
+
+ PasswordGenerator passwordGenerator = new PasswordGenerator();
+ String password = passwordGenerator.generatePassword(10, specialCharacterRule);
+
+ Assert.assertTrue(containsOnlyCharactersFromSet(password, "ABCxyz123!@#"));
+ }
+
+ private boolean containsOnlyCharactersFromSet(String password, String setOfCharacters) {
+ return Stream.of(password.split(""))
+ .allMatch(it -> setOfCharacters.contains(it));
+ }
+
+}
diff --git a/libraries-security/src/test/java/com/baeldung/passay/PasswordValidatorUnitTest.java b/libraries-security/src/test/java/com/baeldung/passay/PasswordValidatorUnitTest.java
new file mode 100644
index 0000000000..3fc59a82d5
--- /dev/null
+++ b/libraries-security/src/test/java/com/baeldung/passay/PasswordValidatorUnitTest.java
@@ -0,0 +1,81 @@
+package com.baeldung.passay;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.passay.LengthRule;
+import org.passay.MessageResolver;
+import org.passay.PasswordData;
+import org.passay.PasswordValidator;
+import org.passay.PropertiesMessageResolver;
+import org.passay.RuleResult;
+import org.passay.RuleResultDetail;
+import org.passay.RuleResultMetadata;
+import org.passay.WhitespaceRule;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+
+public class PasswordValidatorUnitTest {
+
+ @Test
+ public void givenPasswordValidatorWithLengthRule_whenValidation_thenTooShortPassword() {
+ PasswordData passwordData = new PasswordData("1234");
+
+ PasswordValidator passwordValidator = new PasswordValidator(new LengthRule(5));
+
+ RuleResult validate = passwordValidator.validate(passwordData);
+ assertEquals(false, validate.isValid());
+
+ RuleResultDetail ruleResultDetail = validate.getDetails()
+ .get(0);
+ assertEquals("TOO_SHORT", ruleResultDetail.getErrorCode());
+ assertEquals(5, ruleResultDetail.getParameters()
+ .get("minimumLength"));
+ assertEquals(5, ruleResultDetail.getParameters()
+ .get("maximumLength"));
+
+ Integer lengthCount = validate.getMetadata()
+ .getCounts()
+ .get(RuleResultMetadata.CountCategory.Length);
+ assertEquals(Integer.valueOf(4), lengthCount);
+ }
+
+ @Test
+ public void givenPasswordValidatorWithLengthRule_whenValidation_thenTooLongPassword() {
+ PasswordData passwordData = new PasswordData("123456");
+
+ PasswordValidator passwordValidator = new PasswordValidator(new LengthRule(5));
+
+ RuleResult validate = passwordValidator.validate(passwordData);
+ assertFalse(validate.isValid());
+ Assert.assertEquals("TOO_LONG", validate.getDetails()
+ .get(0)
+ .getErrorCode());
+ }
+
+ @Test
+ public void givenPasswordValidatorWithLengthRule_whenValidation_thenCustomizedMeesagesAvailable() throws IOException {
+ URL resource = this.getClass()
+ .getClassLoader()
+ .getResource("messages.properties");
+ Properties props = new Properties();
+ props.load(new FileInputStream(resource.getPath()));
+
+ MessageResolver resolver = new PropertiesMessageResolver(props);
+ PasswordValidator validator = new PasswordValidator(resolver, new LengthRule(8, 16), new WhitespaceRule());
+
+ RuleResult tooShort = validator.validate(new PasswordData("XXXX"));
+ RuleResult tooLong = validator.validate(new PasswordData("ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ"));
+
+ assertEquals("Password must not contain less characters than 16.", validator.getMessages(tooShort)
+ .get(0));
+ assertEquals("Password must not have more characters than 16.", validator.getMessages(tooLong)
+ .get(0));
+ }
+
+}
diff --git a/libraries-security/src/test/java/com/baeldung/passay/PositiveMatchingRulesUnitTest.java b/libraries-security/src/test/java/com/baeldung/passay/PositiveMatchingRulesUnitTest.java
new file mode 100644
index 0000000000..0da1b43335
--- /dev/null
+++ b/libraries-security/src/test/java/com/baeldung/passay/PositiveMatchingRulesUnitTest.java
@@ -0,0 +1,76 @@
+package com.baeldung.passay;
+
+import org.junit.Test;
+import org.passay.AllowedCharacterRule;
+import org.passay.AllowedRegexRule;
+import org.passay.CharacterCharacteristicsRule;
+import org.passay.CharacterRule;
+import org.passay.EnglishCharacterData;
+import org.passay.LengthComplexityRule;
+import org.passay.LengthRule;
+import org.passay.PasswordData;
+import org.passay.PasswordValidator;
+import org.passay.RuleResult;
+
+import static org.junit.Assert.*;
+
+public class PositiveMatchingRulesUnitTest {
+
+ @Test
+ public void givenPasswordValidationRules_whenValidatingPassword_thenPosswordIsNotValidWithSeveralErrors() {
+ PasswordValidator passwordValidator = new PasswordValidator(new AllowedCharacterRule(new char[] { 'a', 'b', 'c' }), new AllowedRegexRule("\\d{2}\\w{10}"), new CharacterRule(EnglishCharacterData.LowerCase, 5), new LengthRule(8, 10));
+
+ RuleResult validate = passwordValidator.validate(new PasswordData("12abc"));
+
+ assertFalse(validate.isValid());
+ assertEquals("ALLOWED_CHAR:{illegalCharacter=1, matchBehavior=contains}", getDetail(validate, 0));
+ assertEquals("ALLOWED_CHAR:{illegalCharacter=2, matchBehavior=contains}", getDetail(validate, 1));
+ assertEquals("ALLOWED_MATCH:{pattern=\\d{2}\\w{10}}", getDetail(validate, 2));
+ assertEquals("INSUFFICIENT_LOWERCASE:{" + "minimumRequired=5, matchingCharacterCount=3, " + "validCharacters=abcdefghijklmnopqrstuvwxyz, " + "matchingCharacters=abc}", getDetail(validate, 3));
+ assertEquals("TOO_SHORT:{minimumLength=8, maximumLength=10}", getDetail(validate, 4));
+ }
+
+ @Test
+ public void givenRulesForDifferentPasswordLength_whenValidatingTwoDifferentPassword_thenBothOfThemAreInvalid() {
+ PasswordData shortPassword = new PasswordData("12ab");
+ PasswordData longPassword = new PasswordData("1234abcde");
+
+ LengthComplexityRule lengthComplexityRule = new LengthComplexityRule();
+ lengthComplexityRule.addRules("[1,5]", new CharacterRule(EnglishCharacterData.LowerCase, 5));
+ lengthComplexityRule.addRules("[6,10]", new AllowedCharacterRule(new char[] { 'a', 'b', 'c', 'd' }));
+
+ PasswordValidator passwordValidator = new PasswordValidator(lengthComplexityRule);
+
+ RuleResult validateShort = passwordValidator.validate(shortPassword);
+ RuleResult validateLong = passwordValidator.validate(longPassword);
+
+ assertFalse(validateShort.isValid());
+ assertFalse(validateLong.isValid());
+
+ assertEquals("INSUFFICIENT_LOWERCASE:{" + "minimumRequired=5, " + "matchingCharacterCount=2, " + "validCharacters=abcdefghijklmnopqrstuvwxyz, " + "matchingCharacters=ab}", getDetail(validateShort, 0));
+ assertEquals("ALLOWED_CHAR:{illegalCharacter=1, matchBehavior=contains}", getDetail(validateLong, 0));
+ }
+
+ @Test
+ public void givenCharacterCharacteristicsRule_whenValidatingPassword_thenItIsInvalidAsItBreaksToManyRules() {
+ PasswordData shortPassword = new PasswordData();
+ shortPassword.setPassword("12345abcde!");
+
+ CharacterCharacteristicsRule characterCharacteristicsRule = new CharacterCharacteristicsRule(4, new CharacterRule(EnglishCharacterData.LowerCase, 5), new CharacterRule(EnglishCharacterData.UpperCase, 5), new CharacterRule(EnglishCharacterData.Digit),
+ new CharacterRule(EnglishCharacterData.Special));
+
+ PasswordValidator passwordValidator = new PasswordValidator(characterCharacteristicsRule);
+
+ RuleResult validate = passwordValidator.validate(shortPassword);
+ assertFalse(validate.isValid());
+
+ assertEquals("INSUFFICIENT_UPPERCASE:{" + "minimumRequired=5, " + "matchingCharacterCount=0, " + "validCharacters=ABCDEFGHIJKLMNOPQRSTUVWXYZ, " + "matchingCharacters=}", getDetail(validate, 0));
+ assertEquals("INSUFFICIENT_CHARACTERISTICS:{" + "successCount=3, " + "minimumRequired=4, " + "ruleCount=4}", getDetail(validate, 1));
+ }
+
+ private String getDetail(RuleResult validate, int i) {
+ return validate.getDetails()
+ .get(i)
+ .toString();
+ }
+}
diff --git a/spring-cloud-data-flow/log-sink/src/test/java/org/baeldung/spring/cloud/LogSinkApplicationIntegrationTest.java b/libraries-security/src/test/java/com/baeldung/scribejava/ScribejavaUnitTest.java
similarity index 67%
rename from spring-cloud-data-flow/log-sink/src/test/java/org/baeldung/spring/cloud/LogSinkApplicationIntegrationTest.java
rename to libraries-security/src/test/java/com/baeldung/scribejava/ScribejavaUnitTest.java
index b362d72705..6565a5b085 100644
--- a/spring-cloud-data-flow/log-sink/src/test/java/org/baeldung/spring/cloud/LogSinkApplicationIntegrationTest.java
+++ b/libraries-security/src/test/java/com/baeldung/scribejava/ScribejavaUnitTest.java
@@ -1,4 +1,4 @@
-package org.baeldung.spring.cloud;
+package com.baeldung.scribejava;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -7,10 +7,11 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
-public class LogSinkApplicationIntegrationTest {
+public class ScribejavaUnitTest {
@Test
- public void contextLoads() {
+ public void contextLoad(){
+
}
}
diff --git a/libraries-security/src/test/resources/messages.properties b/libraries-security/src/test/resources/messages.properties
new file mode 100644
index 0000000000..ad0039d71d
--- /dev/null
+++ b/libraries-security/src/test/resources/messages.properties
@@ -0,0 +1,2 @@
+TOO_LONG=Password must not have more characters than %2$s.
+TOO_SHORT=Password must not contain less characters than %2$s.
\ No newline at end of file
diff --git a/libraries/src/main/java/com/baeldung/kafka/TransactionalMessageProducer.java b/libraries/src/main/java/com/baeldung/kafka/TransactionalMessageProducer.java
new file mode 100644
index 0000000000..15488bbaf4
--- /dev/null
+++ b/libraries/src/main/java/com/baeldung/kafka/TransactionalMessageProducer.java
@@ -0,0 +1,56 @@
+package com.baeldung.kafka;
+
+import org.apache.kafka.clients.producer.KafkaProducer;
+import org.apache.kafka.clients.producer.ProducerRecord;
+import org.apache.kafka.common.KafkaException;
+
+import java.util.Properties;
+import java.util.stream.Stream;
+
+import static org.apache.kafka.clients.consumer.ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG;
+import static org.apache.kafka.clients.producer.ProducerConfig.ENABLE_IDEMPOTENCE_CONFIG;
+import static org.apache.kafka.clients.producer.ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG;
+import static org.apache.kafka.clients.producer.ProducerConfig.TRANSACTIONAL_ID_CONFIG;
+import static org.apache.kafka.clients.producer.ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG;
+
+public class TransactionalMessageProducer {
+
+ private static final String DATA_MESSAGE_1 = "Put any space separated data here for count";
+ private static final String DATA_MESSAGE_2 = "Output will contain count of every word in the message";
+
+ public static void main(String[] args) {
+
+ KafkaProducer producer = createKafkaProducer();
+
+ producer.initTransactions();
+
+ try{
+
+ producer.beginTransaction();
+
+ Stream.of(DATA_MESSAGE_1, DATA_MESSAGE_2).forEach(s -> producer.send(
+ new ProducerRecord("input", null, s)));
+
+ producer.commitTransaction();
+
+ }catch (KafkaException e){
+
+ producer.abortTransaction();
+
+ }
+
+ }
+
+ private static KafkaProducer createKafkaProducer() {
+
+ Properties props = new Properties();
+ props.put(BOOTSTRAP_SERVERS_CONFIG, "localhost:9092");
+ props.put(ENABLE_IDEMPOTENCE_CONFIG, "true");
+ props.put(TRANSACTIONAL_ID_CONFIG, "prod-0");
+ props.put(KEY_SERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringSerializer");
+ props.put(VALUE_SERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringSerializer");
+
+ return new KafkaProducer(props);
+
+ }
+}
diff --git a/libraries/src/main/java/com/baeldung/kafka/TransactionalApp.java b/libraries/src/main/java/com/baeldung/kafka/TransactionalWordCount.java
similarity index 66%
rename from libraries/src/main/java/com/baeldung/kafka/TransactionalApp.java
rename to libraries/src/main/java/com/baeldung/kafka/TransactionalWordCount.java
index 1e95041a0d..0563ba6684 100644
--- a/libraries/src/main/java/com/baeldung/kafka/TransactionalApp.java
+++ b/libraries/src/main/java/com/baeldung/kafka/TransactionalWordCount.java
@@ -14,6 +14,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
import static java.time.Duration.ofSeconds;
import static java.util.Collections.singleton;
@@ -21,16 +23,16 @@ import static org.apache.kafka.clients.consumer.ConsumerConfig.*;
import static org.apache.kafka.clients.consumer.ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG;
import static org.apache.kafka.clients.producer.ProducerConfig.*;
-public class TransactionalApp {
+public class TransactionalWordCount {
- private static final String CONSUMER_GROUP_ID = "test";
+ private static final String CONSUMER_GROUP_ID = "my-group-id";
private static final String OUTPUT_TOPIC = "output";
private static final String INPUT_TOPIC = "input";
public static void main(String[] args) {
- KafkaConsumer consumer = initConsumer();
- KafkaProducer producer = initProducer();
+ KafkaConsumer consumer = createKafkaConsumer();
+ KafkaProducer producer = createKafkaProducer();
producer.initTransactions();
@@ -38,12 +40,17 @@ public class TransactionalApp {
while (true) {
- ConsumerRecords records = consumer.poll(ofSeconds(20));
+ ConsumerRecords records = consumer.poll(ofSeconds(60));
+
+ Map wordCountMap = records.records(new TopicPartition(INPUT_TOPIC, 0))
+ .stream()
+ .flatMap(record -> Stream.of(record.value().split(" ")))
+ .map(word -> Tuple.of(word, 1))
+ .collect(Collectors.toMap(tuple -> tuple.getKey(), t1 -> t1.getValue(), (v1, v2) -> v1 + v2));
producer.beginTransaction();
- for (ConsumerRecord record : records)
- producer.send(new ProducerRecord(OUTPUT_TOPIC, record));
+ wordCountMap.forEach((key, value) -> producer.send(new ProducerRecord(OUTPUT_TOPIC, key, value.toString())));
Map offsetsToCommit = new HashMap<>();
@@ -51,7 +58,7 @@ public class TransactionalApp {
List> partitionedRecords = records.records(partition);
long offset = partitionedRecords.get(partitionedRecords.size() - 1).offset();
- offsetsToCommit.put(partition, new OffsetAndMetadata(offset));
+ offsetsToCommit.put(partition, new OffsetAndMetadata(offset + 1));
}
producer.sendOffsetsToTransaction(offsetsToCommit, CONSUMER_GROUP_ID);
@@ -68,11 +75,12 @@ public class TransactionalApp {
}
- private static KafkaConsumer initConsumer() {
+ private static KafkaConsumer createKafkaConsumer() {
Properties props = new Properties();
props.put(BOOTSTRAP_SERVERS_CONFIG, "localhost:9092");
props.put(GROUP_ID_CONFIG, CONSUMER_GROUP_ID);
props.put(ENABLE_AUTO_COMMIT_CONFIG, "false");
+ props.put(ISOLATION_LEVEL_CONFIG, "read_committed");
props.put(KEY_DESERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringDeserializer");
props.put(VALUE_DESERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringDeserializer");
@@ -81,19 +89,14 @@ public class TransactionalApp {
return consumer;
}
- private static KafkaProducer initProducer() {
+ private static KafkaProducer createKafkaProducer() {
Properties props = new Properties();
- props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092");
- props.put(ACKS_CONFIG, "all");
- props.put(RETRIES_CONFIG, 3);
- props.put(BATCH_SIZE_CONFIG, 16384);
- props.put(LINGER_MS_CONFIG, 1);
- props.put(BUFFER_MEMORY_CONFIG, 33554432);
+ props.put(BOOTSTRAP_SERVERS_CONFIG, "localhost:9092");
props.put(ENABLE_IDEMPOTENCE_CONFIG, "true");
props.put(TRANSACTIONAL_ID_CONFIG, "prod-1");
- props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringSerializer");
- props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringSerializer");
+ props.put(KEY_SERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringSerializer");
+ props.put(VALUE_SERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringSerializer");
return new KafkaProducer(props);
diff --git a/libraries/src/main/java/com/baeldung/kafka/Tuple.java b/libraries/src/main/java/com/baeldung/kafka/Tuple.java
new file mode 100644
index 0000000000..883de4ba21
--- /dev/null
+++ b/libraries/src/main/java/com/baeldung/kafka/Tuple.java
@@ -0,0 +1,24 @@
+package com.baeldung.kafka;
+
+public class Tuple {
+
+ private String key;
+ private Integer value;
+
+ private Tuple(String key, Integer value) {
+ this.key = key;
+ this.value = value;
+ }
+
+ public static Tuple of(String key, Integer value){
+ return new Tuple(key,value);
+ }
+
+ public String getKey() {
+ return key;
+ }
+
+ public Integer getValue() {
+ return value;
+ }
+}
diff --git a/lombok/README.md b/lombok/README.md
index 1a787e32c7..d12c14416d 100644
--- a/lombok/README.md
+++ b/lombok/README.md
@@ -1,3 +1,5 @@
## Relevant Articles:
- [Introduction to Project Lombok](http://www.baeldung.com/intro-to-project-lombok)
- [Using Lombok’s @Builder Annotation](http://www.baeldung.com/lombok-builder)
+- [Using Lombok’s @Getter for Boolean Fields](https://www.baeldung.com/lombok-getter-boolean)
+- [Lombok @Builder with Inheritance](https://www.baeldung.com/lombok-builder-inheritance)
diff --git a/maven-polyglot/README.md b/maven-polyglot/README.md
new file mode 100644
index 0000000000..589315efd1
--- /dev/null
+++ b/maven-polyglot/README.md
@@ -0,0 +1,3 @@
+To run the maven-polyglot-json-app successfully, you first have to build the maven-polyglot-json-extension module using: mvn clean install.
+
+Related Articles:
diff --git a/maven-polyglot/maven-polyglot-json-app/.mvn/extensions.xml b/maven-polyglot/maven-polyglot-json-app/.mvn/extensions.xml
new file mode 100644
index 0000000000..c06b76e1b2
--- /dev/null
+++ b/maven-polyglot/maven-polyglot-json-app/.mvn/extensions.xml
@@ -0,0 +1,8 @@
+
+
+
+ com.baeldung.maven.polyglot
+ maven-polyglot-json-extension
+ 1.0-SNAPSHOT
+
+
\ No newline at end of file
diff --git a/maven-polyglot/maven-polyglot-json-app/pom.json b/maven-polyglot/maven-polyglot-json-app/pom.json
new file mode 100644
index 0000000000..abd58f3127
--- /dev/null
+++ b/maven-polyglot/maven-polyglot-json-app/pom.json
@@ -0,0 +1,34 @@
+{
+ "modelVersion": "4.0.0",
+ "groupId": "com.baeldung.maven.polyglot",
+ "artifactId": "maven-polyglot-json-app",
+ "version": "1.0-SNAPSHOT",
+ "name": "Json Maven Polyglot",
+ "parent": {
+ "groupId": "org.springframework.boot",
+ "artifactId": "spring-boot-starter-parent",
+ "version": "2.0.5.RELEASE",
+ "relativePath": null
+ },
+ "properties": {
+ "project.build.sourceEncoding": "UTF-8",
+ "project.reporting.outputEncoding": "UTF-8",
+ "maven.compiler.source": "1.8",
+ "maven.compiler.target": "1.8",
+ "java.version": "1.8"
+ },
+ "dependencies": [
+ {
+ "groupId": "org.springframework.boot",
+ "artifactId": "spring-boot-starter-web"
+ }
+ ],
+ "build": {
+ "plugins": [
+ {
+ "groupId": "org.springframework.boot",
+ "artifactId": "spring-boot-maven-plugin"
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/maven-polyglot/maven-polyglot-json-app/src/main/java/com/baeldung/maven/polyglot/MavenPolyglotApplication.java b/maven-polyglot/maven-polyglot-json-app/src/main/java/com/baeldung/maven/polyglot/MavenPolyglotApplication.java
new file mode 100644
index 0000000000..d03116889f
--- /dev/null
+++ b/maven-polyglot/maven-polyglot-json-app/src/main/java/com/baeldung/maven/polyglot/MavenPolyglotApplication.java
@@ -0,0 +1,19 @@
+package com.baeldung.maven.polyglot;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.GetMapping;
+
+@RestController
+@SpringBootApplication
+public class MavenPolyglotApplication {
+ public static void main(String[] args) {
+ SpringApplication.run(MavenPolyglotApplication.class, args);
+ }
+
+ @GetMapping("/")
+ public String home(){
+ return "Hello JSON Maven Model !";
+ }
+}
diff --git a/maven-polyglot/maven-polyglot-json-app/src/main/resources/model.json b/maven-polyglot/maven-polyglot-json-app/src/main/resources/model.json
new file mode 100644
index 0000000000..f006582c12
--- /dev/null
+++ b/maven-polyglot/maven-polyglot-json-app/src/main/resources/model.json
@@ -0,0 +1,109 @@
+{
+ "modules": [],
+ "distributionManagement": null,
+ "properties": {
+ "project.reporting.outputEncoding": "UTF-8",
+ "java.version": "1.8",
+ "maven.compiler.source": "1.8",
+ "project.build.sourceEncoding": "UTF-8",
+ "maven.compiler.target": "1.8"
+ },
+ "dependencyManagement": null,
+ "dependencies": [
+ {
+ "groupId": "org.springframework.boot",
+ "artifactId": "spring-boot-starter-web",
+ "version": null,
+ "type": "jar",
+ "classifier": null,
+ "scope": null,
+ "systemPath": null,
+ "exclusions": [],
+ "optional": null,
+ "managementKey": "org.springframework.boot:spring-boot-starter-web:jar"
+ }
+ ],
+ "repositories": [],
+ "pluginRepositories": [],
+ "reports": null,
+ "reporting": null,
+ "modelVersion": "4.0.0",
+ "parent": {
+ "groupId": "org.springframework.boot",
+ "artifactId": "spring-boot-starter-parent",
+ "version": "2.0.5.RELEASE",
+ "relativePath": "",
+ "id": "org.springframework.boot:spring-boot-starter-parent:pom:2.0.5.RELEASE"
+ },
+ "groupId": "com.demo.polyglot",
+ "artifactId": "maven-polyglot-app",
+ "version": "1.0.1",
+ "packaging": "jar",
+ "name": "Json Maven Polyglot",
+ "description": null,
+ "url": null,
+ "inceptionYear": null,
+ "organization": null,
+ "licenses": [],
+ "developers": [],
+ "contributors": [],
+ "mailingLists": [],
+ "prerequisites": null,
+ "scm": null,
+ "issueManagement": null,
+ "ciManagement": null,
+ "build": {
+ "plugins": [
+ {
+ "inherited": null,
+ "configuration": null,
+ "inheritanceApplied": true,
+ "groupId": "org.liquibase",
+ "artifactId": "liquibase-maven-plugin",
+ "version": "3.0.5",
+ "extensions": null,
+ "executions": [],
+ "dependencies": [],
+ "goals": null,
+ "key": "org.liquibase:liquibase-maven-plugin",
+ "id": "org.liquibase:liquibase-maven-plugin:3.0.5",
+ "executionsAsMap": {}
+ }
+ ],
+ "pluginManagement": null,
+ "defaultGoal": null,
+ "resources": [],
+ "testResources": [],
+ "directory": null,
+ "finalName": null,
+ "filters": [],
+ "sourceDirectory": null,
+ "scriptSourceDirectory": null,
+ "testSourceDirectory": null,
+ "outputDirectory": null,
+ "testOutputDirectory": null,
+ "extensions": [],
+ "pluginsAsMap": {
+ "org.liquibase:liquibase-maven-plugin": {
+ "inherited": null,
+ "configuration": null,
+ "inheritanceApplied": true,
+ "groupId": "org.liquibase",
+ "artifactId": "liquibase-maven-plugin",
+ "version": "3.0.5",
+ "extensions": null,
+ "executions": [],
+ "dependencies": [],
+ "goals": null,
+ "key": "org.liquibase:liquibase-maven-plugin",
+ "id": "org.liquibase:liquibase-maven-plugin:3.0.5",
+ "executionsAsMap": {}
+ }
+ }
+ },
+ "profiles": [],
+ "modelEncoding": "UTF-8",
+ "pomFile": null,
+ "id": "com.demo.polyglot:maven-polyglot-app:jar:1.0.1",
+ "projectDirectory": null
+}
diff --git a/maven-polyglot/maven-polyglot-json-extension/pom.xml b/maven-polyglot/maven-polyglot-json-extension/pom.xml
new file mode 100644
index 0000000000..d5c5b7ab55
--- /dev/null
+++ b/maven-polyglot/maven-polyglot-json-extension/pom.xml
@@ -0,0 +1,47 @@
+
+
+ 4.0.0
+
+ com.baeldung.maven.polyglot
+ maven-polyglot-json-extension
+ 1.0-SNAPSHOT
+
+
+ 1.8
+ 1.8
+
+
+
+
+ org.apache.maven
+ maven-core
+ 3.5.4
+ provided
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+ 2.9.6
+
+
+
+
+
+
+ org.codehaus.plexus
+ plexus-component-metadata
+ 1.7.1
+
+
+
+ generate-metadata
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/maven-polyglot/maven-polyglot-json-extension/src/main/java/com/demo/polyglot/CustomModelProcessor.java b/maven-polyglot/maven-polyglot-json-extension/src/main/java/com/demo/polyglot/CustomModelProcessor.java
new file mode 100644
index 0000000000..a1756192e9
--- /dev/null
+++ b/maven-polyglot/maven-polyglot-json-extension/src/main/java/com/demo/polyglot/CustomModelProcessor.java
@@ -0,0 +1,62 @@
+package com.demo.polyglot;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.building.FileModelSource;
+import org.apache.maven.model.building.ModelProcessor;
+import org.apache.maven.model.io.ModelParseException;
+import org.apache.maven.model.io.ModelReader;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.util.ReaderFactory;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.util.Map;
+
+@Component(role = ModelProcessor.class)
+public class CustomModelProcessor implements ModelProcessor {
+
+ private static final String XML_POM = "pom.xml";
+ private static final String JSON_POM = "pom.json";
+ private static final String JSON_EXT = ".json";
+
+ ObjectMapper objectMapper = new ObjectMapper();
+
+ @Requirement
+ private ModelReader modelReader;
+
+ @Override
+ public File locatePom(File projectDirectory) {
+ File pomFile = new File(projectDirectory, JSON_POM);
+ if (!pomFile.exists()) {
+ pomFile = new File(projectDirectory, XML_POM);
+ }
+ return pomFile;
+ }
+
+ @Override
+ public Model read(InputStream input, Map options) throws IOException, ModelParseException {
+ try (final Reader in = ReaderFactory.newPlatformReader(input)) {
+ return read(in, options);
+ }
+ }
+
+ @Override
+ public Model read(Reader reader, Map options) throws IOException, ModelParseException {
+ FileModelSource source = (options != null) ? (FileModelSource) options.get(SOURCE) : null;
+ if (source != null && source.getLocation().endsWith(JSON_EXT)) {
+ Model model = objectMapper.readValue(reader, Model.class);
+ return model;
+ }
+ //It's a normal maven project with a pom.xml file
+ return modelReader.read(reader, options);
+ }
+
+ @Override
+ public Model read(File input, Map options) throws IOException, ModelParseException {
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/maven-polyglot/maven-polyglot-yml-app/.mvn/extensions.xml b/maven-polyglot/maven-polyglot-yml-app/.mvn/extensions.xml
new file mode 100644
index 0000000000..cfc6275681
--- /dev/null
+++ b/maven-polyglot/maven-polyglot-yml-app/.mvn/extensions.xml
@@ -0,0 +1,8 @@
+
+
+
+ io.takari.polyglot
+ polyglot-yaml
+ 0.3.1
+
+
\ No newline at end of file
diff --git a/maven-polyglot/maven-polyglot-yml-app/pom.yml b/maven-polyglot/maven-polyglot-yml-app/pom.yml
new file mode 100644
index 0000000000..445e2eec3b
--- /dev/null
+++ b/maven-polyglot/maven-polyglot-yml-app/pom.yml
@@ -0,0 +1,7 @@
+modelVersion: 4.0.0
+groupId: com.baeldung.maven.polyglot
+artifactId: maven-polyglot-yml-app
+version: 1.0-SNAPSHOT
+name: 'YAML Demo'
+
+properties: {maven.compiler.source: 1.8, maven.compiler.target: 1.8}
\ No newline at end of file
diff --git a/maven-polyglot/maven-polyglot-yml-app/src/main/java/com/baeldung/maven/polyglot/YamlDemoApplication.java b/maven-polyglot/maven-polyglot-yml-app/src/main/java/com/baeldung/maven/polyglot/YamlDemoApplication.java
new file mode 100644
index 0000000000..2142c7f9b8
--- /dev/null
+++ b/maven-polyglot/maven-polyglot-yml-app/src/main/java/com/baeldung/maven/polyglot/YamlDemoApplication.java
@@ -0,0 +1,7 @@
+package com.baeldung.maven.polyglot;
+
+public class YamlDemoApplication {
+ public static void main(String[] args) {
+ System.out.println("Hello Maven Polyglot YAML !");
+ }
+}
diff --git a/maven-polyglot/maven-polyglot-yml-app/src/main/resources/model.json b/maven-polyglot/maven-polyglot-yml-app/src/main/resources/model.json
new file mode 100644
index 0000000000..f006582c12
--- /dev/null
+++ b/maven-polyglot/maven-polyglot-yml-app/src/main/resources/model.json
@@ -0,0 +1,109 @@
+{
+ "modules": [],
+ "distributionManagement": null,
+ "properties": {
+ "project.reporting.outputEncoding": "UTF-8",
+ "java.version": "1.8",
+ "maven.compiler.source": "1.8",
+ "project.build.sourceEncoding": "UTF-8",
+ "maven.compiler.target": "1.8"
+ },
+ "dependencyManagement": null,
+ "dependencies": [
+ {
+ "groupId": "org.springframework.boot",
+ "artifactId": "spring-boot-starter-web",
+ "version": null,
+ "type": "jar",
+ "classifier": null,
+ "scope": null,
+ "systemPath": null,
+ "exclusions": [],
+ "optional": null,
+ "managementKey": "org.springframework.boot:spring-boot-starter-web:jar"
+ }
+ ],
+ "repositories": [],
+ "pluginRepositories": [],
+ "reports": null,
+ "reporting": null,
+ "modelVersion": "4.0.0",
+ "parent": {
+ "groupId": "org.springframework.boot",
+ "artifactId": "spring-boot-starter-parent",
+ "version": "2.0.5.RELEASE",
+ "relativePath": "",
+ "id": "org.springframework.boot:spring-boot-starter-parent:pom:2.0.5.RELEASE"
+ },
+ "groupId": "com.demo.polyglot",
+ "artifactId": "maven-polyglot-app",
+ "version": "1.0.1",
+ "packaging": "jar",
+ "name": "Json Maven Polyglot",
+ "description": null,
+ "url": null,
+ "inceptionYear": null,
+ "organization": null,
+ "licenses": [],
+ "developers": [],
+ "contributors": [],
+ "mailingLists": [],
+ "prerequisites": null,
+ "scm": null,
+ "issueManagement": null,
+ "ciManagement": null,
+ "build": {
+ "plugins": [
+ {
+ "inherited": null,
+ "configuration": null,
+ "inheritanceApplied": true,
+ "groupId": "org.liquibase",
+ "artifactId": "liquibase-maven-plugin",
+ "version": "3.0.5",
+ "extensions": null,
+ "executions": [],
+ "dependencies": [],
+ "goals": null,
+ "key": "org.liquibase:liquibase-maven-plugin",
+ "id": "org.liquibase:liquibase-maven-plugin:3.0.5",
+ "executionsAsMap": {}
+ }
+ ],
+ "pluginManagement": null,
+ "defaultGoal": null,
+ "resources": [],
+ "testResources": [],
+ "directory": null,
+ "finalName": null,
+ "filters": [],
+ "sourceDirectory": null,
+ "scriptSourceDirectory": null,
+ "testSourceDirectory": null,
+ "outputDirectory": null,
+ "testOutputDirectory": null,
+ "extensions": [],
+ "pluginsAsMap": {
+ "org.liquibase:liquibase-maven-plugin": {
+ "inherited": null,
+ "configuration": null,
+ "inheritanceApplied": true,
+ "groupId": "org.liquibase",
+ "artifactId": "liquibase-maven-plugin",
+ "version": "3.0.5",
+ "extensions": null,
+ "executions": [],
+ "dependencies": [],
+ "goals": null,
+ "key": "org.liquibase:liquibase-maven-plugin",
+ "id": "org.liquibase:liquibase-maven-plugin:3.0.5",
+ "executionsAsMap": {}
+ }
+ }
+ },
+ "profiles": [],
+ "modelEncoding": "UTF-8",
+ "pomFile": null,
+ "id": "com.demo.polyglot:maven-polyglot-app:jar:1.0.1",
+ "projectDirectory": null
+}
diff --git a/mustache/pom.xml b/mustache/pom.xml
index d385246182..a276dfbf43 100644
--- a/mustache/pom.xml
+++ b/mustache/pom.xml
@@ -3,7 +3,6 @@
4.0.0
mustache
- 0.0.1-SNAPSHOT
jar
mustache
@@ -24,10 +23,8 @@
org.assertj
assertj-core
- ${assertj.version}
-
log4j
log4j
@@ -55,13 +52,6 @@
${datafactory.version}
-
- junit
- junit
- ${junit.version}
- test
-
-
@@ -73,90 +63,13 @@
-
-
- integration
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
-
-
- integration-test
-
- test
-
-
-
- **/*LiveTest.java
- **/AutoconfigurationTest.java
-
-
- **/*IntegrationTest.java
- **/*IntTest.java
-
-
-
-
-
-
- json
-
-
-
-
-
-
-
- autoconfiguration
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
-
-
- integration-test
-
- test
-
-
-
- **/*LiveTest.java
- **/*IntegrationTest.java
- **/*IntTest.java
-
-
- **/AutoconfigurationTest.java
-
-
-
-
-
-
- json
-
-
-
-
-
-
-
-
0.9.2
- 3.7.0
1.2.16
- 4.12
- UTF-8
- 3.7.0
- 2.21.0
0.8
3.3.7
- 1.8
\ No newline at end of file
diff --git a/optaplanner/README.md b/optaplanner/README.md
index d793be1f2a..1568a615c0 100644
--- a/optaplanner/README.md
+++ b/optaplanner/README.md
@@ -1,3 +1,3 @@
### Relevant articles
-- [Guide to OptaPlanner](https://www.baeldung.com/opta-planner)
+- [A Guide to OptaPlanner](https://www.baeldung.com/opta-planner)
diff --git a/persistence-modules/spring-data-cassandra/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-data-cassandra/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..46ee3cd368
--- /dev/null
+++ b/persistence-modules/spring-data-cassandra/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,67 @@
+package org.baeldung;
+
+import java.io.IOException;
+import java.util.HashMap;
+
+import org.apache.cassandra.exceptions.ConfigurationException;
+import org.apache.thrift.transport.TTransportException;
+import org.baeldung.spring.data.cassandra.config.CassandraConfig;
+import org.baeldung.spring.data.cassandra.model.Book;
+import org.cassandraunit.utils.EmbeddedCassandraServerHelper;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cassandra.core.cql.CqlIdentifier;
+import org.springframework.data.cassandra.core.CassandraAdminOperations;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import com.datastax.driver.core.Cluster;
+import com.datastax.driver.core.Session;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = CassandraConfig.class)
+public class SpringContextIntegrationTest {
+
+ public static final String KEYSPACE_CREATION_QUERY = "CREATE KEYSPACE IF NOT EXISTS testKeySpace " + "WITH replication = { 'class': 'SimpleStrategy', 'replication_factor': '3' };";
+
+ public static final String KEYSPACE_ACTIVATE_QUERY = "USE testKeySpace;";
+
+ public static final String DATA_TABLE_NAME = "book";
+
+ @Autowired
+ private CassandraAdminOperations adminTemplate;
+
+ @BeforeClass
+ public static void startCassandraEmbedded() throws InterruptedException, TTransportException, ConfigurationException, IOException {
+ EmbeddedCassandraServerHelper.startEmbeddedCassandra();
+ final Cluster cluster = Cluster.builder().addContactPoints("127.0.0.1").withPort(9142).build();
+ final Session session = cluster.connect();
+ session.execute(KEYSPACE_CREATION_QUERY);
+ session.execute(KEYSPACE_ACTIVATE_QUERY);
+ Thread.sleep(5000);
+ }
+
+ @Before
+ public void createTable() throws InterruptedException, TTransportException, ConfigurationException, IOException {
+ adminTemplate.createTable(true, CqlIdentifier.cqlId(DATA_TABLE_NAME), Book.class, new HashMap());
+ }
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+
+ @After
+ public void dropTable() {
+ adminTemplate.dropTable(CqlIdentifier.cqlId(DATA_TABLE_NAME));
+ }
+
+ @AfterClass
+ public static void stopCassandraEmbedded() {
+ EmbeddedCassandraServerHelper.cleanEmbeddedCassandra();
+ }
+}
diff --git a/persistence-modules/spring-data-dynamodb/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-data-dynamodb/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..7f906bdbcd
--- /dev/null
+++ b/persistence-modules/spring-data-dynamodb/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.Application;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = Application.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/persistence-modules/spring-data-eclipselink/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-data-eclipselink/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..4be5891e3e
--- /dev/null
+++ b/persistence-modules/spring-data-eclipselink/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.eclipselink.springdata.EclipselinkSpringDataApplication;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = EclipselinkSpringDataApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/persistence-modules/spring-data-gemfire/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-data-gemfire/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..2f0557ccc1
--- /dev/null
+++ b/persistence-modules/spring-data-gemfire/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,18 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.support.AnnotationConfigContextLoader;
+
+import com.baeldung.spring.data.gemfire.function.GemfireConfiguration;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes=GemfireConfiguration.class, loader=AnnotationConfigContextLoader.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/persistence-modules/spring-data-neo4j/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-data-neo4j/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..ea32ed324b
--- /dev/null
+++ b/persistence-modules/spring-data-neo4j/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,19 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import com.baeldung.spring.data.neo4j.config.MovieDatabaseNeo4jTestConfiguration;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = MovieDatabaseNeo4jTestConfiguration.class)
+@ActiveProfiles(profiles = "test")
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/persistence-modules/spring-data-redis/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-data-redis/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..e093892365
--- /dev/null
+++ b/persistence-modules/spring-data-redis/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import com.baeldung.spring.data.redis.config.RedisConfig;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = RedisConfig.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/persistence-modules/spring-data-solr/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-data-solr/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..e76967ae8a
--- /dev/null
+++ b/persistence-modules/spring-data-solr/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import com.baeldung.spring.data.solr.config.SolrConfig;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = SolrConfig.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/persistence-modules/spring-hibernate-3/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-hibernate-3/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..a81a4eedb1
--- /dev/null
+++ b/persistence-modules/spring-hibernate-3/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.baeldung.spring.PersistenceConfig;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.support.AnnotationConfigContextLoader;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = { PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/persistence-modules/spring-hibernate-5/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-hibernate-5/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..af4618d0f3
--- /dev/null
+++ b/persistence-modules/spring-hibernate-5/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,18 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.support.AnnotationConfigContextLoader;
+
+import com.baeldung.spring.PersistenceConfig;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = { PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/pom.xml b/pom.xml
index 4ffd9ba4a4..a499aac7ee 100644
--- a/pom.xml
+++ b/pom.xml
@@ -290,7 +290,7 @@
- default
+ default-first
@@ -332,6 +332,7 @@
annotations
apache-cxf
apache-fop
+ apache-geode
apache-poi
apache-tika
apache-thrift
@@ -398,7 +399,7 @@
javafx
jgroups
jee-7
- jhipster/jhipster-monolithic
+ jhipster
jjwt
jsf
json-path
@@ -475,6 +476,7 @@
spring-boot-logging-log4j2
spring-cloud-data-flow
spring-cloud
+ spring-cloud-bus
spring-core
spring-cucumber
spring-ejb
@@ -521,9 +523,9 @@
spring-rest-angular
spring-rest-full
spring-rest-query-language
- spring-rest
+
+
spring-resttemplate
- spring-rest-simple
spring-security-acl
spring-security-cache-control
spring-security-client/spring-security-jsp-authentication
@@ -549,136 +551,330 @@
spring-security-rest
spring-security-sso
spring-security-x509
- spring-session
+
+
+
+
+
+ default-second
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ ${maven-surefire-plugin.version}
+
+ 3
+ true
+
+ **/*IntegrationTest.java
+ **/*IntTest.java
+ **/*LongRunningUnitTest.java
+ **/*ManualTest.java
+ **/JdbcTest.java
+ **/*LiveTest.java
+
+
+
+
+
+
+
+
+ parent-boot-1
+ parent-boot-2
+ parent-spring-4
+ parent-spring-5
+ parent-java
+ parent-kotlin
+
+ spring-session
+ spring-sleuth
+ spring-social-login
+ spring-spel
+ spring-state-machine
+ spring-thymeleaf
+ spring-userservice
+ spring-zuul
+ spring-remoting
+ spring-reactor
+ spring-vertx
+ spring-jinq
+ spring-rest-embedded-tomcat
+ testing-modules/testing
+ testing-modules/testng
+ video-tutorials
+ xml
+ xmlunit-2
+ struts-2
+ apache-velocity
+ apache-solrj
+ rabbitmq
+ vertx
+ persistence-modules/spring-data-gemfire
+ mybatis
+ spring-drools
+ drools
+ persistence-modules/liquibase
+ spring-boot-property-exp
+ testing-modules/mockserver
+ testing-modules/test-containers
+ undertow
+ vaadin
+ vertx-and-rxjava
+ saas
+ deeplearning4j
+ lucene
+ vraptor
+ persistence-modules/java-cockroachdb
+ spring-security-thymeleaf
+ persistence-modules/java-jdbi
+ jersey
+ java-spi
+ performance-tests
+ twilio
+ spring-boot-ctx-fluent
+ java-ee-8-security-api
+ spring-webflux-amqp
+ antlr
+ maven-archetype
+ optaplanner
+ apache-meecrowave
+ spring-reactive-kotlin
+ jnosql
+ spring-boot-angular-ecommerce
+ cdi-portable-extension
+ jta
+
+ java-websocket
+ activejdbc
+ animal-sniffer-mvn-plugin
+ apache-avro
+ apache-bval
+ apache-shiro
+ apache-spark
+ asciidoctor
+ checker-plugin
+
+
+ core-java-sun
+ custom-pmd
+ dagger
+ data-structures
+ dubbo
+ flyway
+
+ java-difference-date
+
+ jni
+ jooby
+
+
+
+ ratpack
+ rest-with-spark-java
+ spring-boot-autoconfiguration
+ spring-boot-custom-starter
+ spring-boot-jasypt
+ spring-custom-aop
+ spring-data-rest-querydsl
+ spring-groovy
+ spring-mobile
+ spring-mustache
+ spring-mvc-simple
+ spring-mybatis
+ spring-rest-hal-browser
+ spring-rest-shell
+ spring-rest-template
+ spring-roo
+ spring-security-stormpath
+ sse-jaxrs
+ static-analysis
+ stripe
+
+ Twitter4J
+ wicket
+ xstream
+ cas/cas-secured-app
+ cas/cas-server
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ spring-boot-custom-starter/greeter
+ spring-boot-h2/spring-boot-h2-database
+
+
+
+
+ flyway-cdi-extension
+
+
+
+
+
+ spring-context
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ ${maven-surefire-plugin.version}
+
+ 3
+ true
+
+ **/*SpringContextIntegrationTest.java
+
+
+
+
+
+
+
+
+ spring-5
+ spring-5-data-reactive
+ spring-5-reactive
+ spring-5-reactive-client
+ spring-5-reactive-security
+ spring-5-security
+ spring-activiti
+ spring-akka
+ spring-all
+ spring-aop
+ spring-apache-camel
+ spring-batch
+ spring-bom
+ spring-boot-admin/spring-boot-admin-client
+ spring-boot-admin/spring-boot-admin-server
+ spring-boot-bootstrap
+ spring-boot-bootstrap
+ spring-boot-camel
+ spring-boot-client
+ spring-boot-custom-starter
+ greeter-spring-boot-autoconfigure
+ greeter-spring-boot-sample-app
+ spring-boot-h2/spring-boot-h2-database
+ spring-boot-jasypt
+ spring-boot-keycloak
+ spring-boot-mvc
+ spring-boot-property-exp/property-exp-custom-config
+ spring-boot-property-exp/property-exp-default-config
+ spring-boot-vue
+ spring-cloud
+ spring-cloud/spring-cloud-archaius/basic-config
+ spring-cloud/spring-cloud-archaius/extra-configs
+ spring-cloud/spring-cloud-bootstrap/config
+ spring-cloud/spring-cloud-contract/spring-cloud-contract-consumer
+ spring-cloud/spring-cloud-contract/spring-cloud-contract-producer
+ spring-cloud/spring-cloud-gateway
+ spring-cloud/spring-cloud-kubernetes/demo-backend
+ spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server
+ spring-cloud/spring-cloud-ribbon-client
+ spring-cloud/spring-cloud-security/auth-client
+ spring-cloud/spring-cloud-security/auth-resource
+ spring-cloud/spring-cloud-security/auth-server
+ spring-cloud/spring-cloud-stream/spring-cloud-stream-rabbit
+ spring-cloud/spring-cloud-task/springcloudtasksink
+ spring-cloud/spring-cloud-zookeeper
+ spring-cloud/spring-cloud-bus/spring-cloud-config-server
+ spring-cloud/spring-cloud-data-flow/log-sink
+ spring-cloud/spring-cloud-data-flow/time-processor
+ spring-cloud/spring-cloud-data-flow/time-source
+ spring-cucumber
+ spring-data-keyvalue
+ spring-data-rest
+ spring-dispatcher-servlet
+ spring-drools
+ spring-freemarker
+ spring-hibernate-3
+ spring-hibernate4
+ spring-integration
+ spring-jenkins-pipeline
+ spring-jersey
+ spring-jinq
+ spring-jms
+ spring-kafka
+ spring-katharsis
+ spring-ldap
+ spring-mobile
+ spring-mockito
+ spring-mvc-forms-thymeleaf
+ spring-mvc-java
+ spring-mvc-velocity
+ spring-mvc-webflow
+ spring-protobuf
+ spring-quartz
+ remoting-hessian-burlap/spring-remoting-hessian-burlap-client
+ remoting-hessian-burlap/remoting-hessian-burlap-server
+ spring-reactor
+ spring-remoting/
+ spring-remoting/remoting-http/remoting-http-server
+ spring-remoting/remoting-jms/remoting-jms-client
+ spring-remoting/remoting-rmi/remoting-rmi-server
+ spring-rest
+ spring-rest-angular
+ spring-rest-embedded-tomcat
+ spring-rest-full
+ spring-rest-simple
+ spring-resttemplate
+ spring-security-acl
+ spring-security-angular
+ spring-security-cache-control
+ spring-security-client/spring-security-jsp-authentication
+ spring-security-client/spring-security-jsp-authorize
+ spring-security-client/spring-security-jsp-config
+ spring-security-client/spring-security-mvc
+ spring-security-client/spring-security-thymeleaf-authentication
+ spring-security-client/spring-security-thymeleaf-authorize
+ spring-security-client/spring-security-thymeleaf-config
+ spring-security-core
+ spring-security-mvc-boot
+ spring-security-mvc-custom
+ spring-security-mvc-digest-auth
+ spring-security-mvc-ldap
+ spring-security-mvc-persisted-remember-me
+ spring-security-mvc-session
+ spring-security-mvc-socket
+ spring-security-rest
+ spring-security-sso/spring-security-sso-auth-server
+ spring-security-sso/spring-security-sso-ui
+ spring-security-sso/spring-security-sso-ui-2
+ spring-security-thymeleaf/spring-security-thymeleaf-authentication
+ spring-security-thymeleaf/spring-security-thymeleaf-authorize
+ spring-security-thymeleaf/spring-security-thymeleaf-config
+ spring-security-x509/spring-security-x509-basic-auth
+ spring-security-x509/spring-security-x509-client-auth
+ spring-session/spring-session-jdbc
spring-sleuth
spring-social-login
spring-spel
spring-state-machine
+ spring-swagger-codegen/spring-swagger-codegen-app
spring-thymeleaf
spring-userservice
- spring-zuul
- spring-remoting
- spring-reactor
+ spring-vault
spring-vertx
- spring-jinq
- spring-rest-embedded-tomcat
- testing-modules/testing
- testing-modules/testng
- video-tutorials
- xml
- xmlunit-2
- struts-2
- apache-velocity
- apache-solrj
- rabbitmq
- vertx
- persistence-modules/spring-data-gemfire
- mybatis
- spring-drools
- drools
- persistence-modules/liquibase
- spring-boot-property-exp
- testing-modules/mockserver
- testing-modules/test-containers
- undertow
- vaadin
- vertx-and-rxjava
- saas
- deeplearning4j
- lucene
- vraptor
- persistence-modules/java-cockroachdb
- spring-security-thymeleaf
- persistence-modules/java-jdbi
- jersey
- java-spi
- performance-tests
- twilio
- spring-boot-ctx-fluent
- java-ee-8-security-api
- spring-webflux-amqp
- antlr
- maven-archetype
- optaplanner
- apache-meecrowave
- spring-reactive-kotlin
- jnosql
- spring-boot-angular-ecommerce
- jta
-
- java-websocket
- activejdbc
-
-
- apache-bval
- apache-shiro
- apache-spark
-
- checker-plugin
-
-
- core-java-sun
- custom-pmd
- dagger
- data-structures
- dubbo
-
-
-
-
- jni
- jooby
-
-
-
- ratpack
-
- spring-boot-autoconfiguration
- spring-boot-custom-starter
- spring-boot-jasypt
-
- spring-data-rest-querydsl
-
- spring-mobile
-
- spring-mvc-simple
-
- spring-rest-hal-browser
- spring-rest-shell
- spring-rest-template
- spring-roo
- spring-security-stormpath
- sse-jaxrs
-
- stripe
-
- Twitter4J
- wicket
- xstream
- cas/cas-secured-app
- cas/cas-server
-
-
-
-
-
-
-
-
-
-
-
-
- jenkins/hello-world
-
-
-
- spring-boot-custom-starter/greeter
- spring-boot-h2/spring-boot-h2-database
-
-
-
-
+ spring-zuul/spring-zuul-foos-resource
+ persistence-modules/spring-data-dynamodb
+ persistence-modules/spring-data-eclipselink
+ persistence-modules/spring-data-solr
+ persistence-modules/spring-hibernate-5
@@ -822,6 +1018,7 @@
spring-boot-logging-log4j2
spring-cloud-data-flow
spring-cloud
+ spring-cloud-bus
spring-core
spring-cucumber
spring-ejb
@@ -876,7 +1073,7 @@
spring-rest
spring-resttemplate
spring-rest-simple
- spring-reactive-kotlin
+ spring-reactive-kotlin
@@ -924,13 +1121,13 @@
java-websocket
-
-
-
+ activejdbc
+ animal-sniffer-mvn-plugin
+ apache-avro
apache-bval
apache-shiro
apache-spark
-
+ asciidoctor
checker-plugin
@@ -939,9 +1136,9 @@
dagger
data-structures
dubbo
-
+ flyway
-
+ java-difference-date
jni
jooby
@@ -949,24 +1146,24 @@
ratpack
-
+ rest-with-spark-java
spring-boot-autoconfiguration
spring-boot-custom-starter
-
-
+ spring-boot-jasypt
+ spring-custom-aop
spring-data-rest-querydsl
-
+ spring-groovy
spring-mobile
-
+ spring-mustache
spring-mvc-simple
-
+ spring-mybatis
spring-rest-hal-browser
spring-rest-shell
spring-rest-template
spring-roo
spring-security-stormpath
sse-jaxrs
-
+ static-analysis
stripe
@@ -977,13 +1174,13 @@
-
-
+
+
-
-
+
+
jenkins/hello-world
@@ -994,7 +1191,7 @@
spring-boot-h2/spring-boot-h2-database
-
+
@@ -1176,6 +1373,7 @@
spring-boot-logging-log4j2
spring-cloud-data-flow
spring-cloud
+ spring-cloud-bus
spring-core
spring-cucumber
spring-ejb
@@ -1289,7 +1487,6 @@
spring-security-thymeleaf
persistence-modules/java-jdbi
jersey
- jersey-client-rx
java-spi
performance-tests
twilio
@@ -1383,7 +1580,7 @@
parent-kotlin
libraries
geotools
- jhipster/jhipster-monolithic
+ jhipster
testing-modules/gatling
spring-boot
spring-boot-ops
diff --git a/ratpack/README.md b/ratpack/README.md
index 02b91da0bd..dded42fab6 100644
--- a/ratpack/README.md
+++ b/ratpack/README.md
@@ -4,4 +4,4 @@
- [Ratpack Google Guice Integration](http://www.baeldung.com/ratpack-google-guice)
- [Ratpack Integration with Spring Boot](http://www.baeldung.com/ratpack-spring-boot)
- [Ratpack with Hystrix](http://www.baeldung.com/ratpack-hystrix)
-
+- [Ratpack HTTP Client](https://www.baeldung.com/ratpack-http-client)
diff --git a/rest-with-spark-java/src/test/java/com/baeldung/AppTest.java b/rest-with-spark-java/src/test/java/com/baeldung/AppLiveTest.java
similarity index 96%
rename from rest-with-spark-java/src/test/java/com/baeldung/AppTest.java
rename to rest-with-spark-java/src/test/java/com/baeldung/AppLiveTest.java
index c7b88dd6d1..9e24879767 100644
--- a/rest-with-spark-java/src/test/java/com/baeldung/AppTest.java
+++ b/rest-with-spark-java/src/test/java/com/baeldung/AppLiveTest.java
@@ -16,16 +16,16 @@ import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
-public class AppTest extends TestCase {
+public class AppLiveTest extends TestCase {
ObjectMapper mapper = new ObjectMapper();
- public AppTest( String testName ) {
+ public AppLiveTest( String testName ) {
super( testName );
}
public static Test suite() {
- return new TestSuite( AppTest.class );
+ return new TestSuite( AppLiveTest.class );
}
public void testApp() throws IOException, ClassNotFoundException {
diff --git a/rxjava-2/README.md b/rxjava-2/README.md
index ccf575757f..78eb6e6428 100644
--- a/rxjava-2/README.md
+++ b/rxjava-2/README.md
@@ -2,5 +2,6 @@
- [RxJava and Error Handling](http://www.baeldung.com/rxjava-error-handling)
- [RxJava 2 – Flowable](http://www.baeldung.com/rxjava-2-flowable)
+- [RxJava 2 - Completable](http://www.baeldung.com/rxjava-completable)
- [RxJava Maybe](http://www.baeldung.com/rxjava-maybe)
-- [Introduction to RxRelay for RxJava](http://www.baeldung.com/rx-relay)
\ No newline at end of file
+- [Introduction to RxRelay for RxJava](http://www.baeldung.com/rx-relay)
diff --git a/rxjava-2/pom.xml b/rxjava-2/pom.xml
index 4c5ea014d7..a18b096b6d 100644
--- a/rxjava-2/pom.xml
+++ b/rxjava-2/pom.xml
@@ -38,9 +38,8 @@
3.8.0
- 2.1.3
+ 2.2.2
1.7.0
2.0.0
-
\ No newline at end of file
diff --git a/rxjava-2/src/test/java/com/baeldung/rxjava/CompletableUnitTest.java b/rxjava-2/src/test/java/com/baeldung/rxjava/CompletableUnitTest.java
new file mode 100644
index 0000000000..6acda310a5
--- /dev/null
+++ b/rxjava-2/src/test/java/com/baeldung/rxjava/CompletableUnitTest.java
@@ -0,0 +1,112 @@
+package com.baeldung.rxjava;
+
+import io.reactivex.Completable;
+import io.reactivex.Flowable;
+import io.reactivex.Single;
+import io.reactivex.observers.DisposableCompletableObserver;
+import org.junit.Before;
+import org.junit.Test;
+
+public class CompletableUnitTest {
+
+ Completable first;
+ Completable second;
+ Completable error;
+ Throwable throwable = new RuntimeException();
+
+ @Before
+ public void setUpCompletables() {
+ first = Completable.fromSingle(Single.just(1));
+ second = Completable.fromRunnable(() -> {});
+ error = Single.error(throwable)
+ .ignoreElement();
+ }
+
+ @Test
+ public void whenCompletableConstructed_thenCompletedSuccessfully() {
+ Completable completed = Completable.complete();
+ completed.subscribe(new DisposableCompletableObserver() {
+ @Override
+ public void onComplete() {
+ System.out.println("Completed!");
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ e.printStackTrace();
+ }
+ });
+ Flowable flowable = Flowable.just("request received", "user logged in");
+ Completable flowableCompletable = Completable.fromPublisher(flowable);
+ Completable singleCompletable = Single.just(1)
+ .ignoreElement();
+
+ completed.andThen(flowableCompletable)
+ .andThen(singleCompletable)
+ .test()
+ .assertComplete();
+ }
+
+ @Test
+ public void whenCombiningCompletables_thenCompletedSuccessfully() {
+ first.andThen(second)
+ .test()
+ .assertComplete();
+ }
+
+ @Test
+ public void whenCombinedWithError_thenCompletedWithError() {
+ first.andThen(second)
+ .andThen(error)
+ .test()
+ .assertError(throwable);
+ }
+
+ @Test
+ public void whenCombinedWithNever_thenDoesNotComplete() {
+ first.andThen(second)
+ .andThen(Completable.never())
+ .test()
+ .assertNotComplete();
+ }
+
+ @Test
+ public void whenMergedCompletables_thenCompletedSuccessfully() {
+ Completable.mergeArray(first, second)
+ .test()
+ .assertComplete();
+ }
+
+ @Test
+ public void whenMergedWithError_thenCompletedWithError() {
+ Completable.mergeArray(first, second, error)
+ .test()
+ .assertError(throwable);
+ }
+
+ @Test
+ public void whenFlatMaped_thenCompletedSuccessfully() {
+ Completable allElementsCompletable = Flowable.just("request received", "user logged in")
+ .flatMapCompletable(message -> Completable
+ .fromRunnable(() -> System.out.println(message))
+ );
+ allElementsCompletable
+ .test()
+ .assertComplete();
+ }
+
+ @Test
+ public void whenAmbWithNever_thenCompletedSuccessfully() {
+ Completable.ambArray(first, Completable.never(), second)
+ .test()
+ .assertComplete();
+ }
+
+ @Test
+ public void whenAmbWithError_thenCompletedWithError() {
+ Completable.ambArray(error, first, second)
+ .test()
+ .assertError(throwable);
+ }
+
+}
diff --git a/spring-4/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-4/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..9dfac2bd9e
--- /dev/null
+++ b/spring-4/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.flips.ApplicationConfig;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = ApplicationConfig.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-5-data-reactive/pom.xml b/spring-5-data-reactive/pom.xml
index e4dd454635..5c723c6e29 100644
--- a/spring-5-data-reactive/pom.xml
+++ b/spring-5-data-reactive/pom.xml
@@ -62,28 +62,6 @@
spring-boot-starter-test
test
-
-
- org.junit.jupiter
- junit-jupiter-api
-
-
- org.junit.jupiter
- junit-jupiter-engine
- test
-
-
- org.junit.platform
- junit-platform-surefire-provider
- ${junit.platform.version}
- test
-
-
- org.junit.platform
- junit-platform-runner
- ${junit.platform.version}
- test
-
@@ -175,32 +153,13 @@
-
- org.apache.maven.plugins
- maven-surefire-plugin
-
- 3
- true
- methods
- true
-
- **/*IntegrationTest.java
- **/*IntTest.java
- **/*LiveTest.java
-
-
-
- UTF-8
- UTF-8
- 1.8
1.2.40
1.2.40
- 1.0.0
- 5.0.2
+
diff --git a/spring-5-data-reactive/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-5-data-reactive/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..ce4c172960
--- /dev/null
+++ b/spring-5-data-reactive/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.reactive.Spring5ReactiveApplication;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = Spring5ReactiveApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-5-reactive-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-5-reactive-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..7843a8968d
--- /dev/null
+++ b/spring-5-reactive-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.reactive.Spring5ReactiveTestApplication;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = Spring5ReactiveTestApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-5-reactive-security/src/main/java/com/baeldung/reactive/functional/EmployeeFunctionalConfig.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/functional/EmployeeFunctionalConfig.java
index 8d7860ccdc..76b697c1aa 100644
--- a/spring-5-reactive-security/src/main/java/com/baeldung/reactive/functional/EmployeeFunctionalConfig.java
+++ b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/functional/EmployeeFunctionalConfig.java
@@ -39,7 +39,7 @@ public class EmployeeFunctionalConfig {
}
@Bean
- RouterFunction updateEmployee() {
+ RouterFunction updateEmployeeRoute() {
return route(POST("/employees/update"),
req -> req.body(toMono(Employee.class))
.doOnNext(employeeRepository()::updateEmployee)
diff --git a/spring-5-reactive-security/src/test/java/com/baeldung/reactive/functional/EmployeeSpringFunctionalIntegrationTest.java b/spring-5-reactive-security/src/test/java/com/baeldung/reactive/functional/EmployeeSpringFunctionalIntegrationTest.java
index 1197820066..6e73e8072c 100644
--- a/spring-5-reactive-security/src/test/java/com/baeldung/reactive/functional/EmployeeSpringFunctionalIntegrationTest.java
+++ b/spring-5-reactive-security/src/test/java/com/baeldung/reactive/functional/EmployeeSpringFunctionalIntegrationTest.java
@@ -1,13 +1,37 @@
package com.baeldung.reactive.functional;
+import static org.mockito.BDDMockito.given;
+import static org.mockito.Mockito.verify;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.FixMethodOrder;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.MethodSorters;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.mock.mockito.MockBean;
+import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.reactive.server.WebTestClient;
import com.baeldung.webflux.Employee;
+import com.baeldung.webflux.EmployeeRepository;
+import reactor.core.publisher.Flux;
+import reactor.core.publisher.Mono;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = EmployeeSpringFunctionalApplication.class)
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class EmployeeSpringFunctionalIntegrationTest {
- private static EmployeeFunctionalConfig config = new EmployeeFunctionalConfig();
+ @Autowired
+ private EmployeeFunctionalConfig config;
+
+ @MockBean
+ private EmployeeRepository employeeRepository;
@Test
public void givenEmployeeId_whenGetEmployeeById_thenCorrectEmployee() {
@@ -15,7 +39,9 @@ public class EmployeeSpringFunctionalIntegrationTest {
.bindToRouterFunction(config.getEmployeeByIdRoute())
.build();
- Employee expected = new Employee("1", "Employee 1");
+ Employee employee = new Employee("1", "Employee 1");
+
+ given(employeeRepository.findEmployeeById("1")).willReturn(Mono.just(employee));
client.get()
.uri("/employees/1")
@@ -23,6 +49,50 @@ public class EmployeeSpringFunctionalIntegrationTest {
.expectStatus()
.isOk()
.expectBody(Employee.class)
- .isEqualTo(expected);
+ .isEqualTo(employee);
+ }
+
+ @Test
+ public void whenGetAllEmployees_thenCorrectEmployees() {
+ WebTestClient client = WebTestClient
+ .bindToRouterFunction(config.getAllEmployeesRoute())
+ .build();
+
+ List employeeList = new ArrayList<>();
+
+ Employee employee1 = new Employee("1", "Employee 1");
+ Employee employee2 = new Employee("2", "Employee 2");
+
+ employeeList.add(employee1);
+ employeeList.add(employee2);
+
+ Flux employeeFlux = Flux.fromIterable(employeeList);
+ given(employeeRepository.findAllEmployees()).willReturn(employeeFlux);
+
+ client.get()
+ .uri("/employees")
+ .exchange()
+ .expectStatus()
+ .isOk()
+ .expectBodyList(Employee.class)
+ .isEqualTo(employeeList);
+ }
+
+ @Test
+ public void whenUpdateEmployee_thenEmployeeUpdated() {
+ WebTestClient client = WebTestClient
+ .bindToRouterFunction(config.updateEmployeeRoute())
+ .build();
+
+ Employee employee = new Employee("1", "Employee 1 Updated");
+
+ client.post()
+ .uri("/employees/update")
+ .body(Mono.just(employee), Employee.class)
+ .exchange()
+ .expectStatus()
+ .isOk();
+
+ verify(employeeRepository).updateEmployee(employee);
}
}
diff --git a/spring-5-reactive-security/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-5-reactive-security/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..2bcd974510
--- /dev/null
+++ b/spring-5-reactive-security/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.reactive.security.SpringSecurity5Application;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = SpringSecurity5Application.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-5-reactive/README.md b/spring-5-reactive/README.md
index 0665eb4f57..7977fd820f 100644
--- a/spring-5-reactive/README.md
+++ b/spring-5-reactive/README.md
@@ -13,3 +13,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
- [How to Set a Header on a Response with Spring 5](http://www.baeldung.com/spring-response-header)
- [Spring Webflux and CORS](http://www.baeldung.com/spring-webflux-cors)
- [Handling Errors in Spring WebFlux](http://www.baeldung.com/spring-webflux-errors)
+- [Server-Sent Events in Spring](https://www.baeldung.com/spring-server-sent-events)
diff --git a/spring-5-reactive/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-5-reactive/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..ce4c172960
--- /dev/null
+++ b/spring-5-reactive/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.reactive.Spring5ReactiveApplication;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = Spring5ReactiveApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-5-security/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-5-security/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..967f67e760
--- /dev/null
+++ b/spring-5-security/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.dsl.CustomConfigurerApplication;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = CustomConfigurerApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-5/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-5/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..75b3df4978
--- /dev/null
+++ b/spring-5/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.Spring5Application;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = Spring5Application.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-activiti/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-activiti/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..ae37e77f86
--- /dev/null
+++ b/spring-activiti/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.example.activitiwithspring.ActivitiWithSpringApplication;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = ActivitiWithSpringApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-amqp-simple/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-amqp-simple/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..f134074cf8
--- /dev/null
+++ b/spring-amqp-simple/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.springamqpsimple.SpringAmqpApplication;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = SpringAmqpApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-aop/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-aop/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..cf1ac7de89
--- /dev/null
+++ b/spring-aop/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,15 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = Application.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-apache-camel/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-apache-camel/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..efd0603c76
--- /dev/null
+++ b/spring-apache-camel/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,13 @@
+package org.baeldung;
+
+import org.junit.Test;
+
+import com.baeldung.camel.main.App;
+
+public class SpringContextIntegrationTest {
+
+ @Test
+ public final void testMain() throws Exception {
+ App.main(null);
+ }
+}
diff --git a/spring-batch/repository.sqlite b/spring-batch/repository.sqlite
new file mode 100644
index 0000000000..4456ef63cc
Binary files /dev/null and b/spring-batch/repository.sqlite differ
diff --git a/spring-batch/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-batch/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..c3a9f74759
--- /dev/null
+++ b/spring-batch/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,12 @@
+package org.baeldung;
+
+import org.baeldung.batch.App;
+import org.junit.Test;
+
+public class SpringContextIntegrationTest {
+
+ @Test
+ public final void testMain() throws Exception {
+ App.main(null);
+ }
+}
diff --git a/spring-bom/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-bom/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..6dee4b808e
--- /dev/null
+++ b/spring-bom/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,13 @@
+package org.baeldung;
+
+import org.junit.Test;
+
+import com.baeldung.spring.bom.HelloWorldApp;
+
+public class SpringContextIntegrationTest {
+
+ @Test
+ public final void testMain() throws Exception {
+ HelloWorldApp.main(null);
+ }
+}
diff --git a/spring-boot-admin/spring-boot-admin-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-admin/spring-boot-admin-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..1f1fae17bc
--- /dev/null
+++ b/spring-boot-admin/spring-boot-admin-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.springbootadminclient.SpringBootAdminClientApplication;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = SpringBootAdminClientApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-boot-admin/spring-boot-admin-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-admin/spring-boot-admin-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..4c151d97df
--- /dev/null
+++ b/spring-boot-admin/spring-boot-admin-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.springbootadminserver.SpringBootAdminServerApplication;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = SpringBootAdminServerApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-boot-angular-ecommerce/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-angular-ecommerce/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..4f595916f7
--- /dev/null
+++ b/spring-boot-angular-ecommerce/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.ecommerce.EcommerceApplication;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = EcommerceApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-boot-autoconfiguration/src/main/java/com/baeldung/autoconfiguration/MySQLAutoconfiguration.java b/spring-boot-autoconfiguration/src/main/java/com/baeldung/autoconfiguration/MySQLAutoconfiguration.java
index 4f4f6fb6af..d6fc1836c7 100644
--- a/spring-boot-autoconfiguration/src/main/java/com/baeldung/autoconfiguration/MySQLAutoconfiguration.java
+++ b/spring-boot-autoconfiguration/src/main/java/com/baeldung/autoconfiguration/MySQLAutoconfiguration.java
@@ -1,10 +1,27 @@
package com.baeldung.autoconfiguration;
+import java.util.Arrays;
+import java.util.Properties;
+
+import javax.persistence.EntityManagerFactory;
+import javax.sql.DataSource;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
-import org.springframework.boot.autoconfigure.condition.*;
+import org.springframework.boot.autoconfigure.condition.ConditionMessage;
import org.springframework.boot.autoconfigure.condition.ConditionMessage.Style;
-import org.springframework.context.annotation.*;
+import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnResource;
+import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ConditionContext;
+import org.springframework.context.annotation.Conditional;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.PropertySource;
import org.springframework.core.Ordered;
import org.springframework.core.env.Environment;
import org.springframework.core.type.AnnotatedTypeMetadata;
@@ -14,11 +31,6 @@ import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.util.ClassUtils;
-import javax.persistence.EntityManagerFactory;
-import javax.sql.DataSource;
-import java.util.Arrays;
-import java.util.Properties;
-
@Configuration
@ConditionalOnClass(DataSource.class)
@AutoConfigureOrder(Ordered.HIGHEST_PRECEDENCE)
diff --git a/spring-boot-autoconfiguration/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-autoconfiguration/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..136ea2481f
--- /dev/null
+++ b/spring-boot-autoconfiguration/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,19 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.autoconfiguration.example.AutoconfigurationApplication;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = AutoconfigurationApplication.class)
+@EnableJpaRepositories(basePackages = { "com.baeldung.autoconfiguration.example" })
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-boot-bootstrap/README.md b/spring-boot-bootstrap/README.md
index 519b36ce4f..4b09f11714 100644
--- a/spring-boot-bootstrap/README.md
+++ b/spring-boot-bootstrap/README.md
@@ -2,3 +2,4 @@
- [Bootstrap a Simple Application using Spring Boot](http://www.baeldung.com/spring-boot-start)
- [Spring Boot Dependency Management with a Custom Parent](http://www.baeldung.com/spring-boot-dependency-management-custom-parent)
- [Thin JARs with Spring Boot](http://www.baeldung.com/spring-boot-thin-jar)
+- [Deploying a Spring Boot Application to Cloud Foundry](https://www.baeldung.com/spring-boot-app-deploy-to-cloud-foundry)
diff --git a/spring-boot-bootstrap/pom.xml b/spring-boot-bootstrap/pom.xml
index c1ce4df6e2..b5bcc587b1 100644
--- a/spring-boot-bootstrap/pom.xml
+++ b/spring-boot-bootstrap/pom.xml
@@ -78,6 +78,43 @@
+
+ cloud-gcp
+
+
+ org.springframework.cloud
+ spring-cloud-gcp-starter
+ 1.0.0.RELEASE
+
+
+ org.springframework.cloud
+ spring-cloud-gcp-starter-sql-mysql
+ 1.0.0.RELEASE
+
+
+
+ ${project.name}-gcp
+
+
+ src/main/resources
+
+ **/logback.xml
+
+
+
+
+
+ com.google.cloud.tools
+ appengine-maven-plugin
+ 1.3.2
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
cloudfoundry
@@ -91,6 +128,7 @@
+ ${project.name}-cf
src/main/resources
@@ -103,9 +141,6 @@
org.springframework.boot
spring-boot-maven-plugin
-
- ${project.name}-cf
-
org.apache.maven.plugins
diff --git a/spring-boot-bootstrap/src/main/appengine/app.yaml b/spring-boot-bootstrap/src/main/appengine/app.yaml
new file mode 100644
index 0000000000..a65ec6533a
--- /dev/null
+++ b/spring-boot-bootstrap/src/main/appengine/app.yaml
@@ -0,0 +1,19 @@
+runtime: java
+env: flex
+runtime_config:
+ jdk: openjdk8
+env_variables:
+ SPRING_PROFILES_ACTIVE: "gcp,mysql"
+handlers:
+- url: /.*
+ script: this field is required, but ignored
+resources:
+ cpu: 2
+ memory_gb: 2
+ disk_size_gb: 10
+ volumes:
+ - name: ramdisk1
+ volume_type: tmpfs
+ size_gb: 0.5
+manual_scaling:
+ instances: 1
diff --git a/spring-boot-bootstrap/src/main/resources/application-gcp.properties b/spring-boot-bootstrap/src/main/resources/application-gcp.properties
new file mode 100644
index 0000000000..3dd11eeb8c
--- /dev/null
+++ b/spring-boot-bootstrap/src/main/resources/application-gcp.properties
@@ -0,0 +1,3 @@
+spring.cloud.gcp.sql.instance-connection-name=baeldung-spring-boot-bootstrap:europe-west2:baeldung-spring-boot-bootstrap-db
+spring.cloud.gcp.sql.database-name=baeldung_bootstrap_db
+spring.cloud.gcp.logging.enabled=true
\ No newline at end of file
diff --git a/spring-boot-bootstrap/src/main/resources/application.properties b/spring-boot-bootstrap/src/main/resources/application.properties
index eee89ca460..d83166d843 100644
--- a/spring-boot-bootstrap/src/main/resources/application.properties
+++ b/spring-boot-bootstrap/src/main/resources/application.properties
@@ -8,4 +8,5 @@ spring.thymeleaf.suffix=.html
server.error.path=/error
server.error.whitelabel.enabled=false
-spring.jpa.generate-ddl=true
\ No newline at end of file
+spring.jpa.generate-ddl=true
+spring.jpa.hibernate.ddl-auto=update
\ No newline at end of file
diff --git a/spring-boot-bootstrap/src/main/resources/logback-gcp.xml b/spring-boot-bootstrap/src/main/resources/logback-gcp.xml
new file mode 100644
index 0000000000..9a9c1c633d
--- /dev/null
+++ b/spring-boot-bootstrap/src/main/resources/logback-gcp.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-boot-bootstrap/src/main/resources/spring-cloud-bootstrap.properties b/spring-boot-bootstrap/src/main/resources/spring-cloud-bootstrap.properties
new file mode 100644
index 0000000000..6ba0b5ffcc
--- /dev/null
+++ b/spring-boot-bootstrap/src/main/resources/spring-cloud-bootstrap.properties
@@ -0,0 +1 @@
+spring.cloud.appId=baeldung-spring-boot-bootstrap
diff --git a/spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/src/test/java/org/baeldung/SpringCloudRestConfigIntegrationTest.java b/spring-boot-bootstrap/src/test/java/org/baeldung/SpringContextIntegrationTest.java
similarity index 85%
rename from spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/src/test/java/org/baeldung/SpringCloudRestConfigIntegrationTest.java
rename to spring-boot-bootstrap/src/test/java/org/baeldung/SpringContextIntegrationTest.java
index 8cc30a32ab..9ae417a546 100644
--- a/spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/src/test/java/org/baeldung/SpringCloudRestConfigIntegrationTest.java
+++ b/spring-boot-bootstrap/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -7,9 +7,9 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
-public class SpringCloudRestConfigIntegrationTest {
+public class SpringContextIntegrationTest {
+
@Test
public void contextLoads() {
}
-
}
diff --git a/spring-boot-camel/pom.xml b/spring-boot-camel/pom.xml
index f04e8e34f7..19a0bec809 100644
--- a/spring-boot-camel/pom.xml
+++ b/spring-boot-camel/pom.xml
@@ -38,6 +38,12 @@
spring-boot-starter-web
${spring-boot-starter.version}
+
+ org.springframework.boot
+ spring-boot-starter-test
+ ${spring-boot-starter.version}
+ test
+
diff --git a/spring-boot-camel/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-camel/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..6eee0abf1e
--- /dev/null
+++ b/spring-boot-camel/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.camel.Application;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = Application.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-boot-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..97debc5b63
--- /dev/null
+++ b/spring-boot-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,16 @@
+package org.baeldung;
+
+import org.baeldung.boot.Application;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = Application.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-boot-ctx-fluent/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-ctx-fluent/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..c9f7220ab9
--- /dev/null
+++ b/spring-boot-ctx-fluent/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,13 @@
+package org.baeldung;
+
+import org.junit.Test;
+
+import com.baeldung.parent.App;
+
+public class SpringContextIntegrationTest {
+
+ @Test
+ public final void testMain() throws Exception {
+ App.main(new String[] {});
+ }
+}
diff --git a/spring-boot-custom-starter/greeter-spring-boot-autoconfigure/pom.xml b/spring-boot-custom-starter/greeter-spring-boot-autoconfigure/pom.xml
index 9c2d85da86..5862bdd6c8 100644
--- a/spring-boot-custom-starter/greeter-spring-boot-autoconfigure/pom.xml
+++ b/spring-boot-custom-starter/greeter-spring-boot-autoconfigure/pom.xml
@@ -40,6 +40,13 @@
${greeter.version}
true
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ 1.5.10.RELEASE
+ test
+
diff --git a/spring-boot-custom-starter/greeter-spring-boot-autoconfigure/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-custom-starter/greeter-spring-boot-autoconfigure/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..9c8d825ea4
--- /dev/null
+++ b/spring-boot-custom-starter/greeter-spring-boot-autoconfigure/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import com.baeldung.greeter.autoconfigure.GreeterAutoConfiguration;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = GreeterAutoConfiguration.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-boot-custom-starter/greeter-spring-boot-sample-app/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-custom-starter/greeter-spring-boot-sample-app/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..23f285238b
--- /dev/null
+++ b/spring-boot-custom-starter/greeter-spring-boot-sample-app/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.greeter.sample.GreeterSampleApplication;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = GreeterSampleApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-boot-h2/README.md b/spring-boot-h2/README.md
new file mode 100644
index 0000000000..af5f395440
--- /dev/null
+++ b/spring-boot-h2/README.md
@@ -0,0 +1,2 @@
+### Relevant Articles:
+- [Access the Same In-Memory H2 Database in Multiple Spring Boot Applications](https://www.baeldung.com/spring-boot-access-h2-database-multiple-apps)
diff --git a/spring-boot-h2/spring-boot-h2-remote-app/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-h2/spring-boot-h2-remote-app/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..f48199d4e8
--- /dev/null
+++ b/spring-boot-h2/spring-boot-h2-remote-app/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.h2db.demo.ClientSpringBootApp;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = ClientSpringBootApp.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-boot-jasypt/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-jasypt/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..dce3819a26
--- /dev/null
+++ b/spring-boot-jasypt/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.jasypt.Main;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = Main.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-boot-keycloak/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-keycloak/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..7367568611
--- /dev/null
+++ b/spring-boot-keycloak/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.keycloak.SpringBoot;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = SpringBoot.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-boot-logging-log4j2/spring-boot-logging-log4j2-app/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-logging-log4j2/spring-boot-logging-log4j2-app/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..2d46b21ba5
--- /dev/null
+++ b/spring-boot-logging-log4j2/spring-boot-logging-log4j2-app/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.springbootlogging.SpringBootLoggingApplication;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = SpringBootLoggingApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-boot-mvc/pom.xml b/spring-boot-mvc/pom.xml
index 06712e4791..65d23ebfc6 100644
--- a/spring-boot-mvc/pom.xml
+++ b/spring-boot-mvc/pom.xml
@@ -19,32 +19,16 @@
org.springframework.boot
spring-boot-starter-web
-
-
- com.sun.faces
- jsf-api
- 2.2.9
-
org.apache.tomcat.embed
tomcat-embed-jasper
+
- javax.faces
- javax.faces-api
- 2.1
+ org.glassfish
+ javax.faces
+ 2.3.7
-
- javax.servlet
- jstl
- 1.2
-
-
- com.sun.faces
- jsf-impl
- 2.2.8-02
-
-
org.springframework.boot
diff --git a/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/jsfapplication/model/TodoDao.java b/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/jsfapplication/model/TodoDao.java
index d33f5e5da0..96d44474af 100644
--- a/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/jsfapplication/model/TodoDao.java
+++ b/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/jsfapplication/model/TodoDao.java
@@ -14,7 +14,7 @@ import org.springframework.stereotype.Component;
public class TodoDao implements Dao {
private List todoList = new ArrayList<>();
-
+
@Override
public Optional get(int id) {
return Optional.ofNullable(todoList.get(id));
@@ -22,9 +22,9 @@ public class TodoDao implements Dao {
@Override
public Collection getAll() {
- return Collections.unmodifiableCollection(todoList.stream()
+ return todoList.stream()
.filter(Objects::nonNull)
- .collect(Collectors.toList()));
+ .collect(Collectors.collectingAndThen(Collectors.toList(), Collections::unmodifiableList));
}
@Override
diff --git a/spring-boot-mvc/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-mvc/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..6ed93e8c44
--- /dev/null
+++ b/spring-boot-mvc/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.springbootmvc.SpringBootMvcApplication;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = SpringBootMvcApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-boot-property-exp/property-exp-custom-config/pom.xml b/spring-boot-property-exp/property-exp-custom-config/pom.xml
index 958a07a86b..ab22c5ad30 100644
--- a/spring-boot-property-exp/property-exp-custom-config/pom.xml
+++ b/spring-boot-property-exp/property-exp-custom-config/pom.xml
@@ -20,7 +20,14 @@
spring-boot-starter
${spring-boot.version}
+
+ org.springframework.boot
+ spring-boot-starter-test
+ ${spring-boot.version}
+ test
+
+
diff --git a/spring-boot-property-exp/property-exp-custom-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-property-exp/property-exp-custom-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..6dd3419d39
--- /dev/null
+++ b/spring-boot-property-exp/property-exp-custom-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.propertyexpansion.SpringBootPropertyExpansionApp;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = SpringBootPropertyExpansionApp.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-boot-property-exp/property-exp-default-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-property-exp/property-exp-default-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..6dd3419d39
--- /dev/null
+++ b/spring-boot-property-exp/property-exp-default-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.propertyexpansion.SpringBootPropertyExpansionApp;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = SpringBootPropertyExpansionApp.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-boot-security/README.md b/spring-boot-security/README.md
index a79e7de610..30a3218672 100644
--- a/spring-boot-security/README.md
+++ b/spring-boot-security/README.md
@@ -9,3 +9,5 @@
### Relevant Articles:
- [Spring Boot Security Auto-Configuration](http://www.baeldung.com/spring-boot-security-autoconfiguration)
+- [Spring Security for Spring Boot Integration Tests](https://www.baeldung.com/spring-security-integration-tests)
+- [Introduction to Spring Security Taglibs](https://www.baeldung.com/spring-security-taglibs)
diff --git a/spring-boot-vue/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-vue/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..6ed93e8c44
--- /dev/null
+++ b/spring-boot-vue/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.springbootmvc.SpringBootMvcApplication;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = SpringBootMvcApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-boot/README.MD b/spring-boot/README.MD
index 54382992d4..192c4f9fed 100644
--- a/spring-boot/README.MD
+++ b/spring-boot/README.MD
@@ -33,3 +33,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
- [Container Configuration in Spring Boot 2](http://www.baeldung.com/embeddedservletcontainercustomizer-configurableembeddedservletcontainer-spring-boot)
- [Introduction to Chaos Monkey](https://www.baeldung.com/spring-boot-chaos-monkey)
- [Spring Component Scanning](https://www.baeldung.com/spring-component-scanning)
+- [Load Spring Boot Properties From a JSON File](https://www.baeldung.com/spring-boot-json-properties)
diff --git a/spring-boot/pom.xml b/spring-boot/pom.xml
index 50859f674c..0ea6b6156f 100644
--- a/spring-boot/pom.xml
+++ b/spring-boot/pom.xml
@@ -145,6 +145,20 @@
chaos-monkey-spring-boot
${chaos.monkey.version}
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-log4j
+ 1.3.8.RELEASE
+
+
+ org.graylog2
+ gelfj
+ 1.1.16
+ compile
+
@@ -224,4 +238,4 @@
2.2.4
-
\ No newline at end of file
+
diff --git a/spring-boot/src/main/java/com/baeldung/graylog/GraylogDemoApplication.java b/spring-boot/src/main/java/com/baeldung/graylog/GraylogDemoApplication.java
new file mode 100644
index 0000000000..be49a0e927
--- /dev/null
+++ b/spring-boot/src/main/java/com/baeldung/graylog/GraylogDemoApplication.java
@@ -0,0 +1,17 @@
+package com.baeldung.graylog;
+
+import org.apache.log4j.Logger;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class GraylogDemoApplication {
+
+ private final static Logger LOG =
+ Logger.getLogger(GraylogDemoApplication.class);
+
+ public static void main(String[] args) {
+ SpringApplication.run(GraylogDemoApplication.class, args);
+ LOG.info("Hello from Spring Boot");
+ }
+}
diff --git a/spring-boot/src/main/resources/log4j.xml b/spring-boot/src/main/resources/log4j.xml
new file mode 100644
index 0000000000..61c1b7b229
--- /dev/null
+++ b/spring-boot/src/main/resources/log4j.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-cloud-bus/pom.xml b/spring-cloud-bus/pom.xml
new file mode 100644
index 0000000000..d493c4e984
--- /dev/null
+++ b/spring-cloud-bus/pom.xml
@@ -0,0 +1,39 @@
+
+
+ 4.0.0
+ com.baeldung.spring.cloud
+ spring-cloud-bus
+ 1.0.0-SNAPSHOT
+ pom
+
+
+ parent-boot-1
+ com.baeldung
+ 0.0.1-SNAPSHOT
+ ../parent-boot-1
+
+
+
+ spring-cloud-config-client
+ spring-cloud-config-server
+
+
+
+
+
+ org.springframework.cloud
+ spring-cloud-dependencies
+ ${spring-cloud-dependencies.version}
+ pom
+ import
+
+
+
+
+
+ Brixton.SR7
+
+
+
diff --git a/spring-cloud-bus/spring-cloud-config-client/pom.xml b/spring-cloud-bus/spring-cloud-config-client/pom.xml
index bd9fb45587..b2b69303bf 100644
--- a/spring-cloud-bus/spring-cloud-config-client/pom.xml
+++ b/spring-cloud-bus/spring-cloud-config-client/pom.xml
@@ -1,76 +1,53 @@
- 4.0.0
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ 4.0.0
+ spring-cloud-config-client
+ jar
- com.baeldung.spring.cloud
- spring-cloud-config-client
- 0.0.1-SNAPSHOT
- jar
+ spring-cloud-config-client
+ Demo Spring Cloud Config Client
- spring-cloud-config-client
- Demo Spring Cloud Config Client
+
+ spring-cloud-bus
+ com.baeldung.spring.cloud
+ 1.0.0-SNAPSHOT
+
-
- parent-boot-1
- com.baeldung
- 0.0.1-SNAPSHOT
- ../../parent-boot-1
-
+
+
+ org.springframework.cloud
+ spring-cloud-starter-config
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
-
-
- org.springframework.cloud
- spring-cloud-starter-config
-
-
- org.springframework.boot
- spring-boot-starter-web
-
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
+
+ org.springframework.boot
+ spring-boot-actuator
+
-
- org.springframework.boot
- spring-boot-actuator
-
+
+ org.springframework.cloud
+ spring-cloud-starter-bus-amqp
+
+
-
- org.springframework.cloud
- spring-cloud-starter-bus-amqp
-
-
-
-
-
-
- org.springframework.cloud
- spring-cloud-dependencies
- ${spring-cloud.version}
- pom
- import
-
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
-
-
- UTF-8
- UTF-8
- 1.8
- Dalston.SR1
-
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
diff --git a/spring-cloud/spring-cloud-kubernetes/demo-frontend/src/test/java/com/baeldung/spring/cloud/kubernetes/frontend/KubernetesFrontendApplicationIntegrationTest.java b/spring-cloud-bus/spring-cloud-config-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java
similarity index 56%
rename from spring-cloud/spring-cloud-kubernetes/demo-frontend/src/test/java/com/baeldung/spring/cloud/kubernetes/frontend/KubernetesFrontendApplicationIntegrationTest.java
rename to spring-cloud-bus/spring-cloud-config-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java
index 19ad9676cb..c0298daeb1 100644
--- a/spring-cloud/spring-cloud-kubernetes/demo-frontend/src/test/java/com/baeldung/spring/cloud/kubernetes/frontend/KubernetesFrontendApplicationIntegrationTest.java
+++ b/spring-cloud-bus/spring-cloud-config-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -1,13 +1,15 @@
-package com.baeldung.spring.cloud.kubernetes.frontend;
+package org.baeldung;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
+import com.baeldung.SpringCloudConfigClientApplication;
+
@RunWith(SpringRunner.class)
-@SpringBootTest
-public class KubernetesFrontendApplicationIntegrationTest {
+@SpringBootTest(classes = SpringCloudConfigClientApplication.class)
+public class SpringContextIntegrationTest {
@Test
public void contextLoads() {
diff --git a/spring-cloud-bus/spring-cloud-config-server/pom.xml b/spring-cloud-bus/spring-cloud-config-server/pom.xml
index 194289ea1e..f50b78ff18 100644
--- a/spring-cloud-bus/spring-cloud-config-server/pom.xml
+++ b/spring-cloud-bus/spring-cloud-config-server/pom.xml
@@ -1,77 +1,54 @@
- 4.0.0
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ 4.0.0
+ spring-cloud-config-server
+ jar
- com.baeldung.spring.cloud
- spring-cloud-config-server
- 0.0.1-SNAPSHOT
- jar
+ spring-cloud-config-server
+ Demo Spring Cloud Config Server
- spring-cloud-config-server
- Demo Spring Cloud Config Server
+
+ spring-cloud-bus
+ com.baeldung.spring.cloud
+ 1.0.0-SNAPSHOT
+
-
- parent-boot-1
- com.baeldung
- 0.0.1-SNAPSHOT
- ../../parent-boot-1
-
+
+
+ org.springframework.cloud
+ spring-cloud-config-server
+
-
-
- org.springframework.cloud
- spring-cloud-config-server
-
+
+ org.springframework.boot
+ spring-boot-starter-security
+
-
- org.springframework.boot
- spring-boot-starter-security
-
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
+
+ org.springframework.cloud
+ spring-cloud-config-monitor
+
-
- org.springframework.cloud
- spring-cloud-config-monitor
-
+
+ org.springframework.cloud
+ spring-cloud-starter-stream-rabbit
+
+
-
- org.springframework.cloud
- spring-cloud-starter-stream-rabbit
-
-
-
-
-
-
- org.springframework.cloud
- spring-cloud-dependencies
- ${spring-cloud.version}
- pom
- import
-
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
-
-
- UTF-8
- UTF-8
- 1.8
- Dalston.SR1
-
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
diff --git a/spring-cloud-bus/spring-cloud-config-server/src/test/java/com/baeldung/SpringCloudConfigServerApplicationTests.java b/spring-cloud-bus/spring-cloud-config-server/src/test/java/com/baeldung/SpringCloudConfigServerApplicationIntegrationTest.java
similarity index 81%
rename from spring-cloud-bus/spring-cloud-config-server/src/test/java/com/baeldung/SpringCloudConfigServerApplicationTests.java
rename to spring-cloud-bus/spring-cloud-config-server/src/test/java/com/baeldung/SpringCloudConfigServerApplicationIntegrationTest.java
index 3969c7ba2d..12e0928ad8 100644
--- a/spring-cloud-bus/spring-cloud-config-server/src/test/java/com/baeldung/SpringCloudConfigServerApplicationTests.java
+++ b/spring-cloud-bus/spring-cloud-config-server/src/test/java/com/baeldung/SpringCloudConfigServerApplicationIntegrationTest.java
@@ -7,7 +7,7 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
-public class SpringCloudConfigServerApplicationTests {
+public class SpringCloudConfigServerApplicationIntegrationTest {
@Test
public void contextLoads() {
diff --git a/spring-cloud/spring-cloud-kubernetes/demo-backend/src/test/java/com/baeldung/spring/cloud/kubernetes/backend/KubernetesBackendApplicationIntegrationTest.java b/spring-cloud-bus/spring-cloud-config-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java
similarity index 56%
rename from spring-cloud/spring-cloud-kubernetes/demo-backend/src/test/java/com/baeldung/spring/cloud/kubernetes/backend/KubernetesBackendApplicationIntegrationTest.java
rename to spring-cloud-bus/spring-cloud-config-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java
index 2440b97aaf..c43bb9f067 100644
--- a/spring-cloud/spring-cloud-kubernetes/demo-backend/src/test/java/com/baeldung/spring/cloud/kubernetes/backend/KubernetesBackendApplicationIntegrationTest.java
+++ b/spring-cloud-bus/spring-cloud-config-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -1,13 +1,15 @@
-package com.baeldung.spring.cloud.kubernetes.backend;
+package org.baeldung;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
+import com.baeldung.SpringCloudConfigServerApplication;
+
@RunWith(SpringRunner.class)
-@SpringBootTest
-public class KubernetesBackendApplicationIntegrationTest {
+@SpringBootTest(classes = SpringCloudConfigServerApplication.class)
+public class SpringContextIntegrationTest {
@Test
public void contextLoads() {
diff --git a/spring-cloud-data-flow/batch-job/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud-data-flow/batch-job/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..b87ace74a4
--- /dev/null
+++ b/spring-cloud-data-flow/batch-job/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,18 @@
+package org.baeldung;
+
+import org.baeldung.spring.cloud.JobConfiguration;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest
+@ContextConfiguration(classes = JobConfiguration.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-cloud-data-flow/data-flow-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud-data-flow/data-flow-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..eb2a5c54ef
--- /dev/null
+++ b/spring-cloud-data-flow/data-flow-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,16 @@
+package org.baeldung;
+
+import org.baeldung.spring.cloud.DataFlowServerApplication;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = DataFlowServerApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-cloud-data-flow/data-flow-shell/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud-data-flow/data-flow-shell/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..28dbc9a8d8
--- /dev/null
+++ b/spring-cloud-data-flow/data-flow-shell/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.baeldung.spring.cloud.DataFlowShellApplication;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = DataFlowShellApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void contextLoads() {
+ }
+
+}
diff --git a/spring-cloud-data-flow/etl/README.MD b/spring-cloud-data-flow/etl/README.MD
new file mode 100644
index 0000000000..0cbb460b01
--- /dev/null
+++ b/spring-cloud-data-flow/etl/README.MD
@@ -0,0 +1,9 @@
+# Overview
+This is an example of a ETL stream pipeline, mixing a starter application with custom transform and sink.
+
+# Applications
+JDBC Source - Application Starter distributed by default
+
+customer-transform - Custom application to transform the data
+
+customer-mongodb-sink - Custom application to sink the data
diff --git a/spring-cloud-data-flow/etl/customer-mongodb-sink/pom.xml b/spring-cloud-data-flow/etl/customer-mongodb-sink/pom.xml
new file mode 100644
index 0000000000..468d8e17d0
--- /dev/null
+++ b/spring-cloud-data-flow/etl/customer-mongodb-sink/pom.xml
@@ -0,0 +1,75 @@
+
+
+ 4.0.0
+
+ com.customer
+ customer-mongodb-sink
+ jar
+
+ customer-mongodb-sink
+ Example ETL Load Project
+
+
+ parent-boot-2
+ com.baeldung
+ 0.0.1-SNAPSHOT
+ ../../../parent-boot-2
+
+
+
+ UTF-8
+ UTF-8
+ 1.8
+ Finchley.SR1
+
+
+
+
+ org.springframework.cloud
+ spring-cloud-stream
+
+
+ org.springframework.cloud
+ spring-cloud-stream-binder-rabbit
+
+
+ org.springframework.boot
+ spring-boot-starter-data-mongodb
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ org.springframework.cloud
+ spring-cloud-stream-test-support
+ test
+
+
+
+
+
+
+ org.springframework.cloud
+ spring-cloud-dependencies
+ ${spring-cloud.version}
+ pom
+ import
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
+
diff --git a/spring-cloud-data-flow/etl/customer-mongodb-sink/src/main/java/com/customer/customermongodbsink/Customer.java b/spring-cloud-data-flow/etl/customer-mongodb-sink/src/main/java/com/customer/customermongodbsink/Customer.java
new file mode 100644
index 0000000000..cf44aec5b7
--- /dev/null
+++ b/spring-cloud-data-flow/etl/customer-mongodb-sink/src/main/java/com/customer/customermongodbsink/Customer.java
@@ -0,0 +1,27 @@
+package com.customer.customermongodbsink;
+
+import org.springframework.data.mongodb.core.mapping.Document;
+
+@Document(collection = "customer")
+public class Customer {
+
+ private Long id;
+ private String name;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+}
\ No newline at end of file
diff --git a/spring-cloud-data-flow/etl/customer-mongodb-sink/src/main/java/com/customer/customermongodbsink/CustomerListener.java b/spring-cloud-data-flow/etl/customer-mongodb-sink/src/main/java/com/customer/customermongodbsink/CustomerListener.java
new file mode 100644
index 0000000000..c841daea8a
--- /dev/null
+++ b/spring-cloud-data-flow/etl/customer-mongodb-sink/src/main/java/com/customer/customermongodbsink/CustomerListener.java
@@ -0,0 +1,18 @@
+package com.customer.customermongodbsink;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cloud.stream.annotation.EnableBinding;
+import org.springframework.cloud.stream.annotation.StreamListener;
+import org.springframework.cloud.stream.messaging.Sink;
+
+@EnableBinding(Sink.class)
+public class CustomerListener {
+
+ @Autowired
+ private CustomerRepository repository;
+
+ @StreamListener(Sink.INPUT)
+ public void save(Customer customer) {
+ repository.save(customer);
+ }
+}
diff --git a/spring-cloud-data-flow/etl/customer-mongodb-sink/src/main/java/com/customer/customermongodbsink/CustomerMongodbSinkApplication.java b/spring-cloud-data-flow/etl/customer-mongodb-sink/src/main/java/com/customer/customermongodbsink/CustomerMongodbSinkApplication.java
new file mode 100644
index 0000000000..2ef311457e
--- /dev/null
+++ b/spring-cloud-data-flow/etl/customer-mongodb-sink/src/main/java/com/customer/customermongodbsink/CustomerMongodbSinkApplication.java
@@ -0,0 +1,12 @@
+package com.customer.customermongodbsink;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class CustomerMongodbSinkApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(CustomerMongodbSinkApplication.class, args);
+ }
+}
diff --git a/spring-cloud-data-flow/etl/customer-mongodb-sink/src/main/java/com/customer/customermongodbsink/CustomerRepository.java b/spring-cloud-data-flow/etl/customer-mongodb-sink/src/main/java/com/customer/customermongodbsink/CustomerRepository.java
new file mode 100644
index 0000000000..f921ff51cf
--- /dev/null
+++ b/spring-cloud-data-flow/etl/customer-mongodb-sink/src/main/java/com/customer/customermongodbsink/CustomerRepository.java
@@ -0,0 +1,9 @@
+package com.customer.customermongodbsink;
+
+import org.springframework.data.mongodb.repository.MongoRepository;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface CustomerRepository extends MongoRepository {
+
+}
\ No newline at end of file
diff --git a/spring-cloud-data-flow/etl/customer-mongodb-sink/src/main/resources/application.properties b/spring-cloud-data-flow/etl/customer-mongodb-sink/src/main/resources/application.properties
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/spring-cloud-data-flow/etl/customer-transform/pom.xml b/spring-cloud-data-flow/etl/customer-transform/pom.xml
new file mode 100644
index 0000000000..bc4b648907
--- /dev/null
+++ b/spring-cloud-data-flow/etl/customer-transform/pom.xml
@@ -0,0 +1,68 @@
+
+
+ 4.0.0
+
+ com.customer
+ customer-transform
+ 0.0.1-SNAPSHOT
+ jar
+
+ customer-transform
+ Example transform ETL step
+
+
+ parent-boot-2
+ com.baeldung
+ 0.0.1-SNAPSHOT
+ ../../../parent-boot-2
+
+
+
+ UTF-8
+ UTF-8
+ 1.8
+ Finchley.SR1
+
+
+
+
+ org.springframework.cloud
+ spring-cloud-stream-binder-rabbit
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ org.springframework.cloud
+ spring-cloud-stream-test-support
+ test
+
+
+
+
+
+
+ org.springframework.cloud
+ spring-cloud-dependencies
+ ${spring-cloud.version}
+ pom
+ import
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
+
diff --git a/spring-cloud-data-flow/etl/customer-transform/src/main/java/com/customer/customertransform/Customer.java b/spring-cloud-data-flow/etl/customer-transform/src/main/java/com/customer/customertransform/Customer.java
new file mode 100644
index 0000000000..f0e4d79388
--- /dev/null
+++ b/spring-cloud-data-flow/etl/customer-transform/src/main/java/com/customer/customertransform/Customer.java
@@ -0,0 +1,29 @@
+package com.customer.customertransform;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class Customer {
+
+ private Long id;
+
+ private String name;
+
+ @JsonProperty("customer_name")
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @JsonProperty("name")
+ public String getName() {
+ return name;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+}
\ No newline at end of file
diff --git a/spring-cloud-data-flow/etl/customer-transform/src/main/java/com/customer/customertransform/CustomerProcessorConfiguration.java b/spring-cloud-data-flow/etl/customer-transform/src/main/java/com/customer/customertransform/CustomerProcessorConfiguration.java
new file mode 100644
index 0000000000..c99fcf55be
--- /dev/null
+++ b/spring-cloud-data-flow/etl/customer-transform/src/main/java/com/customer/customertransform/CustomerProcessorConfiguration.java
@@ -0,0 +1,16 @@
+package com.customer.customertransform;
+
+
+import org.springframework.cloud.stream.annotation.EnableBinding;
+import org.springframework.cloud.stream.messaging.Processor;
+import org.springframework.integration.annotation.Transformer;
+
+@EnableBinding(Processor.class)
+public class CustomerProcessorConfiguration {
+
+ @Transformer(inputChannel = Processor.INPUT, outputChannel = Processor.OUTPUT)
+ public Customer convertToPojo(Customer payload) {
+
+ return payload;
+ }
+}
\ No newline at end of file
diff --git a/spring-cloud-data-flow/etl/customer-transform/src/main/java/com/customer/customertransform/CustomerTransformApplication.java b/spring-cloud-data-flow/etl/customer-transform/src/main/java/com/customer/customertransform/CustomerTransformApplication.java
new file mode 100644
index 0000000000..8781f4da54
--- /dev/null
+++ b/spring-cloud-data-flow/etl/customer-transform/src/main/java/com/customer/customertransform/CustomerTransformApplication.java
@@ -0,0 +1,12 @@
+package com.customer.customertransform;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class CustomerTransformApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(CustomerTransformApplication.class, args);
+ }
+}
diff --git a/spring-cloud-data-flow/etl/customer-transform/src/main/resources/application.properties b/spring-cloud-data-flow/etl/customer-transform/src/main/resources/application.properties
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/spring-cloud-data-flow/etl/pom.xml b/spring-cloud-data-flow/etl/pom.xml
new file mode 100644
index 0000000000..2b904f6e0d
--- /dev/null
+++ b/spring-cloud-data-flow/etl/pom.xml
@@ -0,0 +1,20 @@
+
+ 4.0.0
+ org.baeldung.spring.cloud
+ etl-spring-cloud-data-flow
+ 0.0.1-SNAPSHOT
+ pom
+
+
+ org.baeldung.spring.cloud
+ spring-cloud-data-flow
+ 0.0.1-SNAPSHOT
+
+
+
+ customer-mongodb-sink
+ customer-transform
+
+
+
diff --git a/spring-cloud-data-flow/log-sink/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud-data-flow/log-sink/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..8dc814ddce
--- /dev/null
+++ b/spring-cloud-data-flow/log-sink/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.baeldung.spring.cloud.LogSinkApplication;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = LogSinkApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void contextLoads() {
+ }
+
+}
diff --git a/spring-cloud-data-flow/pom.xml b/spring-cloud-data-flow/pom.xml
index 5f24aa2cbd..5a007f3c7d 100644
--- a/spring-cloud-data-flow/pom.xml
+++ b/spring-cloud-data-flow/pom.xml
@@ -19,6 +19,7 @@
time-processor
log-sink
batch-job
+ etl
diff --git a/spring-cloud-data-flow/time-processor/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud-data-flow/time-processor/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..dcfeafa2bb
--- /dev/null
+++ b/spring-cloud-data-flow/time-processor/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.baeldung.spring.cloud.TimeProcessorApplication;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = TimeProcessorApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void contextLoads() {
+ }
+
+}
diff --git a/spring-cloud-data-flow/time-source/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud-data-flow/time-source/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..2c402824f0
--- /dev/null
+++ b/spring-cloud-data-flow/time-source/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.baeldung.spring.cloud.TimeSourceApplication;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = TimeSourceApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void contextLoads() {
+ }
+
+}
diff --git a/spring-cloud-data-flow/time-source/src/test/java/org/baeldung/spring/cloud/TimeSourceApplicationIntegrationTest.java b/spring-cloud-data-flow/time-source/src/test/java/org/baeldung/spring/cloud/TimeSourceApplicationIntegrationTest.java
deleted file mode 100644
index 6d71a785a3..0000000000
--- a/spring-cloud-data-flow/time-source/src/test/java/org/baeldung/spring/cloud/TimeSourceApplicationIntegrationTest.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.baeldung.spring.cloud;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest
-public class TimeSourceApplicationIntegrationTest {
-
- @Test
- public void contextLoads() {
- }
-
-}
diff --git a/spring-cloud/pom.xml b/spring-cloud/pom.xml
index d0095e9a8a..924ea2be36 100644
--- a/spring-cloud/pom.xml
+++ b/spring-cloud/pom.xml
@@ -36,6 +36,7 @@
spring-cloud-functions
spring-cloud-vault
spring-cloud-security
+ spring-cloud-task
diff --git a/spring-cloud/spring-cloud-archaius/additional-sources-simple/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-archaius/additional-sources-simple/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..e5ebbce1aa
--- /dev/null
+++ b/spring-cloud/spring-cloud-archaius/additional-sources-simple/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.spring.cloud.archaius.additionalsources.AdditionalSourcesSimpleApplication;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = AdditionalSourcesSimpleApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-cloud/spring-cloud-archaius/basic-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-archaius/basic-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..16542981e8
--- /dev/null
+++ b/spring-cloud/spring-cloud-archaius/basic-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.spring.cloud.archaius.basic.BasicArchaiusApplication;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = BasicArchaiusApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-cloud/spring-cloud-archaius/dynamodb-config/pom.xml b/spring-cloud/spring-cloud-archaius/dynamodb-config/pom.xml
new file mode 100644
index 0000000000..3ffbf8f619
--- /dev/null
+++ b/spring-cloud/spring-cloud-archaius/dynamodb-config/pom.xml
@@ -0,0 +1,47 @@
+
+
+ 4.0.0
+ dynamodb-config
+ jar
+
+
+ com.baeldung.spring.cloud
+ spring-cloud-archaius
+ 1.0.0-SNAPSHOT
+ ..
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ com.amazonaws
+ aws-java-sdk-dynamodb
+ ${aws.sdk.dynamo.version}
+
+
+ com.github.derjust
+ spring-data-dynamodb
+ ${spring.dynamo.version}
+
+
+ com.netflix.archaius
+ archaius-aws
+ ${archaius.version}
+
+
+ org.projectlombok
+ lombok
+ provided
+
+
+
+
+ 1.11.407
+ 5.0.3
+ 0.7.6
+
+
diff --git a/spring-cloud/spring-cloud-archaius/dynamodb-config/src/main/java/com/baeldung/spring/cloud/archaius/dynamosources/DynamoSourcesApplication.java b/spring-cloud/spring-cloud-archaius/dynamodb-config/src/main/java/com/baeldung/spring/cloud/archaius/dynamosources/DynamoSourcesApplication.java
new file mode 100644
index 0000000000..ee08f2b1fb
--- /dev/null
+++ b/spring-cloud/spring-cloud-archaius/dynamodb-config/src/main/java/com/baeldung/spring/cloud/archaius/dynamosources/DynamoSourcesApplication.java
@@ -0,0 +1,12 @@
+package com.baeldung.spring.cloud.archaius.dynamosources;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class DynamoSourcesApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(DynamoSourcesApplication.class, args);
+ }
+}
diff --git a/spring-cloud/spring-cloud-archaius/dynamodb-config/src/main/java/com/baeldung/spring/cloud/archaius/dynamosources/config/ApplicationPropertiesConfigurations.java b/spring-cloud/spring-cloud-archaius/dynamodb-config/src/main/java/com/baeldung/spring/cloud/archaius/dynamosources/config/ApplicationPropertiesConfigurations.java
new file mode 100644
index 0000000000..7b533e8021
--- /dev/null
+++ b/spring-cloud/spring-cloud-archaius/dynamodb-config/src/main/java/com/baeldung/spring/cloud/archaius/dynamosources/config/ApplicationPropertiesConfigurations.java
@@ -0,0 +1,52 @@
+package com.baeldung.spring.cloud.archaius.dynamosources.config;
+
+import java.util.Arrays;
+
+import org.apache.commons.configuration.AbstractConfiguration;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import com.amazonaws.services.dynamodbv2.AmazonDynamoDB;
+import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper;
+import com.amazonaws.services.dynamodbv2.model.CreateTableRequest;
+import com.amazonaws.services.dynamodbv2.model.ProvisionedThroughput;
+import com.amazonaws.services.dynamodbv2.util.TableUtils;
+import com.baeldung.spring.cloud.archaius.dynamosources.dynamodb.ArchaiusProperties;
+import com.baeldung.spring.cloud.archaius.dynamosources.dynamodb.ArchaiusPropertiesRepository;
+import com.netflix.config.DynamicConfiguration;
+import com.netflix.config.FixedDelayPollingScheduler;
+import com.netflix.config.PolledConfigurationSource;
+import com.netflix.config.sources.DynamoDbConfigurationSource;
+
+@Configuration
+public class ApplicationPropertiesConfigurations {
+
+ @Autowired
+ AmazonDynamoDB amazonDynamoDb;
+
+ @Autowired
+ private ArchaiusPropertiesRepository repository;
+
+ @Bean
+ public AbstractConfiguration addApplicationPropertiesSource() {
+ // Normally, the DB Table would be already created and populated.
+ // In this case, we'll do it just before creating the archaius config source that uses it
+ initDatabase();
+ PolledConfigurationSource source = new DynamoDbConfigurationSource(amazonDynamoDb);
+ return new DynamicConfiguration(source, new FixedDelayPollingScheduler());
+ }
+
+ private void initDatabase() {
+ // Create the table
+ DynamoDBMapper mapper = new DynamoDBMapper(amazonDynamoDb);
+ CreateTableRequest tableRequest = mapper.generateCreateTableRequest(ArchaiusProperties.class);
+ tableRequest.setProvisionedThroughput(new ProvisionedThroughput(1L, 1L));
+ TableUtils.createTableIfNotExists(amazonDynamoDb, tableRequest);
+
+ // Populate the table
+ ArchaiusProperties property = new ArchaiusProperties("baeldung.archaius.properties.one", "one FROM:dynamoDB");
+ ArchaiusProperties property3 = new ArchaiusProperties("baeldung.archaius.properties.three", "three FROM:dynamoDB");
+ repository.saveAll(Arrays.asList(property, property3));
+ }
+}
diff --git a/spring-cloud/spring-cloud-archaius/dynamodb-config/src/main/java/com/baeldung/spring/cloud/archaius/dynamosources/config/DynamoDbConfiguration.java b/spring-cloud/spring-cloud-archaius/dynamodb-config/src/main/java/com/baeldung/spring/cloud/archaius/dynamosources/config/DynamoDbConfiguration.java
new file mode 100644
index 0000000000..8f12051a7f
--- /dev/null
+++ b/spring-cloud/spring-cloud-archaius/dynamodb-config/src/main/java/com/baeldung/spring/cloud/archaius/dynamosources/config/DynamoDbConfiguration.java
@@ -0,0 +1,46 @@
+package com.baeldung.spring.cloud.archaius.dynamosources.config;
+
+import org.socialsignin.spring.data.dynamodb.repository.config.EnableDynamoDBRepositories;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import com.amazonaws.auth.AWSCredentialsProvider;
+import com.amazonaws.auth.AWSStaticCredentialsProvider;
+import com.amazonaws.auth.BasicAWSCredentials;
+import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration;
+import com.amazonaws.regions.Regions;
+import com.amazonaws.services.dynamodbv2.AmazonDynamoDB;
+import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClientBuilder;
+
+@Configuration
+@EnableDynamoDBRepositories(basePackages = "com.baeldung.spring.cloud.archaius.dynamosources.dynamodb")
+public class DynamoDbConfiguration {
+
+ @Value("${amazon.dynamodb.endpoint}")
+ private String amazonDynamoDBEndpoint;
+
+ @Value("${aws.accessKeyId}")
+ private String amazonDynamoDBAccessKeyId;
+
+ @Value("${aws.secretKey}")
+ private String amazonDynamoDBSecretKey;
+
+ @Bean
+ public AmazonDynamoDB amazonDynamoDB() {
+ AmazonDynamoDB amazonDynamoDB = AmazonDynamoDBClientBuilder.standard()
+ .withCredentials(amazonAWSCredentials())
+ .withEndpointConfiguration(setupEndpointConfiguration())
+ .build();
+
+ return amazonDynamoDB;
+ }
+
+ private AWSCredentialsProvider amazonAWSCredentials() {
+ return new AWSStaticCredentialsProvider(new BasicAWSCredentials(amazonDynamoDBAccessKeyId, amazonDynamoDBSecretKey));
+ }
+
+ private EndpointConfiguration setupEndpointConfiguration() {
+ return new EndpointConfiguration(amazonDynamoDBEndpoint, Regions.DEFAULT_REGION.getName());
+ }
+}
diff --git a/spring-cloud/spring-cloud-archaius/dynamodb-config/src/main/java/com/baeldung/spring/cloud/archaius/dynamosources/controller/ConfigPropertiesController.java b/spring-cloud/spring-cloud-archaius/dynamodb-config/src/main/java/com/baeldung/spring/cloud/archaius/dynamosources/controller/ConfigPropertiesController.java
new file mode 100644
index 0000000000..2ac5055fe3
--- /dev/null
+++ b/spring-cloud/spring-cloud-archaius/dynamodb-config/src/main/java/com/baeldung/spring/cloud/archaius/dynamosources/controller/ConfigPropertiesController.java
@@ -0,0 +1,32 @@
+package com.baeldung.spring.cloud.archaius.dynamosources.controller;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.netflix.config.DynamicPropertyFactory;
+import com.netflix.config.DynamicStringProperty;
+
+@RestController
+public class ConfigPropertiesController {
+
+ private DynamicStringProperty propertyOneWithDynamic = DynamicPropertyFactory.getInstance()
+ .getStringProperty("baeldung.archaius.properties.one", "not found!");
+
+ private DynamicStringProperty propertyTwoWithDynamic = DynamicPropertyFactory.getInstance()
+ .getStringProperty("baeldung.archaius.properties.two", "not found!");
+
+ private DynamicStringProperty propertyThreeWithDynamic = DynamicPropertyFactory.getInstance()
+ .getStringProperty("baeldung.archaius.properties.three", "not found!");
+
+ @GetMapping("/properties-from-dynamic")
+ public Map getPropertiesFromDynamic() {
+ Map properties = new HashMap<>();
+ properties.put(propertyOneWithDynamic.getName(), propertyOneWithDynamic.get());
+ properties.put(propertyTwoWithDynamic.getName(), propertyTwoWithDynamic.get());
+ properties.put(propertyThreeWithDynamic.getName(), propertyThreeWithDynamic.get());
+ return properties;
+ }
+}
diff --git a/spring-cloud/spring-cloud-archaius/dynamodb-config/src/main/java/com/baeldung/spring/cloud/archaius/dynamosources/dynamodb/ArchaiusProperties.java b/spring-cloud/spring-cloud-archaius/dynamodb-config/src/main/java/com/baeldung/spring/cloud/archaius/dynamosources/dynamodb/ArchaiusProperties.java
new file mode 100644
index 0000000000..016f8433cf
--- /dev/null
+++ b/spring-cloud/spring-cloud-archaius/dynamodb-config/src/main/java/com/baeldung/spring/cloud/archaius/dynamosources/dynamodb/ArchaiusProperties.java
@@ -0,0 +1,23 @@
+package com.baeldung.spring.cloud.archaius.dynamosources.dynamodb;
+
+import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBAttribute;
+import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBHashKey;
+import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBTable;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+@AllArgsConstructor
+@DynamoDBTable(tableName = "archaiusProperties")
+public class ArchaiusProperties {
+
+ @DynamoDBHashKey
+ @DynamoDBAttribute
+ private String key;
+
+ @DynamoDBAttribute
+ private String value;
+}
diff --git a/spring-cloud/spring-cloud-archaius/dynamodb-config/src/main/java/com/baeldung/spring/cloud/archaius/dynamosources/dynamodb/ArchaiusPropertiesRepository.java b/spring-cloud/spring-cloud-archaius/dynamodb-config/src/main/java/com/baeldung/spring/cloud/archaius/dynamosources/dynamodb/ArchaiusPropertiesRepository.java
new file mode 100644
index 0000000000..fbcc953261
--- /dev/null
+++ b/spring-cloud/spring-cloud-archaius/dynamodb-config/src/main/java/com/baeldung/spring/cloud/archaius/dynamosources/dynamodb/ArchaiusPropertiesRepository.java
@@ -0,0 +1,7 @@
+package com.baeldung.spring.cloud.archaius.dynamosources.dynamodb;
+
+import org.springframework.data.repository.CrudRepository;
+
+public interface ArchaiusPropertiesRepository extends CrudRepository {
+
+}
diff --git a/spring-cloud/spring-cloud-archaius/dynamodb-config/src/main/resources/application.properties b/spring-cloud/spring-cloud-archaius/dynamodb-config/src/main/resources/application.properties
new file mode 100644
index 0000000000..3823d2685f
--- /dev/null
+++ b/spring-cloud/spring-cloud-archaius/dynamodb-config/src/main/resources/application.properties
@@ -0,0 +1,6 @@
+server.port=8082
+baeldung.archaius.properties.one=one FROM:application.properties
+baeldung.archaius.properties.two=two FROM:application.properties
+amazon.dynamodb.endpoint=http://localhost:8000/
+aws.accessKeyId=key
+aws.secretKey=key2
diff --git a/spring-cloud/spring-cloud-archaius/dynamodb-config/src/test/java/com/baeldung/spring/cloud/archaius/dynamosources/ArchaiusDynamoDbLiveTest.java b/spring-cloud/spring-cloud-archaius/dynamodb-config/src/test/java/com/baeldung/spring/cloud/archaius/dynamosources/ArchaiusDynamoDbLiveTest.java
new file mode 100644
index 0000000000..3802cb99cd
--- /dev/null
+++ b/spring-cloud/spring-cloud-archaius/dynamodb-config/src/test/java/com/baeldung/spring/cloud/archaius/dynamosources/ArchaiusDynamoDbLiveTest.java
@@ -0,0 +1,53 @@
+package com.baeldung.spring.cloud.archaius.dynamosources;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.web.client.TestRestTemplate;
+import org.springframework.context.ConfigurableApplicationContext;
+import org.springframework.core.ParameterizedTypeReference;
+import org.springframework.http.HttpMethod;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+public class ArchaiusDynamoDbLiveTest {
+
+ private static final String BASE_URL = "http://localhost:8082";
+
+ private static final String DYNAMIC_PROPERTIES_URL = "/properties-from-dynamic";
+ private static final Map EXPECTED_ARCHAIUS_PROPERTIES = createExpectedArchaiusProperties();
+
+ private static Map createExpectedArchaiusProperties() {
+ Map map = new HashMap<>();
+ map.put("baeldung.archaius.properties.one", "one FROM:dynamoDB");
+ map.put("baeldung.archaius.properties.two", "two FROM:application.properties");
+ map.put("baeldung.archaius.properties.three", "three FROM:dynamoDB");
+ return map;
+ }
+
+ @Autowired
+ ConfigurableApplicationContext context;
+
+ @Autowired
+ private TestRestTemplate template;
+
+ private Map exchangeAsMap(String uri, ParameterizedTypeReference
-
- 1.2.2.RELEASE
- 1.4.2.RELEASE
-
diff --git a/spring-cloud/spring-cloud-config/client/src/test/java/com/baeldung/spring/cloud/config/client/ConfigClientLiveTest.java b/spring-cloud/spring-cloud-config/client/src/test/java/org/baeldung/SpringContextIntegrationTest.java
similarity index 76%
rename from spring-cloud/spring-cloud-config/client/src/test/java/com/baeldung/spring/cloud/config/client/ConfigClientLiveTest.java
rename to spring-cloud/spring-cloud-config/client/src/test/java/org/baeldung/SpringContextIntegrationTest.java
index 9bca369c64..d727772cf9 100644
--- a/spring-cloud/spring-cloud-config/client/src/test/java/com/baeldung/spring/cloud/config/client/ConfigClientLiveTest.java
+++ b/spring-cloud/spring-cloud-config/client/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -1,4 +1,4 @@
-package com.baeldung.spring.cloud.config.client;
+package org.baeldung;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -6,10 +6,12 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
+import com.baeldung.spring.cloud.config.client.ConfigClient;
+
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = ConfigClient.class)
@WebAppConfiguration
-public class ConfigClientLiveTest {
+public class SpringContextIntegrationTest {
@Test
public void contextLoads() {
}
diff --git a/spring-cloud/spring-cloud-config/server/pom.xml b/spring-cloud/spring-cloud-config/server/pom.xml
index 61b27244b6..7bbb903cf9 100644
--- a/spring-cloud/spring-cloud-config/server/pom.xml
+++ b/spring-cloud/spring-cloud-config/server/pom.xml
@@ -15,23 +15,19 @@
org.springframework.cloud
spring-cloud-config-server
- ${spring-cloud-config-server.version}
-
+
org.springframework.boot
spring-boot-starter-security
- ${org.springframework.boot.version}
-
+
org.springframework.boot
spring-boot-starter-web
- ${org.springframework.boot.version}
-
+
org.springframework.boot
spring-boot-starter-test
- ${org.springframework.boot.version}
test
@@ -41,14 +37,8 @@
org.springframework.boot
spring-boot-maven-plugin
- ${org.springframework.boot.version}
-
+
-
- 1.2.2.RELEASE
- 1.4.2.RELEASE
-
-
diff --git a/spring-cloud/spring-cloud-config/server/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-config/server/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..cd30392d4f
--- /dev/null
+++ b/spring-cloud/spring-cloud-config/server/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,18 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+
+import com.baeldung.spring.cloud.config.server.ConfigServer;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@SpringBootTest(classes = ConfigServer.class)
+@WebAppConfiguration
+public class SpringContextIntegrationTest {
+ @Test
+ public void contextLoads() {
+ }
+}
diff --git a/spring-cloud/spring-cloud-connectors-heroku/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-connectors-heroku/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..a705f18bc6
--- /dev/null
+++ b/spring-cloud/spring-cloud-connectors-heroku/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.spring.cloud.connectors.heroku.ConnectorsHerokuApplication;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = ConnectorsHerokuApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-cloud/spring-cloud-consul/pom.xml b/spring-cloud/spring-cloud-consul/pom.xml
index 8181832bea..2a2714d597 100644
--- a/spring-cloud/spring-cloud-consul/pom.xml
+++ b/spring-cloud/spring-cloud-consul/pom.xml
@@ -25,6 +25,13 @@
spring-cloud-starter-consul-config
${spring-cloud-starter-consul.version}
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ 1.5.10.RELEASE
+ test
+
diff --git a/spring-cloud/spring-cloud-consul/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-consul/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..6290ccc03e
--- /dev/null
+++ b/spring-cloud/spring-cloud-consul/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,20 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.spring.cloud.consul.discovery.DiscoveryClientApplication;
+import com.baeldung.spring.cloud.consul.health.ServiceDiscoveryApplication;
+import com.baeldung.spring.cloud.consul.properties.DistributedPropertiesApplication;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = { DiscoveryClientApplication.class, ServiceDiscoveryApplication.class,
+ DistributedPropertiesApplication.class })
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-cloud/spring-cloud-contract/spring-cloud-contract-consumer/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-contract/spring-cloud-contract-consumer/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..1c1192cc3f
--- /dev/null
+++ b/spring-cloud/spring-cloud-contract/spring-cloud-contract-consumer/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.spring.cloud.springcloudcontractconsumer.SpringCloudContractConsumerApplication;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = SpringCloudContractConsumerApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-cloud/spring-cloud-contract/spring-cloud-contract-producer/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-contract/spring-cloud-contract-producer/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..2b6703ae5c
--- /dev/null
+++ b/spring-cloud/spring-cloud-contract/spring-cloud-contract-producer/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.spring.cloud.springcloudcontractproducer.SpringCloudContractProducerApplication;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = SpringCloudContractProducerApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/pom.xml b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/pom.xml
index c7822d51ee..8bc51adcab 100644
--- a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/pom.xml
+++ b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/pom.xml
@@ -28,6 +28,24 @@
spring-boot-starter-web
${spring-boot-starter-web.version}
+
+ org.springframework.boot
+ spring-boot-starter-test
+ 1.5.10.RELEASE
+ test
+
+
+ org.springframework.boot
+ spring-boot-test
+ 1.5.10.RELEASE
+ test
+
+
+ org.springframework
+ spring-test
+ 4.0.5.RELEASE
+ test
+
diff --git a/spring-cloud/spring-cloud-gateway/pom.xml b/spring-cloud/spring-cloud-gateway/pom.xml
index 8babbff274..4d8b57d4cf 100644
--- a/spring-cloud/spring-cloud-gateway/pom.xml
+++ b/spring-cloud/spring-cloud-gateway/pom.xml
@@ -38,6 +38,11 @@
org.springframework.boot
spring-boot-starter-webflux
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
org.hibernate
diff --git a/spring-cloud/spring-cloud-gateway/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-gateway/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..f2addf5c1a
--- /dev/null
+++ b/spring-cloud/spring-cloud-gateway/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.spring.cloud.GatewayApplication;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = GatewayApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/pom.xml b/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/pom.xml
index ce1e1856ed..11b9275b46 100644
--- a/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/pom.xml
+++ b/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/pom.xml
@@ -24,33 +24,32 @@
org.springframework.cloud
spring-cloud-starter-hystrix
- ${spring-cloud-starter-hystrix.version}
org.springframework.cloud
spring-cloud-starter-hystrix-dashboard
- ${spring-cloud-starter-hystrix.version}
org.springframework.cloud
spring-cloud-starter-feign
- ${spring-cloud-starter-feign.version}
org.springframework.boot
spring-boot-starter-web
- ${spring-boot-starter-web.version}
org.springframework.boot
spring-boot-starter-thymeleaf
- ${spring-boot-starter-web.version}
org.springframework.boot
spring-boot-starter-actuator
- ${spring-boot-starter-web.version}
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
diff --git a/spring-cloud/spring-cloud-kubernetes/demo-backend/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-kubernetes/demo-backend/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..ce57cf5052
--- /dev/null
+++ b/spring-cloud/spring-cloud-kubernetes/demo-backend/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,18 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.spring.cloud.kubernetes.backend.KubernetesBackendApplication;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = KubernetesBackendApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void contextLoads() {
+ }
+
+}
diff --git a/spring-cloud/spring-cloud-kubernetes/demo-frontend/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-kubernetes/demo-frontend/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..f7e9e35540
--- /dev/null
+++ b/spring-cloud/spring-cloud-kubernetes/demo-frontend/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,18 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.spring.cloud.kubernetes.frontend.KubernetesFrontendApplication;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = KubernetesFrontendApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void contextLoads() {
+ }
+
+}
diff --git a/spring-cloud/spring-cloud-rest/spring-cloud-rest-books-api/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-rest/spring-cloud-rest-books-api/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..24e758ff82
--- /dev/null
+++ b/spring-cloud/spring-cloud-rest/spring-cloud-rest-books-api/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,15 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = BooksApiApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-boot-bootstrap/src/test/java/org/baeldung/SpringBootBootstrapApplicationIntegrationTest.java b/spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java
similarity index 72%
rename from spring-boot-bootstrap/src/test/java/org/baeldung/SpringBootBootstrapApplicationIntegrationTest.java
rename to spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java
index 7c54288665..28c6e67377 100644
--- a/spring-boot-bootstrap/src/test/java/org/baeldung/SpringBootBootstrapApplicationIntegrationTest.java
+++ b/spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -6,10 +6,10 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
-@SpringBootTest
-public class SpringBootBootstrapApplicationIntegrationTest {
-
+@SpringBootTest(classes = SpringCloudRestConfigApplication.class)
+public class SpringContextIntegrationTest {
@Test
public void contextLoads() {
}
+
}
diff --git a/spring-cloud/spring-cloud-rest/spring-cloud-rest-discovery-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-rest/spring-cloud-rest-discovery-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..e22359a016
--- /dev/null
+++ b/spring-cloud/spring-cloud-rest/spring-cloud-rest-discovery-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,15 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = SpringCloudRestServerApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-cloud/spring-cloud-rest/spring-cloud-rest-reviews-api/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-rest/spring-cloud-rest-reviews-api/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..07d7db0505
--- /dev/null
+++ b/spring-cloud/spring-cloud-rest/spring-cloud-rest-reviews-api/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,15 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = BookReviewsApiApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-cloud/spring-cloud-ribbon-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-ribbon-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..baa1b12eff
--- /dev/null
+++ b/spring-cloud/spring-cloud-ribbon-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.spring.cloud.ribbon.client.ServerLocationApp;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = ServerLocationApp.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-cloud-bus/spring-cloud-config-client/src/test/java/com/baeldung/SpringCloudConfigClientLiveTest.java b/spring-cloud/spring-cloud-security/auth-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java
similarity index 64%
rename from spring-cloud-bus/spring-cloud-config-client/src/test/java/com/baeldung/SpringCloudConfigClientLiveTest.java
rename to spring-cloud/spring-cloud-security/auth-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java
index 364368713a..60a208d6f4 100644
--- a/spring-cloud-bus/spring-cloud-config-client/src/test/java/com/baeldung/SpringCloudConfigClientLiveTest.java
+++ b/spring-cloud/spring-cloud-security/auth-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -1,13 +1,15 @@
-package com.baeldung;
+package org.baeldung;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
+import com.baeldung.CloudSite;
+
@RunWith(SpringRunner.class)
-@SpringBootTest
-public class SpringCloudConfigClientLiveTest {
+@SpringBootTest(classes = CloudSite.class)
+public class SpringContextIntegrationTest {
@Test
public void contextLoads() {
diff --git a/spring-cloud-data-flow/time-processor/src/test/java/org/baeldung/spring/cloud/TimeProcessorApplicationIntegrationTest.java b/spring-cloud/spring-cloud-security/auth-resource/src/test/java/org/baeldung/SpringContextIntegrationTest.java
similarity index 64%
rename from spring-cloud-data-flow/time-processor/src/test/java/org/baeldung/spring/cloud/TimeProcessorApplicationIntegrationTest.java
rename to spring-cloud/spring-cloud-security/auth-resource/src/test/java/org/baeldung/SpringContextIntegrationTest.java
index 9bd0fd8c24..4d4c312bce 100644
--- a/spring-cloud-data-flow/time-processor/src/test/java/org/baeldung/spring/cloud/TimeProcessorApplicationIntegrationTest.java
+++ b/spring-cloud/spring-cloud-security/auth-resource/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -1,13 +1,15 @@
-package org.baeldung.spring.cloud;
+package org.baeldung;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
+import com.baeldung.Application;
+
@RunWith(SpringRunner.class)
-@SpringBootTest
-public class TimeProcessorApplicationIntegrationTest {
+@SpringBootTest(classes = Application.class)
+public class SpringContextIntegrationTest {
@Test
public void contextLoads() {
diff --git a/spring-cloud-data-flow/data-flow-shell/src/test/java/org/baeldung/spring/cloud/DataFlowShellApplicationIntegrationTest.java b/spring-cloud/spring-cloud-security/auth-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java
similarity index 64%
rename from spring-cloud-data-flow/data-flow-shell/src/test/java/org/baeldung/spring/cloud/DataFlowShellApplicationIntegrationTest.java
rename to spring-cloud/spring-cloud-security/auth-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java
index 5ab3292388..63a89ac45c 100644
--- a/spring-cloud-data-flow/data-flow-shell/src/test/java/org/baeldung/spring/cloud/DataFlowShellApplicationIntegrationTest.java
+++ b/spring-cloud/spring-cloud-security/auth-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -1,13 +1,15 @@
-package org.baeldung.spring.cloud;
+package org.baeldung;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
+import com.baeldung.AuthServer;
+
@RunWith(SpringRunner.class)
-@SpringBootTest
-public class DataFlowShellApplicationIntegrationTest {
+@SpringBootTest(classes = AuthServer.class)
+public class SpringContextIntegrationTest {
@Test
public void contextLoads() {
diff --git a/spring-cloud/spring-cloud-stream-starters/twitterhdfs/pom.xml b/spring-cloud/spring-cloud-stream-starters/twitterhdfs/pom.xml
index bf725da5cf..6f582576d8 100644
--- a/spring-cloud/spring-cloud-stream-starters/twitterhdfs/pom.xml
+++ b/spring-cloud/spring-cloud-stream-starters/twitterhdfs/pom.xml
@@ -1,11 +1,11 @@
-
-
+
+
4.0.0
com.baeldung.twitterhdfs
twitterhdfs
jar
- 1.0.0
+ 1.0.0-SNAPSHOT
twitterhdfs
@@ -45,9 +45,6 @@
- UTF-8
- UTF-8
- 1.8
1.3.1.RELEASE
diff --git a/spring-cloud/spring-cloud-stream-starters/twitterhdfs/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-stream-starters/twitterhdfs/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..3d370e7b48
--- /dev/null
+++ b/spring-cloud/spring-cloud-stream-starters/twitterhdfs/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,20 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.twitterhdfs.aggregate.AggregateApp;
+import com.baeldung.twitterhdfs.processor.ProcessorApp;
+import com.baeldung.twitterhdfs.sink.SinkApp;
+import com.baeldung.twitterhdfs.source.SourceApp;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = {AggregateApp.class, ProcessorApp.class, SinkApp.class, SourceApp.class})
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-cloud/spring-cloud-stream/spring-cloud-stream-rabbit/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-stream/spring-cloud-stream-rabbit/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..70c5f46aa1
--- /dev/null
+++ b/spring-cloud/spring-cloud-stream/spring-cloud-stream-rabbit/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.spring.cloud.stream.rabbit.MultipleOutputsServiceApplication;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = MultipleOutputsServiceApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-cloud/spring-cloud-task/pom.xml b/spring-cloud/spring-cloud-task/pom.xml
new file mode 100644
index 0000000000..ef76d464bc
--- /dev/null
+++ b/spring-cloud/spring-cloud-task/pom.xml
@@ -0,0 +1,46 @@
+
+
+ 4.0.0
+ com.baeldung.spring.cloud
+ spring-cloud-task
+ 1.0.0-SNAPSHOT
+ pom
+
+
+ parent-boot-1
+ com.baeldung
+ 0.0.1-SNAPSHOT
+ ../../parent-boot-1
+
+
+
+ springcloudtaskbatch
+ springcloudtasksink
+
+
+
+
+
+ org.springframework.cloud
+ spring-cloud-task-dependencies
+ ${spring-cloud-task.version}
+ pom
+ import
+
+
+ org.springframework.cloud
+ spring-cloud-dependencies
+ ${spring-cloud-dependencies.version}
+ pom
+ import
+
+
+
+
+
+ Brixton.SR7
+ 1.2.2.RELEASE
+
+
+
diff --git a/spring-cloud/spring-cloud-task/springcloudtaskbatch/pom.xml b/spring-cloud/spring-cloud-task/springcloudtaskbatch/pom.xml
index f97d78099f..89c9318c4e 100644
--- a/spring-cloud/spring-cloud-task/springcloudtaskbatch/pom.xml
+++ b/spring-cloud/spring-cloud-task/springcloudtaskbatch/pom.xml
@@ -3,14 +3,12 @@
4.0.0
org.baeldung.cloud
springcloudtaskbatch
- 0.0.1-SNAPSHOT
- springcloudtaskbatch
+ springcloudtaskbatch
- parent-boot-1
- com.baeldung
- 0.0.1-SNAPSHOT
- ../../../parent-boot-1
+ spring-cloud-task
+ com.baeldung.spring.cloud
+ 1.0.0-SNAPSHOT
@@ -47,18 +45,6 @@
-
-
-
- org.springframework.cloud
- spring-cloud-task-dependencies
- ${spring-cloud-task.version}
- pom
- import
-
-
-
-
@@ -70,10 +56,6 @@
com.baeldung.TaskDemo
- UTF-8
- UTF-8
- 1.8
- 1.2.2.RELEASE
diff --git a/spring-cloud/spring-cloud-task/springcloudtaskbatch/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-task/springcloudtaskbatch/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..4b5aff2db8
--- /dev/null
+++ b/spring-cloud/spring-cloud-task/springcloudtaskbatch/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import com.baeldung.task.JobConfiguration;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = JobConfiguration.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-cloud/spring-cloud-task/springcloudtasksink/pom.xml b/spring-cloud/spring-cloud-task/springcloudtasksink/pom.xml
index fdcbabdd51..ca0de342a9 100644
--- a/spring-cloud/spring-cloud-task/springcloudtasksink/pom.xml
+++ b/spring-cloud/spring-cloud-task/springcloudtasksink/pom.xml
@@ -2,19 +2,15 @@
4.0.0
-
- com.baeldung
SpringCloudTaskSink
- 0.0.1-SNAPSHOT
jar
SpringCloudTaskSink
Demo project for Spring Boot
-
- parent-boot-1
- com.baeldung
- 0.0.1-SNAPSHOT
- ../../../parent-boot-1
+
+ spring-cloud-task
+ com.baeldung.spring.cloud
+ 1.0.0-SNAPSHOT
@@ -36,11 +32,6 @@
spring-boot-starter-test
test
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
org.springframework.cloud
@@ -49,25 +40,6 @@
-
-
-
- org.springframework.cloud
- spring-cloud-task-dependencies
- ${spring-cloud-task.version}
- pom
- import
-
-
- org.springframework.cloud
- spring-cloud-dependencies
- ${spring-cloud.version}
- pom
- import
-
-
-
-
@@ -78,11 +50,7 @@
- UTF-8
- UTF-8
- 1.8
1.2.2.RELEASE
- Edgware.SR2
1.3.0.RELEASE
diff --git a/spring-cloud/spring-cloud-task/springcloudtasksink/src/test/java/com/baeldung/SpringCloudTaskFinal/SpringCloudTaskSinkApplicationTests.java b/spring-cloud/spring-cloud-task/springcloudtasksink/src/test/java/com/baeldung/SpringCloudTaskFinal/SpringCloudTaskSinkApplicationIntegrationTest.java
similarity index 97%
rename from spring-cloud/spring-cloud-task/springcloudtasksink/src/test/java/com/baeldung/SpringCloudTaskFinal/SpringCloudTaskSinkApplicationTests.java
rename to spring-cloud/spring-cloud-task/springcloudtasksink/src/test/java/com/baeldung/SpringCloudTaskFinal/SpringCloudTaskSinkApplicationIntegrationTest.java
index 1f47eada14..104c04138e 100644
--- a/spring-cloud/spring-cloud-task/springcloudtasksink/src/test/java/com/baeldung/SpringCloudTaskFinal/SpringCloudTaskSinkApplicationTests.java
+++ b/spring-cloud/spring-cloud-task/springcloudtasksink/src/test/java/com/baeldung/SpringCloudTaskFinal/SpringCloudTaskSinkApplicationIntegrationTest.java
@@ -24,7 +24,7 @@ import static org.mockito.Mockito.verify;
@RunWith(SpringRunner.class)
@SpringBootTest(
classes = SpringCloudTaskSinkApplication.class)
-public class SpringCloudTaskSinkApplicationTests {
+public class SpringCloudTaskSinkApplicationIntegrationTest {
@Autowired
ApplicationContext context;
diff --git a/spring-cloud/spring-cloud-task/springcloudtasksink/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-task/springcloudtasksink/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..b8dd03d65f
--- /dev/null
+++ b/spring-cloud/spring-cloud-task/springcloudtasksink/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.SpringCloudTaskFinal.SpringCloudTaskSinkApplication;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = SpringCloudTaskSinkApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-cloud/spring-cloud-zookeeper/Greeting/src/test/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-zookeeper/Greeting/src/test/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..0f544b3ed1
--- /dev/null
+++ b/spring-cloud/spring-cloud-zookeeper/Greeting/src/test/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.spring.cloud.ribbon.client.ServerLocationApp;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = GreetingApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-core/src/main/java/com/baeldung/definition/Config.java b/spring-core/src/main/java/com/baeldung/definition/Config.java
new file mode 100644
index 0000000000..126e6259ca
--- /dev/null
+++ b/spring-core/src/main/java/com/baeldung/definition/Config.java
@@ -0,0 +1,16 @@
+package com.baeldung.definition;
+
+import com.baeldung.definition.domain.Address;
+import com.baeldung.definition.domain.Company;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+@ComponentScan(basePackageClasses = Company.class)
+public class Config {
+ @Bean
+ public Address getAddress() {
+ return new Address("High Street", 1000);
+ }
+}
diff --git a/spring-core/src/main/java/com/baeldung/definition/domain/Address.java b/spring-core/src/main/java/com/baeldung/definition/domain/Address.java
new file mode 100644
index 0000000000..91be18398e
--- /dev/null
+++ b/spring-core/src/main/java/com/baeldung/definition/domain/Address.java
@@ -0,0 +1,14 @@
+package com.baeldung.definition.domain;
+
+import lombok.Data;
+
+@Data
+public class Address {
+ private String street;
+ private int number;
+
+ public Address(String street, int number) {
+ this.street = street;
+ this.number = number;
+ }
+}
diff --git a/spring-core/src/main/java/com/baeldung/definition/domain/Company.java b/spring-core/src/main/java/com/baeldung/definition/domain/Company.java
new file mode 100644
index 0000000000..eabde8afdf
--- /dev/null
+++ b/spring-core/src/main/java/com/baeldung/definition/domain/Company.java
@@ -0,0 +1,14 @@
+package com.baeldung.definition.domain;
+
+import lombok.Data;
+import org.springframework.stereotype.Component;
+
+@Data
+@Component
+public class Company {
+ private Address address;
+
+ public Company(Address address) {
+ this.address = address;
+ }
+}
diff --git a/spring-core/src/test/java/com/baeldung/definition/SpringBeanIntegrationTest.java b/spring-core/src/test/java/com/baeldung/definition/SpringBeanIntegrationTest.java
new file mode 100644
index 0000000000..0057611308
--- /dev/null
+++ b/spring-core/src/test/java/com/baeldung/definition/SpringBeanIntegrationTest.java
@@ -0,0 +1,18 @@
+package com.baeldung.definition;
+
+import com.baeldung.definition.domain.Company;
+import org.junit.Test;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.annotation.AnnotationConfigApplicationContext;
+
+import static org.junit.Assert.assertEquals;
+
+public class SpringBeanIntegrationTest {
+ @Test
+ public void whenUsingIoC_thenDependenciesAreInjected() {
+ ApplicationContext context = new AnnotationConfigApplicationContext(Config.class);
+ Company company = context.getBean("company", Company.class);
+ assertEquals("High Street", company.getAddress().getStreet());
+ assertEquals(1000, company.getAddress().getNumber());
+ }
+}
diff --git a/spring-cucumber/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cucumber/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..80efd86f13
--- /dev/null
+++ b/spring-cucumber/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.SpringDemoApplication;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = SpringDemoApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-custom-aop/pom.xml b/spring-custom-aop/pom.xml
index fd5f87a476..f0b1dbb5ac 100644
--- a/spring-custom-aop/pom.xml
+++ b/spring-custom-aop/pom.xml
@@ -149,6 +149,7 @@
3.1.7
8.5.11
18.0
+ 8.0.43
diff --git a/spring-custom-aop/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-custom-aop/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..0384c67e26
--- /dev/null
+++ b/spring-custom-aop/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,25 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.annotation.servletcomponentscan.SpringBootAnnotatedApp;
+import com.baeldung.annotation.servletcomponentscan.SpringBootPlainApp;
+import com.baeldung.git.CommitIdApplication;
+import com.baeldung.internationalization.InternationalizationApp;
+import com.baeldung.intro.App;
+import com.baeldung.servlets.ApplicationMain;
+import com.baeldung.webjar.WebjarsdemoApplication;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = { SpringBootAnnotatedApp.class, SpringBootPlainApp.class, CommitIdApplication.class,
+ InternationalizationApp.class, App.class, ApplicationMain.class, Application.class,
+ WebjarsdemoApplication.class })
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-data-couchbase-2/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-data-couchbase-2/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..9c9d58dd0b
--- /dev/null
+++ b/spring-data-couchbase-2/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,20 @@
+package org.baeldung;
+
+import org.baeldung.spring.data.couchbase2b.MultiBucketCouchbaseConfig;
+import org.baeldung.spring.data.couchbase2b.MultiBucketIntegrationTestConfig;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.TestExecutionListeners;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.support.DependencyInjectionTestExecutionListener;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = { MultiBucketCouchbaseConfig.class, MultiBucketIntegrationTestConfig.class })
+@TestExecutionListeners(listeners = { DependencyInjectionTestExecutionListener.class })
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-data-elasticsearch/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-data-elasticsearch/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..6f45039c96
--- /dev/null
+++ b/spring-data-elasticsearch/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import com.baeldung.spring.data.es.config.Config;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = Config.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-data-jpa/README.md b/spring-data-jpa/README.md
index 20e9d41839..8817020eec 100644
--- a/spring-data-jpa/README.md
+++ b/spring-data-jpa/README.md
@@ -11,6 +11,9 @@
- [Spring Data Java 8 Support](http://www.baeldung.com/spring-data-java-8)
- [A Simple Tagging Implementation with JPA](http://www.baeldung.com/jpa-tagging)
- [Spring Data Composable Repositories](https://www.baeldung.com/spring-data-composable-repositories)
+- [Auditing with JPA, Hibernate, and Spring Data JPA](https://www.baeldung.com/database-auditing-jpa)
+- [Query Entities by Dates and Times with Spring Data JPA](https://www.baeldung.com/spring-data-jpa-query-by-date)
+- [DDD Aggregates and @DomainEvents](https://www.baeldung.com/spring-data-ddd)
### Eclipse Config
After importing the project into Eclipse, you may see the following error:
diff --git a/spring-data-jpa/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-data-jpa/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..0a60412813
--- /dev/null
+++ b/spring-data-jpa/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,22 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.Application;
+import com.baeldung.config.PersistenceConfiguration;
+import com.baeldung.config.PersistenceProductConfiguration;
+import com.baeldung.config.PersistenceUserConfiguration;
+
+@RunWith(SpringRunner.class)
+@DataJpaTest(excludeAutoConfiguration = {PersistenceConfiguration.class, PersistenceUserConfiguration.class, PersistenceProductConfiguration.class})
+@SpringBootTest(classes = Application.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-data-keyvalue/pom.xml b/spring-data-keyvalue/pom.xml
index 6ab928303d..edd8967b97 100644
--- a/spring-data-keyvalue/pom.xml
+++ b/spring-data-keyvalue/pom.xml
@@ -1,9 +1,7 @@
4.0.0
- com.baeldung
spring-data-keyvalue
- 1.0
parent-boot-2
@@ -13,7 +11,6 @@
-
org.springframework.boot
spring-boot-starter
@@ -30,8 +27,4 @@
-
- 2.0.3.RELEASE
-
-
\ No newline at end of file
diff --git a/spring-data-keyvalue/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-data-keyvalue/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..d28bdcbc89
--- /dev/null
+++ b/spring-data-keyvalue/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.spring.data.keyvalue.SpringDataKeyValueApplication;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = SpringDataKeyValueApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-data-mongodb/pom.xml b/spring-data-mongodb/pom.xml
index 332245adc8..ad70d987bb 100644
--- a/spring-data-mongodb/pom.xml
+++ b/spring-data-mongodb/pom.xml
@@ -8,9 +8,9 @@
com.baeldung
- parent-spring-4
+ parent-spring-5
0.0.1-SNAPSHOT
- ../parent-spring-4
+ ../parent-spring-5
@@ -19,6 +19,28 @@
spring-data-mongodb
${org.springframework.data.version}
+
+
+ org.springframework.data
+ spring-data-releasetrain
+ Lovelace-M3
+ pom
+ import
+
+
+
+ org.mongodb
+ mongodb-driver-reactivestreams
+ ${mongodb-reactivestreams.version}
+
+
+
+ io.projectreactor
+ reactor-test
+ ${projectreactor.version}
+ test
+
+
org.springframework
spring-core
@@ -48,6 +70,17 @@
+
+
+ spring-milestones
+ Spring Milestones
+ https://repo.spring.io/milestone
+
+ false
+
+
+
+
@@ -70,10 +103,12 @@
- 1.10.4.RELEASE
- 2.9.0
+ 2.1.0.RELEASE
4.1.4
1.1.3
+ 5.1.0.RELEASE
+ 1.9.2
+ 3.2.0.RELEASE
diff --git a/spring-data-mongodb/src/main/java/com/baeldung/config/MongoConfig.java b/spring-data-mongodb/src/main/java/com/baeldung/config/MongoConfig.java
index 551a9142a6..f1048fa145 100644
--- a/spring-data-mongodb/src/main/java/com/baeldung/config/MongoConfig.java
+++ b/spring-data-mongodb/src/main/java/com/baeldung/config/MongoConfig.java
@@ -1,21 +1,23 @@
package com.baeldung.config;
-import com.mongodb.Mongo;
-import com.mongodb.MongoClient;
-import com.baeldung.converter.UserWriterConverter;
-import com.baeldung.event.CascadeSaveMongoEventListener;
-import com.baeldung.event.UserCascadeSaveMongoEventListener;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.core.convert.converter.Converter;
-import org.springframework.data.mongodb.config.AbstractMongoConfiguration;
-import org.springframework.data.mongodb.core.convert.CustomConversions;
-import org.springframework.data.mongodb.gridfs.GridFsTemplate;
-import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
-
import java.util.ArrayList;
import java.util.List;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.convert.converter.Converter;
+import org.springframework.data.mongodb.MongoDbFactory;
+import org.springframework.data.mongodb.MongoTransactionManager;
+import org.springframework.data.mongodb.config.AbstractMongoConfiguration;
+import org.springframework.data.mongodb.core.convert.MongoCustomConversions;
+import org.springframework.data.mongodb.gridfs.GridFsTemplate;
+import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
+
+import com.baeldung.converter.UserWriterConverter;
+import com.baeldung.event.CascadeSaveMongoEventListener;
+import com.baeldung.event.UserCascadeSaveMongoEventListener;
+import com.mongodb.MongoClient;
+
@Configuration
@EnableMongoRepositories(basePackages = "com.baeldung.repository")
public class MongoConfig extends AbstractMongoConfiguration {
@@ -28,7 +30,7 @@ public class MongoConfig extends AbstractMongoConfiguration {
}
@Override
- public Mongo mongo() throws Exception {
+ public MongoClient mongoClient() {
return new MongoClient("127.0.0.1", 27017);
}
@@ -48,13 +50,19 @@ public class MongoConfig extends AbstractMongoConfiguration {
}
@Override
- public CustomConversions customConversions() {
+ public MongoCustomConversions customConversions() {
converters.add(new UserWriterConverter());
- return new CustomConversions(converters);
+ return new MongoCustomConversions(converters);
}
@Bean
public GridFsTemplate gridFsTemplate() throws Exception {
return new GridFsTemplate(mongoDbFactory(), mappingMongoConverter());
}
+
+ @Bean
+ MongoTransactionManager transactionManager(MongoDbFactory dbFactory) {
+ return new MongoTransactionManager(dbFactory);
+ }
+
}
diff --git a/spring-data-mongodb/src/main/java/com/baeldung/config/MongoReactiveConfig.java b/spring-data-mongodb/src/main/java/com/baeldung/config/MongoReactiveConfig.java
new file mode 100644
index 0000000000..b4042b5550
--- /dev/null
+++ b/spring-data-mongodb/src/main/java/com/baeldung/config/MongoReactiveConfig.java
@@ -0,0 +1,23 @@
+package com.baeldung.config;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.data.mongodb.config.AbstractReactiveMongoConfiguration;
+import org.springframework.data.mongodb.repository.config.EnableReactiveMongoRepositories;
+
+import com.mongodb.reactivestreams.client.MongoClient;
+import com.mongodb.reactivestreams.client.MongoClients;
+
+@Configuration
+@EnableReactiveMongoRepositories(basePackages = "com.baeldung.reactive.repository")
+public class MongoReactiveConfig extends AbstractReactiveMongoConfiguration {
+
+ @Override
+ public MongoClient reactiveMongoClient() {
+ return MongoClients.create();
+ }
+
+ @Override
+ protected String getDatabaseName() {
+ return "reactive";
+ }
+}
diff --git a/spring-data-mongodb/src/main/java/com/baeldung/config/SimpleMongoConfig.java b/spring-data-mongodb/src/main/java/com/baeldung/config/SimpleMongoConfig.java
index 95f192811f..c3ddad5a82 100644
--- a/spring-data-mongodb/src/main/java/com/baeldung/config/SimpleMongoConfig.java
+++ b/spring-data-mongodb/src/main/java/com/baeldung/config/SimpleMongoConfig.java
@@ -1,18 +1,18 @@
package com.baeldung.config;
-import com.mongodb.Mongo;
-import com.mongodb.MongoClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
+import com.mongodb.MongoClient;
+
@Configuration
@EnableMongoRepositories(basePackages = "com.baeldung.repository")
public class SimpleMongoConfig {
@Bean
- public Mongo mongo() throws Exception {
+ public MongoClient mongo() throws Exception {
return new MongoClient("localhost");
}
diff --git a/spring-data-mongodb/src/main/java/com/baeldung/reactive/repository/UserRepository.java b/spring-data-mongodb/src/main/java/com/baeldung/reactive/repository/UserRepository.java
new file mode 100644
index 0000000000..7e754aa680
--- /dev/null
+++ b/spring-data-mongodb/src/main/java/com/baeldung/reactive/repository/UserRepository.java
@@ -0,0 +1,9 @@
+package com.baeldung.reactive.repository;
+
+import org.springframework.data.mongodb.repository.ReactiveMongoRepository;
+
+import com.baeldung.model.User;
+
+
+public interface UserRepository extends ReactiveMongoRepository {
+}
diff --git a/spring-data-mongodb/src/main/java/com/baeldung/repository/UserRepository.java b/spring-data-mongodb/src/main/java/com/baeldung/repository/UserRepository.java
index e9dc0f5c95..4c69d7f9c6 100644
--- a/spring-data-mongodb/src/main/java/com/baeldung/repository/UserRepository.java
+++ b/spring-data-mongodb/src/main/java/com/baeldung/repository/UserRepository.java
@@ -1,13 +1,14 @@
package com.baeldung.repository;
-import com.baeldung.model.User;
-import org.springframework.data.mongodb.repository.MongoRepository;
-import org.springframework.data.mongodb.repository.Query;
-import org.springframework.data.querydsl.QueryDslPredicateExecutor;
-
import java.util.List;
-public interface UserRepository extends MongoRepository, QueryDslPredicateExecutor {
+import org.springframework.data.mongodb.repository.MongoRepository;
+import org.springframework.data.mongodb.repository.Query;
+import org.springframework.data.querydsl.QuerydslPredicateExecutor;
+
+import com.baeldung.model.User;
+
+public interface UserRepository extends MongoRepository, QuerydslPredicateExecutor {
@Query("{ 'name' : ?0 }")
List findUsersByName(String name);
diff --git a/spring-data-mongodb/src/main/resources/mongoConfig.xml b/spring-data-mongodb/src/main/resources/mongoConfig.xml
index 2b32863fb6..324f7f60c2 100644
--- a/spring-data-mongodb/src/main/resources/mongoConfig.xml
+++ b/spring-data-mongodb/src/main/resources/mongoConfig.xml
@@ -3,17 +3,17 @@
xmlns:p="http://www.springframework.org/schema/p" xmlns:mongo="http://www.springframework.org/schema/data/mongo"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
+ http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/data/mongo
- http://www.springframework.org/schema/data/mongo/spring-mongo-1.0.xsd
+ http://www.springframework.org/schema/data/mongo/spring-mongo.xsd
http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-3.2.xsd"
+ http://www.springframework.org/schema/context/spring-context.xsd"
>
-
+
-
+
@@ -27,12 +27,12 @@
-
+
-
+
-
+
diff --git a/spring-data-mongodb/src/test/java/com/baeldung/aggregation/ZipsAggregationLiveTest.java b/spring-data-mongodb/src/test/java/com/baeldung/aggregation/ZipsAggregationLiveTest.java
index a4bea45fcf..1da50d7cb4 100644
--- a/spring-data-mongodb/src/test/java/com/baeldung/aggregation/ZipsAggregationLiveTest.java
+++ b/spring-data-mongodb/src/test/java/com/baeldung/aggregation/ZipsAggregationLiveTest.java
@@ -1,12 +1,24 @@
package com.baeldung.aggregation;
-import com.mongodb.DB;
-import com.mongodb.DBCollection;
-import com.mongodb.DBObject;
-import com.mongodb.MongoClient;
-import com.mongodb.util.JSON;
-import com.baeldung.aggregation.model.StatePopulation;
-import com.baeldung.config.MongoConfig;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.springframework.data.mongodb.core.aggregation.Aggregation.group;
+import static org.springframework.data.mongodb.core.aggregation.Aggregation.limit;
+import static org.springframework.data.mongodb.core.aggregation.Aggregation.match;
+import static org.springframework.data.mongodb.core.aggregation.Aggregation.newAggregation;
+import static org.springframework.data.mongodb.core.aggregation.Aggregation.project;
+import static org.springframework.data.mongodb.core.aggregation.Aggregation.sort;
+
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.StreamSupport;
+
+import org.bson.Document;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -26,23 +38,11 @@ import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import java.io.BufferedReader;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.stream.Collectors;
-import java.util.stream.StreamSupport;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.springframework.data.mongodb.core.aggregation.Aggregation.group;
-import static org.springframework.data.mongodb.core.aggregation.Aggregation.limit;
-import static org.springframework.data.mongodb.core.aggregation.Aggregation.match;
-import static org.springframework.data.mongodb.core.aggregation.Aggregation.newAggregation;
-import static org.springframework.data.mongodb.core.aggregation.Aggregation.project;
-import static org.springframework.data.mongodb.core.aggregation.Aggregation.sort;
+import com.baeldung.aggregation.model.StatePopulation;
+import com.baeldung.config.MongoConfig;
+import com.mongodb.MongoClient;
+import com.mongodb.client.MongoCollection;
+import com.mongodb.client.MongoDatabase;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = MongoConfig.class)
@@ -56,23 +56,22 @@ public class ZipsAggregationLiveTest {
@BeforeClass
public static void setupTests() throws Exception {
client = new MongoClient();
- DB testDB = client.getDB("test");
- DBCollection zipsCollection = testDB.getCollection("zips");
+ MongoDatabase testDB = client.getDatabase("test");
+ MongoCollection zipsCollection = testDB.getCollection("zips");
zipsCollection.drop();
InputStream zipsJsonStream = ZipsAggregationLiveTest.class.getResourceAsStream("/zips.json");
BufferedReader reader = new BufferedReader(new InputStreamReader(zipsJsonStream));
reader.lines()
- .forEach(line -> zipsCollection.insert((DBObject) JSON.parse(line)));
+ .forEach(line -> zipsCollection.insertOne(Document.parse(line)));
reader.close();
-
}
@AfterClass
public static void tearDown() throws Exception {
client = new MongoClient();
- DB testDB = client.getDB("test");
- DBCollection zipsCollection = testDB.getCollection("zips");
+ MongoDatabase testDB = client.getDatabase("test");
+ MongoCollection zipsCollection = testDB.getCollection("zips");
zipsCollection.drop();
client.close();
}
@@ -140,13 +139,13 @@ public class ZipsAggregationLiveTest {
Aggregation aggregation = newAggregation(sumZips, sortByCount, groupFirstAndLast);
- AggregationResults result = mongoTemplate.aggregate(aggregation, "zips", DBObject.class);
- DBObject dbObject = result.getUniqueMappedResult();
+ AggregationResults result = mongoTemplate.aggregate(aggregation, "zips", Document.class);
+ Document document = result.getUniqueMappedResult();
- assertEquals("DC", dbObject.get("minZipState"));
- assertEquals(24, dbObject.get("minZipCount"));
- assertEquals("TX", dbObject.get("maxZipState"));
- assertEquals(1671, dbObject.get("maxZipCount"));
+ assertEquals("DC", document.get("minZipState"));
+ assertEquals(24, document.get("minZipCount"));
+ assertEquals("TX", document.get("maxZipState"));
+ assertEquals(1671, document.get("maxZipCount"));
}
}
diff --git a/spring-data-mongodb/src/test/java/com/baeldung/gridfs/GridFSLiveTest.java b/spring-data-mongodb/src/test/java/com/baeldung/gridfs/GridFSLiveTest.java
index 02485e8517..3a88a1e654 100644
--- a/spring-data-mongodb/src/test/java/com/baeldung/gridfs/GridFSLiveTest.java
+++ b/spring-data-mongodb/src/test/java/com/baeldung/gridfs/GridFSLiveTest.java
@@ -1,8 +1,19 @@
package com.baeldung.gridfs;
-import com.mongodb.BasicDBObject;
-import com.mongodb.DBObject;
-import com.mongodb.gridfs.GridFSDBFile;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.Matchers.nullValue;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.bson.types.ObjectId;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -16,18 +27,9 @@ import org.springframework.data.mongodb.gridfs.GridFsTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.List;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.Matchers.nullValue;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThat;
+import com.mongodb.BasicDBObject;
+import com.mongodb.DBObject;
+import com.mongodb.client.gridfs.model.GridFSFile;
@ContextConfiguration("file:src/main/resources/mongoConfig.xml")
@RunWith(SpringJUnit4ClassRunner.class)
@@ -40,8 +42,9 @@ public class GridFSLiveTest {
@After
public void tearDown() {
- List fileList = gridFsTemplate.find(null);
- for (GridFSDBFile file : fileList) {
+ List fileList = new ArrayList();
+ gridFsTemplate.find(new Query()).into(fileList);
+ for (GridFSFile file : fileList) {
gridFsTemplate.delete(new Query(Criteria.where("filename").is(file.getFilename())));
}
}
@@ -54,7 +57,7 @@ public class GridFSLiveTest {
String id = "";
try {
inputStream = new FileInputStream("src/main/resources/test.png");
- id = gridFsTemplate.store(inputStream, "test.png", "image/png", metaData).getId().toString();
+ id = gridFsTemplate.store(inputStream, "test.png", "image/png", metaData).toString();
} catch (FileNotFoundException ex) {
logger.error("File not found", ex);
} finally {
@@ -75,10 +78,10 @@ public class GridFSLiveTest {
DBObject metaData = new BasicDBObject();
metaData.put("user", "alex");
InputStream inputStream = null;
- String id = "";
+ ObjectId id = null;
try {
inputStream = new FileInputStream("src/main/resources/test.png");
- id = gridFsTemplate.store(inputStream, "test.png", "image/png", metaData).getId().toString();
+ id = gridFsTemplate.store(inputStream, "test.png", "image/png", metaData);
} catch (FileNotFoundException ex) {
logger.error("File not found", ex);
} finally {
@@ -91,22 +94,22 @@ public class GridFSLiveTest {
}
}
- GridFSDBFile gridFSDBFile = gridFsTemplate.findOne(new Query(Criteria.where("_id").is(id)));
+ GridFSFile gridFSFile = gridFsTemplate.findOne(new Query(Criteria.where("_id").is(id)));
- assertNotNull(gridFSDBFile);
- assertNotNull(gridFSDBFile.getInputStream());
- assertThat(gridFSDBFile.numChunks(), is(1));
- assertThat(gridFSDBFile.containsField("filename"), is(true));
- assertThat(gridFSDBFile.get("filename"), is("test.png"));
- assertThat(gridFSDBFile.getId(), is(id));
- assertThat(gridFSDBFile.keySet().size(), is(9));
- assertNotNull(gridFSDBFile.getMD5());
- assertNotNull(gridFSDBFile.getUploadDate());
- assertNull(gridFSDBFile.getAliases());
- assertNotNull(gridFSDBFile.getChunkSize());
- assertThat(gridFSDBFile.getContentType(), is("image/png"));
- assertThat(gridFSDBFile.getFilename(), is("test.png"));
- assertThat(gridFSDBFile.getMetaData().get("user"), is("alex"));
+ assertNotNull(gridFSFile);
+// assertNotNull(gridFSFile.getInputStream());
+// assertThat(gridFSFile.numChunks(), is(1));
+// assertThat(gridFSFile.containsField("filename"), is(true));
+ assertThat(gridFSFile.getFilename(), is("test.png"));
+ assertThat(gridFSFile.getObjectId(), is(id));
+// assertThat(gridFSFile.keySet().size(), is(9));
+// assertNotNull(gridFSFile.getMD5());
+ assertNotNull(gridFSFile.getUploadDate());
+// assertNull(gridFSFile.getAliases());
+ assertNotNull(gridFSFile.getChunkSize());
+ assertThat(gridFSFile.getMetadata().get("_contentType"), is("image/png"));
+ assertThat(gridFSFile.getFilename(), is("test.png"));
+ assertThat(gridFSFile.getMetadata().get("user"), is("alex"));
}
@Test
@@ -133,10 +136,11 @@ public class GridFSLiveTest {
}
}
- List gridFSDBFiles = gridFsTemplate.find(null);
+ List gridFSFiles = new ArrayList();
+ gridFsTemplate.find(new Query()).into(gridFSFiles);
- assertNotNull(gridFSDBFiles);
- assertThat(gridFSDBFiles.size(), is(2));
+ assertNotNull(gridFSFiles);
+ assertThat(gridFSFiles.size(), is(2));
}
@Test
@@ -163,10 +167,11 @@ public class GridFSLiveTest {
}
}
- List gridFSDBFiles = gridFsTemplate.find(new Query(Criteria.where("metadata.user").is("alex")));
+ List gridFSFiles = new ArrayList();
+ gridFsTemplate.find(new Query(Criteria.where("metadata.user").is("alex"))).into(gridFSFiles);
- assertNotNull(gridFSDBFiles);
- assertThat(gridFSDBFiles.size(), is(1));
+ assertNotNull(gridFSFiles);
+ assertThat(gridFSFiles.size(), is(1));
}
@Test
@@ -177,7 +182,7 @@ public class GridFSLiveTest {
String id = "";
try {
inputStream = new FileInputStream("src/main/resources/test.png");
- id = gridFsTemplate.store(inputStream, "test.png", "image/png", metaData).getId().toString();
+ id = gridFsTemplate.store(inputStream, "test.png", "image/png", metaData).toString();
} catch (FileNotFoundException ex) {
logger.error("File not found", ex);
} finally {
@@ -200,10 +205,9 @@ public class GridFSLiveTest {
DBObject metaData = new BasicDBObject();
metaData.put("user", "alex");
InputStream inputStream = null;
- String id = "";
try {
inputStream = new FileInputStream("src/main/resources/test.png");
- id = gridFsTemplate.store(inputStream, "test.png", "image/png", metaData).getId().toString();
+ gridFsTemplate.store(inputStream, "test.png", "image/png", metaData).toString();
} catch (FileNotFoundException ex) {
logger.error("File not found", ex);
} finally {
diff --git a/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/DocumentQueryLiveTest.java b/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/DocumentQueryLiveTest.java
index 7a61f9f98a..d05bde0f1b 100644
--- a/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/DocumentQueryLiveTest.java
+++ b/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/DocumentQueryLiveTest.java
@@ -1,8 +1,11 @@
package com.baeldung.mongotemplate;
-import com.baeldung.config.MongoConfig;
-import com.baeldung.model.EmailAddress;
-import com.baeldung.model.User;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.util.Iterator;
+import java.util.List;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -17,11 +20,9 @@ import org.springframework.data.mongodb.core.query.Query;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import java.util.Iterator;
-import java.util.List;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
+import com.baeldung.config.MongoConfig;
+import com.baeldung.model.EmailAddress;
+import com.baeldung.model.User;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = MongoConfig.class)
@@ -152,7 +153,7 @@ public class DocumentQueryLiveTest {
user.setAge(35);
mongoTemplate.insert(user);
- final Pageable pageableRequest = new PageRequest(0, 2);
+ final Pageable pageableRequest = PageRequest.of(0, 2);
Query query = new Query();
query.with(pageableRequest);
diff --git a/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/MongoTemplateQueryLiveTest.java b/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/MongoTemplateQueryLiveTest.java
index ee1d4f4760..fc78921b75 100644
--- a/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/MongoTemplateQueryLiveTest.java
+++ b/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/MongoTemplateQueryLiveTest.java
@@ -1,8 +1,11 @@
package com.baeldung.mongotemplate;
-import com.baeldung.config.MongoConfig;
-import com.baeldung.model.EmailAddress;
-import com.baeldung.model.User;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.Matchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+import java.util.List;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -20,11 +23,9 @@ import org.springframework.data.mongodb.core.query.Query;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import java.util.List;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.Matchers.nullValue;
-import static org.junit.Assert.assertThat;
+import com.baeldung.config.MongoConfig;
+import com.baeldung.model.EmailAddress;
+import com.baeldung.model.User;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = MongoConfig.class)
@@ -104,7 +105,7 @@ public class MongoTemplateQueryLiveTest {
user.setAge(35);
mongoTemplate.insert(user);
- final Pageable pageableRequest = new PageRequest(0, 2);
+ final Pageable pageableRequest = PageRequest.of(0, 2);
Query query = new Query();
query.with(pageableRequest);
diff --git a/spring-data-mongodb/src/test/java/com/baeldung/repository/UserRepositoryLiveTest.java b/spring-data-mongodb/src/test/java/com/baeldung/repository/UserRepositoryLiveTest.java
index da4e91baec..901610e42d 100644
--- a/spring-data-mongodb/src/test/java/com/baeldung/repository/UserRepositoryLiveTest.java
+++ b/spring-data-mongodb/src/test/java/com/baeldung/repository/UserRepositoryLiveTest.java
@@ -5,8 +5,6 @@ import static org.junit.Assert.assertThat;
import java.util.List;
-import com.baeldung.config.MongoConfig;
-import com.baeldung.model.User;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -22,6 +20,9 @@ import org.springframework.data.mongodb.core.query.Query;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import com.baeldung.config.MongoConfig;
+import com.baeldung.model.User;
+
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = MongoConfig.class)
public class UserRepositoryLiveTest {
@@ -72,8 +73,7 @@ public class UserRepositoryLiveTest {
user.setName("Jim");
userRepository.save(user);
-
- assertThat(mongoOps.findAll(User.class).size(), is(2));
+ assertThat(mongoOps.findAll(User.class).size(), is(1));
}
@Test
@@ -94,7 +94,7 @@ public class UserRepositoryLiveTest {
mongoOps.insert(user);
user = mongoOps.findOne(Query.query(Criteria.where("name").is("Chris")), User.class);
- final User foundUser = userRepository.findOne(user.getId());
+ final User foundUser = userRepository.findById(user.getId()).get();
assertThat(user.getName(), is(foundUser.getName()));
}
@@ -106,7 +106,7 @@ public class UserRepositoryLiveTest {
mongoOps.insert(user);
user = mongoOps.findOne(Query.query(Criteria.where("name").is("Harris")), User.class);
- final boolean isExists = userRepository.exists(user.getId());
+ final boolean isExists = userRepository.existsById(user.getId());
assertThat(isExists, is(true));
}
@@ -138,7 +138,7 @@ public class UserRepositoryLiveTest {
user.setName("Adam");
mongoOps.insert(user);
- final Pageable pageableRequest = new PageRequest(0, 1);
+ final Pageable pageableRequest = PageRequest.of(0, 1);
final Page page = userRepository.findAll(pageableRequest);
List users = page.getContent();
diff --git a/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionReactiveIntegrationTest.java b/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionReactiveIntegrationTest.java
new file mode 100644
index 0000000000..43aa865e91
--- /dev/null
+++ b/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionReactiveIntegrationTest.java
@@ -0,0 +1,47 @@
+package com.baeldung.transaction;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.mongodb.core.ReactiveMongoOperations;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import com.baeldung.config.MongoReactiveConfig;
+import com.baeldung.model.User;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = MongoReactiveConfig.class)
+public class MongoTransactionReactiveIntegrationTest {
+
+ @Autowired
+ private ReactiveMongoOperations reactiveOps;
+
+ @Before
+ public void testSetup() {
+ if (!reactiveOps.collectionExists(User.class)
+ .block()) {
+ reactiveOps.createCollection(User.class);
+ }
+ }
+
+ @After
+ public void tearDown() {
+ System.out.println(reactiveOps.findAll(User.class)
+ .count()
+ .block());
+ reactiveOps.dropCollection(User.class);
+ }
+
+ @Test
+ public void whenPerformTransaction_thenSuccess() {
+ User user1 = new User("Jane", 23);
+ User user2 = new User("John", 34);
+ reactiveOps.inTransaction()
+ .execute(action -> action.insert(user1)
+ .then(action.insert(user2)));
+ }
+
+}
diff --git a/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionTemplateIntegrationTest.java b/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionTemplateIntegrationTest.java
new file mode 100644
index 0000000000..1dbe724d87
--- /dev/null
+++ b/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionTemplateIntegrationTest.java
@@ -0,0 +1,68 @@
+package com.baeldung.transaction;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.util.List;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.mongodb.MongoTransactionManager;
+import org.springframework.data.mongodb.SessionSynchronization;
+import org.springframework.data.mongodb.core.MongoTemplate;
+import org.springframework.data.mongodb.core.query.Criteria;
+import org.springframework.data.mongodb.core.query.Query;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.transaction.TransactionStatus;
+import org.springframework.transaction.support.TransactionCallbackWithoutResult;
+import org.springframework.transaction.support.TransactionTemplate;
+
+import com.baeldung.config.MongoConfig;
+import com.baeldung.model.User;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = MongoConfig.class)
+public class MongoTransactionTemplateIntegrationTest {
+
+ @Autowired
+ private MongoTemplate mongoTemplate;
+
+ @Autowired
+ private MongoTransactionManager mongoTransactionManager;
+
+ @Before
+ public void testSetup() {
+ if (!mongoTemplate.collectionExists(User.class)) {
+ mongoTemplate.createCollection(User.class);
+ }
+ }
+
+ @After
+ public void tearDown() {
+ mongoTemplate.dropCollection(User.class);
+ }
+
+ @Test
+ public void givenTransactionTemplate_whenPerformTransaction_thenSuccess() {
+ mongoTemplate.setSessionSynchronization(SessionSynchronization.ALWAYS);
+ TransactionTemplate transactionTemplate = new TransactionTemplate(mongoTransactionManager);
+ transactionTemplate.execute(new TransactionCallbackWithoutResult() {
+ @Override
+ protected void doInTransactionWithoutResult(TransactionStatus status) {
+ mongoTemplate.insert(new User("Kim", 20));
+ mongoTemplate.insert(new User("Jack", 45));
+ };
+ });
+
+ Query query = new Query().addCriteria(Criteria.where("name")
+ .is("Jack"));
+ List users = mongoTemplate.find(query, User.class);
+
+ assertThat(users.size(), is(1));
+ }
+
+}
diff --git a/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionalIntegrationTest.java b/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionalIntegrationTest.java
new file mode 100644
index 0000000000..4d747789a0
--- /dev/null
+++ b/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionalIntegrationTest.java
@@ -0,0 +1,90 @@
+package com.baeldung.transaction;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.MethodSorters;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.mongodb.MongoTransactionException;
+import org.springframework.data.mongodb.core.MongoTemplate;
+import org.springframework.data.mongodb.core.query.Criteria;
+import org.springframework.data.mongodb.core.query.Query;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.baeldung.config.MongoConfig;
+import com.baeldung.model.User;
+import com.baeldung.repository.UserRepository;
+import com.mongodb.MongoCommandException;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = MongoConfig.class)
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class MongoTransactionalIntegrationTest {
+
+ @Autowired
+ private MongoTemplate mongoTemplate;
+
+ @Autowired
+ private UserRepository userRepository;
+
+ @Test
+ @Transactional
+ public void whenPerformMongoTransaction_thenSuccess() {
+ userRepository.save(new User("John", 30));
+ userRepository.save(new User("Ringo", 35));
+ Query query = new Query().addCriteria(Criteria.where("name")
+ .is("John"));
+ List users = mongoTemplate.find(query, User.class);
+
+ assertThat(users.size(), is(1));
+ }
+
+ @Test(expected = MongoTransactionException.class)
+ @Transactional
+ public void whenListCollectionDuringMongoTransaction_thenException() {
+ if (mongoTemplate.collectionExists(User.class)) {
+ mongoTemplate.save(new User("John", 30));
+ mongoTemplate.save(new User("Ringo", 35));
+ }
+ }
+
+ @Test(expected = MongoCommandException.class)
+ @Transactional
+ public void whenCountDuringMongoTransaction_thenException() {
+ userRepository.save(new User("John", 30));
+ userRepository.save(new User("Ringo", 35));
+ userRepository.count();
+ }
+
+ @Test
+ @Transactional
+ public void whenQueryDuringMongoTransaction_thenSuccess() {
+ userRepository.save(new User("Jane", 20));
+ userRepository.save(new User("Nick", 33));
+ List users = mongoTemplate.find(new Query(), User.class);
+
+ assertTrue(users.size() > 1);
+ }
+
+ // ==== Using test instead of before and after due to @transactional doesn't allow list collection
+
+ @Test
+ public void setup() {
+ if (!mongoTemplate.collectionExists(User.class)) {
+ mongoTemplate.createCollection(User.class);
+ }
+ }
+
+ @Test
+ public void ztearDown() {
+ mongoTemplate.dropCollection(User.class);
+ }
+}
diff --git a/spring-data-mongodb/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-data-mongodb/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..04d549a288
--- /dev/null
+++ b/spring-data-mongodb/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,18 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import com.baeldung.config.MongoConfig;
+import com.baeldung.config.SimpleMongoConfig;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = { MongoConfig.class, SimpleMongoConfig.class })
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-data-rest-querydsl/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-data-rest-querydsl/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..7f906bdbcd
--- /dev/null
+++ b/spring-data-rest-querydsl/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.Application;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = Application.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-data-rest/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-data-rest/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..0380e3dc2f
--- /dev/null
+++ b/spring-data-rest/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.SpringDataRestApplication;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = SpringDataRestApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-dispatcher-servlet/pom.xml b/spring-dispatcher-servlet/pom.xml
index 4e4346e43b..7ac291740e 100644
--- a/spring-dispatcher-servlet/pom.xml
+++ b/spring-dispatcher-servlet/pom.xml
@@ -61,6 +61,12 @@
commons-fileupload
${commons-fileupload.version}
+
+ org.springframework.boot
+ spring-boot-starter-test
+ 1.5.10.RELEASE
+ test
+
diff --git a/spring-dispatcher-servlet/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-dispatcher-servlet/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..8a9d3421c2
--- /dev/null
+++ b/spring-dispatcher-servlet/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,19 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+
+import com.baeldung.springdispatcherservlet.configuration.AppConfig;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = AppConfig.class)
+@WebAppConfiguration
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-drools/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-drools/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..68325682e5
--- /dev/null
+++ b/spring-drools/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import com.baeldung.spring.drools.service.TaxiFareConfiguration;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = TaxiFareConfiguration.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-ejb/spring-ejb-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-ejb/spring-ejb-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..4d2d83646d
--- /dev/null
+++ b/spring-ejb/spring-ejb-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.springejbclient.SpringEjbClientApplication;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = SpringEjbClientApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-exceptions/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-exceptions/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..492673b168
--- /dev/null
+++ b/spring-exceptions/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,18 @@
+package org.baeldung;
+
+import org.baeldung.spring.config.CoreConfig;
+import org.baeldung.spring.config.MvcConfig;
+import org.baeldung.spring.config.PersistenceConfig;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = { CoreConfig.class, MvcConfig.class, PersistenceConfig.class})
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-freemarker/pom.xml b/spring-freemarker/pom.xml
index f0626195fd..4ff57e27f0 100644
--- a/spring-freemarker/pom.xml
+++ b/spring-freemarker/pom.xml
@@ -44,6 +44,13 @@
freemarker
${freemarker.version}
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ 1.5.10.RELEASE
+ test
+
diff --git a/spring-freemarker/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-freemarker/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..ab0e6e8f49
--- /dev/null
+++ b/spring-freemarker/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,20 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+
+import com.baeldung.freemarker.config.SpringWebConfig;
+import com.baeldung.freemarker.config.WebConfiguration;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = { SpringWebConfig.class, WebConfiguration.class })
+@WebAppConfiguration
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-groovy/src/test/java/com/baeldug/groovyconfig/GroovyConfigurationTest.java b/spring-groovy/src/test/java/com/baeldug/groovyconfig/GroovyConfigurationUnitTest.java
similarity index 97%
rename from spring-groovy/src/test/java/com/baeldug/groovyconfig/GroovyConfigurationTest.java
rename to spring-groovy/src/test/java/com/baeldug/groovyconfig/GroovyConfigurationUnitTest.java
index 91ca6dbfe9..dbefba5ba5 100644
--- a/spring-groovy/src/test/java/com/baeldug/groovyconfig/GroovyConfigurationTest.java
+++ b/spring-groovy/src/test/java/com/baeldug/groovyconfig/GroovyConfigurationUnitTest.java
@@ -7,7 +7,7 @@ import java.io.File;
import org.junit.Test;
import org.springframework.context.support.GenericGroovyApplicationContext;
-public class GroovyConfigurationTest {
+public class GroovyConfigurationUnitTest {
private static final String FILE_NAME = "GroovyBeanConfig.groovy";
private static final String FILE_PATH = "src/main/java/com/baeldug/groovyconfig/";
diff --git a/spring-groovy/src/test/java/com/baeldug/groovyconfig/JavaConfigurationTest.java b/spring-groovy/src/test/java/com/baeldug/groovyconfig/JavaConfigurationUnitTest.java
similarity index 93%
rename from spring-groovy/src/test/java/com/baeldug/groovyconfig/JavaConfigurationTest.java
rename to spring-groovy/src/test/java/com/baeldug/groovyconfig/JavaConfigurationUnitTest.java
index 2d9b1000ff..c1e16f1b62 100644
--- a/spring-groovy/src/test/java/com/baeldug/groovyconfig/JavaConfigurationTest.java
+++ b/spring-groovy/src/test/java/com/baeldug/groovyconfig/JavaConfigurationUnitTest.java
@@ -5,7 +5,7 @@ import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
-public class JavaConfigurationTest {
+public class JavaConfigurationUnitTest {
@Test
public void whenJavaConfig_thenCorrectPerson() {
diff --git a/spring-groovy/src/test/java/com/baeldug/groovyconfig/XmlConfigurationTest.java b/spring-groovy/src/test/java/com/baeldug/groovyconfig/XmlConfigurationUnitTest.java
similarity index 94%
rename from spring-groovy/src/test/java/com/baeldug/groovyconfig/XmlConfigurationTest.java
rename to spring-groovy/src/test/java/com/baeldug/groovyconfig/XmlConfigurationUnitTest.java
index 3ee724207c..b8d341ee39 100644
--- a/spring-groovy/src/test/java/com/baeldug/groovyconfig/XmlConfigurationTest.java
+++ b/spring-groovy/src/test/java/com/baeldug/groovyconfig/XmlConfigurationUnitTest.java
@@ -6,7 +6,7 @@ import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
-public class XmlConfigurationTest {
+public class XmlConfigurationUnitTest {
@Test
public void whenXmlConfig_thenCorrectPerson() {
diff --git a/spring-groovy/src/test/java/com/baeldug/spring_groovy/AppTest.java b/spring-groovy/src/test/java/com/baeldug/spring_groovy/AppUnitTest.java
similarity index 82%
rename from spring-groovy/src/test/java/com/baeldug/spring_groovy/AppTest.java
rename to spring-groovy/src/test/java/com/baeldug/spring_groovy/AppUnitTest.java
index 19eefb6c0f..3d8fa3e2d8 100644
--- a/spring-groovy/src/test/java/com/baeldug/spring_groovy/AppTest.java
+++ b/spring-groovy/src/test/java/com/baeldug/spring_groovy/AppUnitTest.java
@@ -7,7 +7,7 @@ import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
-public class AppTest
+public class AppUnitTest
extends TestCase
{
/**
@@ -15,7 +15,7 @@ public class AppTest
*
* @param testName name of the test case
*/
- public AppTest( String testName )
+ public AppUnitTest( String testName )
{
super( testName );
}
@@ -25,7 +25,7 @@ public class AppTest
*/
public static Test suite()
{
- return new TestSuite( AppTest.class );
+ return new TestSuite( AppUnitTest.class );
}
/**
diff --git a/spring-hibernate4/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-hibernate4/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..af4618d0f3
--- /dev/null
+++ b/spring-hibernate4/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,18 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.support.AnnotationConfigContextLoader;
+
+import com.baeldung.spring.PersistenceConfig;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = { PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-integration/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-integration/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..92e80a0903
--- /dev/null
+++ b/spring-integration/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,21 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import com.baeldung.si.security.MessageConsumer;
+import com.baeldung.si.security.SecuredDirectChannel;
+import com.baeldung.si.security.SecurityConfig;
+import com.baeldung.si.security.SecurityPubSubChannel;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = { SecurityConfig.class, SecuredDirectChannel.class, SecurityPubSubChannel.class,
+ MessageConsumer.class })
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-jenkins-pipeline/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-jenkins-pipeline/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..8eb1589de7
--- /dev/null
+++ b/spring-jenkins-pipeline/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.SpringJenkinsPipelineApplication;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = SpringJenkinsPipelineApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-jersey/pom.xml b/spring-jersey/pom.xml
index 40dc91a88d..872835177d 100644
--- a/spring-jersey/pom.xml
+++ b/spring-jersey/pom.xml
@@ -118,6 +118,14 @@
3.10.0
test
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ 1.5.10.RELEASE
+ test
+
diff --git a/spring-jersey/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-jersey/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..21f180854c
--- /dev/null
+++ b/spring-jersey/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import com.baeldung.server.config.RestConfig;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = RestConfig.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-jinq/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-jinq/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..ccf774330f
--- /dev/null
+++ b/spring-jinq/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.spring.jinq.JinqApplication;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = JinqApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-jms/pom.xml b/spring-jms/pom.xml
index 949a78b2a1..814875f77b 100644
--- a/spring-jms/pom.xml
+++ b/spring-jms/pom.xml
@@ -33,6 +33,14 @@
activemq-all
${activemq.version}
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ 1.5.10.RELEASE
+ test
+
diff --git a/spring-jms/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-jms/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..e13809f571
--- /dev/null
+++ b/spring-jms/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,15 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations = {"classpath:applicationContext.xml", "classpath:EmbeddedActiveMQ.xml"})
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-kafka/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-kafka/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..40bf86c76f
--- /dev/null
+++ b/spring-kafka/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.spring.kafka.KafkaApplication;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = KafkaApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-katharsis/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-katharsis/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..48081903b6
--- /dev/null
+++ b/spring-katharsis/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,16 @@
+package org.baeldung;
+
+import org.baeldung.Application;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = Application.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-ldap/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-ldap/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..9c233e6562
--- /dev/null
+++ b/spring-ldap/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import com.baeldung.ldap.javaconfig.AppConfig;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = AppConfig.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-mobile/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-mobile/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..7f906bdbcd
--- /dev/null
+++ b/spring-mobile/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.Application;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = Application.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-mockito/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-mockito/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..7ce9f70302
--- /dev/null
+++ b/spring-mockito/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.MocksApplication;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = MocksApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-mustache/pom.xml b/spring-mustache/pom.xml
index 4e7a1ba5a3..9e4c528ee0 100644
--- a/spring-mustache/pom.xml
+++ b/spring-mustache/pom.xml
@@ -3,9 +3,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
- com.baeldung
spring-mustache
- 0.0.1-SNAPSHOT
jar
spring-mustache
Demo project for Spring Boot
@@ -50,9 +48,6 @@
- UTF-8
- UTF-8
- 1.8
3.3.7
0.8
diff --git a/spring-mustache/src/test/java/com/baeldung/springmustache/SpringMustacheApplicationTests.java b/spring-mustache/src/test/java/com/baeldung/springmustache/SpringMustacheApplicationIntegrationTest.java
similarity index 94%
rename from spring-mustache/src/test/java/com/baeldung/springmustache/SpringMustacheApplicationTests.java
rename to spring-mustache/src/test/java/com/baeldung/springmustache/SpringMustacheApplicationIntegrationTest.java
index 9138dfe92b..1eecf58986 100644
--- a/spring-mustache/src/test/java/com/baeldung/springmustache/SpringMustacheApplicationTests.java
+++ b/spring-mustache/src/test/java/com/baeldung/springmustache/SpringMustacheApplicationIntegrationTest.java
@@ -13,7 +13,7 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
-public class SpringMustacheApplicationTests {
+public class SpringMustacheApplicationIntegrationTest {
@Autowired
private TestRestTemplate restTemplate;
diff --git a/spring-mvc-forms-jsp/pom.xml b/spring-mvc-forms-jsp/pom.xml
index 6c75c9299b..5536314086 100644
--- a/spring-mvc-forms-jsp/pom.xml
+++ b/spring-mvc-forms-jsp/pom.xml
@@ -63,6 +63,12 @@
jackson-databind
${jackson-databind.version}
+
+ org.springframework.boot
+ spring-boot-starter-test
+ 1.5.10.RELEASE
+ test
+
diff --git a/spring-mvc-forms-jsp/src/main/java/com/baeldung/springmvcforms/configuration/ApplicationConfiguration.java b/spring-mvc-forms-jsp/src/main/java/com/baeldung/springmvcforms/configuration/ApplicationConfiguration.java
index b8b36df84e..2b2844e0de 100644
--- a/spring-mvc-forms-jsp/src/main/java/com/baeldung/springmvcforms/configuration/ApplicationConfiguration.java
+++ b/spring-mvc-forms-jsp/src/main/java/com/baeldung/springmvcforms/configuration/ApplicationConfiguration.java
@@ -14,7 +14,7 @@ import org.springframework.web.servlet.view.InternalResourceViewResolver;
@Configuration
@EnableWebMvc
@ComponentScan(basePackages = {"com.baeldung.springmvcforms", "com.baeldung.jstl"})
-class ApplicationConfiguration implements WebMvcConfigurer {
+public class ApplicationConfiguration implements WebMvcConfigurer {
@Override
public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
diff --git a/spring-mvc-forms-jsp/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-mvc-forms-jsp/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..c1e9b71550
--- /dev/null
+++ b/spring-mvc-forms-jsp/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,19 @@
+package org.baeldung;
+
+import com.baeldung.springmvcforms.configuration.ApplicationConfiguration;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = ApplicationConfiguration.class)
+@WebAppConfiguration
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-mvc-forms-thymeleaf/src/test/java/org/baeldung/listbindingexample/SpringContextIntegrationTest.java b/spring-mvc-forms-thymeleaf/src/test/java/org/baeldung/listbindingexample/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..da87a6830a
--- /dev/null
+++ b/spring-mvc-forms-thymeleaf/src/test/java/org/baeldung/listbindingexample/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung.listbindingexample;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.listbindingexample.ListBindingApplication;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = {ListBindingApplication.class})
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-mvc-forms-thymeleaf/src/test/java/org/baeldung/sessionattrs/SpringContextIntegrationTest.java b/spring-mvc-forms-thymeleaf/src/test/java/org/baeldung/sessionattrs/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..e6b0dbf98c
--- /dev/null
+++ b/spring-mvc-forms-thymeleaf/src/test/java/org/baeldung/sessionattrs/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung.sessionattrs;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.sessionattrs.SessionAttrsApplication;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = {SessionAttrsApplication.class})
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-mvc-java/README.md b/spring-mvc-java/README.md
index 44b1d65bc8..3a580202cf 100644
--- a/spring-mvc-java/README.md
+++ b/spring-mvc-java/README.md
@@ -30,3 +30,5 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
- [A Quick Example of Spring Websockets’ @SendToUser Annotation](http://www.baeldung.com/spring-websockets-sendtouser)
- [Using Spring ResponseEntity to Manipulate the HTTP Response](http://www.baeldung.com/spring-response-entity)
- [Using Spring @ResponseStatus to Set HTTP Status Code](http://www.baeldung.com/spring-response-status)
+- [Bootstrap a Web Application with Spring 5](https://www.baeldung.com/bootstraping-a-web-application-with-spring-and-java-based-configuration)
+- [Spring MVC Tutorial](https://www.baeldung.com/spring-mvc-tutorial)
diff --git a/spring-mvc-velocity/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-mvc-velocity/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..3649332870
--- /dev/null
+++ b/spring-mvc-velocity/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,20 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+
+import com.baeldung.mvc.velocity.spring.config.WebConfig;
+import com.baeldung.mvc.velocity.test.config.TestConfig;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = { TestConfig.class, WebConfig.class })
+@WebAppConfiguration
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-mvc-webflow/pom.xml b/spring-mvc-webflow/pom.xml
index f7070efb94..e1a279a787 100644
--- a/spring-mvc-webflow/pom.xml
+++ b/spring-mvc-webflow/pom.xml
@@ -52,6 +52,14 @@
log4j-over-slf4j
${org.slf4j.version}
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ 1.5.10.RELEASE
+ test
+
diff --git a/spring-mvc-webflow/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-mvc-webflow/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..6f028c78d8
--- /dev/null
+++ b/spring-mvc-webflow/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,19 @@
+package org.baeldung;
+
+import org.baeldung.spring.WebFlowConfig;
+import org.baeldung.spring.WebMvcConfig;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = {WebFlowConfig.class, WebMvcConfig.class})
+@WebAppConfiguration
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-mvc-xml/pom.xml b/spring-mvc-xml/pom.xml
index fd33c25241..7187b5c270 100644
--- a/spring-mvc-xml/pom.xml
+++ b/spring-mvc-xml/pom.xml
@@ -86,6 +86,13 @@
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ 1.5.10.RELEASE
+ test
+
diff --git a/spring-mvc-xml/src/main/java/com/baeldung/spring/ClientWebConfig.java b/spring-mvc-xml/src/main/java/com/baeldung/spring/ClientWebConfig.java
index 9752526963..22260fca70 100644
--- a/spring-mvc-xml/src/main/java/com/baeldung/spring/ClientWebConfig.java
+++ b/spring-mvc-xml/src/main/java/com/baeldung/spring/ClientWebConfig.java
@@ -1,11 +1,13 @@
package com.baeldung.spring;
+import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@ImportResource("classpath:webMvcConfig.xml")
@Configuration
+@ComponentScan
public class ClientWebConfig implements WebMvcConfigurer {
public ClientWebConfig() {
diff --git a/spring-mvc-xml/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-mvc-xml/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..ec34abd367
--- /dev/null
+++ b/spring-mvc-xml/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,19 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+
+import com.baeldung.spring.ClientWebConfig;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = ClientWebConfig.class)
+@WebAppConfiguration
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-mybatis/src/main/java/com/baeldung/spring/mybatis/controller/StudentController.java b/spring-mybatis/src/main/java/com/baeldung/spring/mybatis/controller/StudentController.java
index 427613f23f..c1e5579103 100644
--- a/spring-mybatis/src/main/java/com/baeldung/spring/mybatis/controller/StudentController.java
+++ b/spring-mybatis/src/main/java/com/baeldung/spring/mybatis/controller/StudentController.java
@@ -31,7 +31,7 @@ public class StudentController {
@RequestMapping(value = "/signup", method = RequestMethod.POST)
public String signup(@Validated @ModelAttribute("student") Student student, BindingResult result, ModelMap model) {
- if (studentService.getStudentByUserName(student.getUserName())) {
+ if (studentService.getStudentByUserName(student.getUserName()) != null) {
model.addAttribute("message", "User Name exists. Try another user name");
return "signup";
} else {
@@ -50,7 +50,7 @@ public class StudentController {
@RequestMapping(value = "/login", method = RequestMethod.POST)
public String login(@ModelAttribute("studentLogin") StudentLogin studentLogin, BindingResult result, ModelMap model) {
- boolean found = studentService.getStudentByLogin(studentLogin.getUserName(), studentLogin.getPassword());
+ boolean found = studentService.getStudentByLogin(studentLogin.getUserName(), studentLogin.getPassword()) != null;
if (found) {
return "success";
} else {
diff --git a/spring-protobuf/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-protobuf/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..615ebd5f4a
--- /dev/null
+++ b/spring-protobuf/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.protobuf.Application;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = Application.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-quartz/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-quartz/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..516cc587a7
--- /dev/null
+++ b/spring-quartz/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,16 @@
+package org.baeldung;
+
+import org.baeldung.springquartz.SpringQuartzApp;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = SpringQuartzApp.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-reactor/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-reactor/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..7f906bdbcd
--- /dev/null
+++ b/spring-reactor/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.Application;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = Application.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-remoting/remoting-amqp/remoting-amqp-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-remoting/remoting-amqp/remoting-amqp-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..2de3ed94d1
--- /dev/null
+++ b/spring-remoting/remoting-amqp/remoting-amqp-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.client.AmqpClient;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = AmqpClient.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-remoting/remoting-amqp/remoting-amqp-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-remoting/remoting-amqp/remoting-amqp-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..5dc6d1df75
--- /dev/null
+++ b/spring-remoting/remoting-amqp/remoting-amqp-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.server.AmqpServer;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = AmqpServer.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-remoting/remoting-hessian-burlap/remoting-hessian-burlap-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-remoting/remoting-hessian-burlap/remoting-hessian-burlap-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..1aec444aa0
--- /dev/null
+++ b/spring-remoting/remoting-hessian-burlap/remoting-hessian-burlap-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,18 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.client.BurlapClient;
+import com.baeldung.client.HessianClient;
+
+@SpringBootTest(classes = {BurlapClient.class, HessianClient.class})
+@RunWith(SpringRunner.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-remoting/remoting-hessian-burlap/remoting-hessian-burlap-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-remoting/remoting-hessian-burlap/remoting-hessian-burlap-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..f1aad1f601
--- /dev/null
+++ b/spring-remoting/remoting-hessian-burlap/remoting-hessian-burlap-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.server.Server;
+
+@SpringBootTest(classes = Server.class)
+@RunWith(SpringRunner.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-remoting/remoting-http/remoting-http-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-remoting/remoting-http/remoting-http-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..f1aad1f601
--- /dev/null
+++ b/spring-remoting/remoting-http/remoting-http-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.server.Server;
+
+@SpringBootTest(classes = Server.class)
+@RunWith(SpringRunner.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-remoting/remoting-jms/remoting-jms-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-remoting/remoting-jms/remoting-jms-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..a94e639dc8
--- /dev/null
+++ b/spring-remoting/remoting-jms/remoting-jms-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.client.JmsClient;
+
+@SpringBootTest(classes = JmsClient.class)
+@RunWith(SpringRunner.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-remoting/remoting-jms/remoting-jms-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-remoting/remoting-jms/remoting-jms-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..5c9cc5f872
--- /dev/null
+++ b/spring-remoting/remoting-jms/remoting-jms-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.server.JmsServer;
+
+@SpringBootTest(classes = JmsServer.class)
+@RunWith(SpringRunner.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-remoting/remoting-rmi/remoting-rmi-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-remoting/remoting-rmi/remoting-rmi-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..3460792fc6
--- /dev/null
+++ b/spring-remoting/remoting-rmi/remoting-rmi-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.client.RmiClient;
+
+@SpringBootTest(classes = RmiClient.class)
+@RunWith(SpringRunner.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-remoting/remoting-rmi/remoting-rmi-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-remoting/remoting-rmi/remoting-rmi-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..2063dd5e6e
--- /dev/null
+++ b/spring-remoting/remoting-rmi/remoting-rmi-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.server.RmiServer;
+
+@SpringBootTest(classes = RmiServer.class)
+@RunWith(SpringRunner.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-rest-angular/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-rest-angular/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..228d0019bd
--- /dev/null
+++ b/spring-rest-angular/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,16 @@
+package org.baeldung;
+
+import org.baeldung.web.main.Application;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = Application.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-rest-embedded-tomcat/pom.xml b/spring-rest-embedded-tomcat/pom.xml
index 3cbbf63d94..a8c53dbc3a 100644
--- a/spring-rest-embedded-tomcat/pom.xml
+++ b/spring-rest-embedded-tomcat/pom.xml
@@ -57,6 +57,13 @@
httpcore
${httpcore.version}
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ 1.5.10.RELEASE
+ test
+
diff --git a/spring-rest-embedded-tomcat/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-rest-embedded-tomcat/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..8b8ff1a322
--- /dev/null
+++ b/spring-rest-embedded-tomcat/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,18 @@
+package org.baeldung;
+
+import org.baeldung.embedded.configuration.UserConfiguration;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = { UserConfiguration.class })
+@WebAppConfiguration
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-rest-full/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-rest-full/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..35939c992f
--- /dev/null
+++ b/spring-rest-full/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,16 @@
+package org.baeldung;
+
+import org.baeldung.spring.Application;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = Application.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-rest-query-language/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-rest-query-language/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..35939c992f
--- /dev/null
+++ b/spring-rest-query-language/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,16 @@
+package org.baeldung;
+
+import org.baeldung.spring.Application;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = Application.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-rest-simple/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-rest-simple/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..66243ef00d
--- /dev/null
+++ b/spring-rest-simple/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,16 @@
+package org.baeldung;
+
+import org.baeldung.config.Application;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = Application.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-rest/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-rest/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..d99dacd331
--- /dev/null
+++ b/spring-rest/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,24 @@
+package org.baeldung;
+
+import org.baeldung.config.MainApplication;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.custom.CustomApplication;
+import com.baeldung.produceimage.ImageApplication;
+import com.baeldung.propertyeditor.PropertyEditorApplication;
+import com.baeldung.responseheaders.ResponseHeadersApplication;
+import com.baeldung.web.log.app.Application;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = { CustomApplication.class, ImageApplication.class, PropertyEditorApplication.class,
+ ResponseHeadersApplication.class, Application.class, com.baeldung.web.upload.app.Application.class,
+ MainApplication.class})
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-resttemplate/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-resttemplate/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..3a5a20cfeb
--- /dev/null
+++ b/spring-resttemplate/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,16 @@
+package org.baeldung;
+
+import org.baeldung.resttemplate.configuration.RestTemplateConfigurationApplication;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = RestTemplateConfigurationApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-security-acl/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-acl/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..c7890d79ac
--- /dev/null
+++ b/spring-security-acl/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,16 @@
+package org.baeldung;
+
+import org.baeldung.acl.Application;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = Application.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-security-angular/server/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-angular/server/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..8c62ac5e91
--- /dev/null
+++ b/spring-security-angular/server/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.springbootsecurityrest.basicauth.SpringBootSecurityApplication;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = SpringBootSecurityApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-security-cache-control/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-cache-control/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..c047fc6210
--- /dev/null
+++ b/spring-security-cache-control/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.cachecontrol.AppRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = AppRunner.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-security-client/spring-security-jsp-authentication/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-client/spring-security-jsp-authentication/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..66243ef00d
--- /dev/null
+++ b/spring-security-client/spring-security-jsp-authentication/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,16 @@
+package org.baeldung;
+
+import org.baeldung.config.Application;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = Application.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-security-client/spring-security-jsp-authorize/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-client/spring-security-jsp-authorize/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..66243ef00d
--- /dev/null
+++ b/spring-security-client/spring-security-jsp-authorize/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,16 @@
+package org.baeldung;
+
+import org.baeldung.config.Application;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = Application.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-security-client/spring-security-jsp-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-client/spring-security-jsp-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..66243ef00d
--- /dev/null
+++ b/spring-security-client/spring-security-jsp-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,16 @@
+package org.baeldung;
+
+import org.baeldung.config.Application;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = Application.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-security-client/spring-security-mvc/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-client/spring-security-mvc/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..66243ef00d
--- /dev/null
+++ b/spring-security-client/spring-security-mvc/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,16 @@
+package org.baeldung;
+
+import org.baeldung.config.Application;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = Application.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-security-client/spring-security-thymeleaf-authentication/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-client/spring-security-thymeleaf-authentication/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..66243ef00d
--- /dev/null
+++ b/spring-security-client/spring-security-thymeleaf-authentication/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,16 @@
+package org.baeldung;
+
+import org.baeldung.config.Application;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = Application.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-security-client/spring-security-thymeleaf-authorize/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-client/spring-security-thymeleaf-authorize/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..66243ef00d
--- /dev/null
+++ b/spring-security-client/spring-security-thymeleaf-authorize/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,16 @@
+package org.baeldung;
+
+import org.baeldung.config.Application;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = Application.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-security-client/spring-security-thymeleaf-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-client/spring-security-thymeleaf-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..66243ef00d
--- /dev/null
+++ b/spring-security-client/spring-security-thymeleaf-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,16 @@
+package org.baeldung;
+
+import org.baeldung.config.Application;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = Application.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-security-core/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-core/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..5698afa417
--- /dev/null
+++ b/spring-security-core/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,16 @@
+package org.baeldung;
+
+import org.baeldung.app.App;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = App.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-security-mvc-boot/README.MD b/spring-security-mvc-boot/README.MD
index eec61f087f..6bd9b9295c 100644
--- a/spring-security-mvc-boot/README.MD
+++ b/spring-security-mvc-boot/README.MD
@@ -10,3 +10,4 @@ The "REST With Spring" Classes: http://github.learnspringsecurity.com
- [Multiple Authentication Providers in Spring Security](http://www.baeldung.com/spring-security-multiple-auth-providers)
- [Granted Authority Versus Role in Spring Security](http://www.baeldung.com/spring-security-granted-authority-vs-role)
- [Spring Data with Spring Security](https://www.baeldung.com/spring-data-security)
+- [Spring Security – Whitelist IP Range](https://www.baeldung.com/spring-security-whitelist-ip-range)
diff --git a/spring-security-mvc-custom/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-mvc-custom/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..9e74e83a53
--- /dev/null
+++ b/spring-security-mvc-custom/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,19 @@
+package org.baeldung;
+
+import org.baeldung.spring.MvcConfig;
+import org.baeldung.spring.SecSecurityConfig;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = { MvcConfig.class, SecSecurityConfig.class })
+@WebAppConfiguration
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-security-mvc-digest-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-mvc-digest-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..a4a85a8fa2
--- /dev/null
+++ b/spring-security-mvc-digest-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,20 @@
+package org.baeldung;
+
+import org.baeldung.spring.ClientConfig;
+import org.baeldung.spring.MvcConfig;
+import org.baeldung.spring.SecSecurityConfig;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = { ClientConfig.class, MvcConfig.class, SecSecurityConfig.class })
+@WebAppConfiguration
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-security-mvc-ldap/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-mvc-ldap/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..0b701e9acf
--- /dev/null
+++ b/spring-security-mvc-ldap/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,15 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = SampleLDAPApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-security-mvc-login/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-mvc-login/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..1d7f9ae497
--- /dev/null
+++ b/spring-security-mvc-login/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,16 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration({ "/RedirectionWebSecurityConfig.xml", "/mvc-servlet.xml" })
+@WebAppConfiguration
+public class SpringContextIntegrationTest {
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-security-mvc-persisted-remember-me/pom.xml b/spring-security-mvc-persisted-remember-me/pom.xml
index 2add895ecb..8b15e658e8 100644
--- a/spring-security-mvc-persisted-remember-me/pom.xml
+++ b/spring-security-mvc-persisted-remember-me/pom.xml
@@ -133,6 +133,14 @@
guava
${guava.version}
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ 1.5.10.RELEASE
+ test
+
diff --git a/spring-security-mvc-persisted-remember-me/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-mvc-persisted-remember-me/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..f1df880862
--- /dev/null
+++ b/spring-security-mvc-persisted-remember-me/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,20 @@
+package org.baeldung;
+
+import org.baeldung.spring.MvcConfig;
+import org.baeldung.spring.PersistenceConfig;
+import org.baeldung.spring.SecurityConfig;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = { MvcConfig.class, PersistenceConfig.class, SecurityConfig.class })
+@WebAppConfiguration
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-security-mvc-session/pom.xml b/spring-security-mvc-session/pom.xml
index 7ffbd76aac..85c8475657 100644
--- a/spring-security-mvc-session/pom.xml
+++ b/spring-security-mvc-session/pom.xml
@@ -113,6 +113,14 @@
metrics-core
${codahale.metrics.version}
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ 1.5.10.RELEASE
+ test
+
diff --git a/spring-security-mvc-session/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-mvc-session/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..9e74e83a53
--- /dev/null
+++ b/spring-security-mvc-session/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,19 @@
+package org.baeldung;
+
+import org.baeldung.spring.MvcConfig;
+import org.baeldung.spring.SecSecurityConfig;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = { MvcConfig.class, SecSecurityConfig.class })
+@WebAppConfiguration
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-security-mvc-socket/README.md b/spring-security-mvc-socket/README.md
index 828d9a3448..6c2ad7b985 100644
--- a/spring-security-mvc-socket/README.md
+++ b/spring-security-mvc-socket/README.md
@@ -1,3 +1,10 @@
+To build the project, run the command: mvn clean install. This will build a war file in the target folder that you can deploye on a server like Tomcat.
+
+Alternatively, run the project from an IDE.
+
+To login, use credentials from the data.sql file in src/main/resource, eg: user/password.
+
+
### Relevant Articles:
- [Intro to Security and WebSockets](http://www.baeldung.com/spring-security-websockets)
-- [Spring WebSockets: Specific User Chat](http://www.baeldung.com/spring-websocket-specific-user-chat)
\ No newline at end of file
+- [Spring WebSockets: Build an User Chat](https://www.baeldung.com/spring-websockets-send-message-to-user)
diff --git a/spring-security-mvc-socket/pom.xml b/spring-security-mvc-socket/pom.xml
index b7559753b5..d1b8365077 100644
--- a/spring-security-mvc-socket/pom.xml
+++ b/spring-security-mvc-socket/pom.xml
@@ -148,10 +148,18 @@
jackson-annotations
${jackson.version}
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ 1.5.10.RELEASE
+ test
+
-
+
org.apache.tomcat.maven
@@ -171,7 +179,6 @@
-
spring-security-mvc-socket
diff --git a/spring-security-mvc-socket/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-mvc-socket/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..00202a98cb
--- /dev/null
+++ b/spring-security-mvc-socket/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,24 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+
+import com.baeldung.springsecuredsockets.config.AppConfig;
+import com.baeldung.springsecuredsockets.config.DataStoreConfig;
+import com.baeldung.springsecuredsockets.config.SecurityConfig;
+import com.baeldung.springsecuredsockets.config.SocketBrokerConfig;
+import com.baeldung.springsecuredsockets.config.SocketSecurityConfig;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = { AppConfig.class, DataStoreConfig.class, SecurityConfig.class,
+ SocketBrokerConfig.class, SocketSecurityConfig.class })
+@WebAppConfiguration
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-security-openid/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-openid/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..79a725dcae
--- /dev/null
+++ b/spring-security-openid/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,16 @@
+package org.baeldung;
+
+import org.baeldung.config.SpringOpenidApplication;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = SpringOpenidApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-security-react/pom.xml b/spring-security-react/pom.xml
index 11ad679128..32817945be 100644
--- a/spring-security-react/pom.xml
+++ b/spring-security-react/pom.xml
@@ -82,6 +82,14 @@
${jstl.version}
runtime
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ 1.5.10.RELEASE
+ test
+
diff --git a/spring-security-react/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-react/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..a921976fc3
--- /dev/null
+++ b/spring-security-react/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.baeldung.spring.MvcConfig;
+import org.baeldung.spring.SecSecurityConfig;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = { MvcConfig.class, SecSecurityConfig.class })
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-security-rest-basic-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-rest-basic-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..6cf624c179
--- /dev/null
+++ b/spring-security-rest-basic-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,15 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration({ "/WebSecurityConfig.xml" })
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-security-rest/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-rest/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..e2e9f2af2b
--- /dev/null
+++ b/spring-security-rest/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,20 @@
+package org.baeldung;
+
+import org.baeldung.spring.ClientWebConfig;
+import org.baeldung.spring.SecurityJavaConfig;
+import org.baeldung.spring.WebConfig;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@WebAppConfiguration
+@ContextConfiguration(classes = { ClientWebConfig.class, SecurityJavaConfig.class, WebConfig.class })
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-security-sso/spring-security-sso-auth-server/src/test/java/org/baeldung/test/AuthServerIntegrationTest.java b/spring-security-sso/spring-security-sso-auth-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java
similarity index 88%
rename from spring-security-sso/spring-security-sso-auth-server/src/test/java/org/baeldung/test/AuthServerIntegrationTest.java
rename to spring-security-sso/spring-security-sso-auth-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java
index 9e2d6feca1..66ee232b10 100644
--- a/spring-security-sso/spring-security-sso-auth-server/src/test/java/org/baeldung/test/AuthServerIntegrationTest.java
+++ b/spring-security-sso/spring-security-sso-auth-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -1,4 +1,4 @@
-package org.baeldung.test;
+package org.baeldung;
import org.baeldung.config.AuthorizationServerApplication;
import org.junit.Test;
@@ -9,7 +9,7 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = AuthorizationServerApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT)
-public class AuthServerIntegrationTest {
+public class SpringContextIntegrationTest {
@Test
public void whenLoadApplication_thenSuccess() {
diff --git a/spring-security-sso/spring-security-sso-ui/src/test/java/org/baeldung/test/UiIntegrationTest.java b/spring-security-sso/spring-security-sso-ui-2/src/test/java/org/baeldung/SpringContextIntegrationTest.java
similarity index 88%
rename from spring-security-sso/spring-security-sso-ui/src/test/java/org/baeldung/test/UiIntegrationTest.java
rename to spring-security-sso/spring-security-sso-ui-2/src/test/java/org/baeldung/SpringContextIntegrationTest.java
index 6386eac0b8..2fb0210929 100644
--- a/spring-security-sso/spring-security-sso-ui/src/test/java/org/baeldung/test/UiIntegrationTest.java
+++ b/spring-security-sso/spring-security-sso-ui-2/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -1,4 +1,4 @@
-package org.baeldung.test;
+package org.baeldung;
import org.baeldung.config.UiApplication;
import org.junit.Test;
@@ -9,7 +9,7 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = UiApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT)
-public class UiIntegrationTest {
+public class SpringContextIntegrationTest {
@Test
public void whenLoadApplication_thenSuccess() {
diff --git a/spring-security-sso/spring-security-sso-ui-2/src/test/java/org/baeldung/test/UiIntegrationTest.java b/spring-security-sso/spring-security-sso-ui/src/test/java/org/baeldung/SpringContextIntegrationTest.java
similarity index 88%
rename from spring-security-sso/spring-security-sso-ui-2/src/test/java/org/baeldung/test/UiIntegrationTest.java
rename to spring-security-sso/spring-security-sso-ui/src/test/java/org/baeldung/SpringContextIntegrationTest.java
index 6386eac0b8..2fb0210929 100644
--- a/spring-security-sso/spring-security-sso-ui-2/src/test/java/org/baeldung/test/UiIntegrationTest.java
+++ b/spring-security-sso/spring-security-sso-ui/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -1,4 +1,4 @@
-package org.baeldung.test;
+package org.baeldung;
import org.baeldung.config.UiApplication;
import org.junit.Test;
@@ -9,7 +9,7 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = UiApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT)
-public class UiIntegrationTest {
+public class SpringContextIntegrationTest {
@Test
public void whenLoadApplication_thenSuccess() {
diff --git a/spring-security-x509/spring-security-x509-basic-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-x509/spring-security-x509-basic-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..7ec6125f84
--- /dev/null
+++ b/spring-security-x509/spring-security-x509-basic-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.spring.security.x509.X509AuthenticationServer;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = X509AuthenticationServer.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-security-x509/spring-security-x509-client-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-x509/spring-security-x509-client-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..7ec6125f84
--- /dev/null
+++ b/spring-security-x509/spring-security-x509-client-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.spring.security.x509.X509AuthenticationServer;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = X509AuthenticationServer.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-session/spring-session-jdbc/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-session/spring-session-jdbc/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..b921f76a0d
--- /dev/null
+++ b/spring-session/spring-session-jdbc/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.springsessionjdbc.SpringSessionJdbcApplication;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = SpringSessionJdbcApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-session/spring-session-redis/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-session/spring-session-redis/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..a62e728826
--- /dev/null
+++ b/spring-session/spring-session-redis/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.spring.session.SessionWebApplication;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = SessionWebApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-sleuth/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-sleuth/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..ef722ecba0
--- /dev/null
+++ b/spring-sleuth/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.spring.session.SleuthWebApp;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = SleuthWebApp.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-social-login/src/test/java/org/baeldung/test/ApplicationIntegrationTest.java b/spring-social-login/src/test/java/org/baeldung/SpringContextIntegrationTest.java
similarity index 87%
rename from spring-social-login/src/test/java/org/baeldung/test/ApplicationIntegrationTest.java
rename to spring-social-login/src/test/java/org/baeldung/SpringContextIntegrationTest.java
index 43aaea18b1..29ed401118 100644
--- a/spring-social-login/src/test/java/org/baeldung/test/ApplicationIntegrationTest.java
+++ b/spring-social-login/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -1,4 +1,4 @@
-package org.baeldung.test;
+package org.baeldung;
import org.baeldung.config.Application;
import org.junit.Test;
@@ -9,7 +9,7 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class, webEnvironment = WebEnvironment.RANDOM_PORT)
-public class ApplicationIntegrationTest {
+public class SpringContextIntegrationTest {
@Test
public void whenLoadApplication_thenSuccess() {
diff --git a/spring-spel/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-spel/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..f394374a94
--- /dev/null
+++ b/spring-spel/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,15 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations = {"classpath:applicationContext.xml"})
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-state-machine/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-state-machine/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..72292a5089
--- /dev/null
+++ b/spring-state-machine/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,23 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import com.baeldung.spring.statemachine.config.ForkJoinStateMachineConfiguration;
+import com.baeldung.spring.statemachine.config.HierarchicalStateMachineConfiguration;
+import com.baeldung.spring.statemachine.config.JunctionStateMachineConfiguration;
+import com.baeldung.spring.statemachine.config.SimpleEnumStateMachineConfiguration;
+import com.baeldung.spring.statemachine.config.SimpleStateMachineConfiguration;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = { SimpleStateMachineConfiguration.class, SimpleEnumStateMachineConfiguration.class,
+ JunctionStateMachineConfiguration.class, HierarchicalStateMachineConfiguration.class,
+ ForkJoinStateMachineConfiguration.class })
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-swagger-codegen/spring-swagger-codegen-app/pom.xml b/spring-swagger-codegen/spring-swagger-codegen-app/pom.xml
index 0fb5cf8e75..4aff696828 100644
--- a/spring-swagger-codegen/spring-swagger-codegen-app/pom.xml
+++ b/spring-swagger-codegen/spring-swagger-codegen-app/pom.xml
@@ -21,6 +21,12 @@
spring-boot-starter-web
${spring.version}
+
+ org.springframework.boot
+ spring-boot-starter-test
+ ${spring.version}
+ test
+
diff --git a/spring-swagger-codegen/spring-swagger-codegen-app/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-swagger-codegen/spring-swagger-codegen-app/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..2143dc7f4d
--- /dev/null
+++ b/spring-swagger-codegen/spring-swagger-codegen-app/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.petstore.app.PetStoreApplication;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = PetStoreApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-thymeleaf/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-thymeleaf/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..c7a0b4fc60
--- /dev/null
+++ b/spring-thymeleaf/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,22 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+
+import com.baeldung.thymeleaf.config.InitSecurity;
+import com.baeldung.thymeleaf.config.WebApp;
+import com.baeldung.thymeleaf.config.WebMVCConfig;
+import com.baeldung.thymeleaf.config.WebMVCSecurity;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@WebAppConfiguration
+@ContextConfiguration(classes = { WebApp.class, WebMVCConfig.class, WebMVCSecurity.class, InitSecurity.class })
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-userservice/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-userservice/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..825b89eb10
--- /dev/null
+++ b/spring-userservice/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,18 @@
+package org.baeldung;
+
+import org.baeldung.custom.config.MvcConfig;
+import org.baeldung.custom.config.PersistenceDerbyJPAConfig;
+import org.baeldung.custom.config.SecSecurityConfig;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = { MvcConfig.class, PersistenceDerbyJPAConfig.class, SecSecurityConfig.class })
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-vault/README.md b/spring-vault/README.md
new file mode 100644
index 0000000000..8db065a3dd
--- /dev/null
+++ b/spring-vault/README.md
@@ -0,0 +1,2 @@
+### Relevant Articles:
+- [Spring Vault](https://www.baeldung.com/spring-vault)
diff --git a/spring-vault/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-vault/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..a2d727ea79
--- /dev/null
+++ b/spring-vault/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,16 @@
+package org.baeldung;
+
+import org.baeldung.springvault.SpringVaultApplication;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = SpringVaultApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-vertx/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-vertx/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..b1f7b39f7e
--- /dev/null
+++ b/spring-vertx/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,17 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.vertxspring.VertxSpringApplication;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = VertxSpringApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-webflux-amqp/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-webflux-amqp/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..35efff49c2
--- /dev/null
+++ b/spring-webflux-amqp/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,16 @@
+package org.baeldung;
+
+import org.baeldung.spring.amqp.SpringWebfluxAmqpApplication;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = SpringWebfluxAmqpApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-zuul/spring-zuul-foos-resource/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-zuul/spring-zuul-foos-resource/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..623966373b
--- /dev/null
+++ b/spring-zuul/spring-zuul-foos-resource/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,16 @@
+package org.baeldung;
+
+import org.baeldung.config.ResourceServerApplication;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = ResourceServerApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/spring-zuul/spring-zuul-ui/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-zuul/spring-zuul-ui/src/test/java/org/baeldung/SpringContextIntegrationTest.java
new file mode 100644
index 0000000000..a3d49627e5
--- /dev/null
+++ b/spring-zuul/spring-zuul-ui/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -0,0 +1,16 @@
+package org.baeldung;
+
+import org.baeldung.config.UiApplication;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = UiApplication.class)
+public class SpringContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/static-analysis/src/test/java/com/baeldung/pmd/CntTest.java b/static-analysis/src/test/java/com/baeldung/pmd/CntUnitTest.java
similarity index 92%
rename from static-analysis/src/test/java/com/baeldung/pmd/CntTest.java
rename to static-analysis/src/test/java/com/baeldung/pmd/CntUnitTest.java
index ed72602f99..cdbf9f6f5e 100644
--- a/static-analysis/src/test/java/com/baeldung/pmd/CntTest.java
+++ b/static-analysis/src/test/java/com/baeldung/pmd/CntUnitTest.java
@@ -4,7 +4,7 @@ import static org.junit.Assert.assertEquals;
import org.junit.Test;
-public class CntTest {
+public class CntUnitTest {
private Cnt service;
diff --git a/testing-modules/junit-5/README.md b/testing-modules/junit-5/README.md
index 40c4e8cde9..836848282b 100644
--- a/testing-modules/junit-5/README.md
+++ b/testing-modules/junit-5/README.md
@@ -1,7 +1,6 @@
### Relevant Articles:
- [The Basics of JUnit 5 – A Preview](http://www.baeldung.com/junit-5-preview)
- [A Guide to JUnit 5](http://www.baeldung.com/junit-5)
-- [Guide to Dynamic Tests in Junit 5](http://www.baeldung.com/junit5-dynamic-tests)
- [A Guide to @RepeatedTest in Junit 5](http://www.baeldung.com/junit-5-repeated-test)
- [Guide to Dynamic Tests in Junit 5](http://www.baeldung.com/junit5-dynamic-tests)
- [A Guied to JUnit 5 Extensions](http://www.baeldung.com/junit-5-extensions)
diff --git a/vaadin-spring/README.md b/vaadin-spring/README.md
deleted file mode 100644
index 347c92d7b5..0000000000
--- a/vaadin-spring/README.md
+++ /dev/null
@@ -1,3 +0,0 @@
-### Relevant articles
-
-- [Sample Application with Spring Boot and Vaadin](https://www.baeldung.com/spring-boot-vaadin)