From 2bb03452c25202826b30ab9890b070d140a2fc04 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Fri, 24 May 2019 00:46:42 +0530 Subject: [PATCH 01/62] [BAEL-14776] - Upgraded to spring boot 2 --- spring-security-mvc-session/pom.xml | 27 +++---------------- .../java/org/baeldung/spring/MvcConfig.java | 5 ++-- .../baeldung/spring/SecSecurityConfig.java | 11 ++++++-- 3 files changed, 15 insertions(+), 28 deletions(-) diff --git a/spring-security-mvc-session/pom.xml b/spring-security-mvc-session/pom.xml index c0e1527a24..c1fbda0f98 100644 --- a/spring-security-mvc-session/pom.xml +++ b/spring-security-mvc-session/pom.xml @@ -8,10 +8,10 @@ war - com.baeldung - parent-spring-4 - 0.0.1-SNAPSHOT - ../parent-spring-4 + parent-boot-2 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-2 @@ -21,17 +21,14 @@ org.springframework.security spring-security-web - ${org.springframework.security.version} org.springframework.security spring-security-config - ${org.springframework.security.version} org.springframework.security spring-security-taglibs - ${org.springframework.security.version} @@ -39,7 +36,6 @@ org.springframework spring-core - ${spring.version} commons-logging @@ -50,43 +46,34 @@ org.springframework spring-context - ${spring.version} org.springframework spring-jdbc - ${spring.version} org.springframework spring-beans - ${spring.version} org.springframework spring-aop - ${spring.version} org.springframework spring-tx - ${spring.version} org.springframework spring-expression - ${spring.version} - org.springframework spring-web - ${spring.version} org.springframework spring-webmvc - ${spring.version} @@ -94,14 +81,12 @@ javax.servlet javax.servlet-api - ${javax.servlet-api.version} provided javax.servlet jstl - ${jstl.version} runtime @@ -117,7 +102,6 @@ org.springframework.boot spring-boot-starter-test - 1.5.10.RELEASE test @@ -166,9 +150,6 @@ - - 4.2.6.RELEASE - 3.0.2 diff --git a/spring-security-mvc-session/src/main/java/org/baeldung/spring/MvcConfig.java b/spring-security-mvc-session/src/main/java/org/baeldung/spring/MvcConfig.java index 9e9c240181..b9f50ded73 100644 --- a/spring-security-mvc-session/src/main/java/org/baeldung/spring/MvcConfig.java +++ b/spring-security-mvc-session/src/main/java/org/baeldung/spring/MvcConfig.java @@ -5,13 +5,13 @@ import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.ViewResolver; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.view.InternalResourceViewResolver; import org.springframework.web.servlet.view.JstlView; @EnableWebMvc @Configuration -public class MvcConfig extends WebMvcConfigurerAdapter { +public class MvcConfig implements WebMvcConfigurer { public MvcConfig() { super(); @@ -21,7 +21,6 @@ public class MvcConfig extends WebMvcConfigurerAdapter { @Override public void addViewControllers(final ViewControllerRegistry registry) { - super.addViewControllers(registry); registry.addViewController("/anonymous.html"); diff --git a/spring-security-mvc-session/src/main/java/org/baeldung/spring/SecSecurityConfig.java b/spring-security-mvc-session/src/main/java/org/baeldung/spring/SecSecurityConfig.java index deeea78e4e..b7996ebf18 100644 --- a/spring-security-mvc-session/src/main/java/org/baeldung/spring/SecSecurityConfig.java +++ b/spring-security-mvc-session/src/main/java/org/baeldung/spring/SecSecurityConfig.java @@ -8,6 +8,8 @@ import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.http.SessionCreationPolicy; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.web.authentication.AuthenticationSuccessHandler; import org.springframework.security.web.session.HttpSessionEventPublisher; @@ -24,9 +26,9 @@ public class SecSecurityConfig extends WebSecurityConfigurerAdapter { protected void configure(final AuthenticationManagerBuilder auth) throws Exception { // @formatter:off auth.inMemoryAuthentication() - .withUser("user1").password("user1Pass").roles("USER") + .withUser("user1").password(passwordEncoder().encode("user1Pass")).roles("USER") .and() - .withUser("admin1").password("admin1Pass").roles("ADMIN"); + .withUser("admin1").password(passwordEncoder().encode("admin1Pass")).roles("ADMIN"); // @formatter:on } @@ -68,5 +70,10 @@ public class SecSecurityConfig extends WebSecurityConfigurerAdapter { public HttpSessionEventPublisher httpSessionEventPublisher() { return new HttpSessionEventPublisher(); } + + @Bean + public PasswordEncoder passwordEncoder() { + return new BCryptPasswordEncoder(); + } } From 2d0eeabcd88f83a8e56ae3eb6d02e9275e1085f4 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sun, 16 Jun 2019 00:28:58 +0530 Subject: [PATCH 02/62] [BAEL-14776] - Converted to boot project and added starters inn pom.xml --- core-java-modules/core-java-lambdas/README.MD | 2 +- spring-security-mvc-session/pom.xml | 51 +++---------------- .../baeldung/SpringSessionApplication.java | 12 +++++ 3 files changed, 21 insertions(+), 44 deletions(-) create mode 100644 spring-security-mvc-session/src/main/java/org/baeldung/SpringSessionApplication.java diff --git a/core-java-modules/core-java-lambdas/README.MD b/core-java-modules/core-java-lambdas/README.MD index 31790ffbb1..10b876735e 100644 --- a/core-java-modules/core-java-lambdas/README.MD +++ b/core-java-modules/core-java-lambdas/README.MD @@ -1,3 +1,3 @@ -### Relevant Articles +## Relevant articles: - [Why Do Local Variables Used in Lambdas Have to Be Final or Effectively Final?](https://www.baeldung.com/java-lambda-effectively-final-local-variables) diff --git a/spring-security-mvc-session/pom.xml b/spring-security-mvc-session/pom.xml index c1fbda0f98..276f651436 100644 --- a/spring-security-mvc-session/pom.xml +++ b/spring-security-mvc-session/pom.xml @@ -19,12 +19,8 @@ - org.springframework.security - spring-security-web - - - org.springframework.security - spring-security-config + org.springframework.boot + spring-boot-starter-security org.springframework.security @@ -32,48 +28,17 @@ - - org.springframework - spring-core - - - commons-logging - commons-logging - - + org.springframework.boot + spring-boot-starter-web - org.springframework - spring-context + org.apache.tomcat.embed + tomcat-embed-jasper - org.springframework - spring-jdbc - - - org.springframework - spring-beans - - - org.springframework - spring-aop - - - org.springframework - spring-tx - - - org.springframework - spring-expression - - - org.springframework - spring-web - - - org.springframework - spring-webmvc + org.springframework.boot + spring-boot-starter-tomcat diff --git a/spring-security-mvc-session/src/main/java/org/baeldung/SpringSessionApplication.java b/spring-security-mvc-session/src/main/java/org/baeldung/SpringSessionApplication.java new file mode 100644 index 0000000000..9e52f0430a --- /dev/null +++ b/spring-security-mvc-session/src/main/java/org/baeldung/SpringSessionApplication.java @@ -0,0 +1,12 @@ +package org.baeldung; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class SpringSessionApplication { + + public static void main(String[] args) { + SpringApplication.run(SpringSessionApplication.class, args); + } +} From 40c2e9541fd9193efdc1cbf5a53cb013200e0834 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sun, 16 Jun 2019 11:43:26 +0530 Subject: [PATCH 03/62] [BAEL-15412] - Moved article to libraries-http module --- libraries-http/README.md | 7 ++ libraries-http/pom.xml | 81 +++++++++++++++++++ .../googlehttpclientguide/GitHubExample.java | 0 .../googlehttpclientguide/GitHubUrl.java | 0 .../baeldung/googlehttpclientguide/User.java | 0 .../googlehttpclientguide/logging.properties | 0 libraries-http/src/main/resources/logback.xml | 13 +++ .../AsyncHttpClientLiveTest.java | 0 .../test/java/com/baeldung/client/Consts.java | 0 .../okhttp/DefaultContentTypeInterceptor.java | 0 .../okhttp/OkHttpFileUploadingLiveTest.java | 3 + .../baeldung/okhttp/OkHttpGetLiveTest.java | 3 + .../baeldung/okhttp/OkHttpHeaderLiveTest.java | 0 .../baeldung/okhttp/OkHttpMiscLiveTest.java | 3 + .../okhttp/OkHttpPostingLiveTest.java | 3 + .../okhttp/OkHttpRedirectLiveTest.java | 0 .../okhttp/ProgressRequestWrapper.java | 0 libraries/README.md | 3 - libraries/pom.xml | 9 +-- pom.xml | 2 + spring-rest/README.md | 1 - spring-rest/pom.xml | 9 --- 22 files changed, 116 insertions(+), 21 deletions(-) create mode 100644 libraries-http/README.md create mode 100644 libraries-http/pom.xml rename {libraries => libraries-http}/src/main/java/com/baeldung/googlehttpclientguide/GitHubExample.java (100%) rename {libraries => libraries-http}/src/main/java/com/baeldung/googlehttpclientguide/GitHubUrl.java (100%) rename {libraries => libraries-http}/src/main/java/com/baeldung/googlehttpclientguide/User.java (100%) rename {libraries => libraries-http}/src/main/java/com/baeldung/googlehttpclientguide/logging.properties (100%) create mode 100644 libraries-http/src/main/resources/logback.xml rename {libraries => libraries-http}/src/test/java/com/baeldung/asynchttpclient/AsyncHttpClientLiveTest.java (100%) rename {spring-rest => libraries-http}/src/test/java/com/baeldung/client/Consts.java (100%) rename {spring-rest => libraries-http}/src/test/java/com/baeldung/okhttp/DefaultContentTypeInterceptor.java (100%) rename {spring-rest => libraries-http}/src/test/java/com/baeldung/okhttp/OkHttpFileUploadingLiveTest.java (93%) rename {spring-rest => libraries-http}/src/test/java/com/baeldung/okhttp/OkHttpGetLiveTest.java (93%) rename {spring-rest => libraries-http}/src/test/java/com/baeldung/okhttp/OkHttpHeaderLiveTest.java (100%) rename {spring-rest => libraries-http}/src/test/java/com/baeldung/okhttp/OkHttpMiscLiveTest.java (95%) rename {spring-rest => libraries-http}/src/test/java/com/baeldung/okhttp/OkHttpPostingLiveTest.java (94%) rename {spring-rest => libraries-http}/src/test/java/com/baeldung/okhttp/OkHttpRedirectLiveTest.java (100%) rename {spring-rest => libraries-http}/src/test/java/com/baeldung/okhttp/ProgressRequestWrapper.java (100%) diff --git a/libraries-http/README.md b/libraries-http/README.md new file mode 100644 index 0000000000..dd8c6a5f67 --- /dev/null +++ b/libraries-http/README.md @@ -0,0 +1,7 @@ + +### Relevant Articles: + +- [A Guide to OkHttp](http://www.baeldung.com/guide-to-okhttp) +- [A Guide to Google-Http-Client](http://www.baeldung.com/google-http-client) +- [Asynchronous HTTP with async-http-client in Java](http://www.baeldung.com/async-http-client) +- [WebSockets with AsyncHttpClient](http://www.baeldung.com/async-http-client-websockets) diff --git a/libraries-http/pom.xml b/libraries-http/pom.xml new file mode 100644 index 0000000000..6006a93aef --- /dev/null +++ b/libraries-http/pom.xml @@ -0,0 +1,81 @@ + + + + 4.0.0 + libraries-http + libraries-http + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + + + + + org.assertj + assertj-core + ${assertj.version} + + + + + com.squareup.okhttp3 + okhttp + ${com.squareup.okhttp3.version} + + + + + com.google.http-client + google-http-client + ${googleclient.version} + + + com.google.http-client + google-http-client-jackson2 + ${googleclient.version} + + + com.google.http-client + google-http-client-gson + ${googleclient.version} + + + + + org.asynchttpclient + async-http-client + ${async.http.client.version} + + + + com.fasterxml.jackson.core + jackson-databind + ${jackson.version} + + + + com.google.code.gson + gson + 2.8.5 + + + + com.squareup.okhttp3 + mockwebserver + ${com.squareup.okhttp3.version} + test + + + + + + 3.6.2 + 3.14.2 + 1.23.0 + 2.2.0 + + diff --git a/libraries/src/main/java/com/baeldung/googlehttpclientguide/GitHubExample.java b/libraries-http/src/main/java/com/baeldung/googlehttpclientguide/GitHubExample.java similarity index 100% rename from libraries/src/main/java/com/baeldung/googlehttpclientguide/GitHubExample.java rename to libraries-http/src/main/java/com/baeldung/googlehttpclientguide/GitHubExample.java diff --git a/libraries/src/main/java/com/baeldung/googlehttpclientguide/GitHubUrl.java b/libraries-http/src/main/java/com/baeldung/googlehttpclientguide/GitHubUrl.java similarity index 100% rename from libraries/src/main/java/com/baeldung/googlehttpclientguide/GitHubUrl.java rename to libraries-http/src/main/java/com/baeldung/googlehttpclientguide/GitHubUrl.java diff --git a/libraries/src/main/java/com/baeldung/googlehttpclientguide/User.java b/libraries-http/src/main/java/com/baeldung/googlehttpclientguide/User.java similarity index 100% rename from libraries/src/main/java/com/baeldung/googlehttpclientguide/User.java rename to libraries-http/src/main/java/com/baeldung/googlehttpclientguide/User.java diff --git a/libraries/src/main/java/com/baeldung/googlehttpclientguide/logging.properties b/libraries-http/src/main/java/com/baeldung/googlehttpclientguide/logging.properties similarity index 100% rename from libraries/src/main/java/com/baeldung/googlehttpclientguide/logging.properties rename to libraries-http/src/main/java/com/baeldung/googlehttpclientguide/logging.properties diff --git a/libraries-http/src/main/resources/logback.xml b/libraries-http/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/libraries-http/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/libraries/src/test/java/com/baeldung/asynchttpclient/AsyncHttpClientLiveTest.java b/libraries-http/src/test/java/com/baeldung/asynchttpclient/AsyncHttpClientLiveTest.java similarity index 100% rename from libraries/src/test/java/com/baeldung/asynchttpclient/AsyncHttpClientLiveTest.java rename to libraries-http/src/test/java/com/baeldung/asynchttpclient/AsyncHttpClientLiveTest.java diff --git a/spring-rest/src/test/java/com/baeldung/client/Consts.java b/libraries-http/src/test/java/com/baeldung/client/Consts.java similarity index 100% rename from spring-rest/src/test/java/com/baeldung/client/Consts.java rename to libraries-http/src/test/java/com/baeldung/client/Consts.java diff --git a/spring-rest/src/test/java/com/baeldung/okhttp/DefaultContentTypeInterceptor.java b/libraries-http/src/test/java/com/baeldung/okhttp/DefaultContentTypeInterceptor.java similarity index 100% rename from spring-rest/src/test/java/com/baeldung/okhttp/DefaultContentTypeInterceptor.java rename to libraries-http/src/test/java/com/baeldung/okhttp/DefaultContentTypeInterceptor.java diff --git a/spring-rest/src/test/java/com/baeldung/okhttp/OkHttpFileUploadingLiveTest.java b/libraries-http/src/test/java/com/baeldung/okhttp/OkHttpFileUploadingLiveTest.java similarity index 93% rename from spring-rest/src/test/java/com/baeldung/okhttp/OkHttpFileUploadingLiveTest.java rename to libraries-http/src/test/java/com/baeldung/okhttp/OkHttpFileUploadingLiveTest.java index 75980a5360..7b28c17607 100644 --- a/spring-rest/src/test/java/com/baeldung/okhttp/OkHttpFileUploadingLiveTest.java +++ b/libraries-http/src/test/java/com/baeldung/okhttp/OkHttpFileUploadingLiveTest.java @@ -19,6 +19,9 @@ import okhttp3.Response; import org.junit.Before; import org.junit.Test; +/** + * Execute spring-rest module before running this live test + */ public class OkHttpFileUploadingLiveTest { private static final String BASE_URL = "http://localhost:" + APPLICATION_PORT + "/spring-rest"; diff --git a/spring-rest/src/test/java/com/baeldung/okhttp/OkHttpGetLiveTest.java b/libraries-http/src/test/java/com/baeldung/okhttp/OkHttpGetLiveTest.java similarity index 93% rename from spring-rest/src/test/java/com/baeldung/okhttp/OkHttpGetLiveTest.java rename to libraries-http/src/test/java/com/baeldung/okhttp/OkHttpGetLiveTest.java index 3edd2eab06..5efc4aa998 100644 --- a/spring-rest/src/test/java/com/baeldung/okhttp/OkHttpGetLiveTest.java +++ b/libraries-http/src/test/java/com/baeldung/okhttp/OkHttpGetLiveTest.java @@ -17,6 +17,9 @@ import okhttp3.Response; import org.junit.Before; import org.junit.Test; +/** + * Execute spring-rest module before running this live test + */ public class OkHttpGetLiveTest { private static final String BASE_URL = "http://localhost:" + APPLICATION_PORT + "/spring-rest"; diff --git a/spring-rest/src/test/java/com/baeldung/okhttp/OkHttpHeaderLiveTest.java b/libraries-http/src/test/java/com/baeldung/okhttp/OkHttpHeaderLiveTest.java similarity index 100% rename from spring-rest/src/test/java/com/baeldung/okhttp/OkHttpHeaderLiveTest.java rename to libraries-http/src/test/java/com/baeldung/okhttp/OkHttpHeaderLiveTest.java diff --git a/spring-rest/src/test/java/com/baeldung/okhttp/OkHttpMiscLiveTest.java b/libraries-http/src/test/java/com/baeldung/okhttp/OkHttpMiscLiveTest.java similarity index 95% rename from spring-rest/src/test/java/com/baeldung/okhttp/OkHttpMiscLiveTest.java rename to libraries-http/src/test/java/com/baeldung/okhttp/OkHttpMiscLiveTest.java index 207ad14e71..24617794d1 100644 --- a/spring-rest/src/test/java/com/baeldung/okhttp/OkHttpMiscLiveTest.java +++ b/libraries-http/src/test/java/com/baeldung/okhttp/OkHttpMiscLiveTest.java @@ -20,6 +20,9 @@ import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +/** + * Execute spring-rest module before running this live test + */ public class OkHttpMiscLiveTest { private static final String BASE_URL = "http://localhost:" + APPLICATION_PORT + "/spring-rest"; diff --git a/spring-rest/src/test/java/com/baeldung/okhttp/OkHttpPostingLiveTest.java b/libraries-http/src/test/java/com/baeldung/okhttp/OkHttpPostingLiveTest.java similarity index 94% rename from spring-rest/src/test/java/com/baeldung/okhttp/OkHttpPostingLiveTest.java rename to libraries-http/src/test/java/com/baeldung/okhttp/OkHttpPostingLiveTest.java index 66fee0b626..19e689c093 100644 --- a/spring-rest/src/test/java/com/baeldung/okhttp/OkHttpPostingLiveTest.java +++ b/libraries-http/src/test/java/com/baeldung/okhttp/OkHttpPostingLiveTest.java @@ -20,6 +20,9 @@ import okhttp3.Response; import org.junit.Before; import org.junit.Test; +/** + * Execute spring-rest module before running this live test + */ public class OkHttpPostingLiveTest { private static final String BASE_URL = "http://localhost:" + APPLICATION_PORT + "/spring-rest"; diff --git a/spring-rest/src/test/java/com/baeldung/okhttp/OkHttpRedirectLiveTest.java b/libraries-http/src/test/java/com/baeldung/okhttp/OkHttpRedirectLiveTest.java similarity index 100% rename from spring-rest/src/test/java/com/baeldung/okhttp/OkHttpRedirectLiveTest.java rename to libraries-http/src/test/java/com/baeldung/okhttp/OkHttpRedirectLiveTest.java diff --git a/spring-rest/src/test/java/com/baeldung/okhttp/ProgressRequestWrapper.java b/libraries-http/src/test/java/com/baeldung/okhttp/ProgressRequestWrapper.java similarity index 100% rename from spring-rest/src/test/java/com/baeldung/okhttp/ProgressRequestWrapper.java rename to libraries-http/src/test/java/com/baeldung/okhttp/ProgressRequestWrapper.java diff --git a/libraries/README.md b/libraries/README.md index f6a39daef1..f6f2cf4e07 100644 --- a/libraries/README.md +++ b/libraries/README.md @@ -36,14 +36,11 @@ - [Introduction To Docx4J](http://www.baeldung.com/docx4j) - [Introduction to StreamEx](http://www.baeldung.com/streamex) - [Introduction to BouncyCastle with Java](http://www.baeldung.com/java-bouncy-castle) -- [A Guide to Google-Http-Client](http://www.baeldung.com/google-http-client) - [Interact with Google Sheets from Java](http://www.baeldung.com/google-sheets-java-client) - [A Docker Guide for Java](http://www.baeldung.com/docker-java-api) - [Introduction To OpenCSV](http://www.baeldung.com/opencsv) - [Introduction to Akka Actors in Java](http://www.baeldung.com/akka-actors-java) -- [Asynchronous HTTP with async-http-client in Java](http://www.baeldung.com/async-http-client) - [Introduction to Smooks](http://www.baeldung.com/smooks) -- [WebSockets with AsyncHttpClient](http://www.baeldung.com/async-http-client-websockets) - [A Guide to Infinispan in Java](http://www.baeldung.com/infinispan) - [Introduction to OpenCSV](http://www.baeldung.com/opencsv) - [A Guide to Unirest](http://www.baeldung.com/unirest) diff --git a/libraries/pom.xml b/libraries/pom.xml index 7823732224..f6c88197bd 100644 --- a/libraries/pom.xml +++ b/libraries/pom.xml @@ -25,13 +25,7 @@ ${typesafe-akka.version} test - - - - org.asynchttpclient - async-http-client - ${async.http.client.version} - + org.beykery @@ -871,7 +865,6 @@ 2.0.0 1.7.0 3.0.14 - 2.2.0 9.1.5.Final 4.1 1.4.9 diff --git a/pom.xml b/pom.xml index 9760e06bc1..a099dd7d68 100644 --- a/pom.xml +++ b/pom.xml @@ -505,6 +505,7 @@ libraries-primitive libraries-security libraries-server + libraries-http linkrest logging-modules lombok @@ -1183,6 +1184,7 @@ libraries-apache-commons libraries-security libraries-server + libraries-http linkrest logging-modules lombok diff --git a/spring-rest/README.md b/spring-rest/README.md index 5d7894cdf8..54b47604d4 100644 --- a/spring-rest/README.md +++ b/spring-rest/README.md @@ -6,7 +6,6 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring ### Relevant Articles: - [Spring @RequestMapping](http://www.baeldung.com/spring-requestmapping) - [Returning Custom Status Codes from Spring Controllers](http://www.baeldung.com/spring-mvc-controller-custom-http-status-code) -- [A Guide to OkHttp](http://www.baeldung.com/guide-to-okhttp) - [Binary Data Formats in a Spring REST API](http://www.baeldung.com/spring-rest-api-with-binary-data-formats) - [Guide to UriComponentsBuilder in Spring](http://www.baeldung.com/spring-uricomponentsbuilder) - [Introduction to FindBugs](http://www.baeldung.com/intro-to-findbugs) diff --git a/spring-rest/pom.xml b/spring-rest/pom.xml index 36934af101..99bdd7646d 100644 --- a/spring-rest/pom.xml +++ b/spring-rest/pom.xml @@ -93,13 +93,6 @@ commons-lang3 - - - com.squareup.okhttp3 - okhttp - ${com.squareup.okhttp3.version} - - org.hamcrest @@ -280,8 +273,6 @@ 3.0.4 3.0.0 false - - 3.4.1 2.2.0 3.5.11 From 112fed951642dcdade2e0c617c4dba285a8afa4c Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sun, 16 Jun 2019 21:32:47 +0530 Subject: [PATCH 04/62] [BAEL-14776] - Removed explicit version mention from xml config file --- .../src/main/resources/webSecurityConfig.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-security-mvc-session/src/main/resources/webSecurityConfig.xml b/spring-security-mvc-session/src/main/resources/webSecurityConfig.xml index e8aa2f76bc..42ff4c2186 100644 --- a/spring-security-mvc-session/src/main/resources/webSecurityConfig.xml +++ b/spring-security-mvc-session/src/main/resources/webSecurityConfig.xml @@ -2,9 +2,9 @@ From f13b1e78ef0528eabf0b0903b284070122600324 Mon Sep 17 00:00:00 2001 From: gpq5 Date: Sat, 22 Jun 2019 22:17:12 +0530 Subject: [PATCH 05/62] [BAEL-3002] Comparing 2 JSON objects with Jackson --- .../json/compare/JsonCompareUnitTest.java | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 jackson-2/src/test/java/com/baeldung/jackson/json/compare/JsonCompareUnitTest.java diff --git a/jackson-2/src/test/java/com/baeldung/jackson/json/compare/JsonCompareUnitTest.java b/jackson-2/src/test/java/com/baeldung/jackson/json/compare/JsonCompareUnitTest.java new file mode 100644 index 0000000000..02f6726901 --- /dev/null +++ b/jackson-2/src/test/java/com/baeldung/jackson/json/compare/JsonCompareUnitTest.java @@ -0,0 +1,62 @@ +package com.baeldung.jackson.json.compare; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.io.IOException; +import java.util.Comparator; + +import org.junit.Test; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.NumericNode; + +public class JsonCompareUnitTest { + + @Test + public void givenTwoSameJsonDataObjects_whenCompared_thenAreEqual() throws IOException { + ObjectMapper mapper = new ObjectMapper(); + + String jsonString1 = "{\"k1\":\"v1\",\"k2\":\"v2\",\"k3\":\"v3\",\"k4\":\"v4\"}"; + String jsonString2 = "{\"k1\":\"v1\",\"k2\":\"v2\",\"k3\":\"v3\",\"k4\":\"v4\"}"; + JsonNode actualObj1 = mapper.readTree(jsonString1); + JsonNode actualObj2 = mapper.readTree(jsonString2); + + assertTrue(actualObj1.equals(actualObj2)); + + } + + @Test + public void givenTwoJsonDataObjects_whenComparedUsingCustomComparator_thenEqual() throws Exception { + ObjectMapper mapper = new ObjectMapper(); + + String jsonString1 = "{\"k1\": 5,\"k2\":9191}"; + String jsonString2 = "{\"k1\": 5.0,\"k2\":9191}"; + JsonNode actualObj1 = mapper.readTree(jsonString1); + JsonNode actualObj2 = mapper.readTree(jsonString2); + + assertFalse(actualObj1.equals(actualObj2)); + + Comparator cmp = new Comparator() { + @Override + public int compare(JsonNode o1, JsonNode o2) { + if (o1.equals(o2)) { + return 0; + } + if ((o1 instanceof NumericNode) && (o2 instanceof NumericNode)) { + double d1 = ((NumericNode) o1).asDouble(); + double d2 = ((NumericNode) o2).asDouble(); + if (d1 == d2) { + return 0; + } + } + return 1; + } + }; + + assertTrue(actualObj1.equals(cmp, actualObj2)); + + } + +} From 0eeb8a37f5d6fa5870f583e4e66b879895102927 Mon Sep 17 00:00:00 2001 From: gpq5 Date: Sun, 23 Jun 2019 08:58:20 +0530 Subject: [PATCH 06/62] added additional examples --- .../json/compare/JsonCompareUnitTest.java | 47 +++++++++++++++---- 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/jackson-2/src/test/java/com/baeldung/jackson/json/compare/JsonCompareUnitTest.java b/jackson-2/src/test/java/com/baeldung/jackson/json/compare/JsonCompareUnitTest.java index 02f6726901..100f999d10 100644 --- a/jackson-2/src/test/java/com/baeldung/jackson/json/compare/JsonCompareUnitTest.java +++ b/jackson-2/src/test/java/com/baeldung/jackson/json/compare/JsonCompareUnitTest.java @@ -18,10 +18,39 @@ public class JsonCompareUnitTest { public void givenTwoSameJsonDataObjects_whenCompared_thenAreEqual() throws IOException { ObjectMapper mapper = new ObjectMapper(); - String jsonString1 = "{\"k1\":\"v1\",\"k2\":\"v2\",\"k3\":\"v3\",\"k4\":\"v4\"}"; - String jsonString2 = "{\"k1\":\"v1\",\"k2\":\"v2\",\"k3\":\"v3\",\"k4\":\"v4\"}"; - JsonNode actualObj1 = mapper.readTree(jsonString1); - JsonNode actualObj2 = mapper.readTree(jsonString2); + String s1 = "{\"employee\": {\"id\": \"1212\",\"fullName\": \"John Miles\",\"age\": 34 }}"; + String s2 = "{\"employee\": {\"id\": \"1212\",\"fullName\": \"John Miles\",\"age\": 34 }}"; + + JsonNode actualObj1 = mapper.readTree(s1); + JsonNode actualObj2 = mapper.readTree(s2); + + assertTrue(actualObj1.equals(actualObj2)); + + } + + @Test + public void givenTwoSameNestedJsonDataObjects_whenCompared_thenAreEqual() throws IOException { + ObjectMapper mapper = new ObjectMapper(); + + String s1 = "{\"employee\": {\"id\": \"1212\",\"fullName\": \"John Miles\",\"age\": 34,\n" + "\"contact\":{\"email\": \"john@xyz.com\",\"phone\": \"9999999999\"} }}"; + String s2 = "{\"employee\": {\"id\": \"1212\",\"fullName\": \"John Miles\",\"age\": 34,\n" + "\"contact\":{\"email\": \"john@xyz.com\",\"phone\": \"9999999999\"} }}"; + + JsonNode actualObj1 = mapper.readTree(s1); + JsonNode actualObj2 = mapper.readTree(s2); + + assertTrue(actualObj1.equals(actualObj2)); + + } + + @Test + public void givenTwoSameListJsonDataObjects_whenCompared_thenAreEqual() throws IOException { + ObjectMapper mapper = new ObjectMapper(); + + String s1 = "{\"employee\": {\"id\": \"1212\",\"fullName\": \"John Miles\",\"age\": 34, \"skills\":[\"Java\", \"C++\", \"Python\"] }}"; + String s2 = "{\"employee\": {\"id\": \"1212\",\"fullName\": \"John Miles\",\"age\": 34, \"skills\":[\"Java\", \"C++\", \"Python\"] }}"; + + JsonNode actualObj1 = mapper.readTree(s1); + JsonNode actualObj2 = mapper.readTree(s2); assertTrue(actualObj1.equals(actualObj2)); @@ -31,12 +60,11 @@ public class JsonCompareUnitTest { public void givenTwoJsonDataObjects_whenComparedUsingCustomComparator_thenEqual() throws Exception { ObjectMapper mapper = new ObjectMapper(); - String jsonString1 = "{\"k1\": 5,\"k2\":9191}"; - String jsonString2 = "{\"k1\": 5.0,\"k2\":9191}"; - JsonNode actualObj1 = mapper.readTree(jsonString1); - JsonNode actualObj2 = mapper.readTree(jsonString2); + String s1 = "{\"name\": \"John\",\"score\":5.0}"; + String s2 = "{\"name\": \"John\",\"score\":5}"; + JsonNode actualObj1 = mapper.readTree(s1); + JsonNode actualObj2 = mapper.readTree(s2); - assertFalse(actualObj1.equals(actualObj2)); Comparator cmp = new Comparator() { @Override @@ -55,6 +83,7 @@ public class JsonCompareUnitTest { } }; + assertFalse(actualObj1.equals(actualObj2)); assertTrue(actualObj1.equals(cmp, actualObj2)); } From 706035468b8992f58fd79ecc3d47311f92dd8104 Mon Sep 17 00:00:00 2001 From: gpq5 Date: Sun, 23 Jun 2019 12:35:44 +0530 Subject: [PATCH 07/62] Minor fixes --- .../jackson/json/compare/JsonCompareUnitTest.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/jackson-2/src/test/java/com/baeldung/jackson/json/compare/JsonCompareUnitTest.java b/jackson-2/src/test/java/com/baeldung/jackson/json/compare/JsonCompareUnitTest.java index 100f999d10..05b89abc09 100644 --- a/jackson-2/src/test/java/com/baeldung/jackson/json/compare/JsonCompareUnitTest.java +++ b/jackson-2/src/test/java/com/baeldung/jackson/json/compare/JsonCompareUnitTest.java @@ -18,8 +18,8 @@ public class JsonCompareUnitTest { public void givenTwoSameJsonDataObjects_whenCompared_thenAreEqual() throws IOException { ObjectMapper mapper = new ObjectMapper(); - String s1 = "{\"employee\": {\"id\": \"1212\",\"fullName\": \"John Miles\",\"age\": 34 }}"; - String s2 = "{\"employee\": {\"id\": \"1212\",\"fullName\": \"John Miles\",\"age\": 34 }}"; + String s1 = "{\"employee\": {\"id\": \"1212\",\"fullName\": \"John Miles\", \"age\": 34 }}"; + String s2 = "{\"employee\": {\"id\": \"1212\",\"age\": 34, \"fullName\": \"John Miles\" }}"; JsonNode actualObj1 = mapper.readTree(s1); JsonNode actualObj2 = mapper.readTree(s2); @@ -29,11 +29,11 @@ public class JsonCompareUnitTest { } @Test - public void givenTwoSameNestedJsonDataObjects_whenCompared_thenAreEqual() throws IOException { + public void givenTwoSameNestedJsonDataObjects_whenCompared_thenEqual() throws IOException { ObjectMapper mapper = new ObjectMapper(); - String s1 = "{\"employee\": {\"id\": \"1212\",\"fullName\": \"John Miles\",\"age\": 34,\n" + "\"contact\":{\"email\": \"john@xyz.com\",\"phone\": \"9999999999\"} }}"; - String s2 = "{\"employee\": {\"id\": \"1212\",\"fullName\": \"John Miles\",\"age\": 34,\n" + "\"contact\":{\"email\": \"john@xyz.com\",\"phone\": \"9999999999\"} }}"; + String s1 = "{\"employee\": {\"id\": \"1212\",\"fullName\": \"John Miles\",\"age\": 34, \"contact\":{\"email\": \"john@xyz.com\",\"phone\": \"9999999999\"} }}"; + String s2 = "{\"employee\": {\"id\": \"1212\",\"fullName\": \"John Miles\",\"age\": 34, \"contact\":{\"email\": \"john@xyz.com\",\"phone\": \"9999999999\"} }}"; JsonNode actualObj1 = mapper.readTree(s1); JsonNode actualObj2 = mapper.readTree(s2); @@ -43,7 +43,7 @@ public class JsonCompareUnitTest { } @Test - public void givenTwoSameListJsonDataObjects_whenCompared_thenAreEqual() throws IOException { + public void givenTwoSameListJsonDataObjects_whenCompared_thenEqual() throws IOException { ObjectMapper mapper = new ObjectMapper(); String s1 = "{\"employee\": {\"id\": \"1212\",\"fullName\": \"John Miles\",\"age\": 34, \"skills\":[\"Java\", \"C++\", \"Python\"] }}"; @@ -57,7 +57,7 @@ public class JsonCompareUnitTest { } @Test - public void givenTwoJsonDataObjects_whenComparedUsingCustomComparator_thenEqual() throws Exception { + public void givenTwoJsonDataObjects_whenComparedUsingCustomComparator_thenEqual() throws IOException { ObjectMapper mapper = new ObjectMapper(); String s1 = "{\"name\": \"John\",\"score\":5.0}"; @@ -65,7 +65,6 @@ public class JsonCompareUnitTest { JsonNode actualObj1 = mapper.readTree(s1); JsonNode actualObj2 = mapper.readTree(s2); - Comparator cmp = new Comparator() { @Override public int compare(JsonNode o1, JsonNode o2) { From 3d50c203a630fb42652ad1898e50b0d50eaa2e70 Mon Sep 17 00:00:00 2001 From: gpq5 Date: Fri, 28 Jun 2019 10:15:05 +0530 Subject: [PATCH 08/62] made changes as per review comments --- .../json/compare/JsonCompareUnitTest.java | 46 ++++++++++--------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/jackson-2/src/test/java/com/baeldung/jackson/json/compare/JsonCompareUnitTest.java b/jackson-2/src/test/java/com/baeldung/jackson/json/compare/JsonCompareUnitTest.java index 05b89abc09..2f2c18e248 100644 --- a/jackson-2/src/test/java/com/baeldung/jackson/json/compare/JsonCompareUnitTest.java +++ b/jackson-2/src/test/java/com/baeldung/jackson/json/compare/JsonCompareUnitTest.java @@ -1,6 +1,7 @@ package com.baeldung.jackson.json.compare; -import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertTrue; import java.io.IOException; @@ -24,7 +25,7 @@ public class JsonCompareUnitTest { JsonNode actualObj1 = mapper.readTree(s1); JsonNode actualObj2 = mapper.readTree(s2); - assertTrue(actualObj1.equals(actualObj2)); + assertEquals(actualObj1, actualObj2); } @@ -38,7 +39,7 @@ public class JsonCompareUnitTest { JsonNode actualObj1 = mapper.readTree(s1); JsonNode actualObj2 = mapper.readTree(s2); - assertTrue(actualObj1.equals(actualObj2)); + assertEquals(actualObj1, actualObj2); } @@ -52,7 +53,7 @@ public class JsonCompareUnitTest { JsonNode actualObj1 = mapper.readTree(s1); JsonNode actualObj2 = mapper.readTree(s2); - assertTrue(actualObj1.equals(actualObj2)); + assertEquals(actualObj1, actualObj2); } @@ -65,26 +66,27 @@ public class JsonCompareUnitTest { JsonNode actualObj1 = mapper.readTree(s1); JsonNode actualObj2 = mapper.readTree(s2); - Comparator cmp = new Comparator() { - @Override - public int compare(JsonNode o1, JsonNode o2) { - if (o1.equals(o2)) { - return 0; - } - if ((o1 instanceof NumericNode) && (o2 instanceof NumericNode)) { - double d1 = ((NumericNode) o1).asDouble(); - double d2 = ((NumericNode) o2).asDouble(); - if (d1 == d2) { - return 0; - } - } - return 1; - } - }; + NumericNodeComparator cmp = new NumericNodeComparator(); - assertFalse(actualObj1.equals(actualObj2)); + assertNotEquals(actualObj1, actualObj2); assertTrue(actualObj1.equals(cmp, actualObj2)); } - + + public class NumericNodeComparator implements Comparator { + @Override + public int compare(JsonNode o1, JsonNode o2) { + if (o1.equals(o2)) { + return 0; + } + if ((o1 instanceof NumericNode) && (o2 instanceof NumericNode)) { + Double d1 = ((NumericNode) o1).asDouble(); + Double d2 = ((NumericNode) o2).asDouble(); + if (d1.equals(d2)) { + return 0; + } + } + return 1; + } + } } From cf4b0e2129f1db7859fd4c25af542cdced0aa366 Mon Sep 17 00:00:00 2001 From: Pavan Shankar Koli Date: Sat, 29 Jun 2019 18:53:11 +0530 Subject: [PATCH 09/62] BAEL-2578 Disabling auto configuration --- .../spring-data-jpa/README.md | 3 ++ .../spring-data-jpa/pom.xml | 50 +++++++++++++++++++ .../java/com/baeldung/jpa/SpringDataJPA.java | 15 ++++++ .../src/main/resources/application.properties | 1 + .../src/main/resources/logback.xml | 13 +++++ .../jpa/SpringDataJPAIntegrationTest.java | 26 ++++++++++ .../spring-data-mongodb/README.md | 4 ++ .../spring-data-mongodb/pom.xml | 43 ++++++++++++++++ .../baeldung/mongodb/SpringDataMongoDB.java | 15 ++++++ .../src/main/resources/application.properties | 1 + .../src/main/resources/logback.xml | 13 +++++ .../SpringDataMongoDBIntegrationTest.java | 25 ++++++++++ .../spring-data-redis/README.md | 4 ++ .../spring-data-redis/pom.xml | 43 ++++++++++++++++ .../com/baeldung/redis/SpringDataRedis.java | 14 ++++++ .../src/main/resources/application.properties | 1 + .../src/main/resources/logback.xml | 13 +++++ .../redis/SpringDataRedisIntegrationTest.java | 25 ++++++++++ 18 files changed, 309 insertions(+) create mode 100644 spring-data-disable-auto-configuration/spring-data-jpa/README.md create mode 100644 spring-data-disable-auto-configuration/spring-data-jpa/pom.xml create mode 100644 spring-data-disable-auto-configuration/spring-data-jpa/src/main/java/com/baeldung/jpa/SpringDataJPA.java create mode 100644 spring-data-disable-auto-configuration/spring-data-jpa/src/main/resources/application.properties create mode 100644 spring-data-disable-auto-configuration/spring-data-jpa/src/main/resources/logback.xml create mode 100644 spring-data-disable-auto-configuration/spring-data-jpa/src/test/java/com/baeldung/jpa/SpringDataJPAIntegrationTest.java create mode 100644 spring-data-disable-auto-configuration/spring-data-mongodb/README.md create mode 100644 spring-data-disable-auto-configuration/spring-data-mongodb/pom.xml create mode 100644 spring-data-disable-auto-configuration/spring-data-mongodb/src/main/java/com/baeldung/mongodb/SpringDataMongoDB.java create mode 100644 spring-data-disable-auto-configuration/spring-data-mongodb/src/main/resources/application.properties create mode 100644 spring-data-disable-auto-configuration/spring-data-mongodb/src/main/resources/logback.xml create mode 100644 spring-data-disable-auto-configuration/spring-data-mongodb/src/test/java/com/baeldung/mongodb/SpringDataMongoDBIntegrationTest.java create mode 100644 spring-data-disable-auto-configuration/spring-data-redis/README.md create mode 100644 spring-data-disable-auto-configuration/spring-data-redis/pom.xml create mode 100644 spring-data-disable-auto-configuration/spring-data-redis/src/main/java/com/baeldung/redis/SpringDataRedis.java create mode 100644 spring-data-disable-auto-configuration/spring-data-redis/src/main/resources/application.properties create mode 100644 spring-data-disable-auto-configuration/spring-data-redis/src/main/resources/logback.xml create mode 100644 spring-data-disable-auto-configuration/spring-data-redis/src/test/java/com/baeldung/redis/SpringDataRedisIntegrationTest.java diff --git a/spring-data-disable-auto-configuration/spring-data-jpa/README.md b/spring-data-disable-auto-configuration/spring-data-jpa/README.md new file mode 100644 index 0000000000..23117c9903 --- /dev/null +++ b/spring-data-disable-auto-configuration/spring-data-jpa/README.md @@ -0,0 +1,3 @@ +This module is for Jira BAEL-2578 + +### Relevant Articles: diff --git a/spring-data-disable-auto-configuration/spring-data-jpa/pom.xml b/spring-data-disable-auto-configuration/spring-data-jpa/pom.xml new file mode 100644 index 0000000000..db431fb7fa --- /dev/null +++ b/spring-data-disable-auto-configuration/spring-data-jpa/pom.xml @@ -0,0 +1,50 @@ + + + 4.0.0 + com.baeldung + spring-data-jpa + 0.0.1-SNAPSHOT + spring-data-jpa + jar + Spring Data with JPA + + + parent-boot-2 + com.baeldung + 0.0.1-SNAPSHOT + ../../parent-boot-2 + + + + + org.springframework.boot + spring-boot-starter-data-jpa + 2.1.6.RELEASE + + + + com.h2database + h2 + 1.4.197 + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + \ No newline at end of file diff --git a/spring-data-disable-auto-configuration/spring-data-jpa/src/main/java/com/baeldung/jpa/SpringDataJPA.java b/spring-data-disable-auto-configuration/spring-data-jpa/src/main/java/com/baeldung/jpa/SpringDataJPA.java new file mode 100644 index 0000000000..bec1b18010 --- /dev/null +++ b/spring-data-disable-auto-configuration/spring-data-jpa/src/main/java/com/baeldung/jpa/SpringDataJPA.java @@ -0,0 +1,15 @@ +package com.baeldung.jpa; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration; +import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; + +@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class, HibernateJpaAutoConfiguration.class}) +public class SpringDataJPA { + + public static void main(String[] args) { + SpringApplication.run(SpringDataJPA.class, args); + } +} diff --git a/spring-data-disable-auto-configuration/spring-data-jpa/src/main/resources/application.properties b/spring-data-disable-auto-configuration/spring-data-jpa/src/main/resources/application.properties new file mode 100644 index 0000000000..fc33388896 --- /dev/null +++ b/spring-data-disable-auto-configuration/spring-data-jpa/src/main/resources/application.properties @@ -0,0 +1 @@ +spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration,org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration \ No newline at end of file diff --git a/spring-data-disable-auto-configuration/spring-data-jpa/src/main/resources/logback.xml b/spring-data-disable-auto-configuration/spring-data-jpa/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-data-disable-auto-configuration/spring-data-jpa/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-data-disable-auto-configuration/spring-data-jpa/src/test/java/com/baeldung/jpa/SpringDataJPAIntegrationTest.java b/spring-data-disable-auto-configuration/spring-data-jpa/src/test/java/com/baeldung/jpa/SpringDataJPAIntegrationTest.java new file mode 100644 index 0000000000..170f60f861 --- /dev/null +++ b/spring-data-disable-auto-configuration/spring-data-jpa/src/test/java/com/baeldung/jpa/SpringDataJPAIntegrationTest.java @@ -0,0 +1,26 @@ +package com.baeldung.jpa; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.NoSuchBeanDefinitionException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.context.ApplicationContext; +import org.springframework.test.context.junit4.SpringRunner; + +import javax.sql.DataSource; + + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = SpringDataJPA.class) +public class SpringDataJPAIntegrationTest { + + @Autowired + private ApplicationContext context; + + @Test(expected = NoSuchBeanDefinitionException.class) + public void givenAutoconfigurationIsDisable_whenApplicationStarts_thenContextWillNotHaveTheAutoconfiguredClasses() { + context.getBean(DataSource.class); + } + +} diff --git a/spring-data-disable-auto-configuration/spring-data-mongodb/README.md b/spring-data-disable-auto-configuration/spring-data-mongodb/README.md new file mode 100644 index 0000000000..b91f5eda5a --- /dev/null +++ b/spring-data-disable-auto-configuration/spring-data-mongodb/README.md @@ -0,0 +1,4 @@ +This module is for Jira BAEL-2578 + + +### Relevant Articles: diff --git a/spring-data-disable-auto-configuration/spring-data-mongodb/pom.xml b/spring-data-disable-auto-configuration/spring-data-mongodb/pom.xml new file mode 100644 index 0000000000..95bf32545b --- /dev/null +++ b/spring-data-disable-auto-configuration/spring-data-mongodb/pom.xml @@ -0,0 +1,43 @@ + + + 4.0.0 + com.baeldung + spring-data-mongodb + 0.0.1-SNAPSHOT + spring-data-mongodb + jar + Spring Data with MongoDB + + + parent-boot-2 + com.baeldung + 0.0.1-SNAPSHOT + ../../parent-boot-2 + + + + + org.springframework.boot + spring-boot-starter-data-mongodb + 2.1.6.RELEASE + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + \ No newline at end of file diff --git a/spring-data-disable-auto-configuration/spring-data-mongodb/src/main/java/com/baeldung/mongodb/SpringDataMongoDB.java b/spring-data-disable-auto-configuration/spring-data-mongodb/src/main/java/com/baeldung/mongodb/SpringDataMongoDB.java new file mode 100644 index 0000000000..a38eddb0e8 --- /dev/null +++ b/spring-data-disable-auto-configuration/spring-data-mongodb/src/main/java/com/baeldung/mongodb/SpringDataMongoDB.java @@ -0,0 +1,15 @@ +package com.baeldung.mongodb; + + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration; +import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration; + +@SpringBootApplication(exclude = {MongoAutoConfiguration.class, MongoDataAutoConfiguration.class}) +public class SpringDataMongoDB { + + public static void main(String[] args) { + SpringApplication.run(SpringMongoDB.class, args); + } +} diff --git a/spring-data-disable-auto-configuration/spring-data-mongodb/src/main/resources/application.properties b/spring-data-disable-auto-configuration/spring-data-mongodb/src/main/resources/application.properties new file mode 100644 index 0000000000..9f190ed8ae --- /dev/null +++ b/spring-data-disable-auto-configuration/spring-data-mongodb/src/main/resources/application.properties @@ -0,0 +1 @@ +spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration,org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration \ No newline at end of file diff --git a/spring-data-disable-auto-configuration/spring-data-mongodb/src/main/resources/logback.xml b/spring-data-disable-auto-configuration/spring-data-mongodb/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-data-disable-auto-configuration/spring-data-mongodb/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-data-disable-auto-configuration/spring-data-mongodb/src/test/java/com/baeldung/mongodb/SpringDataMongoDBIntegrationTest.java b/spring-data-disable-auto-configuration/spring-data-mongodb/src/test/java/com/baeldung/mongodb/SpringDataMongoDBIntegrationTest.java new file mode 100644 index 0000000000..33f5620c32 --- /dev/null +++ b/spring-data-disable-auto-configuration/spring-data-mongodb/src/test/java/com/baeldung/mongodb/SpringDataMongoDBIntegrationTest.java @@ -0,0 +1,25 @@ +package com.baeldung.mongodb; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.NoSuchBeanDefinitionException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.context.ApplicationContext; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.test.context.junit4.SpringRunner; + + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = SpringMongoDB.class) +public class SpringDataMongoDBIntegrationTest { + + @Autowired + private ApplicationContext context; + + @Test(expected = NoSuchBeanDefinitionException.class) + public void givenAutoconfigurationIsDisable_whenApplicationStarts_thenContextWillNotHaveTheAutoconfiguredClasses() { + context.getBean(MongoTemplate.class); + } + +} diff --git a/spring-data-disable-auto-configuration/spring-data-redis/README.md b/spring-data-disable-auto-configuration/spring-data-redis/README.md new file mode 100644 index 0000000000..b91f5eda5a --- /dev/null +++ b/spring-data-disable-auto-configuration/spring-data-redis/README.md @@ -0,0 +1,4 @@ +This module is for Jira BAEL-2578 + + +### Relevant Articles: diff --git a/spring-data-disable-auto-configuration/spring-data-redis/pom.xml b/spring-data-disable-auto-configuration/spring-data-redis/pom.xml new file mode 100644 index 0000000000..7c997033ed --- /dev/null +++ b/spring-data-disable-auto-configuration/spring-data-redis/pom.xml @@ -0,0 +1,43 @@ + + + 4.0.0 + com.baeldung + spring-data-redis + 0.0.1-SNAPSHOT + spring-data-redis + jar + Spring Data with Redis + + + parent-boot-2 + com.baeldung + 0.0.1-SNAPSHOT + ../../parent-boot-2 + + + + + org.springframework.boot + spring-boot-starter-data-redis + 2.1.6.RELEASE + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + \ No newline at end of file diff --git a/spring-data-disable-auto-configuration/spring-data-redis/src/main/java/com/baeldung/redis/SpringDataRedis.java b/spring-data-disable-auto-configuration/spring-data-redis/src/main/java/com/baeldung/redis/SpringDataRedis.java new file mode 100644 index 0000000000..d5a682834b --- /dev/null +++ b/spring-data-disable-auto-configuration/spring-data-redis/src/main/java/com/baeldung/redis/SpringDataRedis.java @@ -0,0 +1,14 @@ +package com.baeldung.redis; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration; +import org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration; + +@SpringBootApplication(exclude = {RedisAutoConfiguration.class, RedisRepositoriesAutoConfiguration.class}) +public class SpringDataRedis { + + public static void main(String[] args) { + SpringApplication.run(SpringRedis.class, args); + } +} diff --git a/spring-data-disable-auto-configuration/spring-data-redis/src/main/resources/application.properties b/spring-data-disable-auto-configuration/spring-data-redis/src/main/resources/application.properties new file mode 100644 index 0000000000..8c5a8dbbfd --- /dev/null +++ b/spring-data-disable-auto-configuration/spring-data-redis/src/main/resources/application.properties @@ -0,0 +1 @@ +spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration, org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration \ No newline at end of file diff --git a/spring-data-disable-auto-configuration/spring-data-redis/src/main/resources/logback.xml b/spring-data-disable-auto-configuration/spring-data-redis/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-data-disable-auto-configuration/spring-data-redis/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-data-disable-auto-configuration/spring-data-redis/src/test/java/com/baeldung/redis/SpringDataRedisIntegrationTest.java b/spring-data-disable-auto-configuration/spring-data-redis/src/test/java/com/baeldung/redis/SpringDataRedisIntegrationTest.java new file mode 100644 index 0000000000..e142713417 --- /dev/null +++ b/spring-data-disable-auto-configuration/spring-data-redis/src/test/java/com/baeldung/redis/SpringDataRedisIntegrationTest.java @@ -0,0 +1,25 @@ +package com.baeldung.redis; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.NoSuchBeanDefinitionException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.context.ApplicationContext; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.test.context.junit4.SpringRunner; + + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = SpringRedis.class) +public class SpringDataRedisIntegrationTest { + + @Autowired + private ApplicationContext context; + + @Test(expected = NoSuchBeanDefinitionException.class) + public void givenAutoconfigurationIsDisable_whenApplicationStarts_thenContextWillNotHaveTheAutoconfiguredClasses() { + context.getBean(RedisTemplate.class); + } + +} From ad919054df4a9952a3e30dcfe64a9b82d5759725 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Mon, 1 Jul 2019 16:20:28 +0530 Subject: [PATCH 10/62] Back-link added --- persistence-modules/hibernate5/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/persistence-modules/hibernate5/README.md b/persistence-modules/hibernate5/README.md index 68008bc8fe..65322f0cea 100644 --- a/persistence-modules/hibernate5/README.md +++ b/persistence-modules/hibernate5/README.md @@ -33,3 +33,4 @@ - [Hibernate Aggregate Functions](https://www.baeldung.com/hibernate-aggregate-functions) - [Hibernate Query Plan Cache](https://www.baeldung.com/hibernate-query-plan-cache) - [TransactionRequiredException Error](https://www.baeldung.com/jpa-transaction-required-exception) +- [Enabling Transaction Locks in Spring Data JPA](https://www.baeldung.com/java-jpa-transaction-locks) From ce206fade423f59a4c72f202750264e6ae1cdd4e Mon Sep 17 00:00:00 2001 From: gpq5 Date: Tue, 2 Jul 2019 00:40:57 +0530 Subject: [PATCH 11/62] fix for comparison issue with double --- .../com/baeldung/jackson/json/compare/JsonCompareUnitTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jackson-2/src/test/java/com/baeldung/jackson/json/compare/JsonCompareUnitTest.java b/jackson-2/src/test/java/com/baeldung/jackson/json/compare/JsonCompareUnitTest.java index 2f2c18e248..4cadac073c 100644 --- a/jackson-2/src/test/java/com/baeldung/jackson/json/compare/JsonCompareUnitTest.java +++ b/jackson-2/src/test/java/com/baeldung/jackson/json/compare/JsonCompareUnitTest.java @@ -82,7 +82,7 @@ public class JsonCompareUnitTest { if ((o1 instanceof NumericNode) && (o2 instanceof NumericNode)) { Double d1 = ((NumericNode) o1).asDouble(); Double d2 = ((NumericNode) o2).asDouble(); - if (d1.equals(d2)) { + if (d1.compareTo(d2) == 0) { return 0; } } From b886923aa9700f61ba896afa5cfc5b93b611cfee Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 2 Jul 2019 13:37:46 +0530 Subject: [PATCH 12/62] Back-link added --- core-java-modules/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/README.md b/core-java-modules/README.md index 7a7d0a7a1b..9ce6057f32 100644 --- a/core-java-modules/README.md +++ b/core-java-modules/README.md @@ -3,3 +3,4 @@ - [Multi-Module Maven Application with Java Modules](https://www.baeldung.com/maven-multi-module-project-java-jpms) - [Guide to Java FileChannel](https://www.baeldung.com/java-filechannel) - [Understanding the NumberFormatException in Java](https://www.baeldung.com/java-number-format-exception) +- [Will an Error Be Caught by Catch Block in Java?](https://www.baeldung.com/java-error-catch) From 43fd64c938cea0680aec898da7eb0f9b4df24dac Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Tue, 2 Jul 2019 13:40:43 +0530 Subject: [PATCH 13/62] Back-link added --- spring-boot-autoconfiguration/README.MD | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-boot-autoconfiguration/README.MD b/spring-boot-autoconfiguration/README.MD index a71af54dff..dc9cad539a 100644 --- a/spring-boot-autoconfiguration/README.MD +++ b/spring-boot-autoconfiguration/README.MD @@ -3,4 +3,5 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring ### Relevant Articles: -- [Create a Custom Auto-Configuration with Spring Boot](http://www.baeldung.com/spring-boot-custom-auto-configuration) \ No newline at end of file +- [Create a Custom Auto-Configuration with Spring Boot](http://www.baeldung.com/spring-boot-custom-auto-configuration) +- [Guide to ApplicationContextRunner in Spring Boot](https://www.baeldung.com/spring-boot-context-runner) From ceb3d9ba789a11d696afde71e5599ec4282ad09c Mon Sep 17 00:00:00 2001 From: gpq5 Date: Tue, 2 Jul 2019 23:25:24 +0530 Subject: [PATCH 14/62] added another example of custom comparator --- .../json/compare/JsonCompareUnitTest.java | 36 ++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/jackson-2/src/test/java/com/baeldung/jackson/json/compare/JsonCompareUnitTest.java b/jackson-2/src/test/java/com/baeldung/jackson/json/compare/JsonCompareUnitTest.java index 4cadac073c..03d7c63e36 100644 --- a/jackson-2/src/test/java/com/baeldung/jackson/json/compare/JsonCompareUnitTest.java +++ b/jackson-2/src/test/java/com/baeldung/jackson/json/compare/JsonCompareUnitTest.java @@ -12,6 +12,7 @@ import org.junit.Test; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.NumericNode; +import com.fasterxml.jackson.databind.node.TextNode; public class JsonCompareUnitTest { @@ -58,7 +59,7 @@ public class JsonCompareUnitTest { } @Test - public void givenTwoJsonDataObjects_whenComparedUsingCustomComparator_thenEqual() throws IOException { + public void givenTwoJsonDataObjects_whenComparedUsingCustomNumericNodeComparator_thenEqual() throws IOException { ObjectMapper mapper = new ObjectMapper(); String s1 = "{\"name\": \"John\",\"score\":5.0}"; @@ -89,4 +90,37 @@ public class JsonCompareUnitTest { return 1; } } + + @Test + public void givenTwoJsonDataObjects_whenComparedUsingCustomTextNodeComparator_thenEqual() throws IOException { + ObjectMapper mapper = new ObjectMapper(); + + String s1 = "{\"name\": \"JOHN\",\"score\":5}"; + String s2 = "{\"name\": \"John\",\"score\":5}"; + JsonNode actualObj1 = mapper.readTree(s1); + JsonNode actualObj2 = mapper.readTree(s2); + + TextNodeComparator cmp = new TextNodeComparator(); + + assertNotEquals(actualObj1, actualObj2); + assertTrue(actualObj1.equals(cmp, actualObj2)); + + } + + public class TextNodeComparator implements Comparator { + @Override + public int compare(JsonNode o1, JsonNode o2) { + if (o1.equals(o2)) { + return 0; + } + if ((o1 instanceof TextNode) && (o2 instanceof TextNode)) { + String s1 = ((TextNode) o1).asText(); + String s2 = ((TextNode) o2).asText(); + if (s1.equalsIgnoreCase(s2)) { + return 0; + } + } + return 1; + } + } } From c828d6083ed6af6dde213c5c6b4ea9aba3ad8b57 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Wed, 3 Jul 2019 11:15:17 +0530 Subject: [PATCH 15/62] Back-link added --- java-collections-conversions/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/java-collections-conversions/README.md b/java-collections-conversions/README.md index 31fead3c42..0dec3563ff 100644 --- a/java-collections-conversions/README.md +++ b/java-collections-conversions/README.md @@ -10,4 +10,5 @@ - [Converting a List to String in Java](http://www.baeldung.com/java-list-to-string) - [How to Convert List to Map in Java](http://www.baeldung.com/java-list-to-map) - [Array to String Conversions](https://www.baeldung.com/java-array-to-string) -- [Converting a Collection to ArrayList in Java](https://www.baeldung.com/java-convert-collection-arraylist) \ No newline at end of file +- [Converting a Collection to ArrayList in Java](https://www.baeldung.com/java-convert-collection-arraylist) +- [Java 8 Collectors toMap](https://www.baeldung.com/java-collectors-tomap) From 524e50f5dea9ccaca7e03bcb6d64f6f955ab1975 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Wed, 3 Jul 2019 11:17:10 +0530 Subject: [PATCH 16/62] Back-link added --- testing-modules/spring-testing/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/testing-modules/spring-testing/README.md b/testing-modules/spring-testing/README.md index 8eb282643a..12c8edfded 100644 --- a/testing-modules/spring-testing/README.md +++ b/testing-modules/spring-testing/README.md @@ -4,3 +4,4 @@ - [A Quick Guide to @TestPropertySource](https://www.baeldung.com/spring-test-property-source) - [Guide to ReflectionTestUtils for Unit Testing](https://www.baeldung.com/spring-reflection-test-utils) - [How to Test the @Scheduled Annotation](https://www.baeldung.com/spring-testing-scheduled-annotation) +- [Using SpringJUnit4ClassRunner with Parameterized](https://www.baeldung.com/springjunit4classrunner-parameterized) From 69b272888fffa7cfad5790a80031018b5c37afc5 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Wed, 3 Jul 2019 11:19:52 +0530 Subject: [PATCH 17/62] Back-link added --- libraries-2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries-2/README.md b/libraries-2/README.md index cdeed10b3f..862d7395fe 100644 --- a/libraries-2/README.md +++ b/libraries-2/README.md @@ -5,3 +5,4 @@ - [Guide to Classgraph Library](https://www.baeldung.com/classgraph) - [Create a Java Command Line Program with Picocli](https://www.baeldung.com/java-picocli-create-command-line-program) - [Guide to Java Parallel Collectors Library](https://www.baeldung.com/java-parallel-collectors) +- [A Guide to Crawler4j](https://www.baeldung.com/crawler4j) From 3d16af291f34f1bc21d1fffbf8be88b6a01b8f74 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Wed, 3 Jul 2019 11:21:15 +0530 Subject: [PATCH 18/62] Back-link added --- libraries-2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries-2/README.md b/libraries-2/README.md index 862d7395fe..78fd9c8573 100644 --- a/libraries-2/README.md +++ b/libraries-2/README.md @@ -6,3 +6,4 @@ - [Create a Java Command Line Program with Picocli](https://www.baeldung.com/java-picocli-create-command-line-program) - [Guide to Java Parallel Collectors Library](https://www.baeldung.com/java-parallel-collectors) - [A Guide to Crawler4j](https://www.baeldung.com/crawler4j) +- [Decode an OkHttp JSON Response](https://www.baeldung.com/okhttp-json-response) From cc7260465aac5517f9fdc60035b5a3d2e0bf7379 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Wed, 3 Jul 2019 11:23:34 +0530 Subject: [PATCH 19/62] Back-link added --- spring-session/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-session/README.md b/spring-session/README.md index 505d043e75..c9875beadf 100644 --- a/spring-session/README.md +++ b/spring-session/README.md @@ -5,3 +5,4 @@ ### Relevant Articles: - [Guide to Spring Session](https://www.baeldung.com/spring-session) - [Spring Session with JDBC](https://www.baeldung.com/spring-session-jdbc) +- [Spring Session with MongoDB](https://www.baeldung.com/spring-session-mongodb) From c9126ae52b26cd95f7d1e57912a41a3772aecf26 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Wed, 3 Jul 2019 11:25:15 +0530 Subject: [PATCH 20/62] Back-link added --- persistence-modules/hibernate-mapping/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/persistence-modules/hibernate-mapping/README.md b/persistence-modules/hibernate-mapping/README.md index 203cb2f8e4..0df13653b9 100644 --- a/persistence-modules/hibernate-mapping/README.md +++ b/persistence-modules/hibernate-mapping/README.md @@ -3,3 +3,4 @@ - [Persisting Maps with Hibernate](https://www.baeldung.com/hibernate-persisting-maps) - [Difference Between @Size, @Length, and @Column(length=value)](https://www.baeldung.com/jpa-size-length-column-differences) +- [Hibernate Validator Specific Constraints](https://www.baeldung.com/hibernate-validator-constraints) From cb82c9828bfe6219ba4c43e6bda6825c031af210 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Wed, 3 Jul 2019 11:26:49 +0530 Subject: [PATCH 21/62] Back-link added --- core-java-modules/core-java-optional/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core-java-modules/core-java-optional/README.md b/core-java-modules/core-java-optional/README.md index 12a6fd1a56..b6848b5d33 100644 --- a/core-java-modules/core-java-optional/README.md +++ b/core-java-modules/core-java-optional/README.md @@ -2,4 +2,5 @@ ## Core Java Optional -### Relevant Articles: \ No newline at end of file +### Relevant Articles: +- [Java Optional as Return Type](https://www.baeldung.com/java-optional-return) From 8bc56f4e3930e5f0e9d2f4403452606eb65549a0 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Wed, 3 Jul 2019 11:32:23 +0530 Subject: [PATCH 22/62] Back-link added --- core-groovy-2/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core-groovy-2/README.md b/core-groovy-2/README.md index d6fc6fc2f7..33df8b107b 100644 --- a/core-groovy-2/README.md +++ b/core-groovy-2/README.md @@ -6,4 +6,5 @@ - [Template Engines in Groovy](https://www.baeldung.com/groovy-template-engines) - [Groovy def Keyword](https://www.baeldung.com/groovy-def-keyword) - [Pattern Matching in Strings in Groovy](https://www.baeldung.com/groovy-pattern-matching) -- [Working with XML in Groovy](https://www.baeldung.com/groovy-xml) \ No newline at end of file +- [Working with XML in Groovy](https://www.baeldung.com/groovy-xml) +- [Integrating Groovy into Java Applications](https://www.baeldung.com/groovy-java-applications) From 9a34e576c95bc881481b6d829e5eec7cd048dd26 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Wed, 3 Jul 2019 11:37:42 +0530 Subject: [PATCH 23/62] Back-link added --- core-java-modules/core-java-collections-set/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-collections-set/README.md b/core-java-modules/core-java-collections-set/README.md index 2e09e920dc..618b4e932c 100644 --- a/core-java-modules/core-java-collections-set/README.md +++ b/core-java-modules/core-java-collections-set/README.md @@ -10,3 +10,4 @@ - [Initializing HashSet at the Time of Construction](http://www.baeldung.com/java-initialize-hashset) - [Guide to EnumSet](https://www.baeldung.com/java-enumset) - [Set Operations in Java](https://www.baeldung.com/java-set-operations) +- [Copying Sets in Java](https://www.baeldung.com/java-copy-sets) From d4f0f099482d701b81df336c44873a3bb650d4f3 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Wed, 3 Jul 2019 11:37:52 +0530 Subject: [PATCH 24/62] Back-link added --- core-java-modules/core-java-10/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-10/README.md b/core-java-modules/core-java-10/README.md index f0a25712a7..8fb4f8a7dd 100644 --- a/core-java-modules/core-java-10/README.md +++ b/core-java-modules/core-java-10/README.md @@ -5,3 +5,4 @@ - [Guide to Java 10](http://www.baeldung.com/java-10-overview) - [Copy a List to Another List in Java](http://www.baeldung.com/java-copy-list-to-another) - [Deep Dive Into the New Java JIT Compiler – Graal](https://www.baeldung.com/graal-java-jit-compiler) +- [Copying Sets in Java](https://www.baeldung.com/java-copy-sets) From 44e2cc65cadb5d5bc59fb723e76bacf37583bacd Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Wed, 3 Jul 2019 11:42:59 +0530 Subject: [PATCH 25/62] Back-link added --- algorithms-miscellaneous-3/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/algorithms-miscellaneous-3/README.md b/algorithms-miscellaneous-3/README.md index 7a83a97c5b..edf9a71502 100644 --- a/algorithms-miscellaneous-3/README.md +++ b/algorithms-miscellaneous-3/README.md @@ -5,3 +5,4 @@ - [Converting Between Roman and Arabic Numerals in Java](http://www.baeldung.com/java-convert-roman-arabic) - [Practical Java Examples of the Big O Notation](http://www.baeldung.com/java-algorithm-complexity) - [Checking If a List Is Sorted in Java](https://www.baeldung.com/java-check-if-list-sorted) +- [Checking if a Java Graph has a Cycle](https://www.baeldung.com/java-graph-has-a-cycle) From d1251f762b543a0a240c1b38200235598c49aafc Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Wed, 3 Jul 2019 11:58:11 +0530 Subject: [PATCH 26/62] Back-link added --- core-java-modules/core-java-nio/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-java-modules/core-java-nio/README.md b/core-java-modules/core-java-nio/README.md index e73a9850ad..9034c3b3b1 100644 --- a/core-java-modules/core-java-nio/README.md +++ b/core-java-modules/core-java-nio/README.md @@ -1,3 +1,3 @@ ## Relevant articles: -- [Determine File Creating Date in Java](https://www.baeldung.com/file-creation-date-java) +- [Determine File Creating Date in Java](https://www.baeldung.com/java-file-creation-date) From 5acc605d39fed716a56430430be68f8a412b58b2 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Wed, 3 Jul 2019 12:04:33 +0530 Subject: [PATCH 27/62] Back-link added --- java-collections-conversions/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/java-collections-conversions/README.md b/java-collections-conversions/README.md index 0dec3563ff..bec7df6c55 100644 --- a/java-collections-conversions/README.md +++ b/java-collections-conversions/README.md @@ -12,3 +12,4 @@ - [Array to String Conversions](https://www.baeldung.com/java-array-to-string) - [Converting a Collection to ArrayList in Java](https://www.baeldung.com/java-convert-collection-arraylist) - [Java 8 Collectors toMap](https://www.baeldung.com/java-collectors-tomap) +- [Converting Iterable to Collection in Java](https://www.baeldung.com/java-iterable-to-collection) From 8d383d5f8a241fa0aa5a48c997c6fbafe6070822 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Wed, 3 Jul 2019 12:05:53 +0530 Subject: [PATCH 28/62] Back-link added --- jackson-2/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jackson-2/README.md b/jackson-2/README.md index ee9f8458a0..d8c233a00e 100644 --- a/jackson-2/README.md +++ b/jackson-2/README.md @@ -9,4 +9,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Mapping Multiple JSON Fields to a Single Java Field](https://www.baeldung.com/json-multiple-fields-single-java-field) - [How to Process YAML with Jackson](https://www.baeldung.com/jackson-yaml) - [Working with Tree Model Nodes in Jackson](https://www.baeldung.com/jackson-json-node-tree-model) - +- [Converting JSON to CSV in Java](https://www.baeldung.com/java-converting-json-to-csv) From 8b7ad99af9cc6d421e9998bd869a1523e29b8e04 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Wed, 3 Jul 2019 12:06:59 +0530 Subject: [PATCH 29/62] Back-link added --- testing-modules/junit-5-basics/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/testing-modules/junit-5-basics/README.md b/testing-modules/junit-5-basics/README.md index 6e44a9c071..c09c030780 100644 --- a/testing-modules/junit-5-basics/README.md +++ b/testing-modules/junit-5-basics/README.md @@ -2,3 +2,4 @@ - [Get the Path of the /src/test/resources Directory in JUnit](https://www.baeldung.com/junit-src-test-resources-directory-path) - [Tagging and Filtering JUnit Tests](https://www.baeldung.com/junit-filtering-tests) +- [JUnit 5 Temporary Directory Support](https://www.baeldung.com/junit-5-temporary-directory) From c2563fa0536ef7b89dec9e94245e1f4f24ace4b2 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Wed, 3 Jul 2019 12:08:23 +0530 Subject: [PATCH 30/62] Back-link added --- spring-resttemplate/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-resttemplate/README.md b/spring-resttemplate/README.md index c2c4965231..97a89ff7aa 100644 --- a/spring-resttemplate/README.md +++ b/spring-resttemplate/README.md @@ -10,3 +10,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Configure a RestTemplate with RestTemplateBuilder](http://www.baeldung.com/spring-rest-template-builder) - [Mocking a RestTemplate in Spring](https://www.baeldung.com/spring-mock-rest-template) - [RestTemplate Post Request with JSON](https://www.baeldung.com/spring-resttemplate-post-json) +- [Download a Large File Through a Spring RestTemplate](https://www.baeldung.com/spring-resttemplate-download-large-file) From 241c4ee443ce8bdf407df64cb15601acd9b59b02 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Wed, 3 Jul 2019 12:11:33 +0530 Subject: [PATCH 31/62] Back-link added --- ratpack/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/ratpack/README.md b/ratpack/README.md index 14bc3f6c74..78e2f8ccfc 100644 --- a/ratpack/README.md +++ b/ratpack/README.md @@ -6,3 +6,4 @@ - [Ratpack with Hystrix](http://www.baeldung.com/ratpack-hystrix) - [Ratpack HTTP Client](https://www.baeldung.com/ratpack-http-client) - [Ratpack with RxJava](https://www.baeldung.com/ratpack-rxjava) +- [Ratpack with Groovy](https://www.baeldung.com/ratpack-groovy) From 7136f07e7a5e93d15188f079e48d282fe60f7be8 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Wed, 3 Jul 2019 12:13:37 +0530 Subject: [PATCH 32/62] Back-link added --- spring-static-resources/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-static-resources/README.md b/spring-static-resources/README.md index c12e0272d4..64f017b5dd 100644 --- a/spring-static-resources/README.md +++ b/spring-static-resources/README.md @@ -2,3 +2,4 @@ - [Cachable Static Assets with Spring MVC](http://www.baeldung.com/cachable-static-assets-with-spring-mvc) - [Minification of JS and CSS Assets with Maven](http://www.baeldung.com/maven-minification-of-js-and-css-assets) - [Serve Static Resources with Spring](http://www.baeldung.com/spring-mvc-static-resources) +- [Load a Resource as a String in Spring](https://www.baeldung.com/spring-load-resource-as-string) From ce001ff4bbdd200e1df998bdcb17e4cb611da983 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Wed, 3 Jul 2019 12:14:57 +0530 Subject: [PATCH 33/62] Back-link added --- algorithms-miscellaneous-3/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/algorithms-miscellaneous-3/README.md b/algorithms-miscellaneous-3/README.md index edf9a71502..71541cd2b3 100644 --- a/algorithms-miscellaneous-3/README.md +++ b/algorithms-miscellaneous-3/README.md @@ -6,3 +6,4 @@ - [Practical Java Examples of the Big O Notation](http://www.baeldung.com/java-algorithm-complexity) - [Checking If a List Is Sorted in Java](https://www.baeldung.com/java-check-if-list-sorted) - [Checking if a Java Graph has a Cycle](https://www.baeldung.com/java-graph-has-a-cycle) +- [A Guide to the Folding Technique](https://www.baeldung.com/folding-hashing-technique) From b485df68e43a3889128b1abbf3ef93f9d87f6bae Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Wed, 3 Jul 2019 12:19:57 +0530 Subject: [PATCH 34/62] Back-link added --- autovalue/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/autovalue/README.md b/autovalue/README.md index c6a08359ef..f33ff6899f 100644 --- a/autovalue/README.md +++ b/autovalue/README.md @@ -1,3 +1,4 @@ ### Relevant Articles: - [Introduction to AutoValue](http://www.baeldung.com/introduction-to-autovalue) - [Introduction to AutoFactory](http://www.baeldung.com/autofactory) +- [Google AutoService](https://www.baeldung.com/google-autoservice) From 2c4a1a98301acaea469cd6244c2e1e01b18c0885 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Wed, 3 Jul 2019 12:22:56 +0530 Subject: [PATCH 35/62] Back-link added --- core-java-modules/core-java-lang-oop-2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-lang-oop-2/README.md b/core-java-modules/core-java-lang-oop-2/README.md index 2e36d251ca..72c3c6742b 100644 --- a/core-java-modules/core-java-lang-oop-2/README.md +++ b/core-java-modules/core-java-lang-oop-2/README.md @@ -6,3 +6,4 @@ - [Generic Constructors in Java](https://www.baeldung.com/java-generic-constructors) - [Cannot Reference “X” Before Supertype Constructor Has Been Called](https://www.baeldung.com/java-cannot-reference-x-before-supertype-constructor-error) - [Anonymous Classes in Java](https://www.baeldung.com/java-anonymous-classes) +- [Raw Types in Java](https://www.baeldung.com/raw-types-java) From 6d5cd34665bbf37624408f036e84522889b9bf7e Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Wed, 3 Jul 2019 12:25:04 +0530 Subject: [PATCH 36/62] Back-link added --- java-streams-2/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java-streams-2/README.md b/java-streams-2/README.md index 83ef97686f..b7f1ec11d7 100644 --- a/java-streams-2/README.md +++ b/java-streams-2/README.md @@ -1,3 +1,3 @@ ### Relevant Articles: - [Guide to Stream.reduce()](https://www.baeldung.com/java-stream-reduce) - +- [How to Break from Java Stream forEach](https://www.baeldung.com/java-break-stream-foreach) From f79e3b067623cb557414d621b449726a0e2c7c0d Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Wed, 3 Jul 2019 12:29:43 +0530 Subject: [PATCH 37/62] Back-link added --- java-collections-conversions/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/java-collections-conversions/README.md b/java-collections-conversions/README.md index bec7df6c55..614f20f186 100644 --- a/java-collections-conversions/README.md +++ b/java-collections-conversions/README.md @@ -13,3 +13,4 @@ - [Converting a Collection to ArrayList in Java](https://www.baeldung.com/java-convert-collection-arraylist) - [Java 8 Collectors toMap](https://www.baeldung.com/java-collectors-tomap) - [Converting Iterable to Collection in Java](https://www.baeldung.com/java-iterable-to-collection) +- [Converting Iterator to List](https://www.baeldung.com/java-convert-iterator-to-list) From ccddf1ba82d86a9c77ea1a0172924520337c4326 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Wed, 3 Jul 2019 12:32:14 +0530 Subject: [PATCH 38/62] Back-link added --- java-streams-2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/java-streams-2/README.md b/java-streams-2/README.md index b7f1ec11d7..851d3d71e2 100644 --- a/java-streams-2/README.md +++ b/java-streams-2/README.md @@ -1,3 +1,4 @@ ### Relevant Articles: - [Guide to Stream.reduce()](https://www.baeldung.com/java-stream-reduce) - [How to Break from Java Stream forEach](https://www.baeldung.com/java-break-stream-foreach) +- [Java IntStream Conversions](https://www.baeldung.com/java-intstream-convert) From 45a6be9c854886cfc23a5c4748845369953ed094 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Wed, 3 Jul 2019 12:35:22 +0530 Subject: [PATCH 39/62] Back-link added --- core-java-modules/core-java-8-2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-8-2/README.md b/core-java-modules/core-java-8-2/README.md index d53b731878..245fa93ba7 100644 --- a/core-java-modules/core-java-8-2/README.md +++ b/core-java-modules/core-java-8-2/README.md @@ -6,3 +6,4 @@ - [Anonymous Classes in Java](http://www.baeldung.com/) - [How to Delay Code Execution in Java](https://www.baeldung.com/java-delay-code-execution) - [Run JAR Application With Command Line Arguments](https://www.baeldung.com/java-run-jar-with-arguments) +- [Java 8 Stream skip() vs limit()](https://www.baeldung.com/java-stream-skip-vs-limit) From 15b0bd9f9b32115227bebfde1710d5ba0bf980b7 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Wed, 3 Jul 2019 12:38:55 +0530 Subject: [PATCH 40/62] Back-link added --- spring-boot/README.MD | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-boot/README.MD b/spring-boot/README.MD index d7af3f4614..435398904f 100644 --- a/spring-boot/README.MD +++ b/spring-boot/README.MD @@ -37,3 +37,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Validation in Spring Boot](https://www.baeldung.com/spring-boot-bean-validation) - [Guide to Creating and Running a Jar File in Java](https://www.baeldung.com/java-create-jar) - [Entity To DTO Conversion for a Spring REST API](https://www.baeldung.com/entity-to-and-from-dto-for-a-java-spring-application) +- [Guide to @EnableConfigurationProperties](https://www.baeldung.com/spring-enable-config-properties) From f10889579d360dc13e31c6dfa827ac20b8770161 Mon Sep 17 00:00:00 2001 From: collaboratewithakash <38683470+collaboratewithakash@users.noreply.github.com> Date: Wed, 3 Jul 2019 12:40:27 +0530 Subject: [PATCH 41/62] Back-link added --- core-java-modules/core-java-8/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-8/README.md b/core-java-modules/core-java-8/README.md index d11d2debce..b2ae48ea11 100644 --- a/core-java-modules/core-java-8/README.md +++ b/core-java-modules/core-java-8/README.md @@ -40,3 +40,4 @@ - [Java 8 Predicate Chain](https://www.baeldung.com/java-predicate-chain) - [Method References in Java](https://www.baeldung.com/java-method-references) - [Creating a Custom Annotation in Java](https://www.baeldung.com/java-custom-annotation) +- [The Difference Between Collection.stream().forEach() and Collection.forEach()](https://www.baeldung.com/java-collection-stream-foreach) From 1a3bf2a24f805ac616db4dee84de58bbd787c26f Mon Sep 17 00:00:00 2001 From: amit2103 Date: Fri, 5 Jul 2019 00:15:40 +0530 Subject: [PATCH 42/62] [BAEL-10984] - Updated vaadin article with new version and added removed examples --- vaadin/pom.xml | 31 +- .../com/baeldung/introduction/VaadinUI.java | 278 ++++++++++++++++++ 2 files changed, 305 insertions(+), 4 deletions(-) create mode 100644 vaadin/src/main/java/com/baeldung/introduction/VaadinUI.java diff --git a/vaadin/pom.xml b/vaadin/pom.xml index 648343fcd8..089ebe67c1 100644 --- a/vaadin/pom.xml +++ b/vaadin/pom.xml @@ -33,7 +33,26 @@ javax.servlet-api provided - + + com.vaadin + vaadin-server + ${vaadin-server.version} + + + com.vaadin + vaadin-push + ${vaadin-push.version} + + + com.vaadin + vaadin-client-compiled + ${vaadin-client-compiled.version} + + + com.vaadin + vaadin-themes + ${vaadin-themes.version} + org.springframework.boot spring-boot-starter-data-jpa @@ -155,9 +174,13 @@ - 10.0.11 - 10.0.11 - 10.0.11 + 13.0.9 + 13.0.9 + 13.0.9 + 8.8.5 + 8.8.5 + 8.8.5 + 8.8.5 9.3.9.v20160517 UTF-8 1.8 diff --git a/vaadin/src/main/java/com/baeldung/introduction/VaadinUI.java b/vaadin/src/main/java/com/baeldung/introduction/VaadinUI.java new file mode 100644 index 0000000000..68be53b1b3 --- /dev/null +++ b/vaadin/src/main/java/com/baeldung/introduction/VaadinUI.java @@ -0,0 +1,278 @@ +package com.baeldung.introduction; + +import java.time.Instant; +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; + +import javax.servlet.annotation.WebServlet; + +import com.vaadin.annotations.Push; +import com.vaadin.annotations.Theme; +import com.vaadin.annotations.VaadinServletConfiguration; +import com.vaadin.data.Binder; +import com.vaadin.data.validator.StringLengthValidator; +import com.vaadin.icons.VaadinIcons; +import com.vaadin.server.ExternalResource; +import com.vaadin.server.VaadinRequest; +import com.vaadin.server.VaadinServlet; +import com.vaadin.ui.Button; +import com.vaadin.ui.CheckBox; +import com.vaadin.ui.ComboBox; +import com.vaadin.ui.DateField; +import com.vaadin.ui.FormLayout; +import com.vaadin.ui.Grid; +import com.vaadin.ui.GridLayout; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.InlineDateField; +import com.vaadin.ui.Label; +import com.vaadin.ui.Link; +import com.vaadin.ui.ListSelect; +import com.vaadin.ui.NativeButton; +import com.vaadin.ui.NativeSelect; +import com.vaadin.ui.Panel; +import com.vaadin.ui.PasswordField; +import com.vaadin.ui.RichTextArea; +import com.vaadin.ui.TextArea; +import com.vaadin.ui.TextField; +import com.vaadin.ui.TwinColSelect; +import com.vaadin.ui.UI; +import com.vaadin.ui.VerticalLayout; + +@SuppressWarnings("serial") +@Push +@Theme("mytheme") +public class VaadinUI extends UI { + + private Label currentTime; + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @Override + protected void init(VaadinRequest vaadinRequest) { + final VerticalLayout verticalLayout = new VerticalLayout(); + verticalLayout.setSpacing(true); + verticalLayout.setMargin(true); + final GridLayout gridLayout = new GridLayout(3, 2); + gridLayout.setSpacing(true); + gridLayout.setMargin(true); + final HorizontalLayout horizontalLayout = new HorizontalLayout(); + horizontalLayout.setSpacing(true); + horizontalLayout.setMargin(true); + final FormLayout formLayout = new FormLayout(); + formLayout.setSpacing(true); + formLayout.setMargin(true); + final GridLayout buttonLayout = new GridLayout(3, 5); + buttonLayout.setMargin(true); + buttonLayout.setSpacing(true); + + final Label label = new Label(); + label.setId("Label"); + label.setValue("Label Value"); + label.setCaption("Label"); + gridLayout.addComponent(label); + + final Link link = new Link("Baeldung", new ExternalResource("http://www.baeldung.com/")); + link.setId("Link"); + link.setTargetName("_blank"); + gridLayout.addComponent(link); + + final TextField textField = new TextField(); + textField.setId("TextField"); + textField.setCaption("TextField:"); + textField.setValue("TextField Value"); + textField.setIcon(VaadinIcons.USER); + gridLayout.addComponent(textField); + + final TextArea textArea = new TextArea(); + textArea.setCaption("TextArea"); + textArea.setId("TextArea"); + textArea.setValue("TextArea Value"); + gridLayout.addComponent(textArea); + + final DateField dateField = new DateField("DateField", LocalDate.ofEpochDay(0)); + dateField.setId("DateField"); + gridLayout.addComponent(dateField); + + final PasswordField passwordField = new PasswordField(); + passwordField.setId("PasswordField"); + passwordField.setCaption("PasswordField:"); + passwordField.setValue("password"); + gridLayout.addComponent(passwordField); + + final RichTextArea richTextArea = new RichTextArea(); + richTextArea.setCaption("Rich Text Area"); + richTextArea.setValue("

RichTextArea

"); + richTextArea.setSizeFull(); + + Panel richTextPanel = new Panel(); + richTextPanel.setContent(richTextArea); + + final InlineDateField inlineDateField = new InlineDateField(); + inlineDateField.setValue(LocalDate.ofEpochDay(0)); + inlineDateField.setCaption("Inline Date Field"); + horizontalLayout.addComponent(inlineDateField); + + Button normalButton = new Button("Normal Button"); + normalButton.setId("NormalButton"); + normalButton.addClickListener(e -> { + label.setValue("CLICK"); + }); + buttonLayout.addComponent(normalButton); + + Button tinyButton = new Button("Tiny Button"); + tinyButton.addStyleName("tiny"); + buttonLayout.addComponent(tinyButton); + + Button smallButton = new Button("Small Button"); + smallButton.addStyleName("small"); + buttonLayout.addComponent(smallButton); + + Button largeButton = new Button("Large Button"); + largeButton.addStyleName("large"); + buttonLayout.addComponent(largeButton); + + Button hugeButton = new Button("Huge Button"); + hugeButton.addStyleName("huge"); + buttonLayout.addComponent(hugeButton); + + Button disabledButton = new Button("Disabled Button"); + disabledButton.setDescription("This button cannot be clicked"); + disabledButton.setEnabled(false); + buttonLayout.addComponent(disabledButton); + + Button dangerButton = new Button("Danger Button"); + dangerButton.addStyleName("danger"); + buttonLayout.addComponent(dangerButton); + + Button friendlyButton = new Button("Friendly Button"); + friendlyButton.addStyleName("friendly"); + buttonLayout.addComponent(friendlyButton); + + Button primaryButton = new Button("Primary Button"); + primaryButton.addStyleName("primary"); + buttonLayout.addComponent(primaryButton); + + NativeButton nativeButton = new NativeButton("Native Button"); + buttonLayout.addComponent(nativeButton); + + Button iconButton = new Button("Icon Button"); + iconButton.setIcon(VaadinIcons.ALIGN_LEFT); + buttonLayout.addComponent(iconButton); + + Button borderlessButton = new Button("BorderLess Button"); + borderlessButton.addStyleName("borderless"); + buttonLayout.addComponent(borderlessButton); + + Button linkButton = new Button("Link Button"); + linkButton.addStyleName("link"); + buttonLayout.addComponent(linkButton); + + Button quietButton = new Button("Quiet Button"); + quietButton.addStyleName("quiet"); + buttonLayout.addComponent(quietButton); + + horizontalLayout.addComponent(buttonLayout); + + final CheckBox checkbox = new CheckBox("CheckBox"); + checkbox.setValue(true); + checkbox.addValueChangeListener(e -> checkbox.setValue(!checkbox.getValue())); + formLayout.addComponent(checkbox); + + List numbers = new ArrayList(); + numbers.add("One"); + numbers.add("Ten"); + numbers.add("Eleven"); + ComboBox comboBox = new ComboBox("ComboBox"); + comboBox.setItems(numbers); + formLayout.addComponent(comboBox); + + ListSelect listSelect = new ListSelect("ListSelect"); + listSelect.setItems(numbers); + listSelect.setRows(2); + formLayout.addComponent(listSelect); + + NativeSelect nativeSelect = new NativeSelect("NativeSelect"); + nativeSelect.setItems(numbers); + formLayout.addComponent(nativeSelect); + + TwinColSelect twinColSelect = new TwinColSelect("TwinColSelect"); + twinColSelect.setItems(numbers); + + Grid grid = new Grid("Grid"); + grid.setColumns("Column1", "Column2", "Column3"); + grid.setItems("Item1", "Item2", "Item3"); + grid.setItems("Item4", "Item5", "Item6"); + + Panel panel = new Panel("Panel"); + panel.setContent(grid); + panel.setSizeUndefined(); + + Panel serverPushPanel = new Panel("Server Push"); + FormLayout timeLayout = new FormLayout(); + timeLayout.setSpacing(true); + timeLayout.setMargin(true); + currentTime = new Label("No TIME..."); + timeLayout.addComponent(currentTime); + serverPushPanel.setContent(timeLayout); + serverPushPanel.setSizeUndefined(); + ScheduledExecutorService scheduleExecutor = Executors.newScheduledThreadPool(1); + Runnable task = () -> { + currentTime.setValue("Current Time : " + Instant.now()); + }; + scheduleExecutor.scheduleWithFixedDelay(task, 0, 1, TimeUnit.SECONDS); + + FormLayout dataBindingLayout = new FormLayout(); + dataBindingLayout.setSpacing(true); + dataBindingLayout.setMargin(true); + + Binder binder = new Binder<>(); + BindData bindData = new BindData("BindData"); + binder.readBean(bindData); + TextField bindedTextField = new TextField(); + bindedTextField.setWidth("250px"); + binder.forField(bindedTextField).bind(BindData::getBindName, BindData::setBindName); + dataBindingLayout.addComponent(bindedTextField); + + FormLayout validatorLayout = new FormLayout(); + validatorLayout.setSpacing(true); + validatorLayout.setMargin(true); + + HorizontalLayout textValidatorLayout = new HorizontalLayout(); + textValidatorLayout.setSpacing(true); + textValidatorLayout.setMargin(true); + + + BindData stringValidatorBindData = new BindData(""); + TextField stringValidator = new TextField(); + Binder stringValidatorBinder = new Binder<>(); + stringValidatorBinder.setBean(stringValidatorBindData); + stringValidatorBinder.forField(stringValidator) + .withValidator(new StringLengthValidator("String must have 2-5 characters lenght", 2, 5)) + .bind(BindData::getBindName, BindData::setBindName); + + textValidatorLayout.addComponent(stringValidator); + Button buttonStringValidator = new Button("Validate String"); + buttonStringValidator.addClickListener(e -> stringValidatorBinder.validate()); + textValidatorLayout.addComponent(buttonStringValidator); + + validatorLayout.addComponent(textValidatorLayout); + verticalLayout.addComponent(gridLayout); + verticalLayout.addComponent(richTextPanel); + verticalLayout.addComponent(horizontalLayout); + verticalLayout.addComponent(formLayout); + verticalLayout.addComponent(twinColSelect); + verticalLayout.addComponent(panel); + verticalLayout.addComponent(serverPushPanel); + verticalLayout.addComponent(dataBindingLayout); + verticalLayout.addComponent(validatorLayout); + setContent(verticalLayout); + } + + @WebServlet(urlPatterns = "/*", name = "MyUIServlet", asyncSupported = true) + @VaadinServletConfiguration(ui = VaadinUI.class, productionMode = false) + public static class MyUIServlet extends VaadinServlet { + } +} \ No newline at end of file From 6db4ca2698692b11da4a728eafb9bafde398eed8 Mon Sep 17 00:00:00 2001 From: Pavan Shankar Koli Date: Fri, 5 Jul 2019 23:10:41 +0530 Subject: [PATCH 43/62] BAEL-2578 Created separate module --- pom.xml | 1 + .../pom.xml | 27 +++++++++++++++++++ .../spring-data-jpa/pom.xml | 5 ++-- .../java/com/baeldung/jpa/SpringDataJPA.java | 3 ++- .../spring-data-mongodb/pom.xml | 5 ++-- .../spring-data-redis/pom.xml | 5 ++-- 6 files changed, 36 insertions(+), 10 deletions(-) create mode 100644 spring-data-disable-auto-configuration/pom.xml diff --git a/pom.xml b/pom.xml index 982c52c54e..b642cfbeb1 100644 --- a/pom.xml +++ b/pom.xml @@ -1312,6 +1312,7 @@ spring-boot-ops-2 spring-boot-rest spring-boot-data + spring-data-disable-auto-configuration spring-boot-parent spring-boot-property-exp spring-boot-security diff --git a/spring-data-disable-auto-configuration/pom.xml b/spring-data-disable-auto-configuration/pom.xml new file mode 100644 index 0000000000..91086262cf --- /dev/null +++ b/spring-data-disable-auto-configuration/pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + com.baeldung + spring-data-disable-auto-configuration + 1.0.0-SNAPSHOT + spring-data-disable-auto-configuration + spring-data-disable-auto-configuration + pom + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + .. + + + + spring-data-jpa + spring-data-mongodb + spring-data-redis + + + diff --git a/spring-data-disable-auto-configuration/spring-data-jpa/pom.xml b/spring-data-disable-auto-configuration/spring-data-jpa/pom.xml index db431fb7fa..35113c379a 100644 --- a/spring-data-disable-auto-configuration/spring-data-jpa/pom.xml +++ b/spring-data-disable-auto-configuration/spring-data-jpa/pom.xml @@ -11,10 +11,9 @@ Spring Data with JPA - parent-boot-2 + spring-data-disable-auto-configuration com.baeldung - 0.0.1-SNAPSHOT - ../../parent-boot-2 + 1.0.0-SNAPSHOT diff --git a/spring-data-disable-auto-configuration/spring-data-jpa/src/main/java/com/baeldung/jpa/SpringDataJPA.java b/spring-data-disable-auto-configuration/spring-data-jpa/src/main/java/com/baeldung/jpa/SpringDataJPA.java index bec1b18010..211b5dc8b4 100644 --- a/spring-data-disable-auto-configuration/spring-data-jpa/src/main/java/com/baeldung/jpa/SpringDataJPA.java +++ b/spring-data-disable-auto-configuration/spring-data-jpa/src/main/java/com/baeldung/jpa/SpringDataJPA.java @@ -6,7 +6,8 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration; import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; -@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class, HibernateJpaAutoConfiguration.class}) +@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, + DataSourceTransactionManagerAutoConfiguration.class, HibernateJpaAutoConfiguration.class}) public class SpringDataJPA { public static void main(String[] args) { diff --git a/spring-data-disable-auto-configuration/spring-data-mongodb/pom.xml b/spring-data-disable-auto-configuration/spring-data-mongodb/pom.xml index 95bf32545b..ad707632c5 100644 --- a/spring-data-disable-auto-configuration/spring-data-mongodb/pom.xml +++ b/spring-data-disable-auto-configuration/spring-data-mongodb/pom.xml @@ -11,10 +11,9 @@ Spring Data with MongoDB - parent-boot-2 + spring-data-disable-auto-configuration com.baeldung - 0.0.1-SNAPSHOT - ../../parent-boot-2 + 1.0.0-SNAPSHOT diff --git a/spring-data-disable-auto-configuration/spring-data-redis/pom.xml b/spring-data-disable-auto-configuration/spring-data-redis/pom.xml index 7c997033ed..3b5db228c5 100644 --- a/spring-data-disable-auto-configuration/spring-data-redis/pom.xml +++ b/spring-data-disable-auto-configuration/spring-data-redis/pom.xml @@ -11,10 +11,9 @@ Spring Data with Redis - parent-boot-2 + spring-data-disable-auto-configuration com.baeldung - 0.0.1-SNAPSHOT - ../../parent-boot-2 + 1.0.0-SNAPSHOT From 0fd6c0a724792299bff8ace4c5932260aee6be61 Mon Sep 17 00:00:00 2001 From: Pavan Shankar Koli Date: Sat, 6 Jul 2019 19:32:35 +0530 Subject: [PATCH 44/62] BAEL-2578 Moved code under spring-boot-data module --- pom.xml | 1 - spring-boot-data/pom.xml | 24 +++++++++ .../disableautoconfig}/SpringDataJPA.java | 2 +- .../disableautoconfig}/SpringDataMongoDB.java | 4 +- .../disableautoconfig}/SpringDataRedis.java | 4 +- .../SpringDataJPAIntegrationTest.java | 2 +- .../SpringDataMongoDBIntegrationTest.java | 4 +- .../SpringDataRedisIntegrationTest.java | 4 +- .../pom.xml | 27 ---------- .../spring-data-jpa/README.md | 3 -- .../spring-data-jpa/pom.xml | 49 ------------------- .../src/main/resources/application.properties | 1 - .../src/main/resources/logback.xml | 13 ----- .../spring-data-mongodb/README.md | 4 -- .../spring-data-mongodb/pom.xml | 42 ---------------- .../src/main/resources/application.properties | 1 - .../src/main/resources/logback.xml | 13 ----- .../spring-data-redis/README.md | 4 -- .../spring-data-redis/pom.xml | 42 ---------------- .../src/main/resources/application.properties | 1 - .../src/main/resources/logback.xml | 13 ----- 21 files changed, 34 insertions(+), 224 deletions(-) rename {spring-data-disable-auto-configuration/spring-data-jpa/src/main/java/com/baeldung/jpa => spring-boot-data/src/main/java/com/baeldung/disableautoconfig}/SpringDataJPA.java (94%) rename {spring-data-disable-auto-configuration/spring-data-mongodb/src/main/java/com/baeldung/mongodb => spring-boot-data/src/main/java/com/baeldung/disableautoconfig}/SpringDataMongoDB.java (82%) rename {spring-data-disable-auto-configuration/spring-data-redis/src/main/java/com/baeldung/redis => spring-boot-data/src/main/java/com/baeldung/disableautoconfig}/SpringDataRedis.java (82%) rename {spring-data-disable-auto-configuration/spring-data-jpa/src/test/java/com/baeldung/jpa => spring-boot-data/src/test/java/com/baeldung/disableautoconfig}/SpringDataJPAIntegrationTest.java (95%) rename {spring-data-disable-auto-configuration/spring-data-mongodb/src/test/java/com/baeldung/mongodb => spring-boot-data/src/test/java/com/baeldung/disableautoconfig}/SpringDataMongoDBIntegrationTest.java (89%) rename {spring-data-disable-auto-configuration/spring-data-redis/src/test/java/com/baeldung/redis => spring-boot-data/src/test/java/com/baeldung/disableautoconfig}/SpringDataRedisIntegrationTest.java (89%) delete mode 100644 spring-data-disable-auto-configuration/pom.xml delete mode 100644 spring-data-disable-auto-configuration/spring-data-jpa/README.md delete mode 100644 spring-data-disable-auto-configuration/spring-data-jpa/pom.xml delete mode 100644 spring-data-disable-auto-configuration/spring-data-jpa/src/main/resources/application.properties delete mode 100644 spring-data-disable-auto-configuration/spring-data-jpa/src/main/resources/logback.xml delete mode 100644 spring-data-disable-auto-configuration/spring-data-mongodb/README.md delete mode 100644 spring-data-disable-auto-configuration/spring-data-mongodb/pom.xml delete mode 100644 spring-data-disable-auto-configuration/spring-data-mongodb/src/main/resources/application.properties delete mode 100644 spring-data-disable-auto-configuration/spring-data-mongodb/src/main/resources/logback.xml delete mode 100644 spring-data-disable-auto-configuration/spring-data-redis/README.md delete mode 100644 spring-data-disable-auto-configuration/spring-data-redis/pom.xml delete mode 100644 spring-data-disable-auto-configuration/spring-data-redis/src/main/resources/application.properties delete mode 100644 spring-data-disable-auto-configuration/spring-data-redis/src/main/resources/logback.xml diff --git a/pom.xml b/pom.xml index b642cfbeb1..982c52c54e 100644 --- a/pom.xml +++ b/pom.xml @@ -1312,7 +1312,6 @@ spring-boot-ops-2 spring-boot-rest spring-boot-data - spring-data-disable-auto-configuration spring-boot-parent spring-boot-property-exp spring-boot-security diff --git a/spring-boot-data/pom.xml b/spring-boot-data/pom.xml index 8735a54e7b..9c11e09f4a 100644 --- a/spring-boot-data/pom.xml +++ b/spring-boot-data/pom.xml @@ -15,6 +15,30 @@ + + org.springframework.boot + spring-boot-starter-data-redis + 2.1.6.RELEASE + + + + org.springframework.boot + spring-boot-starter-data-mongodb + 2.1.6.RELEASE + + + + org.springframework.boot + spring-boot-starter-data-jpa + 2.1.6.RELEASE + + + + com.h2database + h2 + 1.4.197 + + org.springframework.boot spring-boot-starter-web diff --git a/spring-data-disable-auto-configuration/spring-data-jpa/src/main/java/com/baeldung/jpa/SpringDataJPA.java b/spring-boot-data/src/main/java/com/baeldung/disableautoconfig/SpringDataJPA.java similarity index 94% rename from spring-data-disable-auto-configuration/spring-data-jpa/src/main/java/com/baeldung/jpa/SpringDataJPA.java rename to spring-boot-data/src/main/java/com/baeldung/disableautoconfig/SpringDataJPA.java index 211b5dc8b4..8e4ee76a25 100644 --- a/spring-data-disable-auto-configuration/spring-data-jpa/src/main/java/com/baeldung/jpa/SpringDataJPA.java +++ b/spring-boot-data/src/main/java/com/baeldung/disableautoconfig/SpringDataJPA.java @@ -1,4 +1,4 @@ -package com.baeldung.jpa; +package com.baeldung.disableautoconfig; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/spring-data-disable-auto-configuration/spring-data-mongodb/src/main/java/com/baeldung/mongodb/SpringDataMongoDB.java b/spring-boot-data/src/main/java/com/baeldung/disableautoconfig/SpringDataMongoDB.java similarity index 82% rename from spring-data-disable-auto-configuration/spring-data-mongodb/src/main/java/com/baeldung/mongodb/SpringDataMongoDB.java rename to spring-boot-data/src/main/java/com/baeldung/disableautoconfig/SpringDataMongoDB.java index a38eddb0e8..5e1cafa932 100644 --- a/spring-data-disable-auto-configuration/spring-data-mongodb/src/main/java/com/baeldung/mongodb/SpringDataMongoDB.java +++ b/spring-boot-data/src/main/java/com/baeldung/disableautoconfig/SpringDataMongoDB.java @@ -1,4 +1,4 @@ -package com.baeldung.mongodb; +package com.baeldung.disableautoconfig; import org.springframework.boot.SpringApplication; @@ -10,6 +10,6 @@ import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration; public class SpringDataMongoDB { public static void main(String[] args) { - SpringApplication.run(SpringMongoDB.class, args); + SpringApplication.run(SpringDataMongoDB.class, args); } } diff --git a/spring-data-disable-auto-configuration/spring-data-redis/src/main/java/com/baeldung/redis/SpringDataRedis.java b/spring-boot-data/src/main/java/com/baeldung/disableautoconfig/SpringDataRedis.java similarity index 82% rename from spring-data-disable-auto-configuration/spring-data-redis/src/main/java/com/baeldung/redis/SpringDataRedis.java rename to spring-boot-data/src/main/java/com/baeldung/disableautoconfig/SpringDataRedis.java index d5a682834b..9ec831c446 100644 --- a/spring-data-disable-auto-configuration/spring-data-redis/src/main/java/com/baeldung/redis/SpringDataRedis.java +++ b/spring-boot-data/src/main/java/com/baeldung/disableautoconfig/SpringDataRedis.java @@ -1,4 +1,4 @@ -package com.baeldung.redis; +package com.baeldung.disableautoconfig; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -9,6 +9,6 @@ import org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoCo public class SpringDataRedis { public static void main(String[] args) { - SpringApplication.run(SpringRedis.class, args); + SpringApplication.run(SpringDataRedis.class, args); } } diff --git a/spring-data-disable-auto-configuration/spring-data-jpa/src/test/java/com/baeldung/jpa/SpringDataJPAIntegrationTest.java b/spring-boot-data/src/test/java/com/baeldung/disableautoconfig/SpringDataJPAIntegrationTest.java similarity index 95% rename from spring-data-disable-auto-configuration/spring-data-jpa/src/test/java/com/baeldung/jpa/SpringDataJPAIntegrationTest.java rename to spring-boot-data/src/test/java/com/baeldung/disableautoconfig/SpringDataJPAIntegrationTest.java index 170f60f861..a465979b3c 100644 --- a/spring-data-disable-auto-configuration/spring-data-jpa/src/test/java/com/baeldung/jpa/SpringDataJPAIntegrationTest.java +++ b/spring-boot-data/src/test/java/com/baeldung/disableautoconfig/SpringDataJPAIntegrationTest.java @@ -1,4 +1,4 @@ -package com.baeldung.jpa; +package com.baeldung.disableautoconfig; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/spring-data-disable-auto-configuration/spring-data-mongodb/src/test/java/com/baeldung/mongodb/SpringDataMongoDBIntegrationTest.java b/spring-boot-data/src/test/java/com/baeldung/disableautoconfig/SpringDataMongoDBIntegrationTest.java similarity index 89% rename from spring-data-disable-auto-configuration/spring-data-mongodb/src/test/java/com/baeldung/mongodb/SpringDataMongoDBIntegrationTest.java rename to spring-boot-data/src/test/java/com/baeldung/disableautoconfig/SpringDataMongoDBIntegrationTest.java index 33f5620c32..bdfadf76ce 100644 --- a/spring-data-disable-auto-configuration/spring-data-mongodb/src/test/java/com/baeldung/mongodb/SpringDataMongoDBIntegrationTest.java +++ b/spring-boot-data/src/test/java/com/baeldung/disableautoconfig/SpringDataMongoDBIntegrationTest.java @@ -1,4 +1,4 @@ -package com.baeldung.mongodb; +package com.baeldung.disableautoconfig; import org.junit.Test; import org.junit.runner.RunWith; @@ -11,7 +11,7 @@ import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) -@SpringBootTest(classes = SpringMongoDB.class) +@SpringBootTest(classes = SpringDataMongoDB.class) public class SpringDataMongoDBIntegrationTest { @Autowired diff --git a/spring-data-disable-auto-configuration/spring-data-redis/src/test/java/com/baeldung/redis/SpringDataRedisIntegrationTest.java b/spring-boot-data/src/test/java/com/baeldung/disableautoconfig/SpringDataRedisIntegrationTest.java similarity index 89% rename from spring-data-disable-auto-configuration/spring-data-redis/src/test/java/com/baeldung/redis/SpringDataRedisIntegrationTest.java rename to spring-boot-data/src/test/java/com/baeldung/disableautoconfig/SpringDataRedisIntegrationTest.java index e142713417..10133cace3 100644 --- a/spring-data-disable-auto-configuration/spring-data-redis/src/test/java/com/baeldung/redis/SpringDataRedisIntegrationTest.java +++ b/spring-boot-data/src/test/java/com/baeldung/disableautoconfig/SpringDataRedisIntegrationTest.java @@ -1,4 +1,4 @@ -package com.baeldung.redis; +package com.baeldung.disableautoconfig; import org.junit.Test; import org.junit.runner.RunWith; @@ -11,7 +11,7 @@ import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) -@SpringBootTest(classes = SpringRedis.class) +@SpringBootTest(classes = SpringDataRedis.class) public class SpringDataRedisIntegrationTest { @Autowired diff --git a/spring-data-disable-auto-configuration/pom.xml b/spring-data-disable-auto-configuration/pom.xml deleted file mode 100644 index 91086262cf..0000000000 --- a/spring-data-disable-auto-configuration/pom.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - 4.0.0 - com.baeldung - spring-data-disable-auto-configuration - 1.0.0-SNAPSHOT - spring-data-disable-auto-configuration - spring-data-disable-auto-configuration - pom - - - com.baeldung - parent-modules - 1.0.0-SNAPSHOT - .. - - - - spring-data-jpa - spring-data-mongodb - spring-data-redis - - - diff --git a/spring-data-disable-auto-configuration/spring-data-jpa/README.md b/spring-data-disable-auto-configuration/spring-data-jpa/README.md deleted file mode 100644 index 23117c9903..0000000000 --- a/spring-data-disable-auto-configuration/spring-data-jpa/README.md +++ /dev/null @@ -1,3 +0,0 @@ -This module is for Jira BAEL-2578 - -### Relevant Articles: diff --git a/spring-data-disable-auto-configuration/spring-data-jpa/pom.xml b/spring-data-disable-auto-configuration/spring-data-jpa/pom.xml deleted file mode 100644 index 35113c379a..0000000000 --- a/spring-data-disable-auto-configuration/spring-data-jpa/pom.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - 4.0.0 - com.baeldung - spring-data-jpa - 0.0.1-SNAPSHOT - spring-data-jpa - jar - Spring Data with JPA - - - spring-data-disable-auto-configuration - com.baeldung - 1.0.0-SNAPSHOT - - - - - org.springframework.boot - spring-boot-starter-data-jpa - 2.1.6.RELEASE - - - - com.h2database - h2 - 1.4.197 - - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - \ No newline at end of file diff --git a/spring-data-disable-auto-configuration/spring-data-jpa/src/main/resources/application.properties b/spring-data-disable-auto-configuration/spring-data-jpa/src/main/resources/application.properties deleted file mode 100644 index fc33388896..0000000000 --- a/spring-data-disable-auto-configuration/spring-data-jpa/src/main/resources/application.properties +++ /dev/null @@ -1 +0,0 @@ -spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration,org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration \ No newline at end of file diff --git a/spring-data-disable-auto-configuration/spring-data-jpa/src/main/resources/logback.xml b/spring-data-disable-auto-configuration/spring-data-jpa/src/main/resources/logback.xml deleted file mode 100644 index 7d900d8ea8..0000000000 --- a/spring-data-disable-auto-configuration/spring-data-jpa/src/main/resources/logback.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - - \ No newline at end of file diff --git a/spring-data-disable-auto-configuration/spring-data-mongodb/README.md b/spring-data-disable-auto-configuration/spring-data-mongodb/README.md deleted file mode 100644 index b91f5eda5a..0000000000 --- a/spring-data-disable-auto-configuration/spring-data-mongodb/README.md +++ /dev/null @@ -1,4 +0,0 @@ -This module is for Jira BAEL-2578 - - -### Relevant Articles: diff --git a/spring-data-disable-auto-configuration/spring-data-mongodb/pom.xml b/spring-data-disable-auto-configuration/spring-data-mongodb/pom.xml deleted file mode 100644 index ad707632c5..0000000000 --- a/spring-data-disable-auto-configuration/spring-data-mongodb/pom.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - 4.0.0 - com.baeldung - spring-data-mongodb - 0.0.1-SNAPSHOT - spring-data-mongodb - jar - Spring Data with MongoDB - - - spring-data-disable-auto-configuration - com.baeldung - 1.0.0-SNAPSHOT - - - - - org.springframework.boot - spring-boot-starter-data-mongodb - 2.1.6.RELEASE - - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - \ No newline at end of file diff --git a/spring-data-disable-auto-configuration/spring-data-mongodb/src/main/resources/application.properties b/spring-data-disable-auto-configuration/spring-data-mongodb/src/main/resources/application.properties deleted file mode 100644 index 9f190ed8ae..0000000000 --- a/spring-data-disable-auto-configuration/spring-data-mongodb/src/main/resources/application.properties +++ /dev/null @@ -1 +0,0 @@ -spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration,org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration \ No newline at end of file diff --git a/spring-data-disable-auto-configuration/spring-data-mongodb/src/main/resources/logback.xml b/spring-data-disable-auto-configuration/spring-data-mongodb/src/main/resources/logback.xml deleted file mode 100644 index 7d900d8ea8..0000000000 --- a/spring-data-disable-auto-configuration/spring-data-mongodb/src/main/resources/logback.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - - \ No newline at end of file diff --git a/spring-data-disable-auto-configuration/spring-data-redis/README.md b/spring-data-disable-auto-configuration/spring-data-redis/README.md deleted file mode 100644 index b91f5eda5a..0000000000 --- a/spring-data-disable-auto-configuration/spring-data-redis/README.md +++ /dev/null @@ -1,4 +0,0 @@ -This module is for Jira BAEL-2578 - - -### Relevant Articles: diff --git a/spring-data-disable-auto-configuration/spring-data-redis/pom.xml b/spring-data-disable-auto-configuration/spring-data-redis/pom.xml deleted file mode 100644 index 3b5db228c5..0000000000 --- a/spring-data-disable-auto-configuration/spring-data-redis/pom.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - 4.0.0 - com.baeldung - spring-data-redis - 0.0.1-SNAPSHOT - spring-data-redis - jar - Spring Data with Redis - - - spring-data-disable-auto-configuration - com.baeldung - 1.0.0-SNAPSHOT - - - - - org.springframework.boot - spring-boot-starter-data-redis - 2.1.6.RELEASE - - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - \ No newline at end of file diff --git a/spring-data-disable-auto-configuration/spring-data-redis/src/main/resources/application.properties b/spring-data-disable-auto-configuration/spring-data-redis/src/main/resources/application.properties deleted file mode 100644 index 8c5a8dbbfd..0000000000 --- a/spring-data-disable-auto-configuration/spring-data-redis/src/main/resources/application.properties +++ /dev/null @@ -1 +0,0 @@ -spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration, org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration \ No newline at end of file diff --git a/spring-data-disable-auto-configuration/spring-data-redis/src/main/resources/logback.xml b/spring-data-disable-auto-configuration/spring-data-redis/src/main/resources/logback.xml deleted file mode 100644 index 7d900d8ea8..0000000000 --- a/spring-data-disable-auto-configuration/spring-data-redis/src/main/resources/logback.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - - \ No newline at end of file From 73ea42d0aeb109fd0817c9189e00b8124092080c Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sun, 7 Jul 2019 01:08:17 +0530 Subject: [PATCH 45/62] [BAEL-15321] - Extracted versions into properties --- algorithms-miscellaneous-1/pom.xml | 3 ++- apache-avro/pom.xml | 2 +- .../core-java-collections-set/pom.xml | 5 +++-- core-java-modules/core-java-exceptions/pom.xml | 2 +- .../multimodulemavenproject/pom.xml | 5 +++-- core-java-modules/pre-jpms/pom.xml | 2 +- jackson-2/pom.xml | 6 +++--- java-dates-2/pom.xml | 3 ++- java-math/pom.xml | 3 ++- libraries-2/pom.xml | 17 +++++++++++------ maven/versions-maven-plugin/original/pom.xml | 12 ++++++++---- patterns/dip/pom.xml | 5 +++-- persistence-modules/elasticsearch/pom.xml | 8 ++++++-- persistence-modules/hibernate-mapping/pom.xml | 6 ++++-- persistence-modules/hibernate-ogm/pom.xml | 16 +++++++++++----- persistence-modules/hibernate5/pom.xml | 8 +++++--- persistence-modules/java-jpa/pom.xml | 3 ++- persistence-modules/spring-data-jpa-2/pom.xml | 6 +++++- persistence-modules/spring-data-jpa/pom.xml | 9 ++++++--- pom.xml | 1 + spring-boot-mvc/pom.xml | 3 ++- spring-cloud/spring-cloud-functions/pom.xml | 5 +++-- spring-mvc-xml/pom.xml | 5 ++--- testing-modules/mockito/pom.xml | 3 ++- testing-modules/spring-testing/pom.xml | 3 ++- xml/pom.xml | 9 ++++++--- 26 files changed, 97 insertions(+), 53 deletions(-) diff --git a/algorithms-miscellaneous-1/pom.xml b/algorithms-miscellaneous-1/pom.xml index 30130208f8..affa66f147 100644 --- a/algorithms-miscellaneous-1/pom.xml +++ b/algorithms-miscellaneous-1/pom.xml @@ -42,7 +42,7 @@ com.github.dpaukov combinatoricslib3 - 3.3.0 + ${combinatoricslib3.version} @@ -83,6 +83,7 @@ 3.9.0 1.11 27.0.1-jre + 3.3.0
\ No newline at end of file diff --git a/apache-avro/pom.xml b/apache-avro/pom.xml index 5d170f0a81..e6fb4d24ff 100644 --- a/apache-avro/pom.xml +++ b/apache-avro/pom.xml @@ -17,7 +17,7 @@ junit junit - 4.10 + ${junit.version} test diff --git a/core-java-modules/core-java-collections-set/pom.xml b/core-java-modules/core-java-collections-set/pom.xml index 4435f8b151..8e2f7707f2 100644 --- a/core-java-modules/core-java-collections-set/pom.xml +++ b/core-java-modules/core-java-collections-set/pom.xml @@ -27,17 +27,18 @@ com.google.code.gson gson - 2.8.5 + ${gson.version} commons-lang commons-lang - 2.6 + ${commons-lang.version}
4.3 27.1-jre + 2.8.5 \ No newline at end of file diff --git a/core-java-modules/core-java-exceptions/pom.xml b/core-java-modules/core-java-exceptions/pom.xml index 37f65882c3..7bc0aa5b4e 100644 --- a/core-java-modules/core-java-exceptions/pom.xml +++ b/core-java-modules/core-java-exceptions/pom.xml @@ -22,7 +22,7 @@ junit junit - 4.12 + ${junit.version} test diff --git a/core-java-modules/multimodulemavenproject/pom.xml b/core-java-modules/multimodulemavenproject/pom.xml index 3d56f1356b..d2fb02deb0 100644 --- a/core-java-modules/multimodulemavenproject/pom.xml +++ b/core-java-modules/multimodulemavenproject/pom.xml @@ -19,13 +19,13 @@ junit junit - 4.12 + ${junit.version} test org.assertj assertj-core - 3.12.2 + ${assertj-core.version} test @@ -58,5 +58,6 @@ UTF-8 + 3.12.2 diff --git a/core-java-modules/pre-jpms/pom.xml b/core-java-modules/pre-jpms/pom.xml index 169cd21f3e..94180ac6c9 100644 --- a/core-java-modules/pre-jpms/pom.xml +++ b/core-java-modules/pre-jpms/pom.xml @@ -18,7 +18,7 @@ org.slf4j slf4j-api - 1.7.25 + ${org.slf4j.version} diff --git a/jackson-2/pom.xml b/jackson-2/pom.xml index 6a975f1de7..2fff1f8706 100644 --- a/jackson-2/pom.xml +++ b/jackson-2/pom.xml @@ -26,21 +26,21 @@ com.fasterxml.jackson.dataformat jackson-dataformat-yaml - 2.9.8 + ${jackson.version} com.fasterxml.jackson.dataformat jackson-dataformat-csv - 2.9.8 + ${jackson.version} com.fasterxml.jackson.datatype jackson-datatype-jsr310 - 2.9.8 + ${jackson.version} diff --git a/java-dates-2/pom.xml b/java-dates-2/pom.xml index 2f861ff5f4..c1419514ef 100644 --- a/java-dates-2/pom.xml +++ b/java-dates-2/pom.xml @@ -25,7 +25,7 @@ commons-validator commons-validator - 1.6 + ${commons-validator.version} @@ -63,6 +63,7 @@ 3.6.1 2.10 + 1.6 1.9 1.9 diff --git a/java-math/pom.xml b/java-math/pom.xml index 159d053df3..f71577b707 100644 --- a/java-math/pom.xml +++ b/java-math/pom.xml @@ -42,7 +42,7 @@ com.github.dpaukov combinatoricslib3 - 3.3.0 + ${combinatoricslib3.version} @@ -63,6 +63,7 @@ 3.9.0 1.11 27.0.1-jre + 3.3.0 \ No newline at end of file diff --git a/libraries-2/pom.xml b/libraries-2/pom.xml index 7bd3f5b355..13b7ccef7b 100644 --- a/libraries-2/pom.xml +++ b/libraries-2/pom.xml @@ -34,7 +34,7 @@ com.pivovarit parallel-collectors - 1.1.0 + ${parallel-collectors.version} org.assertj @@ -96,22 +96,22 @@ com.squareup.okhttp3 okhttp - 3.14.2 + ${okhttp.version} com.fasterxml.jackson.core jackson-databind - 2.9.9 + ${jackson.version} com.google.code.gson gson - 2.8.5 + ${gson.version} com.squareup.okhttp3 mockwebserver - 3.14.2 + ${mockwebserver.version} test @@ -122,7 +122,7 @@ com.github.jknack handlebars - 4.1.2 + ${handlebars.version} @@ -156,5 +156,10 @@ 0.6.0 1.19 0.28.3 + 1.1.0 + 3.14.2 + 2.8.5 + 3.14.2 + 4.1.2 diff --git a/maven/versions-maven-plugin/original/pom.xml b/maven/versions-maven-plugin/original/pom.xml index 7608e4d168..df8ee9a20e 100644 --- a/maven/versions-maven-plugin/original/pom.xml +++ b/maven/versions-maven-plugin/original/pom.xml @@ -11,19 +11,19 @@ commons-io commons-io - 2.3 + ${commons-io.version} org.apache.commons commons-collections4 - 4.0 + ${commons-collections4.version} org.apache.commons commons-lang3 - 3.0 + ${commons-lang3.version} @@ -35,7 +35,7 @@ commons-beanutils commons-beanutils - 1.9.1-SNAPSHOT + ${commons-beanutils.version} @@ -71,6 +71,10 @@ 1.15 + 2.3 + 4.0 + 3.0 + 1.9.1 \ No newline at end of file diff --git a/patterns/dip/pom.xml b/patterns/dip/pom.xml index dac3f824f2..bc793c0090 100644 --- a/patterns/dip/pom.xml +++ b/patterns/dip/pom.xml @@ -19,13 +19,13 @@ junit junit - 4.12 + ${junit.version} test org.assertj assertj-core - 3.12.1 + ${assertj-core.version} test @@ -34,6 +34,7 @@ UTF-8 11 11 + 3.12.1 diff --git a/persistence-modules/elasticsearch/pom.xml b/persistence-modules/elasticsearch/pom.xml index ceed88aa24..f7bfdb44de 100644 --- a/persistence-modules/elasticsearch/pom.xml +++ b/persistence-modules/elasticsearch/pom.xml @@ -20,12 +20,16 @@ io.searchbox jest - 6.3.1 + ${jest.version} com.fasterxml.jackson.core jackson-databind - 2.9.6 + ${jackson.version} + + + 6.3.1 + diff --git a/persistence-modules/hibernate-mapping/pom.xml b/persistence-modules/hibernate-mapping/pom.xml index bb8ebdab65..6845295812 100644 --- a/persistence-modules/hibernate-mapping/pom.xml +++ b/persistence-modules/hibernate-mapping/pom.xml @@ -45,12 +45,12 @@ javax.money money-api - 1.0.3 + ${money-api.version} org.javamoney moneta - 1.3 + ${moneta.version} pom @@ -70,6 +70,8 @@ 3.8.0 6.0.16.Final 3.0.1-b11 + 1.0.3 + 1.3 diff --git a/persistence-modules/hibernate-ogm/pom.xml b/persistence-modules/hibernate-ogm/pom.xml index 2ccac03bd3..7ac29b1720 100644 --- a/persistence-modules/hibernate-ogm/pom.xml +++ b/persistence-modules/hibernate-ogm/pom.xml @@ -19,31 +19,31 @@ org.hibernate.ogm hibernate-ogm-mongodb - 5.4.0.Final + ${hibernate.version} org.hibernate.ogm hibernate-ogm-neo4j - 5.4.0.Final + ${hibernate.version} org.jboss.narayana.jta narayana-jta - 5.5.23.Final + ${narayana-jta.version} junit junit - 4.12 + ${junit.version} test org.easytesting fest-assert - 1.4 + ${fest-assert.version} test @@ -57,4 +57,10 @@ + + + 5.4.0.Final + 1.4 + 5.5.23.Final + \ No newline at end of file diff --git a/persistence-modules/hibernate5/pom.xml b/persistence-modules/hibernate5/pom.xml index 7a9fdc0d34..bf4b2d27ec 100644 --- a/persistence-modules/hibernate5/pom.xml +++ b/persistence-modules/hibernate5/pom.xml @@ -60,7 +60,7 @@ org.hibernate hibernate-testing - 5.2.2.Final + ${hibernate.version} com.fasterxml.jackson.core @@ -70,7 +70,7 @@ net.bytebuddy byte-buddy - 1.9.5 + ${byte-buddy.version} @@ -91,7 +91,7 @@ javax.xml.bind jaxb-api - 2.3.0 + ${jaxb-api.version} @@ -120,6 +120,8 @@ 3.8.0 1.21 0.9 + 1.9.5 + 2.3.0 diff --git a/persistence-modules/java-jpa/pom.xml b/persistence-modules/java-jpa/pom.xml index 51cc401332..978679cfe6 100644 --- a/persistence-modules/java-jpa/pom.xml +++ b/persistence-modules/java-jpa/pom.xml @@ -34,7 +34,7 @@ javax.persistence javax.persistence-api - 2.2 + ${javax.persistence-api.version} @@ -108,6 +108,7 @@ 5.4.0.Final 2.7.4-RC1 42.2.5 + 2.2 \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-2/pom.xml b/persistence-modules/spring-data-jpa-2/pom.xml index fbc19810ef..08be64670b 100644 --- a/persistence-modules/spring-data-jpa-2/pom.xml +++ b/persistence-modules/spring-data-jpa-2/pom.xml @@ -29,7 +29,7 @@ net.ttddyy datasource-proxy - 1.4.1 + ${datasource-proxy.version} @@ -42,4 +42,8 @@ spring-oxm + + + 1.4.1 + \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa/pom.xml b/persistence-modules/spring-data-jpa/pom.xml index a7788065c9..af92f331d1 100644 --- a/persistence-modules/spring-data-jpa/pom.xml +++ b/persistence-modules/spring-data-jpa/pom.xml @@ -37,14 +37,14 @@ org.testcontainers postgresql - 1.10.6 + ${testcontainers.postgresql.version} test org.postgresql postgresql - 42.2.5 + ${postgresql.version} @@ -66,7 +66,7 @@ com.google.guava guava - 21.0 + ${guava.version} @@ -92,6 +92,9 @@ com.baeldung.boot.Application + 1.10.6 + 42.2.5 + 21.0 \ No newline at end of file diff --git a/pom.xml b/pom.xml index d67622feb7..f3ddb5d17b 100644 --- a/pom.xml +++ b/pom.xml @@ -1552,6 +1552,7 @@ 1.6.0 2.21.0 2.5 + 2.6 1.4 3.0.0 3.1.0 diff --git a/spring-boot-mvc/pom.xml b/spring-boot-mvc/pom.xml index e17c1d39b9..fee725847f 100644 --- a/spring-boot-mvc/pom.xml +++ b/spring-boot-mvc/pom.xml @@ -40,7 +40,7 @@ org.glassfish javax.faces - 2.3.7 + ${javax.faces.version} @@ -108,6 +108,7 @@ 2.9.2 1.10.0 + 2.3.7 com.baeldung.springbootmvc.SpringBootMvcApplication diff --git a/spring-cloud/spring-cloud-functions/pom.xml b/spring-cloud/spring-cloud-functions/pom.xml index 7a44e4ae0f..82147cea28 100644 --- a/spring-cloud/spring-cloud-functions/pom.xml +++ b/spring-cloud/spring-cloud-functions/pom.xml @@ -29,7 +29,7 @@ org.springframework.cloud spring-cloud-starter-function-web - 1.0.1.RELEASE + ${spring-cloud-function.version} com.amazonaws @@ -40,7 +40,7 @@ com.amazonaws aws-lambda-java-core - 1.1.0 + ${aws-lambda-java-core.version} provided @@ -87,6 +87,7 @@ UTF-8 1.0.1.RELEASE 2.0.2 + 1.1.0 2.0.4.RELEASE diff --git a/spring-mvc-xml/pom.xml b/spring-mvc-xml/pom.xml index 46af321d1b..c978bdd983 100644 --- a/spring-mvc-xml/pom.xml +++ b/spring-mvc-xml/pom.xml @@ -82,7 +82,7 @@ org.glassfish javax.el - 3.0.1-b08 + ${javax.el.version} @@ -131,12 +131,11 @@ 6.0.10.Final 1.2 3.1.0 - 2.9.6 + 3.0.1-b08 19.0 3.5 - 2.5 2.8.0 diff --git a/testing-modules/mockito/pom.xml b/testing-modules/mockito/pom.xml index acdd7eb2ac..19dbaa0dc1 100644 --- a/testing-modules/mockito/pom.xml +++ b/testing-modules/mockito/pom.xml @@ -33,7 +33,7 @@ org.eclipse.persistence javax.persistence - 2.1.1 + ${javax.persistence.version} @@ -99,6 +99,7 @@ 1.7.0 2.0.0.0 + 2.1.1 \ No newline at end of file diff --git a/testing-modules/spring-testing/pom.xml b/testing-modules/spring-testing/pom.xml index 0eca9b6a7e..f4d7b5dc66 100644 --- a/testing-modules/spring-testing/pom.xml +++ b/testing-modules/spring-testing/pom.xml @@ -51,7 +51,7 @@ org.eclipse.persistence javax.persistence - 2.1.1 + ${javax.persistence.version} org.springframework.data @@ -95,6 +95,7 @@ 5.4.0 5.1.4.RELEASE 4.0.1 + 2.1.1 \ No newline at end of file diff --git a/xml/pom.xml b/xml/pom.xml index ba6a734dc9..e9b89c71fc 100644 --- a/xml/pom.xml +++ b/xml/pom.xml @@ -33,17 +33,17 @@ javax.xml jaxb-api - 2.1 + ${jaxb-api.version} javax.xml jaxp-api - 1.4.2 + ${jaxp-api.version} javax.xml.stream stax-api - 1.0-2 + ${stax-api.version} @@ -252,6 +252,9 @@ 2.5 4.1 1.2.4.5 + 2.1 + 1.4.2 + 1.0-2 3.5 From 7b958a21f23f99f9b7fce1ad2fd68dd1f251cb21 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sat, 6 Jul 2019 23:29:08 +0300 Subject: [PATCH 46/62] Create README.md --- kotlin-quasar/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 kotlin-quasar/README.md diff --git a/kotlin-quasar/README.md b/kotlin-quasar/README.md new file mode 100644 index 0000000000..b3b84e0446 --- /dev/null +++ b/kotlin-quasar/README.md @@ -0,0 +1,3 @@ +### Relevant Articles + +- [Introduction to Quasar in Kotlin](https://www.baeldung.com/kotlin-quasar) From 97e469b47bc4180d3b72a79d898dfe90a3061d9f Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sat, 6 Jul 2019 23:30:17 +0300 Subject: [PATCH 47/62] Create README.md --- spring-boot-parent/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 spring-boot-parent/README.md diff --git a/spring-boot-parent/README.md b/spring-boot-parent/README.md new file mode 100644 index 0000000000..c3bb4c700d --- /dev/null +++ b/spring-boot-parent/README.md @@ -0,0 +1,3 @@ +### Relevant Articles + +- [The Spring Boot Starter Parent](https://www.baeldung.com/spring-boot-starter-parent) From a7130514a831871f6cdcbb26aa6da861389481ed Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sat, 6 Jul 2019 23:31:33 +0300 Subject: [PATCH 48/62] Create README.md --- persistence-modules/elasticsearch/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 persistence-modules/elasticsearch/README.md diff --git a/persistence-modules/elasticsearch/README.md b/persistence-modules/elasticsearch/README.md new file mode 100644 index 0000000000..691e855314 --- /dev/null +++ b/persistence-modules/elasticsearch/README.md @@ -0,0 +1,3 @@ +### Relevant Articles + +- [Jest – Elasticsearch Java Client](https://www.baeldung.com/elasticsearch-jest) From 26b9a36068aa127959f1e9b87bc645c802b637da Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sat, 6 Jul 2019 23:32:18 +0300 Subject: [PATCH 49/62] Create README.md --- spring-boot-performance/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 spring-boot-performance/README.md diff --git a/spring-boot-performance/README.md b/spring-boot-performance/README.md new file mode 100644 index 0000000000..015dd759a8 --- /dev/null +++ b/spring-boot-performance/README.md @@ -0,0 +1,3 @@ +### Relevant Articles + +- [Lazy Initialization in Spring Boot 2](https://www.baeldung.com/spring-boot-lazy-initialization) From 3cf08197b19d7bd4a21a4154ef14ff574f3a9167 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sat, 6 Jul 2019 23:35:20 +0300 Subject: [PATCH 50/62] Update README.md --- libraries-2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries-2/README.md b/libraries-2/README.md index cdeed10b3f..347d41688e 100644 --- a/libraries-2/README.md +++ b/libraries-2/README.md @@ -5,3 +5,4 @@ - [Guide to Classgraph Library](https://www.baeldung.com/classgraph) - [Create a Java Command Line Program with Picocli](https://www.baeldung.com/java-picocli-create-command-line-program) - [Guide to Java Parallel Collectors Library](https://www.baeldung.com/java-parallel-collectors) +- [Templating with Handlebars](https://www.baeldung.com/handlebars) From eb5af9a078bd20640e6b9c33828e5512abb59bbb Mon Sep 17 00:00:00 2001 From: Erik Pragt Date: Sun, 7 Jul 2019 11:42:34 +0200 Subject: [PATCH 51/62] BAEL-2791 Update Spring WebFlux article to 2.1.6.RELEASE, and updated other dependencies to latest versions. --- parent-boot-2/pom.xml | 46 +++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/parent-boot-2/pom.xml b/parent-boot-2/pom.xml index 4b81e27333..f0e921bf37 100644 --- a/parent-boot-2/pom.xml +++ b/parent-boot-2/pom.xml @@ -1,9 +1,9 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 parent-boot-2 0.0.1-SNAPSHOT - parent-boot-2 + parent-boot-2 pom Parent for all Spring Boot 2 modules @@ -13,7 +13,7 @@ 1.0.0-SNAPSHOT - + org.springframework.boot @@ -28,7 +28,7 @@ io.rest-assured rest-assured - + org.springframework.boot spring-boot-starter-test @@ -36,22 +36,22 @@ - - - - - org.springframework.boot - spring-boot-maven-plugin - ${spring-boot.version} - - ${start-class} - - - - - - - + + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot.version} + + ${start-class} + + + + + + + thin-jar @@ -75,9 +75,9 @@ - 3.1.0 + 3.3.0 - 1.0.21.RELEASE - 2.1.3.RELEASE + 1.0.22.RELEASE + 2.1.6.RELEASE From f85dbec8f716907fdd7ff24b5fa0bb8eed7daf86 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sun, 7 Jul 2019 15:22:11 +0530 Subject: [PATCH 52/62] [BAEL-15318] - Make sure the tutorials build doesn't generate any un-committed or un-ignored artifacts --- .gitignore | 3 ++- spring-apache-camel/.gitignore | 1 + .../src/test/destination-folder/2016-12-18 22-00-11File1.txt | 0 .../src/test/destination-folder/2016-12-18 22-00-11File2.txt | 0 spring-batch/.gitignore | 1 + spring-mvc-kotlin/.gitignore | 1 + spring-userservice/.gitignore | 1 + vertx-and-rxjava/.gitignore | 1 + 8 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 spring-apache-camel/.gitignore delete mode 100644 spring-apache-camel/src/test/destination-folder/2016-12-18 22-00-11File1.txt delete mode 100644 spring-apache-camel/src/test/destination-folder/2016-12-18 22-00-11File2.txt create mode 100644 spring-batch/.gitignore create mode 100644 spring-mvc-kotlin/.gitignore create mode 100644 spring-userservice/.gitignore create mode 100644 vertx-and-rxjava/.gitignore diff --git a/.gitignore b/.gitignore index 50cb889e5b..5be11c71ff 100644 --- a/.gitignore +++ b/.gitignore @@ -77,4 +77,5 @@ apache-avro/src/main/java/com/baeldung/avro/model/ jta/transaction-logs/ software-security/sql-injection-samples/derby.log spring-soap/src/main/java/com/baeldung/springsoap/gen/ -/report-*.json \ No newline at end of file +/report-*.json +transaction.log \ No newline at end of file diff --git a/spring-apache-camel/.gitignore b/spring-apache-camel/.gitignore new file mode 100644 index 0000000000..eac473ac50 --- /dev/null +++ b/spring-apache-camel/.gitignore @@ -0,0 +1 @@ +/src/test/destination-folder/* \ No newline at end of file diff --git a/spring-apache-camel/src/test/destination-folder/2016-12-18 22-00-11File1.txt b/spring-apache-camel/src/test/destination-folder/2016-12-18 22-00-11File1.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/spring-apache-camel/src/test/destination-folder/2016-12-18 22-00-11File2.txt b/spring-apache-camel/src/test/destination-folder/2016-12-18 22-00-11File2.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/spring-batch/.gitignore b/spring-batch/.gitignore new file mode 100644 index 0000000000..0ef6d10b38 --- /dev/null +++ b/spring-batch/.gitignore @@ -0,0 +1 @@ +output.csv \ No newline at end of file diff --git a/spring-mvc-kotlin/.gitignore b/spring-mvc-kotlin/.gitignore new file mode 100644 index 0000000000..416395ffea --- /dev/null +++ b/spring-mvc-kotlin/.gitignore @@ -0,0 +1 @@ +transaction.log \ No newline at end of file diff --git a/spring-userservice/.gitignore b/spring-userservice/.gitignore new file mode 100644 index 0000000000..afe61e7c0c --- /dev/null +++ b/spring-userservice/.gitignore @@ -0,0 +1 @@ +derby.log \ No newline at end of file diff --git a/vertx-and-rxjava/.gitignore b/vertx-and-rxjava/.gitignore new file mode 100644 index 0000000000..3aba11e2fd --- /dev/null +++ b/vertx-and-rxjava/.gitignore @@ -0,0 +1 @@ +/.vertx \ No newline at end of file From 37e402eb6035ae312d8d33aa137d54b684fb3f3a Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sun, 7 Jul 2019 23:59:01 +0530 Subject: [PATCH 53/62] [BAEL-15322] - Fix formatting of POMs --- apache-olingo/olingo2/pom.xml | 26 +++--- apache-spark/pom.xml | 2 + bootique/pom.xml | 1 - core-groovy-2/pom.xml | 27 +++--- core-java-modules/core-java-8-2/pom.xml | 18 ++-- .../core-java-collections-set/pom.xml | 40 ++++----- .../core-java-exceptions/pom.xml | 8 +- .../consumermodule/pom.xml | 16 ++-- .../consumermodule/pom.xml | 11 +-- core-java-modules/core-java-nio/pom.xml | 8 +- core-java-modules/core-java-optional/pom.xml | 37 ++++---- core-java-modules/core-java/pom.xml | 1 - .../entitymodule/pom.xml | 9 +- .../mainappmodule/pom.xml | 9 +- .../multimodulemavenproject/pom.xml | 14 +-- .../userdaomodule/pom.xml | 27 +++--- core-java-modules/pre-jpms/pom.xml | 3 +- jws/pom.xml | 2 +- libraries-2/pom.xml | 4 + libraries/pom.xml | 5 -- .../daomodule/pom.xml | 11 +-- .../entitiymodule/pom.xml | 12 +-- .../mainppmodule/pom.xml | 11 +-- .../multimodule-maven-project/pom.xml | 15 ++-- .../userdaomodule/pom.xml | 12 +-- maven-java-11/pom.xml | 9 +- maven/pom.xml | 5 +- maven/versions-maven-plugin/pom.xml | 8 +- msf4j/pom.xml | 1 + optaplanner/pom.xml | 5 -- parent-boot-performance/pom.xml | 15 ++-- patterns/design-patterns/pom.xml | 1 + persistence-modules/hibernate-mapping/pom.xml | 7 +- persistence-modules/java-jpa/pom.xml | 1 + persistence-modules/java-mongodb/pom.xml | 2 - .../jpa-hibernate-cascade-type/pom.xml | 8 +- .../sql-injection-samples/pom.xml | 7 -- spf4j/spf4j-aspects-app/pom.xml | 4 + spf4j/spf4j-core-app/pom.xml | 4 + spring-5-security-cognito/pom.xml | 1 - spring-5-webflux/pom.xml | 11 +-- spring-boot-angular/pom.xml | 7 +- spring-boot-flowable/pom.xml | 4 + spring-boot-mvc-birt/pom.xml | 1 + spring-boot-ops-2/pom.xml | 9 +- spring-boot-performance/pom.xml | 10 +-- .../spring-cloud-bootstrap/gateway/pom.xml | 1 + .../spring-cloud-config/client/pom.xml | 3 +- .../spring-cloud-config/server/pom.xml | 3 +- .../spring-cloud-contract-producer/pom.xml | 1 + spring-cloud/spring-cloud-eureka/pom.xml | 12 +-- spring-cloud/spring-cloud-openfeign/pom.xml | 12 ++- .../spring-cloud-security/auth-client/pom.xml | 24 +++--- spring-core-2/pom.xml | 6 +- spring-mvc-java/pom.xml | 25 +++--- spring-security-kerberos/pom.xml | 3 + spring-session/spring-session-mongodb/pom.xml | 10 +-- spring-soap/pom.xml | 10 +-- spring-thymeleaf-2/pom.xml | 10 +-- testing-modules/gatling/pom.xml | 86 +++++++++---------- .../mocks/mock-comparisons/pom.xml | 1 - xmlunit-2/pom.xml | 1 - 62 files changed, 333 insertions(+), 324 deletions(-) diff --git a/apache-olingo/olingo2/pom.xml b/apache-olingo/olingo2/pom.xml index 1efd4ea602..320f56b717 100644 --- a/apache-olingo/olingo2/pom.xml +++ b/apache-olingo/olingo2/pom.xml @@ -3,37 +3,28 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - - org.springframework.boot - spring-boot-starter-parent - 2.1.3.RELEASE - - org.baeldung.examples.olingo2 olingo2-sample 0.0.1-SNAPSHOT olingo2-sample Sample Olingo 2 Project - - 1.8 - 2.0.11 - + + org.springframework.boot + spring-boot-starter-parent + 2.1.3.RELEASE + + - org.springframework.boot spring-boot-starter-jersey - - org.springframework.boot spring-boot-starter-data-jpa - - com.h2database h2 @@ -90,4 +81,9 @@ + + 1.8 + 2.0.11 + + diff --git a/apache-spark/pom.xml b/apache-spark/pom.xml index f0f002a7e9..b8c1962dd4 100644 --- a/apache-spark/pom.xml +++ b/apache-spark/pom.xml @@ -49,6 +49,7 @@ ${com.datastax.spark.spark-cassandra-connector-java.version} + @@ -78,6 +79,7 @@ + 2.3.0 2.3.0 diff --git a/bootique/pom.xml b/bootique/pom.xml index 4ae8703074..4dd9ba4833 100644 --- a/bootique/pom.xml +++ b/bootique/pom.xml @@ -65,7 +65,6 @@ com.baeldung.bootique.App 0.23 - 2.4.3 diff --git a/core-groovy-2/pom.xml b/core-groovy-2/pom.xml index b945546c8a..53b3e6a7ec 100644 --- a/core-groovy-2/pom.xml +++ b/core-groovy-2/pom.xml @@ -157,20 +157,19 @@ - - bintray - Groovy Bintray - https://dl.bintray.com/groovy/maven - - - never - - - false - - - - + + bintray + Groovy Bintray + https://dl.bintray.com/groovy/maven + + + never + + + false + + + 1.0.0 diff --git a/core-java-modules/core-java-8-2/pom.xml b/core-java-modules/core-java-8-2/pom.xml index 17f0eea20f..07bb3b7543 100644 --- a/core-java-modules/core-java-8-2/pom.xml +++ b/core-java-modules/core-java-8-2/pom.xml @@ -9,7 +9,6 @@ core-java-8-2 jar - com.baeldung parent-java @@ -17,14 +16,6 @@ ../../parent-java - - UTF-8 - 1.8 - 1.8 - 64.2 - 3.12.2 - - com.ibm.icu @@ -51,6 +42,13 @@ - + + + UTF-8 + 1.8 + 1.8 + 64.2 + 3.12.2 + diff --git a/core-java-modules/core-java-collections-set/pom.xml b/core-java-modules/core-java-collections-set/pom.xml index 8e2f7707f2..101ed79de0 100644 --- a/core-java-modules/core-java-collections-set/pom.xml +++ b/core-java-modules/core-java-collections-set/pom.xml @@ -14,26 +14,26 @@ - - com.google.guava - guava - ${guava.version} - - - org.apache.commons - commons-collections4 - ${commons-collections4.version} - - - com.google.code.gson - gson - ${gson.version} - - - commons-lang - commons-lang - ${commons-lang.version} - + + com.google.guava + guava + ${guava.version} + + + org.apache.commons + commons-collections4 + ${commons-collections4.version} + + + com.google.code.gson + gson + ${gson.version} + + + commons-lang + commons-lang + ${commons-lang.version} + diff --git a/core-java-modules/core-java-exceptions/pom.xml b/core-java-modules/core-java-exceptions/pom.xml index 7bc0aa5b4e..2e5200944a 100644 --- a/core-java-modules/core-java-exceptions/pom.xml +++ b/core-java-modules/core-java-exceptions/pom.xml @@ -14,10 +14,6 @@ ../../parent-java - - 3.9 - - junit @@ -32,4 +28,8 @@ + + 3.9 + + diff --git a/core-java-modules/core-java-jpms/decoupling-pattern1/consumermodule/pom.xml b/core-java-modules/core-java-jpms/decoupling-pattern1/consumermodule/pom.xml index 6a41ec0d1a..059075318a 100644 --- a/core-java-modules/core-java-jpms/decoupling-pattern1/consumermodule/pom.xml +++ b/core-java-modules/core-java-jpms/decoupling-pattern1/consumermodule/pom.xml @@ -11,6 +11,14 @@ 1.0 + + + com.baeldung.servicemodule + servicemodule + 1.0 + + + @@ -19,12 +27,4 @@ - - - - com.baeldung.servicemodule - servicemodule - 1.0 - - diff --git a/core-java-modules/core-java-jpms/decoupling-pattern2/consumermodule/pom.xml b/core-java-modules/core-java-jpms/decoupling-pattern2/consumermodule/pom.xml index 828fe7de6a..757d9229df 100644 --- a/core-java-modules/core-java-jpms/decoupling-pattern2/consumermodule/pom.xml +++ b/core-java-modules/core-java-jpms/decoupling-pattern2/consumermodule/pom.xml @@ -2,17 +2,18 @@ - - com.baeldung.decoupling-pattern2 - decoupling-pattern2 - 1.0-SNAPSHOT - 4.0.0 com.baeldung.consumermodule consumermodule 1.0 + + com.baeldung.decoupling-pattern2 + decoupling-pattern2 + 1.0-SNAPSHOT + + com.baeldung.servicemodule diff --git a/core-java-modules/core-java-nio/pom.xml b/core-java-modules/core-java-nio/pom.xml index 36d6848998..31433e632f 100644 --- a/core-java-modules/core-java-nio/pom.xml +++ b/core-java-modules/core-java-nio/pom.xml @@ -8,9 +8,9 @@ jar - com.baeldung - parent-java - 0.0.1-SNAPSHOT - ../../parent-java + com.baeldung + parent-java + 0.0.1-SNAPSHOT + ../../parent-java \ No newline at end of file diff --git a/core-java-modules/core-java-optional/pom.xml b/core-java-modules/core-java-optional/pom.xml index f2478c2c87..f60e3ba03d 100644 --- a/core-java-modules/core-java-optional/pom.xml +++ b/core-java-modules/core-java-optional/pom.xml @@ -1,22 +1,14 @@ - 4.0.0 - - com.baeldung.core-java-modules - core-java-modules - 1.0.0-SNAPSHOT - - core-java-optional - 0.1.0-SNAPSHOT - jar - - - UTF-8 - 1.8 - 1.8 - 5.4.0.Final - 1.4.197 - 2.9.8 - + 4.0.0 + core-java-optional + 0.1.0-SNAPSHOT + jar + + + com.baeldung.core-java-modules + core-java-modules + 1.0.0-SNAPSHOT + @@ -50,4 +42,13 @@ + + + UTF-8 + 1.8 + 1.8 + 5.4.0.Final + 1.4.197 + 2.9.8 + \ No newline at end of file diff --git a/core-java-modules/core-java/pom.xml b/core-java-modules/core-java/pom.xml index 7942f3e7e2..2f33212c38 100644 --- a/core-java-modules/core-java/pom.xml +++ b/core-java-modules/core-java/pom.xml @@ -13,7 +13,6 @@ ../../parent-java - commons-io diff --git a/core-java-modules/multimodulemavenproject/entitymodule/pom.xml b/core-java-modules/multimodulemavenproject/entitymodule/pom.xml index 1fd672d03e..b90a7ed068 100644 --- a/core-java-modules/multimodulemavenproject/entitymodule/pom.xml +++ b/core-java-modules/multimodulemavenproject/entitymodule/pom.xml @@ -1,15 +1,16 @@ 4.0.0 + com.baeldung.entitymodule + entitymodule + 1.0 + jar + com.baeldung.multimodulemavenproject multimodulemavenproject 1.0 - com.baeldung.entitymodule - entitymodule - 1.0 - jar diff --git a/core-java-modules/multimodulemavenproject/mainappmodule/pom.xml b/core-java-modules/multimodulemavenproject/mainappmodule/pom.xml index 26e6a15b1e..1f44a1690c 100644 --- a/core-java-modules/multimodulemavenproject/mainappmodule/pom.xml +++ b/core-java-modules/multimodulemavenproject/mainappmodule/pom.xml @@ -1,15 +1,16 @@ 4.0.0 + com.baeldung.mainappmodule + mainappmodule + 1.0 + jar + com.baeldung.multimodulemavenproject multimodulemavenproject 1.0 - com.baeldung.mainappmodule - mainappmodule - 1.0 - jar diff --git a/core-java-modules/multimodulemavenproject/pom.xml b/core-java-modules/multimodulemavenproject/pom.xml index d2fb02deb0..ad347a4179 100644 --- a/core-java-modules/multimodulemavenproject/pom.xml +++ b/core-java-modules/multimodulemavenproject/pom.xml @@ -14,6 +14,13 @@ ../../ + + entitymodule + daomodule + userdaomodule + mainappmodule + + @@ -49,13 +56,6 @@ - - entitymodule - daomodule - userdaomodule - mainappmodule - - UTF-8 3.12.2 diff --git a/core-java-modules/multimodulemavenproject/userdaomodule/pom.xml b/core-java-modules/multimodulemavenproject/userdaomodule/pom.xml index 63968452db..d3543d5864 100644 --- a/core-java-modules/multimodulemavenproject/userdaomodule/pom.xml +++ b/core-java-modules/multimodulemavenproject/userdaomodule/pom.xml @@ -1,24 +1,16 @@ 4.0.0 + com.baeldung.userdaomodule + userdaomodule + 1.0 + jar + com.baeldung.multimodulemavenproject multimodulemavenproject 1.0 - com.baeldung.userdaomodule - userdaomodule - 1.0 - jar - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - @@ -33,6 +25,15 @@ + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + 9 9 diff --git a/core-java-modules/pre-jpms/pom.xml b/core-java-modules/pre-jpms/pom.xml index 94180ac6c9..380d94fbf1 100644 --- a/core-java-modules/pre-jpms/pom.xml +++ b/core-java-modules/pre-jpms/pom.xml @@ -21,6 +21,7 @@ ${org.slf4j.version} + pre-jpms @@ -65,9 +66,9 @@ - + UTF-8 diff --git a/jws/pom.xml b/jws/pom.xml index 2c89b687f8..6bc790e7ee 100644 --- a/jws/pom.xml +++ b/jws/pom.xml @@ -34,6 +34,7 @@ + ${project.artifactId} org.apache.maven.plugins @@ -78,7 +79,6 @@ - ${project.artifactId} diff --git a/libraries-2/pom.xml b/libraries-2/pom.xml index 13b7ccef7b..ff73888b69 100644 --- a/libraries-2/pom.xml +++ b/libraries-2/pom.xml @@ -5,11 +5,13 @@ 4.0.0 libraries2 libraries2 + com.baeldung parent-modules 1.0.0-SNAPSHOT + jboss-public-repository-group @@ -25,6 +27,7 @@ + org.mapdb @@ -141,6 +144,7 @@ ${mesos.library.version} + 3.0.7 3.6.2 diff --git a/libraries/pom.xml b/libraries/pom.xml index 0efb404458..8e787bdc22 100644 --- a/libraries/pom.xml +++ b/libraries/pom.xml @@ -18,17 +18,12 @@ akka-actor_2.12 ${typesafe-akka.version} - - - - com.typesafe.akka akka-testkit_2.12 ${typesafe-akka.version} test - org.beykery diff --git a/maven-java-11/multimodule-maven-project/daomodule/pom.xml b/maven-java-11/multimodule-maven-project/daomodule/pom.xml index de9be656d4..5520c5a90a 100644 --- a/maven-java-11/multimodule-maven-project/daomodule/pom.xml +++ b/maven-java-11/multimodule-maven-project/daomodule/pom.xml @@ -1,14 +1,15 @@ 4.0.0 - - com.baeldung.multimodule-maven-project - multimodule-maven-project - 1.0 - com.baeldung.daomodule daomodule jar 1.0 daomodule + + + com.baeldung.multimodule-maven-project + multimodule-maven-project + 1.0 + diff --git a/maven-java-11/multimodule-maven-project/entitiymodule/pom.xml b/maven-java-11/multimodule-maven-project/entitiymodule/pom.xml index 8e700e62b5..747722e912 100644 --- a/maven-java-11/multimodule-maven-project/entitiymodule/pom.xml +++ b/maven-java-11/multimodule-maven-project/entitiymodule/pom.xml @@ -1,16 +1,18 @@ 4.0.0 - - com.baeldung.multimodule-maven-project - multimodule-maven-project - 1.0 - com.baeldung.entitymodule entitymodule jar 1.0 entitymodule + + + com.baeldung.multimodule-maven-project + multimodule-maven-project + 1.0 + + 11 11 diff --git a/maven-java-11/multimodule-maven-project/mainppmodule/pom.xml b/maven-java-11/multimodule-maven-project/mainppmodule/pom.xml index d2c94527f1..3e5ec122ff 100644 --- a/maven-java-11/multimodule-maven-project/mainppmodule/pom.xml +++ b/maven-java-11/multimodule-maven-project/mainppmodule/pom.xml @@ -1,16 +1,17 @@ 4.0.0 - - com.baeldung.multimodule-maven-project - multimodule-maven-project - 1.0 - com.baeldung.mainappmodule mainappmodule 1.0 jar mainappmodule + + + com.baeldung.multimodule-maven-project + multimodule-maven-project + 1.0 + diff --git a/maven-java-11/multimodule-maven-project/pom.xml b/maven-java-11/multimodule-maven-project/pom.xml index f22541738c..7e2eb0dd7b 100644 --- a/maven-java-11/multimodule-maven-project/pom.xml +++ b/maven-java-11/multimodule-maven-project/pom.xml @@ -6,12 +6,20 @@ 1.0 pom multimodule-maven-project + com.baeldung.maven-java-11 maven-java-11 1.0 + + entitymodule + daomodule + userdaomodule + mainappmodule + + @@ -45,13 +53,6 @@ - - entitymodule - daomodule - userdaomodule - mainappmodule - - UTF-8 diff --git a/maven-java-11/multimodule-maven-project/userdaomodule/pom.xml b/maven-java-11/multimodule-maven-project/userdaomodule/pom.xml index b4fe7f0398..68e7ae9b82 100644 --- a/maven-java-11/multimodule-maven-project/userdaomodule/pom.xml +++ b/maven-java-11/multimodule-maven-project/userdaomodule/pom.xml @@ -1,16 +1,18 @@ 4.0.0 - - com.baeldung.multimodule-maven-project - multimodule-maven-project - 1.0 - com.baeldung.userdaomodule userdaomodule 1.0 jar userdaomodule + + + com.baeldung.multimodule-maven-project + multimodule-maven-project + 1.0 + + com.baeldung.entitymodule diff --git a/maven-java-11/pom.xml b/maven-java-11/pom.xml index ff95840523..5ae4c00892 100644 --- a/maven-java-11/pom.xml +++ b/maven-java-11/pom.xml @@ -6,14 +6,17 @@ 1.0 pom maven-java-11 + - parent-modules - com.baeldung - 1.0.0-SNAPSHOT + parent-modules + com.baeldung + 1.0.0-SNAPSHOT + multimodule-maven-project + UTF-8 11 diff --git a/maven/pom.xml b/maven/pom.xml index 942bf683e2..ecb031fc11 100644 --- a/maven/pom.xml +++ b/maven/pom.xml @@ -4,12 +4,13 @@ com.baeldung maven 0.0.1-SNAPSHOT + maven + pom + custom-rule maven-enforcer - maven - pom diff --git a/maven/versions-maven-plugin/pom.xml b/maven/versions-maven-plugin/pom.xml index dc0cba75f9..e0714bf0e0 100644 --- a/maven/versions-maven-plugin/pom.xml +++ b/maven/versions-maven-plugin/pom.xml @@ -6,10 +6,6 @@ versions-maven-plugin 0.0.1-SNAPSHOT versions-maven-plugin - - - 1.15 - @@ -73,5 +69,9 @@ + + + 1.15 + \ No newline at end of file diff --git a/msf4j/pom.xml b/msf4j/pom.xml index 4a6f63159d..2a862ac289 100644 --- a/msf4j/pom.xml +++ b/msf4j/pom.xml @@ -23,6 +23,7 @@ + org.wso2.msf4j diff --git a/optaplanner/pom.xml b/optaplanner/pom.xml index fbce0ea072..93b1e68264 100644 --- a/optaplanner/pom.xml +++ b/optaplanner/pom.xml @@ -18,11 +18,6 @@ optaplanner-core 7.9.0.Final - - - - - \ No newline at end of file diff --git a/parent-boot-performance/pom.xml b/parent-boot-performance/pom.xml index b1c6854eae..b7d12e2ba4 100644 --- a/parent-boot-performance/pom.xml +++ b/parent-boot-performance/pom.xml @@ -13,13 +13,6 @@ 1.0.0-SNAPSHOT - - 3.1.0 - - 1.0.21.RELEASE - 2.2.0.M3 - - @@ -31,6 +24,7 @@ + io.rest-assured @@ -88,4 +82,11 @@ + + + 3.1.0 + + 1.0.21.RELEASE + 2.2.0.M3 + diff --git a/patterns/design-patterns/pom.xml b/patterns/design-patterns/pom.xml index ac201ad653..e6bff64f9e 100644 --- a/patterns/design-patterns/pom.xml +++ b/patterns/design-patterns/pom.xml @@ -48,6 +48,7 @@ ${grep4j.version} + UTF-8 1.8 diff --git a/persistence-modules/hibernate-mapping/pom.xml b/persistence-modules/hibernate-mapping/pom.xml index 6845295812..509c54ca75 100644 --- a/persistence-modules/hibernate-mapping/pom.xml +++ b/persistence-modules/hibernate-mapping/pom.xml @@ -2,6 +2,9 @@ + hibernate-mapping + 1.0.0-SNAPSHOT + 4.0.0 com.baeldung @@ -10,10 +13,6 @@ .. - hibernate-mapping - 1.0.0-SNAPSHOT - 4.0.0 - org.hibernate diff --git a/persistence-modules/java-jpa/pom.xml b/persistence-modules/java-jpa/pom.xml index 978679cfe6..ced049d281 100644 --- a/persistence-modules/java-jpa/pom.xml +++ b/persistence-modules/java-jpa/pom.xml @@ -104,6 +104,7 @@ + 5.4.0.Final 2.7.4-RC1 diff --git a/persistence-modules/java-mongodb/pom.xml b/persistence-modules/java-mongodb/pom.xml index 0f5efedb96..dc4503c95e 100644 --- a/persistence-modules/java-mongodb/pom.xml +++ b/persistence-modules/java-mongodb/pom.xml @@ -22,8 +22,6 @@ ${flapdoodle.version} test - - org.mongodb mongo-java-driver diff --git a/persistence-modules/jpa-hibernate-cascade-type/pom.xml b/persistence-modules/jpa-hibernate-cascade-type/pom.xml index 8cfc2a5fa2..a45f297a6b 100644 --- a/persistence-modules/jpa-hibernate-cascade-type/pom.xml +++ b/persistence-modules/jpa-hibernate-cascade-type/pom.xml @@ -2,6 +2,10 @@ + jpa-hibernate-cascade-type + 4.0.0 + 1.0.0-SNAPSHOT + com.baeldung parent-modules @@ -9,10 +13,6 @@ ../../ - jpa-hibernate-cascade-type - 4.0.0 - 1.0.0-SNAPSHOT - org.hibernate diff --git a/software-security/sql-injection-samples/pom.xml b/software-security/sql-injection-samples/pom.xml index b12b479614..5c3256319e 100644 --- a/software-security/sql-injection-samples/pom.xml +++ b/software-security/sql-injection-samples/pom.xml @@ -16,13 +16,10 @@ - - org.springframework.boot spring-boot-starter-jdbc - org.apache.derby derby @@ -43,18 +40,14 @@ lombok provided - org.springframework.boot spring-boot-starter-data-jpa - org.hibernate hibernate-jpamodelgen - - org.springframework.boot spring-boot-devtools diff --git a/spf4j/spf4j-aspects-app/pom.xml b/spf4j/spf4j-aspects-app/pom.xml index 9fccec673a..1c707f4d87 100644 --- a/spf4j/spf4j-aspects-app/pom.xml +++ b/spf4j/spf4j-aspects-app/pom.xml @@ -6,12 +6,14 @@ 0.0.1-SNAPSHOT jar spf4j-aspects-app + parent-modules com.baeldung 1.0.0-SNAPSHOT ../../ + org.spf4j @@ -29,6 +31,7 @@ ${org.slf4j.version} + spf4j-aspects-app @@ -75,6 +78,7 @@ + UTF-8 8.6.10 diff --git a/spf4j/spf4j-core-app/pom.xml b/spf4j/spf4j-core-app/pom.xml index ae346065ef..9f490d9f06 100644 --- a/spf4j/spf4j-core-app/pom.xml +++ b/spf4j/spf4j-core-app/pom.xml @@ -6,12 +6,14 @@ 0.0.1-SNAPSHOT jar spf4j-core-app + parent-modules com.baeldung 1.0.0-SNAPSHOT ../../ + org.spf4j @@ -29,6 +31,7 @@ ${org.slf4j.version} + spf4j-core-app @@ -75,6 +78,7 @@ + UTF-8 8.6.10 diff --git a/spring-5-security-cognito/pom.xml b/spring-5-security-cognito/pom.xml index c7314d6f9f..431c9b8d9c 100644 --- a/spring-5-security-cognito/pom.xml +++ b/spring-5-security-cognito/pom.xml @@ -48,7 +48,6 @@ org.springframework.security spring-security-oauth2-jose - org.springframework spring-test diff --git a/spring-5-webflux/pom.xml b/spring-5-webflux/pom.xml index c1f537d2fe..6317723467 100644 --- a/spring-5-webflux/pom.xml +++ b/spring-5-webflux/pom.xml @@ -28,11 +28,6 @@ - - 1.8 - 2.2.0.M3 - - org.springframework.boot @@ -86,6 +81,7 @@ https://repo.spring.io/milestone + spring-snapshots @@ -101,4 +97,9 @@ https://repo.spring.io/milestone + + + 1.8 + 2.2.0.M3 + diff --git a/spring-boot-angular/pom.xml b/spring-boot-angular/pom.xml index 6ea98eb3d0..62a2701dd0 100644 --- a/spring-boot-angular/pom.xml +++ b/spring-boot-angular/pom.xml @@ -6,15 +6,13 @@ spring-boot-angular 1.0 jar + parent-boot-2 com.baeldung 0.0.1-SNAPSHOT ../../parent-boot-2 - - 1.8 - @@ -47,4 +45,7 @@ + + 1.8 + diff --git a/spring-boot-flowable/pom.xml b/spring-boot-flowable/pom.xml index f9531a1e6a..f7fc943389 100644 --- a/spring-boot-flowable/pom.xml +++ b/spring-boot-flowable/pom.xml @@ -7,12 +7,14 @@ war spring-boot-flowable Spring Boot Flowable Module + parent-boot-2 com.baeldung 0.0.1-SNAPSHOT ../parent-boot-2 + org.springframework.boot @@ -44,6 +46,7 @@ test + @@ -52,6 +55,7 @@ + 6.4.1 diff --git a/spring-boot-mvc-birt/pom.xml b/spring-boot-mvc-birt/pom.xml index 8f41e8410a..6feb2a7611 100644 --- a/spring-boot-mvc-birt/pom.xml +++ b/spring-boot-mvc-birt/pom.xml @@ -9,6 +9,7 @@ 0.0.1-SNAPSHOT jar Module For Spring Boot Integration with BIRT + org.springframework.boot spring-boot-starter-parent diff --git a/spring-boot-ops-2/pom.xml b/spring-boot-ops-2/pom.xml index dc5280df48..74fcd79169 100644 --- a/spring-boot-ops-2/pom.xml +++ b/spring-boot-ops-2/pom.xml @@ -3,6 +3,10 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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-boot-ops-2 + 0.0.1-SNAPSHOT + spring-boot-ops-2 parent-boot-2 @@ -11,11 +15,6 @@ ../parent-boot-2 - com.baeldung - spring-boot-ops-2 - 0.0.1-SNAPSHOT - spring-boot-ops-2 - org.springframework.boot diff --git a/spring-boot-performance/pom.xml b/spring-boot-performance/pom.xml index bbee7493cc..f51df8bc0c 100644 --- a/spring-boot-performance/pom.xml +++ b/spring-boot-performance/pom.xml @@ -14,11 +14,6 @@ ../parent-boot-performance - - - com.baeldung.lazyinitialization.Application - - org.springframework.boot @@ -42,4 +37,9 @@ + + + + com.baeldung.lazyinitialization.Application + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-bootstrap/gateway/pom.xml b/spring-cloud/spring-cloud-bootstrap/gateway/pom.xml index 4f9c60a26a..6cbaa5ac2d 100644 --- a/spring-cloud/spring-cloud-bootstrap/gateway/pom.xml +++ b/spring-cloud/spring-cloud-bootstrap/gateway/pom.xml @@ -97,6 +97,7 @@ + Dalston.RELEASE diff --git a/spring-cloud/spring-cloud-config/client/pom.xml b/spring-cloud/spring-cloud-config/client/pom.xml index c55f9bc471..14b0d2f9b1 100644 --- a/spring-cloud/spring-cloud-config/client/pom.xml +++ b/spring-cloud/spring-cloud-config/client/pom.xml @@ -20,8 +20,7 @@ org.springframework.boot spring-boot-starter-web - - + org.springframework.boot spring-boot-starter-test diff --git a/spring-cloud/spring-cloud-config/server/pom.xml b/spring-cloud/spring-cloud-config/server/pom.xml index b4be7663e2..674749a48d 100644 --- a/spring-cloud/spring-cloud-config/server/pom.xml +++ b/spring-cloud/spring-cloud-config/server/pom.xml @@ -24,8 +24,7 @@ org.springframework.boot spring-boot-starter-web - - + org.springframework.boot spring-boot-starter-test diff --git a/spring-cloud/spring-cloud-contract/spring-cloud-contract-producer/pom.xml b/spring-cloud/spring-cloud-contract/spring-cloud-contract-producer/pom.xml index dffbd29206..7a0fa7db10 100644 --- a/spring-cloud/spring-cloud-contract/spring-cloud-contract-producer/pom.xml +++ b/spring-cloud/spring-cloud-contract/spring-cloud-contract-producer/pom.xml @@ -31,6 +31,7 @@ spring-boot-starter-data-rest + diff --git a/spring-cloud/spring-cloud-eureka/pom.xml b/spring-cloud/spring-cloud-eureka/pom.xml index e8e3d67805..5afb006d41 100644 --- a/spring-cloud/spring-cloud-eureka/pom.xml +++ b/spring-cloud/spring-cloud-eureka/pom.xml @@ -9,18 +9,18 @@ Spring Cloud Eureka Server and Sample Clients pom - - spring-cloud-eureka-server - spring-cloud-eureka-client - spring-cloud-eureka-feign-client - - com.baeldung.spring.cloud spring-cloud 1.0.0-SNAPSHOT .. + + + spring-cloud-eureka-server + spring-cloud-eureka-client + spring-cloud-eureka-feign-client + diff --git a/spring-cloud/spring-cloud-openfeign/pom.xml b/spring-cloud/spring-cloud-openfeign/pom.xml index 002a333749..92de33572b 100644 --- a/spring-cloud/spring-cloud-openfeign/pom.xml +++ b/spring-cloud/spring-cloud-openfeign/pom.xml @@ -9,7 +9,6 @@ openfeign OpenFeign project for Spring Boot - parent-boot-2 com.baeldung @@ -17,12 +16,6 @@ ../../parent-boot-2 - - 2.0.1.RELEASE - Finchley.SR2 - - - org.springframework.cloud @@ -58,4 +51,9 @@ + + 2.0.1.RELEASE + Finchley.SR2 + + diff --git a/spring-cloud/spring-cloud-security/auth-client/pom.xml b/spring-cloud/spring-cloud-security/auth-client/pom.xml index 4152552640..c414e584e5 100644 --- a/spring-cloud/spring-cloud-security/auth-client/pom.xml +++ b/spring-cloud/spring-cloud-security/auth-client/pom.xml @@ -13,6 +13,18 @@ 1.0.0-SNAPSHOT + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + + org.springframework.boot @@ -78,18 +90,6 @@ - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - - - 2.2.0 Greenwich.SR1 diff --git a/spring-core-2/pom.xml b/spring-core-2/pom.xml index 8e4c539e3b..bb4ca9701b 100644 --- a/spring-core-2/pom.xml +++ b/spring-core-2/pom.xml @@ -2,15 +2,15 @@ + 4.0.0 + spring-core-2 + com.baeldung parent-spring-5 0.0.1-SNAPSHOT ../parent-spring-5 - 4.0.0 - - spring-core-2 diff --git a/spring-mvc-java/pom.xml b/spring-mvc-java/pom.xml index 853d8db64c..e5dd5ad9e1 100644 --- a/spring-mvc-java/pom.xml +++ b/spring-mvc-java/pom.xml @@ -15,8 +15,8 @@ - - org.springframework + + org.springframework spring-webmvc ${spring.version} @@ -34,7 +34,6 @@ javax.servlet jstl ${jstl.version} - @@ -134,17 +133,17 @@ gson 2.8.5 - - org.springframework - spring-websocket - ${spring.version} - + + org.springframework + spring-websocket + ${spring.version} + - - org.springframework - spring-messaging - ${spring.version} - + + org.springframework + spring-messaging + ${spring.version} + diff --git a/spring-security-kerberos/pom.xml b/spring-security-kerberos/pom.xml index 35c4ba4926..d98d0ff508 100644 --- a/spring-security-kerberos/pom.xml +++ b/spring-security-kerberos/pom.xml @@ -7,12 +7,14 @@ 0.1-SNAPSHOT spring-security-kerberos war + parent-boot-1 com.baeldung 0.0.1-SNAPSHOT ../parent-boot-1 + org.springframework.boot @@ -50,6 +52,7 @@ test + diff --git a/spring-session/spring-session-mongodb/pom.xml b/spring-session/spring-session-mongodb/pom.xml index 16fbaccc84..dc055ff32d 100644 --- a/spring-session/spring-session-mongodb/pom.xml +++ b/spring-session/spring-session-mongodb/pom.xml @@ -42,11 +42,6 @@ - - 2.1.3.RELEASE - 2.1.5.RELEASE - - @@ -56,4 +51,9 @@ + + 2.1.3.RELEASE + 2.1.5.RELEASE + + \ No newline at end of file diff --git a/spring-soap/pom.xml b/spring-soap/pom.xml index ba05eddf5d..16f19b681f 100644 --- a/spring-soap/pom.xml +++ b/spring-soap/pom.xml @@ -13,11 +13,6 @@ ../parent-boot-2 - - 1.8 - 2.1.2.RELEASE - - @@ -66,4 +61,9 @@ + + 1.8 + 2.1.2.RELEASE + + diff --git a/spring-thymeleaf-2/pom.xml b/spring-thymeleaf-2/pom.xml index bc1147cb14..1b95cac43c 100644 --- a/spring-thymeleaf-2/pom.xml +++ b/spring-thymeleaf-2/pom.xml @@ -23,11 +23,6 @@ - - 1.8 - 1.8 - - @@ -37,4 +32,9 @@ spring-thymeleaf-2 + + + 1.8 + 1.8 + diff --git a/testing-modules/gatling/pom.xml b/testing-modules/gatling/pom.xml index 158da176c6..e708d939e4 100644 --- a/testing-modules/gatling/pom.xml +++ b/testing-modules/gatling/pom.xml @@ -14,6 +14,31 @@ 1.0.0-SNAPSHOT ../../ + + + + + io.gatling + gatling-app + ${gatling.version} + + + io.gatling + gatling-recorder + ${gatling.version} + + + io.gatling.highcharts + gatling-charts-highcharts + ${gatling.version} + + + org.scala-lang + scala-library + ${scala.version} + + + @@ -77,52 +102,27 @@ simulation - - io.gatling - gatling-maven-plugin - ${gatling-maven-plugin.version} - - - test - - execute - - - true - - - - - - + + io.gatling + gatling-maven-plugin + ${gatling-maven-plugin.version} + + + test + + execute + + + true + + + + + + - - - - io.gatling - gatling-app - ${gatling.version} - - - io.gatling - gatling-recorder - ${gatling.version} - - - io.gatling.highcharts - gatling-charts-highcharts - ${gatling.version} - - - org.scala-lang - scala-library - ${scala.version} - - - - 1.8 1.8 diff --git a/testing-modules/mocks/mock-comparisons/pom.xml b/testing-modules/mocks/mock-comparisons/pom.xml index ae36280300..e454f124ce 100644 --- a/testing-modules/mocks/mock-comparisons/pom.xml +++ b/testing-modules/mocks/mock-comparisons/pom.xml @@ -49,7 +49,6 @@ 2.21.0 3.5.1 1.41 - diff --git a/xmlunit-2/pom.xml b/xmlunit-2/pom.xml index faefeca7a1..9e146ccf33 100644 --- a/xmlunit-2/pom.xml +++ b/xmlunit-2/pom.xml @@ -23,7 +23,6 @@ xmlunit-core ${xmlunit.version} - From a46a730ffe862e76bb0d55f24c3db93afd9c434d Mon Sep 17 00:00:00 2001 From: Pavan Shankar Koli Date: Mon, 8 Jul 2019 08:58:23 +0530 Subject: [PATCH 54/62] BAEL-2578 Remove white spaces --- .../java/com/baeldung/disableautoconfig/SpringDataMongoDB.java | 1 - 1 file changed, 1 deletion(-) diff --git a/spring-boot-data/src/main/java/com/baeldung/disableautoconfig/SpringDataMongoDB.java b/spring-boot-data/src/main/java/com/baeldung/disableautoconfig/SpringDataMongoDB.java index 5e1cafa932..865c137a8d 100644 --- a/spring-boot-data/src/main/java/com/baeldung/disableautoconfig/SpringDataMongoDB.java +++ b/spring-boot-data/src/main/java/com/baeldung/disableautoconfig/SpringDataMongoDB.java @@ -1,6 +1,5 @@ package com.baeldung.disableautoconfig; - import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration; From aebb5cb88e2d492dcf646a310cad4fc1b7ce541e Mon Sep 17 00:00:00 2001 From: Erik Pragt Date: Mon, 8 Jul 2019 16:23:20 -0500 Subject: [PATCH 55/62] BAEL-14772 Update Spring Data MongoDB article to latest dependencies --- persistence-modules/spring-data-mongodb/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/persistence-modules/spring-data-mongodb/pom.xml b/persistence-modules/spring-data-mongodb/pom.xml index 7156cdf071..33ad3a5267 100644 --- a/persistence-modules/spring-data-mongodb/pom.xml +++ b/persistence-modules/spring-data-mongodb/pom.xml @@ -21,7 +21,7 @@ org.springframework.data spring-data-releasetrain - Lovelace-SR3 + Lovelace-SR9 pom @@ -95,7 +95,7 @@ - 2.1.2.RELEASE + 2.1.9.RELEASE 4.1.4 1.1.3 1.9.2 From e1bad1ab5376c960ea12e14fb7deceb908a814ce Mon Sep 17 00:00:00 2001 From: Erik Pragt Date: Mon, 8 Jul 2019 16:53:05 -0500 Subject: [PATCH 56/62] BAEL-2883 Fix tests in spring-cloud projects part 3 --- .../basic/SpringContextIntegrationTest.java | 16 ++++++++++++++++ spring-cloud/spring-cloud-aws/.attach_pid23938 | 0 .../gateway/SpringContextIntegrationTest.java | 16 ++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 spring-cloud/spring-cloud-archaius/basic-config/src/test/java/com/baeldung/spring/cloud/archaius/basic/SpringContextIntegrationTest.java delete mode 100644 spring-cloud/spring-cloud-aws/.attach_pid23938 create mode 100644 spring-cloud/spring-cloud-bootstrap/gateway/src/test/java/com/baeldung/spring/cloud/bootstrap/gateway/SpringContextIntegrationTest.java diff --git a/spring-cloud/spring-cloud-archaius/basic-config/src/test/java/com/baeldung/spring/cloud/archaius/basic/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-archaius/basic-config/src/test/java/com/baeldung/spring/cloud/archaius/basic/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..818e313c98 --- /dev/null +++ b/spring-cloud/spring-cloud-archaius/basic-config/src/test/java/com/baeldung/spring/cloud/archaius/basic/SpringContextIntegrationTest.java @@ -0,0 +1,16 @@ +package com.baeldung.spring.cloud.archaius.basic; + +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 SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } + +} diff --git a/spring-cloud/spring-cloud-aws/.attach_pid23938 b/spring-cloud/spring-cloud-aws/.attach_pid23938 deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/spring-cloud/spring-cloud-bootstrap/gateway/src/test/java/com/baeldung/spring/cloud/bootstrap/gateway/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-bootstrap/gateway/src/test/java/com/baeldung/spring/cloud/bootstrap/gateway/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..dc635cd003 --- /dev/null +++ b/spring-cloud/spring-cloud-bootstrap/gateway/src/test/java/com/baeldung/spring/cloud/bootstrap/gateway/SpringContextIntegrationTest.java @@ -0,0 +1,16 @@ +package com.baeldung.spring.cloud.bootstrap.gateway; + +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 SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } + +} From d84e1bd4cf6044973f0240374f26519d4b2bd919 Mon Sep 17 00:00:00 2001 From: Erik Pragt Date: Mon, 8 Jul 2019 17:34:55 -0500 Subject: [PATCH 57/62] BAEL-3036 Update Cors with Spring article and create the code --- .../main/java/com/baeldung/cors/Account.java | 9 +++++++ .../com/baeldung/cors/AccountController.java | 24 ++++++++++++++++++ .../java/com/baeldung/cors/WebConfig.java | 16 ++++++++++++ .../main/webapp/WEB-INF/spring-web-config.xml | 25 +++++++++++++++++++ 4 files changed, 74 insertions(+) create mode 100644 spring-rest-simple/src/main/java/com/baeldung/cors/Account.java create mode 100644 spring-rest-simple/src/main/java/com/baeldung/cors/AccountController.java create mode 100644 spring-rest-simple/src/main/java/com/baeldung/cors/WebConfig.java create mode 100644 spring-rest-simple/src/main/webapp/WEB-INF/spring-web-config.xml diff --git a/spring-rest-simple/src/main/java/com/baeldung/cors/Account.java b/spring-rest-simple/src/main/java/com/baeldung/cors/Account.java new file mode 100644 index 0000000000..dc6a541a46 --- /dev/null +++ b/spring-rest-simple/src/main/java/com/baeldung/cors/Account.java @@ -0,0 +1,9 @@ +package com.baeldung.cors; + +public class Account { + private Long id; + + public Account(Long id) { + this.id = id; + } +} diff --git a/spring-rest-simple/src/main/java/com/baeldung/cors/AccountController.java b/spring-rest-simple/src/main/java/com/baeldung/cors/AccountController.java new file mode 100644 index 0000000000..c387eb2121 --- /dev/null +++ b/spring-rest-simple/src/main/java/com/baeldung/cors/AccountController.java @@ -0,0 +1,24 @@ +package com.baeldung.cors; + +import org.springframework.web.bind.annotation.CrossOrigin; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +@CrossOrigin(maxAge = 3600) +@RestController +@RequestMapping("/account") +public class AccountController { + + @CrossOrigin("http://example.com") + @RequestMapping("/{id}") + public Account retrieve(@PathVariable Long id) { + return new Account(id); + } + + @RequestMapping(method = RequestMethod.DELETE, path = "/{id}") + public void remove(@PathVariable Long id) { + // ... + } +} \ No newline at end of file diff --git a/spring-rest-simple/src/main/java/com/baeldung/cors/WebConfig.java b/spring-rest-simple/src/main/java/com/baeldung/cors/WebConfig.java new file mode 100644 index 0000000000..dc579ce4ba --- /dev/null +++ b/spring-rest-simple/src/main/java/com/baeldung/cors/WebConfig.java @@ -0,0 +1,16 @@ +package com.baeldung.cors; + +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.EnableWebMvc; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +@Configuration +@EnableWebMvc +public class WebConfig implements WebMvcConfigurer { + + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**"); + } +} \ No newline at end of file diff --git a/spring-rest-simple/src/main/webapp/WEB-INF/spring-web-config.xml b/spring-rest-simple/src/main/webapp/WEB-INF/spring-web-config.xml new file mode 100644 index 0000000000..07d50ae1d6 --- /dev/null +++ b/spring-rest-simple/src/main/webapp/WEB-INF/spring-web-config.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + From 4b27a2f33c4061b4ea4c7793d20c77da47ea5a27 Mon Sep 17 00:00:00 2001 From: Graham Cox Date: Tue, 9 Jul 2019 05:36:57 +0100 Subject: [PATCH 58/62] Code samples for advanced quasar article (#7271) --- kotlin-quasar/pom.xml | 23 ++ .../com/baeldung/quasar/ActorsBehaviorTest.kt | 157 +++++++++ .../kotlin/com/baeldung/quasar/ActorsTest.kt | 298 ++++++++++++++++++ .../baeldung/quasar/ReactiveStreamsTest.kt | 135 ++++++++ 4 files changed, 613 insertions(+) create mode 100644 kotlin-quasar/src/test/kotlin/com/baeldung/quasar/ActorsBehaviorTest.kt create mode 100644 kotlin-quasar/src/test/kotlin/com/baeldung/quasar/ActorsTest.kt create mode 100644 kotlin-quasar/src/test/kotlin/com/baeldung/quasar/ReactiveStreamsTest.kt diff --git a/kotlin-quasar/pom.xml b/kotlin-quasar/pom.xml index 44feabd183..a3e5a1ec25 100644 --- a/kotlin-quasar/pom.xml +++ b/kotlin-quasar/pom.xml @@ -45,6 +45,27 @@ junit 4.12 + + + org.slf4j + slf4j-api + ${org.slf4j.version} + + + ch.qos.logback + logback-classic + ${logback.version} + + + ch.qos.logback + logback-core + ${logback.version} + + + org.slf4j + jcl-over-slf4j + ${org.slf4j.version} + @@ -116,5 +137,7 @@ 0.8.0 1.3.31 + 1.7.21 + 1.1.7 diff --git a/kotlin-quasar/src/test/kotlin/com/baeldung/quasar/ActorsBehaviorTest.kt b/kotlin-quasar/src/test/kotlin/com/baeldung/quasar/ActorsBehaviorTest.kt new file mode 100644 index 0000000000..b4d0288a64 --- /dev/null +++ b/kotlin-quasar/src/test/kotlin/com/baeldung/quasar/ActorsBehaviorTest.kt @@ -0,0 +1,157 @@ +package com.baeldung.quasar + +import co.paralleluniverse.actors.Actor +import co.paralleluniverse.actors.ActorRef +import co.paralleluniverse.actors.behaviors.* +import co.paralleluniverse.fibers.Suspendable +import co.paralleluniverse.strands.SuspendableCallable +import org.junit.Test +import org.slf4j.LoggerFactory +import java.lang.Exception + +class ActorsBehaviorTest { + companion object { + private val LOG = LoggerFactory.getLogger(ActorsBehaviorTest::class.java) + } + + @Test + fun requestReplyHelper() { + data class TestMessage(val input: Int) : RequestMessage() + + val actor = object : Actor("requestReplyActor", null) { + @Suspendable + override fun doRun(): Void? { + while (true) { + val msg = receive() + LOG.info("Processing message: {}", msg) + + RequestReplyHelper.reply(msg, msg.input * 100) + } + } + } + + val actorRef = actor.spawn() + + val result = RequestReplyHelper.call(actorRef, TestMessage(50)) + LOG.info("Received reply: {}", result) + } + + @Test + fun server() { + val actor = ServerActor(object : AbstractServerHandler() { + @Suspendable + override fun handleCall(from: ActorRef<*>?, id: Any?, m: Int?): String { + LOG.info("Called with message: {} from {} with ID {}", m, from, id) + return m.toString() ?: "None" + } + + @Suspendable + override fun handleCast(from: ActorRef<*>?, id: Any?, m: Float?) { + LOG.info("Cast message: {} from {} with ID {}", m, from, id) + } + }) + + val server = actor.spawn() + + LOG.info("Call result: {}", server.call(5)) + server.cast(2.5f) + + server.shutdown() + } + + interface Summer { + fun sum(a: Int, b: Int) : Int + } + + @Test + fun proxyServer() { + val actor = ProxyServerActor(false, object : Summer { + @Synchronized + override fun sum(a: Int, b: Int): Int { + Exception().printStackTrace() + LOG.info("Adding together {} and {}", a, b) + return a + b + } + }) + + val summerActor = actor.spawn() + + val result = (summerActor as Summer).sum(1, 2) + LOG.info("Result: {}", result) + + summerActor.shutdown() + } + + @Test + fun eventSource() { + val actor = EventSourceActor() + val eventSource = actor.spawn() + + eventSource.addHandler { msg -> + LOG.info("Sent message: {}", msg) + } + + val name = "Outside Value" + eventSource.addHandler { msg -> + LOG.info("Also Sent message: {} {}", msg, name) + } + + eventSource.send("Hello") + + eventSource.shutdown() + } + + @Test + fun finiteStateMachine() { + val actor = object : FiniteStateMachineActor() { + @Suspendable + override fun initialState(): SuspendableCallable> { + LOG.info("Starting") + return SuspendableCallable { lockedState() } + } + + @Suspendable + fun lockedState() : SuspendableCallable> { + return receive {msg -> + when (msg) { + "PUSH" -> { + LOG.info("Still locked") + lockedState() + } + "COIN" -> { + LOG.info("Unlocking...") + unlockedState() + } + else -> TERMINATE + } + } + } + + @Suspendable + fun unlockedState() : SuspendableCallable> { + return receive {msg -> + when (msg) { + "PUSH" -> { + LOG.info("Locking") + lockedState() + } + "COIN" -> { + LOG.info("Unlocked") + unlockedState() + } + else -> TERMINATE + } + } + } + } + + val actorRef = actor.spawn() + + listOf("PUSH", "COIN", "COIN", "PUSH", "PUSH").forEach { + LOG.info(it) + actorRef.sendSync(it) + } + + actorRef.shutdown() + } +} diff --git a/kotlin-quasar/src/test/kotlin/com/baeldung/quasar/ActorsTest.kt b/kotlin-quasar/src/test/kotlin/com/baeldung/quasar/ActorsTest.kt new file mode 100644 index 0000000000..819a149af3 --- /dev/null +++ b/kotlin-quasar/src/test/kotlin/com/baeldung/quasar/ActorsTest.kt @@ -0,0 +1,298 @@ +package com.baeldung.quasar + +import co.paralleluniverse.actors.* +import co.paralleluniverse.fibers.Suspendable +import co.paralleluniverse.strands.channels.Channels +import org.junit.Assert +import org.junit.Test +import org.slf4j.LoggerFactory +import java.util.concurrent.TimeUnit + +class ActorsTest { + companion object { + private val LOG = LoggerFactory.getLogger(ActorsTest::class.java) + } + + @Test + fun createNoopActor() { + val actor = object : Actor("noopActor", MailboxConfig(5, Channels.OverflowPolicy.THROW)) { + @Suspendable + override fun doRun(): String { + return "Hello" + } + } + + actor.spawn() + + println("Noop Actor: ${actor.get()}") + } + + @Test + fun registerActor() { + val actor = object : Actor("registerActor", null) { + @Suspendable + override fun doRun(): String { + return "Hello" + } + } + + val actorRef = actor.spawn() + actor.register() + + val retrievedRef = ActorRegistry.getActor>("registerActor") + + Assert.assertEquals(actorRef, retrievedRef) + actor.join() + } + + @Test + fun registerActorNewName() { + val actor = object : Actor(null, null) { + @Suspendable + override fun doRun(): String { + return "Hello" + } + } + + val actorRef = actor.spawn() + actor.register("renamedActor") + + val retrievedRef = ActorRegistry.getActor>("renamedActor") + + Assert.assertEquals(actorRef, retrievedRef) + actor.join() + } + + @Test + fun retrieveUnknownActor() { + val retrievedRef = ActorRegistry.getActor>("unknownActor", 1, TimeUnit.SECONDS) + + Assert.assertNull(retrievedRef) + } + + @Test + fun createSimpleActor() { + val actor = object : Actor("simpleActor", null) { + @Suspendable + override fun doRun(): Void? { + val msg = receive() + LOG.info("SimpleActor Received Message: {}", msg) + + return null + } + } + + val actorRef = actor.spawn() + + actorRef.send(1) + + actor.join() + } + + @Test + fun createLoopingActor() { + val actor = object : Actor("loopingActor", null) { + @Suspendable + override fun doRun(): Void? { + while (true) { + val msg = receive() + + if (msg > 0) { + LOG.info("LoopingActor Received Message: {}", msg) + } else { + break + } + } + + return null + } + } + + val actorRef = actor.spawn() + + actorRef.send(3) + actorRef.send(2) + actorRef.send(1) + actorRef.send(0) + + actor.join() + } + + @Test + fun actorBacklog() { + val actor = object : Actor("backlogActor", MailboxConfig(1, Channels.OverflowPolicy.THROW)) { + @Suspendable + override fun doRun(): String { + TimeUnit.MILLISECONDS.sleep(500); + LOG.info("Backlog Actor Received: {}", receive()) + + try { + receive() + } catch (e: Throwable) { + LOG.info("==== Exception throws by receive() ====") + e.printStackTrace() + } + + return "No Exception" + } + } + + val actorRef = actor.spawn() + + actorRef.send(1) + actorRef.send(2) + + try { + LOG.info("Backlog Actor: {}", actor.get()) + } catch (e: Exception) { + // Expected + LOG.info("==== Exception throws by get() ====") + e.printStackTrace() + } + } + + @Test + fun actorBacklogTrySend() { + val actor = object : Actor("backlogTrySendActor", MailboxConfig(1, Channels.OverflowPolicy.THROW)) { + @Suspendable + override fun doRun(): String { + TimeUnit.MILLISECONDS.sleep(500); + LOG.info("Backlog TrySend Actor Received: {}", receive()) + + return "No Exception" + } + } + + val actorRef = actor.spawn() + + LOG.info("Backlog TrySend 1: {}", actorRef.trySend(1)) + LOG.info("Backlog TrySend 1: {}", actorRef.trySend(2)) + + actor.join() + } + + @Test + fun actorTimeoutReceive() { + val actor = object : Actor("TimeoutReceiveActor", MailboxConfig(1, Channels.OverflowPolicy.THROW)) { + @Suspendable + override fun doRun(): String { + LOG.info("Timeout Actor Received: {}", receive(500, TimeUnit.MILLISECONDS)) + + return "Finished" + } + } + + val actorRef = actor.spawn() + + TimeUnit.MILLISECONDS.sleep(300) + actorRef.trySend(1) + + actor.join() + } + + + @Test + fun actorNonBlockingReceive() { + val actor = object : Actor("NonBlockingReceiveActor", MailboxConfig(1, Channels.OverflowPolicy.THROW)) { + @Suspendable + override fun doRun(): String { + LOG.info("NonBlocking Actor Received #1: {}", tryReceive()) + TimeUnit.MILLISECONDS.sleep(500) + LOG.info("NonBlocking Actor Received #2: {}", tryReceive()) + + return "Finished" + } + } + + val actorRef = actor.spawn() + + TimeUnit.MILLISECONDS.sleep(300) + actorRef.trySend(1) + + actor.join() + } + + @Test + fun evenActor() { + val actor = object : Actor("EvenActor", null) { + @Suspendable + override fun filterMessage(m: Any?): Int? { + return when (m) { + is Int -> { + if (m % 2 == 0) { + m * 10 + } else { + null + } + } + else -> super.filterMessage(m) + } + } + + @Suspendable + override fun doRun(): Void? { + while (true) { + val msg = receive() + + if (msg > 0) { + LOG.info("EvenActor Received Message: {}", msg) + } else { + break + } + } + + return null + } + } + + val actorRef = actor.spawn() + + actorRef.send(3) + actorRef.send(2) + actorRef.send(1) + actorRef.send(0) + + actor.join() + } + + @Test + fun watchingActors() { + val watched = object : Actor("WatchedActor", null) { + @Suspendable + override fun doRun(): Void? { + LOG.info("WatchedActor Starting") + receive(500, TimeUnit.MILLISECONDS) + LOG.info("WatchedActor Finishing") + return null + } + } + + val watcher = object : Actor("WatcherActor", null) { + @Suspendable + override fun doRun(): Void? { + LOG.info("WatcherActor Listening") + try { + LOG.info("WatcherActor received Message: {}", receive(2, TimeUnit.SECONDS)) + } catch (e: Exception) { + LOG.info("WatcherActor Received Exception", e) + } + return null + } + + @Suspendable + override fun handleLifecycleMessage(m: LifecycleMessage?): Int? { + LOG.info("WatcherActor Received Lifecycle Message: {}", m) + return super.handleLifecycleMessage(m) + } + } + + val watcherRef = watcher.spawn() + TimeUnit.MILLISECONDS.sleep(200) + + val watchedRef = watched.spawn() + watcher.link(watchedRef) + + watched.join() + watcher.join() + } +} diff --git a/kotlin-quasar/src/test/kotlin/com/baeldung/quasar/ReactiveStreamsTest.kt b/kotlin-quasar/src/test/kotlin/com/baeldung/quasar/ReactiveStreamsTest.kt new file mode 100644 index 0000000000..83e06bf7d6 --- /dev/null +++ b/kotlin-quasar/src/test/kotlin/com/baeldung/quasar/ReactiveStreamsTest.kt @@ -0,0 +1,135 @@ +package com.baeldung.quasar + +import co.paralleluniverse.fibers.Suspendable +import co.paralleluniverse.kotlin.fiber +import co.paralleluniverse.strands.channels.Channels +import co.paralleluniverse.strands.channels.Topic +import co.paralleluniverse.strands.channels.reactivestreams.ReactiveStreams +import org.junit.Test +import org.reactivestreams.Subscriber +import org.reactivestreams.Subscription +import org.slf4j.LoggerFactory +import java.util.concurrent.TimeUnit + +class ReactiveStreamsTest { + companion object { + private val LOG = LoggerFactory.getLogger(ReactiveStreamsTest::class.java) + } + + @Test + fun publisher() { + val inputChannel = Channels.newChannel(1); + + val publisher = ReactiveStreams.toPublisher(inputChannel) + publisher.subscribe(object : Subscriber { + @Suspendable + override fun onComplete() { + LOG.info("onComplete") + } + + @Suspendable + override fun onSubscribe(s: Subscription) { + LOG.info("onSubscribe: {}", s) + s.request(2) + } + + @Suspendable + override fun onNext(t: String?) { + LOG.info("onNext: {}", t) + } + + @Suspendable + override fun onError(t: Throwable?) { + LOG.info("onError: {}", t) + } + }) + + inputChannel.send("Hello") + inputChannel.send("World") + + TimeUnit.SECONDS.sleep(1) + + inputChannel.close() + } + + @Test + fun publisherTopic() { + val inputTopic = Topic() + + val publisher = ReactiveStreams.toPublisher(inputTopic) + publisher.subscribe(object : Subscriber { + @Suspendable + override fun onComplete() { + LOG.info("onComplete 1") + } + + @Suspendable + override fun onSubscribe(s: Subscription) { + LOG.info("onSubscribe 1: {}", s) + s.request(2) + } + + @Suspendable + override fun onNext(t: String?) { + LOG.info("onNext 1: {}", t) + } + + @Suspendable + override fun onError(t: Throwable?) { + LOG.info("onError 1: {}", t) + } + }) + publisher.subscribe(object : Subscriber { + @Suspendable + override fun onComplete() { + LOG.info("onComplete 2") + } + + @Suspendable + override fun onSubscribe(s: Subscription) { + LOG.info("onSubscribe 2: {}", s) + s.request(2) + } + + @Suspendable + override fun onNext(t: String?) { + LOG.info("onNext 2: {}", t) + } + + @Suspendable + override fun onError(t: Throwable?) { + LOG.info("onError 2: {}", t) + } + }) + + inputTopic.send("Hello") + inputTopic.send("World") + + TimeUnit.SECONDS.sleep(1) + + inputTopic.close() + } + + @Test + fun subscribe() { + val inputChannel = Channels.newChannel(10); + val publisher = ReactiveStreams.toPublisher(inputChannel) + + val channel = ReactiveStreams.subscribe(10, Channels.OverflowPolicy.THROW, publisher) + + fiber @Suspendable { + while (!channel.isClosed) { + val message = channel.receive() + LOG.info("Received: {}", message) + } + LOG.info("Stopped receiving messages") + } + + inputChannel.send("Hello") + inputChannel.send("World") + + TimeUnit.SECONDS.sleep(1) + + inputChannel.close() + } +} From 0d6d9129c4eefa93a4667597ad60ab225293fd2c Mon Sep 17 00:00:00 2001 From: Erik Pragt Date: Tue, 9 Jul 2019 06:18:29 -0500 Subject: [PATCH 59/62] BAEL-3035 Update Spring Kafka module and article from 2.2.2 to 2.2.7 (#7266) --- spring-kafka/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-kafka/pom.xml b/spring-kafka/pom.xml index 2fb4c776fe..3d08aaa928 100644 --- a/spring-kafka/pom.xml +++ b/spring-kafka/pom.xml @@ -33,7 +33,7 @@ - 2.2.2.RELEASE + 2.2.7.RELEASE \ No newline at end of file From 51e1014b26ead1fe5f77f3ea1513f67d7dc44c54 Mon Sep 17 00:00:00 2001 From: Priyesh Mashelkar Date: Tue, 9 Jul 2019 12:30:29 +0100 Subject: [PATCH 60/62] Mocking a void method with EasyMock Issue: BAEL-2952 --- testing-modules/easymock/pom.xml | 26 ++++++++++ .../testing/easymock/ForecastProcessor.java | 28 +++++++++++ .../baeldung/testing/easymock/Location.java | 33 +++++++++++++ .../easymock/ServiceUnavailableException.java | 7 +++ .../testing/easymock/WeatherService.java | 5 ++ .../easymock/ForecastProcessorUnitTest.java | 49 +++++++++++++++++++ testing-modules/pom.xml | 1 + 7 files changed, 149 insertions(+) create mode 100644 testing-modules/easymock/pom.xml create mode 100644 testing-modules/easymock/src/main/java/com/baeldung/testing/easymock/ForecastProcessor.java create mode 100644 testing-modules/easymock/src/main/java/com/baeldung/testing/easymock/Location.java create mode 100644 testing-modules/easymock/src/main/java/com/baeldung/testing/easymock/ServiceUnavailableException.java create mode 100644 testing-modules/easymock/src/main/java/com/baeldung/testing/easymock/WeatherService.java create mode 100644 testing-modules/easymock/src/test/java/com/baeldung/testing/easymock/ForecastProcessorUnitTest.java diff --git a/testing-modules/easymock/pom.xml b/testing-modules/easymock/pom.xml new file mode 100644 index 0000000000..2b16dd3a1f --- /dev/null +++ b/testing-modules/easymock/pom.xml @@ -0,0 +1,26 @@ + + + 4.0.0 + + com.baeldung + testing-modules + 1.0.0-SNAPSHOT + + easymock + easymock + http://maven.apache.org + + UTF-8 + + + + org.easymock + easymock + 4.0.2 + test + + + diff --git a/testing-modules/easymock/src/main/java/com/baeldung/testing/easymock/ForecastProcessor.java b/testing-modules/easymock/src/main/java/com/baeldung/testing/easymock/ForecastProcessor.java new file mode 100644 index 0000000000..482e985e5b --- /dev/null +++ b/testing-modules/easymock/src/main/java/com/baeldung/testing/easymock/ForecastProcessor.java @@ -0,0 +1,28 @@ +package com.baeldung.testing.easymock; + +import java.math.BigDecimal; + +public class ForecastProcessor { + private WeatherService weatherService; + + public BigDecimal getMaximumTemperature(String locationName) { + + Location location = new Location(locationName); + + try { + weatherService.populateTemperature(location); + } catch (ServiceUnavailableException e) { + return null; + } + + return location.getMaximumTemparature(); + } + + public WeatherService getWeatherService() { + return weatherService; + } + + public void setWeatherService(WeatherService weatherService) { + this.weatherService = weatherService; + } +} diff --git a/testing-modules/easymock/src/main/java/com/baeldung/testing/easymock/Location.java b/testing-modules/easymock/src/main/java/com/baeldung/testing/easymock/Location.java new file mode 100644 index 0000000000..5f318acd5c --- /dev/null +++ b/testing-modules/easymock/src/main/java/com/baeldung/testing/easymock/Location.java @@ -0,0 +1,33 @@ +package com.baeldung.testing.easymock; + +import java.math.BigDecimal; + +public class Location { + private String name; + private BigDecimal minimumTemperature; + private BigDecimal maximumTemparature; + + public Location(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public BigDecimal getMinimumTemperature() { + return minimumTemperature; + } + + public void setMinimumTemperature(BigDecimal minimumTemperature) { + this.minimumTemperature = minimumTemperature; + } + + public BigDecimal getMaximumTemparature() { + return maximumTemparature; + } + + public void setMaximumTemparature(BigDecimal maximumTemparature) { + this.maximumTemparature = maximumTemparature; + } +} diff --git a/testing-modules/easymock/src/main/java/com/baeldung/testing/easymock/ServiceUnavailableException.java b/testing-modules/easymock/src/main/java/com/baeldung/testing/easymock/ServiceUnavailableException.java new file mode 100644 index 0000000000..abab4bdee8 --- /dev/null +++ b/testing-modules/easymock/src/main/java/com/baeldung/testing/easymock/ServiceUnavailableException.java @@ -0,0 +1,7 @@ +package com.baeldung.testing.easymock; + +public class ServiceUnavailableException extends Exception { + + private static final long serialVersionUID = 6961151537340723535L; + +} diff --git a/testing-modules/easymock/src/main/java/com/baeldung/testing/easymock/WeatherService.java b/testing-modules/easymock/src/main/java/com/baeldung/testing/easymock/WeatherService.java new file mode 100644 index 0000000000..1c6b11b17b --- /dev/null +++ b/testing-modules/easymock/src/main/java/com/baeldung/testing/easymock/WeatherService.java @@ -0,0 +1,5 @@ +package com.baeldung.testing.easymock; + +public interface WeatherService { + void populateTemperature(Location location) throws ServiceUnavailableException; +} diff --git a/testing-modules/easymock/src/test/java/com/baeldung/testing/easymock/ForecastProcessorUnitTest.java b/testing-modules/easymock/src/test/java/com/baeldung/testing/easymock/ForecastProcessorUnitTest.java new file mode 100644 index 0000000000..fa8fa847ae --- /dev/null +++ b/testing-modules/easymock/src/test/java/com/baeldung/testing/easymock/ForecastProcessorUnitTest.java @@ -0,0 +1,49 @@ +package com.baeldung.testing.easymock; + +import static org.hamcrest.Matchers.equalTo; +import static org.junit.Assert.assertThat; + +import java.math.BigDecimal; + +import org.easymock.EasyMock; +import org.easymock.EasyMockRule; +import org.easymock.Mock; +import org.easymock.TestSubject; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; + +public class ForecastProcessorUnitTest { + private static int MAX_TEMP = 90; + + @Rule + public EasyMockRule rule = new EasyMockRule(this); + + @TestSubject + private ForecastProcessor forecastProcessor = new ForecastProcessor(); + + @Mock + private WeatherService mockWeatherService; + + @Before + public void setUp() { + forecastProcessor.setWeatherService(mockWeatherService); + } + + @SuppressWarnings("unchecked") + @Test + public void givenLocationName_whenWeatherServicePopulatesTemperatures_thenMaxTempReturned() throws ServiceUnavailableException { + mockWeatherService.populateTemperature(EasyMock.anyObject(Location.class)); + EasyMock.expectLastCall() + .andAnswer(() -> { + Location passedLocation = (Location) EasyMock.getCurrentArguments()[0]; + passedLocation.setMaximumTemparature(new BigDecimal(MAX_TEMP)); + passedLocation.setMinimumTemperature(new BigDecimal(MAX_TEMP - 10)); + return null; + }); + EasyMock.replay(mockWeatherService); + BigDecimal maxTemperature = forecastProcessor.getMaximumTemperature("New York"); + EasyMock.verify(mockWeatherService); + assertThat(maxTemperature, equalTo(new BigDecimal(MAX_TEMP))); + } +} diff --git a/testing-modules/pom.xml b/testing-modules/pom.xml index 95a19c2557..bc6e23a6b7 100644 --- a/testing-modules/pom.xml +++ b/testing-modules/pom.xml @@ -33,6 +33,7 @@ testing testng junit-5-basics + easymock junit-5-advanced From a238394e5f94b1aa45c790e0a8f7d5c988f82434 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Wed, 10 Jul 2019 08:56:11 +0300 Subject: [PATCH 61/62] Update README.md --- spring-rest-simple/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-rest-simple/README.md b/spring-rest-simple/README.md index 882d0ac301..c01f27bd98 100644 --- a/spring-rest-simple/README.md +++ b/spring-rest-simple/README.md @@ -5,3 +5,4 @@ - [Spring RequestMapping](http://www.baeldung.com/spring-requestmapping) - [Spring and Apache FileUpload](http://www.baeldung.com/spring-apache-file-upload) - [Test a REST API with curl](http://www.baeldung.com/curl-rest) +- [CORS with Spring](https://www.baeldung.com/spring-cors) From 7ebf52f4090015a46ac0abca49f86aac2c24493a Mon Sep 17 00:00:00 2001 From: Kumar Chandrakant Date: Wed, 10 Jul 2019 20:22:01 +0530 Subject: [PATCH 62/62] Adding source code for tutorial tracked by BAEL-2971 (#7250) * Adding source code for tutorial tracked by BAEL-2971 * Renaming Integration Test as par standard --- morphia/README.md | 3 + morphia/pom.xml | 43 ++++++ .../com/baeldung/morphia/domain/Author.java | 31 +++++ .../com/baeldung/morphia/domain/Book.java | 116 ++++++++++++++++ .../baeldung/morphia/domain/Publisher.java | 70 ++++++++++ morphia/src/main/resources/logback.xml | 13 ++ .../morphia/MorphiaIntegrationTest.java | 130 ++++++++++++++++++ pom.xml | 2 + 8 files changed, 408 insertions(+) create mode 100644 morphia/README.md create mode 100644 morphia/pom.xml create mode 100644 morphia/src/main/java/com/baeldung/morphia/domain/Author.java create mode 100644 morphia/src/main/java/com/baeldung/morphia/domain/Book.java create mode 100644 morphia/src/main/java/com/baeldung/morphia/domain/Publisher.java create mode 100644 morphia/src/main/resources/logback.xml create mode 100644 morphia/src/test/java/com/baeldung/morphia/MorphiaIntegrationTest.java diff --git a/morphia/README.md b/morphia/README.md new file mode 100644 index 0000000000..008cf76c49 --- /dev/null +++ b/morphia/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [Intro to Morphia](http://www.baeldung.com/intro-to-morphia) diff --git a/morphia/pom.xml b/morphia/pom.xml new file mode 100644 index 0000000000..e4010a26a1 --- /dev/null +++ b/morphia/pom.xml @@ -0,0 +1,43 @@ + + + 4.0.0 + com.baeldung.morphia + morphia + morphia + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + .. + + + + + dev.morphia.morphia + core + ${morphia.version} + + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot-maven-plugin.version} + + + + + + + 1.4.2.RELEASE + 1.5.3 + + + diff --git a/morphia/src/main/java/com/baeldung/morphia/domain/Author.java b/morphia/src/main/java/com/baeldung/morphia/domain/Author.java new file mode 100644 index 0000000000..b45aee6068 --- /dev/null +++ b/morphia/src/main/java/com/baeldung/morphia/domain/Author.java @@ -0,0 +1,31 @@ +package com.baeldung.morphia.domain; + +import java.util.List; + +import dev.morphia.annotations.Entity; +import dev.morphia.annotations.Id; + +@Entity +public class Author { + + @Id + private String name; + private List books; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public List getBooks() { + return books; + } + + public void setBooks(List books) { + this.books = books; + } + +} diff --git a/morphia/src/main/java/com/baeldung/morphia/domain/Book.java b/morphia/src/main/java/com/baeldung/morphia/domain/Book.java new file mode 100644 index 0000000000..172c916ad9 --- /dev/null +++ b/morphia/src/main/java/com/baeldung/morphia/domain/Book.java @@ -0,0 +1,116 @@ +package com.baeldung.morphia.domain; + +import java.util.HashSet; +import java.util.Set; + +import dev.morphia.annotations.Embedded; +import dev.morphia.annotations.Entity; +import dev.morphia.annotations.Field; +import dev.morphia.annotations.Id; +import dev.morphia.annotations.Index; +import dev.morphia.annotations.IndexOptions; +import dev.morphia.annotations.Indexes; +import dev.morphia.annotations.Property; +import dev.morphia.annotations.Reference; +import dev.morphia.annotations.Validation; + +@Entity("Books") +@Indexes({ @Index(fields = @Field("title"), options = @IndexOptions(name = "book_title")) }) +@Validation("{ price : { $gt : 0 } }") +public class Book { + @Id + private String isbn; + @Property + private String title; + private String author; + @Embedded + private Publisher publisher; + @Property("price") + private double cost; + @Reference + private Set companionBooks; + + public Book() { + + } + + public String getTitle() { + return title; + } + + public String getAuthor() { + return author; + } + + public double getCost() { + return cost; + } + + public void addCompanionBooks(Book book) { + if (companionBooks != null) + this.companionBooks.add(book); + } + + public Book(String isbn, String title, String author, double cost, Publisher publisher) { + this.isbn = isbn; + this.title = title; + this.author = author; + this.cost = cost; + this.publisher = publisher; + this.companionBooks = new HashSet<>(); + } + + @Override + public String toString() { + return "Book [isbn=" + isbn + ", title=" + title + ", author=" + author + ", publisher=" + publisher + ", cost=" + cost + "]"; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((author == null) ? 0 : author.hashCode()); + long temp; + temp = Double.doubleToLongBits(cost); + result = prime * result + (int) (temp ^ (temp >>> 32)); + result = prime * result + ((isbn == null) ? 0 : isbn.hashCode()); + result = prime * result + ((publisher == null) ? 0 : publisher.hashCode()); + result = prime * result + ((title == null) ? 0 : title.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Book other = (Book) obj; + if (author == null) { + if (other.author != null) + return false; + } else if (!author.equals(other.author)) + return false; + if (Double.doubleToLongBits(cost) != Double.doubleToLongBits(other.cost)) + return false; + if (isbn == null) { + if (other.isbn != null) + return false; + } else if (!isbn.equals(other.isbn)) + return false; + if (publisher == null) { + if (other.publisher != null) + return false; + } else if (!publisher.equals(other.publisher)) + return false; + if (title == null) { + if (other.title != null) + return false; + } else if (!title.equals(other.title)) + return false; + return true; + } + +} \ No newline at end of file diff --git a/morphia/src/main/java/com/baeldung/morphia/domain/Publisher.java b/morphia/src/main/java/com/baeldung/morphia/domain/Publisher.java new file mode 100644 index 0000000000..b9e054e9ab --- /dev/null +++ b/morphia/src/main/java/com/baeldung/morphia/domain/Publisher.java @@ -0,0 +1,70 @@ +package com.baeldung.morphia.domain; + +import org.bson.types.ObjectId; + +import dev.morphia.annotations.Entity; +import dev.morphia.annotations.Id; + +@Entity +public class Publisher { + + @Id + private ObjectId id; + private String name; + + public Publisher() { + + } + + public Publisher(ObjectId id, String name) { + this.id = id; + this.name = name; + } + + public ObjectId getId() { + return id; + } + + public void setId(ObjectId id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Override + public String toString() { + return "Catalog [id=" + id + ", name=" + name + "]"; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((name == null) ? 0 : name.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Publisher other = (Publisher) obj; + if (name == null) { + if (other.name != null) + return false; + } else if (!name.equals(other.name)) + return false; + return true; + } + +} diff --git a/morphia/src/main/resources/logback.xml b/morphia/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/morphia/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/morphia/src/test/java/com/baeldung/morphia/MorphiaIntegrationTest.java b/morphia/src/test/java/com/baeldung/morphia/MorphiaIntegrationTest.java new file mode 100644 index 0000000000..a2542a56ab --- /dev/null +++ b/morphia/src/test/java/com/baeldung/morphia/MorphiaIntegrationTest.java @@ -0,0 +1,130 @@ +package com.baeldung.morphia; + +import static dev.morphia.aggregation.Group.grouping; +import static dev.morphia.aggregation.Group.push; +import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.util.Iterator; +import java.util.List; + +import org.bson.types.ObjectId; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +import com.baeldung.morphia.domain.Author; +import com.baeldung.morphia.domain.Book; +import com.baeldung.morphia.domain.Publisher; +import com.mongodb.MongoClient; + +import dev.morphia.Datastore; +import dev.morphia.Morphia; +import dev.morphia.query.Query; +import dev.morphia.query.UpdateOperations; + +@Ignore +public class MorphiaIntegrationTest { + + private static Datastore datastore; + private static ObjectId id = new ObjectId(); + + @BeforeClass + public static void setUp() { + Morphia morphia = new Morphia(); + morphia.mapPackage("com.baeldung.morphia"); + datastore = morphia.createDatastore(new MongoClient(), "library"); + datastore.ensureIndexes(); + } + + @Test + public void givenDataSource_whenCreateEntity_thenEntityCreated() { + Publisher publisher = new Publisher(id, "Awsome Publisher"); + Book book = new Book("9781565927186", "Learning Java", "Tom Kirkman", 3.95, publisher); + Book companionBook = new Book("9789332575103", "Java Performance Companion", "Tom Kirkman", 1.95, publisher); + book.addCompanionBooks(companionBook); + datastore.save(companionBook); + datastore.save(book); + + List books = datastore.createQuery(Book.class) + .field("title") + .contains("Learning Java") + .find() + .toList(); + assertEquals(books.size(), 1); + assertEquals(books.get(0), book); + } + + @Test + public void givenDocument_whenUpdated_thenUpdateReflected() { + Publisher publisher = new Publisher(id, "Awsome Publisher"); + Book book = new Book("9781565927186", "Learning Java", "Tom Kirkman", 3.95, publisher); + datastore.save(book); + Query query = datastore.createQuery(Book.class) + .field("title") + .contains("Learning Java"); + UpdateOperations updates = datastore.createUpdateOperations(Book.class) + .inc("price", 1); + datastore.update(query, updates); + List books = datastore.createQuery(Book.class) + .field("title") + .contains("Learning Java") + .find() + .toList(); + assertEquals(books.get(0) + .getCost(), 4.95); + } + + @Test + public void givenDocument_whenDeleted_thenDeleteReflected() { + Publisher publisher = new Publisher(id, "Awsome Publisher"); + Book book = new Book("9781565927186", "Learning Java", "Tom Kirkman", 3.95, publisher); + datastore.save(book); + Query query = datastore.createQuery(Book.class) + .field("title") + .contains("Learning Java"); + datastore.delete(query); + List books = datastore.createQuery(Book.class) + .field("title") + .contains("Learning Java") + .find() + .toList(); + assertEquals(books.size(), 0); + } + + @Test + public void givenDocument_whenAggregated_thenResultsCollected() { + Publisher publisher = new Publisher(id, "Awsome Publisher"); + datastore.save(new Book("9781565927186", "Learning Java", "Tom Kirkman", 3.95, publisher)); + datastore.save(new Book("9781449313142", "Learning Perl", "Mark Pence", 2.95, publisher)); + datastore.save(new Book("9787564100476", "Learning Python", "Mark Pence", 5.95, publisher)); + datastore.save(new Book("9781449368814", "Learning Scala", "Mark Pence", 6.95, publisher)); + datastore.save(new Book("9781784392338", "Learning Go", "Jonathan Sawyer", 8.95, publisher)); + + Iterator authors = datastore.createAggregation(Book.class) + .group("author", grouping("books", push("title"))) + .out(Author.class); + + assertTrue(authors.hasNext()); + + } + + @Test + public void givenDocument_whenProjected_thenOnlyProjectionReceived() { + Publisher publisher = new Publisher(id, "Awsome Publisher"); + Book book = new Book("9781565927186", "Learning Java", "Tom Kirkman", 3.95, publisher); + datastore.save(book); + List books = datastore.createQuery(Book.class) + .field("title") + .contains("Learning Java") + .project("title", true) + .find() + .toList(); + assertEquals(books.size(), 1); + assertEquals("Learning Java", books.get(0) + .getTitle()); + assertEquals(null, books.get(0) + .getAuthor()); + } + +} diff --git a/pom.xml b/pom.xml index b4fed5150d..f24a307d9e 100644 --- a/pom.xml +++ b/pom.xml @@ -558,6 +558,7 @@ tensorflow-java spring-boot-flowable spring-security-kerberos + morphia @@ -791,6 +792,7 @@ tensorflow-java spring-boot-flowable spring-security-kerberos + morphia