diff --git a/core-java-collections/src/test/java/com/baeldung/collection/CollectionsEmpty.java b/core-java-collections/src/test/java/com/baeldung/collection/CollectionsEmpty.java new file mode 100644 index 0000000000..86a262107d --- /dev/null +++ b/core-java-collections/src/test/java/com/baeldung/collection/CollectionsEmpty.java @@ -0,0 +1,26 @@ +package com.baeldung.collection; + +import java.util.List; +import java.util.ArrayList; +import java.util.Collections; +import org.junit.Assert; +import org.junit.Test; + +public class CollectionsEmpty { + + @Test + public void givenArrayList_whenAddingElement_addsNewElement() { + ArrayList mutableList = new ArrayList<>(); + mutableList.add("test"); + + Assert.assertEquals(mutableList.size(), 1); + Assert.assertEquals(mutableList.get(0), "test"); + } + + @Test(expected = UnsupportedOperationException.class) + public void givenCollectionsEmptyList_whenAddingElement_throwsUnsupportedOperationException() { + List immutableList = Collections.emptyList(); + immutableList.add("test"); + } + +} \ No newline at end of file diff --git a/core-java-sun/pom.xml b/core-java-sun/pom.xml index f489f3b030..7292335232 100644 --- a/core-java-sun/pom.xml +++ b/core-java-sun/pom.xml @@ -303,7 +303,7 @@ 1.7.0 - 2.19.1 + 2.21.0 1.8.0 3.0.2 diff --git a/core-java/pom.xml b/core-java/pom.xml index b83cb478d4..3f44851f97 100644 --- a/core-java/pom.xml +++ b/core-java/pom.xml @@ -530,7 +530,7 @@ 3.10.0 - 2.19.1 + 2.21.0 4.3.4.RELEASE 1.5.8.RELEASE diff --git a/hazelcast/pom.xml b/hazelcast/pom.xml index cc366cd0a6..705792ad05 100644 --- a/hazelcast/pom.xml +++ b/hazelcast/pom.xml @@ -13,16 +13,12 @@ - - com.hazelcast - hazelcast - ${hazelcast.version} - - - com.hazelcast - hazelcast-client - ${hazelcast.version} - + + + com.hazelcast.jet + hazelcast-jet + ${hazelcast.jet.version} + @@ -36,8 +32,8 @@ - - 3.8.4 + + 0.6 \ No newline at end of file diff --git a/hazelcast/src/main/java/com/baeldung/hazelcast/jet/WordCounter.java b/hazelcast/src/main/java/com/baeldung/hazelcast/jet/WordCounter.java new file mode 100644 index 0000000000..971986bcae --- /dev/null +++ b/hazelcast/src/main/java/com/baeldung/hazelcast/jet/WordCounter.java @@ -0,0 +1,51 @@ +package com.baeldung.hazelcast.jet; + +import java.util.List; +import java.util.Map; + +import static com.hazelcast.jet.Traversers.traverseArray; +import static com.hazelcast.jet.aggregate.AggregateOperations.counting; +import static com.hazelcast.jet.function.DistributedFunctions.wholeItem; + +import com.hazelcast.jet.Jet; +import com.hazelcast.jet.JetInstance; +import com.hazelcast.jet.pipeline.Pipeline; +import com.hazelcast.jet.pipeline.Sinks; +import com.hazelcast.jet.pipeline.Sources; + +public class WordCounter { + + private static final String LIST_NAME = "textList"; + + private static final String MAP_NAME = "countMap"; + + private Pipeline createPipeLine() { + Pipeline p = Pipeline.create(); + p.drawFrom(Sources. list(LIST_NAME)) + .flatMap(word -> traverseArray(word.toLowerCase() + .split("\\W+"))) + .filter(word -> !word.isEmpty()) + .groupingKey(wholeItem()) + .aggregate(counting()) + .drainTo(Sinks.map(MAP_NAME)); + return p; + } + + public Long countWord(List sentences, String word) { + long count = 0; + JetInstance jet = Jet.newJetInstance(); + try { + List textList = jet.getList(LIST_NAME); + textList.addAll(sentences); + Pipeline p = createPipeLine(); + jet.newJob(p) + .join(); + Map counts = jet.getMap(MAP_NAME); + count = counts.get(word); + } finally { + Jet.shutdownAll(); + } + return count; + } + +} diff --git a/hazelcast/src/test/java/com/baeldung/hazelcast/jet/WordCounterUnitTest.java b/hazelcast/src/test/java/com/baeldung/hazelcast/jet/WordCounterUnitTest.java new file mode 100644 index 0000000000..95596b3860 --- /dev/null +++ b/hazelcast/src/test/java/com/baeldung/hazelcast/jet/WordCounterUnitTest.java @@ -0,0 +1,21 @@ +package com.baeldung.hazelcast.jet; + +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; + +public class WordCounterUnitTest { + + @Test + public void whenGivenSentencesAndWord_ThenReturnCountOfWord() { + List sentences = new ArrayList<>(); + sentences.add("The first second was alright, but the second second was tough."); + WordCounter wordCounter = new WordCounter(); + long countSecond = wordCounter.countWord(sentences, "second"); + assertTrue(countSecond == 3); + } + +} diff --git a/java-numbers/pom.xml b/java-numbers/pom.xml index a9fb556517..bf4d3e8792 100644 --- a/java-numbers/pom.xml +++ b/java-numbers/pom.xml @@ -156,7 +156,7 @@ 1.19 1.19 - 2.19.1 + 2.21.0 3.0.0-M1 3.0.2 diff --git a/jee-7/pom.xml b/jee-7/pom.xml index d0246f650a..fbf102185d 100644 --- a/jee-7/pom.xml +++ b/jee-7/pom.xml @@ -418,7 +418,7 @@ 1.0.0.Final 2.6 4.2.3.RELEASE - 2.17 + 2.21.0 1.1.2 2.4 2.2.14 diff --git a/mustache/pom.xml b/mustache/pom.xml index 6012c9a15a..d385246182 100644 --- a/mustache/pom.xml +++ b/mustache/pom.xml @@ -153,7 +153,7 @@ 3.7.0 - 2.19.1 + 2.21.0 0.8 3.3.7 1.8 diff --git a/parent-boot-2/pom.xml b/parent-boot-2/pom.xml index ab6162a5a5..2fc46e4c28 100644 --- a/parent-boot-2/pom.xml +++ b/parent-boot-2/pom.xml @@ -8,18 +8,27 @@ Parent for all Spring Boot 2 modules - org.springframework.boot - spring-boot-starter-parent - 2.0.1.RELEASE - + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + + + + org.springframework.boot + spring-boot-dependencies + 2.0.1.RELEASE + pom + import + + + io.rest-assured rest-assured - ${rest-assured.version} - + org.springframework.boot spring-boot-starter-test @@ -27,79 +36,16 @@ - - - - org.springframework.boot - spring-boot-maven-plugin - - - org.apache.maven.plugins - maven-surefire-plugin - ${maven-surefire-plugin.version} - - 3 - true - - **/*IntegrationTest.java - **/*IntTest.java - **/*LongRunningUnitTest.java - **/*ManualTest.java - **/*LiveTest.java - - - - - org.apache.maven.plugins - maven-compiler-plugin - ${maven-compiler-plugin.version} - - ${maven.compiler.source} - ${maven.compiler.target} - - - - - + + + + org.springframework.boot + spring-boot-maven-plugin + 2.0.1.RELEASE + + + - - integration - - - - org.apache.maven.plugins - maven-surefire-plugin - - - integration-test - - test - - - - **/*ManualTest.java - **/*LiveTest.java - **/AutoconfigurationTest.java - **/*UnitTest.java - - - **/*IntegrationTest.java - **/*IntTest.java - */EthControllerTestOne.java - **/*EntryPointsTest.java - - - - - - - json - - - - - - thin-jar @@ -122,13 +68,8 @@ - UTF-8 - UTF-8 - 1.8 3.1.0 - 1.8 - 1.8 1.0.11.RELEASE diff --git a/persistence-modules/spring-data-dynamodb/pom.xml b/persistence-modules/spring-data-dynamodb/pom.xml index 9f2b63c17c..e5bd78d208 100644 --- a/persistence-modules/spring-data-dynamodb/pom.xml +++ b/persistence-modules/spring-data-dynamodb/pom.xml @@ -177,46 +177,12 @@ - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - dynamodb-local DynamoDB Local Release Repository ${dynamodblocal.repository.url} - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - diff --git a/pom.xml b/pom.xml index a9aaff3e22..978e27f055 100644 --- a/pom.xml +++ b/pom.xml @@ -43,9 +43,15 @@ org.junit.jupiter junit-jupiter-engine - ${junit.jupiter.version} + ${junit-jupiter.version} test + + org.junit.jupiter + junit-jupiter-api + ${junit-jupiter.version} + test + org.hamcrest hamcrest-core @@ -70,6 +76,14 @@ ${mockito.version} test + + org.apache.maven.surefire + surefire-logger-api + ${maven-surefire-plugin.version} + + test + true + @@ -98,6 +112,23 @@ **/*LiveTest.java + + + org.junit.platform + junit-platform-surefire-provider + ${junit-platform.version} + + + org.junit.jupiter + junit-jupiter-engine + ${junit-jupiter.version} + + + org.junit.vintage + junit-vintage-engine + ${junit-jupiter.version} + + org.apache.maven.plugins @@ -187,6 +218,10 @@ + + maven-war-plugin + ${maven-war-plugin.version} + @@ -406,6 +441,7 @@ spring-4 spring-5 spring-5-reactive + spring-5-reactive-client spring-5-mvc spring-5-security spring-activiti @@ -663,6 +699,7 @@ spring-4 spring-5 spring-5-reactive + spring-5-reactive-client spring-5-mvc spring-5-security spring-activiti @@ -942,6 +979,7 @@ spark-java spring-4 spring-5-reactive + spring-5-reactive-client spring-5-mvc spring-5-security spring-activiti @@ -1220,7 +1258,7 @@ 2.19.1 2.5 1.4 - 2.6 + 3.0.0 3.1.0 1.2 2.3.1 @@ -1228,7 +1266,8 @@ 1.2 2.5.0 1.3 - 5.0.2 + 1.2.0 + 5.2.0 0.3.1 2.5.1 0.0.1 diff --git a/spring-5-mvc/pom.xml b/spring-5-mvc/pom.xml index 0408550c79..f5346a0fa0 100644 --- a/spring-5-mvc/pom.xml +++ b/spring-5-mvc/pom.xml @@ -82,11 +82,6 @@ spring-boot-starter-test test - - junit - junit - test - com.jayway.restassured rest-assured @@ -137,46 +132,11 @@ - - org.apache.maven.plugins - maven-surefire-plugin - - - false - - **/*IntegrationTest.java - **/*IntTest.java - **/*LiveTest.java - - - - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - + 2.9.0 1.1.2 - diff --git a/spring-5-reactive-client/pom.xml b/spring-5-reactive-client/pom.xml index 9388ee83c1..f2f7dd1729 100644 --- a/spring-5-reactive-client/pom.xml +++ b/spring-5-reactive-client/pom.xml @@ -11,8 +11,8 @@ spring 5 sample project about new features - parent-boot-2 com.baeldung + parent-boot-2 0.0.1-SNAPSHOT ../parent-boot-2 @@ -43,20 +43,6 @@ javax.json.bind javax.json.bind-api - - - - - - - - - - - - - - org.apache.geronimo.specs geronimo-json_1.1_spec @@ -102,28 +88,6 @@ test - - org.junit.jupiter - junit-jupiter-api - - - org.junit.jupiter - junit-jupiter-engine - test - - - org.junit.platform - junit-platform-surefire-provider - ${junit.platform.version} - test - - - org.junit.platform - junit-platform-runner - ${junit.platform.version} - test - - org.projectlombok lombok @@ -145,54 +109,10 @@ JAR - - - org.apache.maven.plugins - maven-surefire-plugin - - 3 - true - methods - true - - **/*IntegrationTest.java - **/*IntTest.java - **/*LiveTest.java - - - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - - UTF-8 - UTF-8 - 1.8 - 1.0.0 - 5.0.0 - 2.20 - 5.0.2.RELEASE 1.0.1.RELEASE 1.1.3 1.0 diff --git a/spring-5-reactive/pom.xml b/spring-5-reactive/pom.xml index acc82be0d1..f89fd45581 100644 --- a/spring-5-reactive/pom.xml +++ b/spring-5-reactive/pom.xml @@ -43,20 +43,6 @@ org.springframework.boot spring-boot-starter-actuator - - - - - - - - - - - - - - org.projectlombok lombok @@ -100,28 +86,6 @@ ${commons-collections4.version} test - - - org.junit.jupiter - junit-jupiter-api - - - org.junit.jupiter - junit-jupiter-engine - test - - - org.junit.platform - junit-platform-surefire-provider - ${junit.platform.version} - test - - - org.junit.platform - junit-platform-runner - ${junit.platform.version} - test - org.apache.commons commons-lang3 @@ -159,29 +123,10 @@ JAR - - - org.apache.maven.plugins - maven-surefire-plugin - - 3 - true - methods - true - - **/*IntegrationTest.java - **/*IntTest.java - **/*LiveTest.java - - - - 1.0.0 - 5.0.2 - 2.20 1.0.1.RELEASE 2.1.12 1.1.3 diff --git a/spring-5-security/pom.xml b/spring-5-security/pom.xml index 7024e6f873..1435019c24 100644 --- a/spring-5-security/pom.xml +++ b/spring-5-security/pom.xml @@ -76,44 +76,7 @@ JAR - - - org.apache.maven.plugins - maven-surefire-plugin - - 3 - true - methods - true - - **/*IntegrationTest.java - **/*IntTest.java - **/*LiveTest.java - - - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - \ No newline at end of file diff --git a/spring-5-security/src/test/java/com/baeldung/inmemory/InMemoryAuthControllerTest.java b/spring-5-security/src/test/java/com/baeldung/inmemory/InMemoryAuthControllerIntegrationTest.java similarity index 97% rename from spring-5-security/src/test/java/com/baeldung/inmemory/InMemoryAuthControllerTest.java rename to spring-5-security/src/test/java/com/baeldung/inmemory/InMemoryAuthControllerIntegrationTest.java index 7a8ea7b248..9d08cb7cfa 100644 --- a/spring-5-security/src/test/java/com/baeldung/inmemory/InMemoryAuthControllerTest.java +++ b/spring-5-security/src/test/java/com/baeldung/inmemory/InMemoryAuthControllerIntegrationTest.java @@ -14,7 +14,7 @@ import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest(classes = InMemoryAuthApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT) -public class InMemoryAuthControllerTest { +public class InMemoryAuthControllerIntegrationTest { @Autowired private TestRestTemplate template; diff --git a/spring-5/pom.xml b/spring-5/pom.xml index e37833ff94..9f60b8a364 100644 --- a/spring-5/pom.xml +++ b/spring-5/pom.xml @@ -41,18 +41,6 @@ javax.json.bind javax.json.bind-api - - - - - - - - - - - - org.apache.geronimo.specs geronimo-json_1.1_spec @@ -85,45 +73,21 @@ org.springframework spring-test - - org.springframework.boot - spring-boot-starter-test - test - org.springframework.security spring-security-test test - org.apache.commons commons-collections4 ${commons-collections4.version} test - org.junit.jupiter junit-jupiter-api - - org.junit.jupiter - junit-jupiter-engine - test - - - org.junit.platform - junit-platform-surefire-provider - ${junit.platform.version} - test - - - org.junit.platform - junit-platform-runner - ${junit.platform.version} - test - org.springframework.restdocs @@ -147,22 +111,6 @@ JAR - - - org.apache.maven.plugins - maven-surefire-plugin - - 3 - true - methods - true - - **/*IntegrationTest.java - **/*IntTest.java - **/*LiveTest.java - - - org.asciidoctor asciidoctor-maven-plugin @@ -190,9 +138,6 @@ - 1.0.0 - 5.0.2.RELEASE - 1.0.1.RELEASE 1.0 1.5.6 4.1 diff --git a/spring-boot-mvc/src/test/java/com/baeldung/springbootmvc/SpringBootMvcApplicationTests.java b/spring-boot-mvc/src/test/java/com/baeldung/springbootmvc/SpringBootMvcApplicationTests.java deleted file mode 100644 index 1add635ed8..0000000000 --- a/spring-boot-mvc/src/test/java/com/baeldung/springbootmvc/SpringBootMvcApplicationTests.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.baeldung.springbootmvc; - -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 SpringBootMvcApplicationTests { - - @Test - public void contextLoads() { - } - -} diff --git a/spring-boot-vue/src/test/java/com/baeldung/springbootmvc/SpringBootMvcApplicationTests.java b/spring-boot-vue/src/test/java/com/baeldung/springbootmvc/SpringBootMvcApplicationUnitTest.java similarity index 96% rename from spring-boot-vue/src/test/java/com/baeldung/springbootmvc/SpringBootMvcApplicationTests.java rename to spring-boot-vue/src/test/java/com/baeldung/springbootmvc/SpringBootMvcApplicationUnitTest.java index 6364351eb3..567b239ed2 100644 --- a/spring-boot-vue/src/test/java/com/baeldung/springbootmvc/SpringBootMvcApplicationTests.java +++ b/spring-boot-vue/src/test/java/com/baeldung/springbootmvc/SpringBootMvcApplicationUnitTest.java @@ -16,7 +16,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @RunWith(SpringRunner.class) @SpringBootTest @AutoConfigureMockMvc -public class SpringBootMvcApplicationTests { +public class SpringBootMvcApplicationUnitTest { @Autowired private MockMvc mockMvc; diff --git a/spring-boot/pom.xml b/spring-boot/pom.xml index ef30600d45..3a43dbd828 100644 --- a/spring-boot/pom.xml +++ b/spring-boot/pom.xml @@ -149,6 +149,12 @@ rome ${rome.version} + + + de.codecentric + chaos-monkey-spring-boot + ${chaos.monkey.version} + @@ -219,9 +225,11 @@ 8.5.11 2.4.1.Final 1.9.0 + 2.0.0 3.6.0 3.2.0 18.0 + 1.2.0 \ No newline at end of file diff --git a/spring-boot/src/main/java/com/baeldung/chaosmonkey/SpringBootChaosMonkeyApp.java b/spring-boot/src/main/java/com/baeldung/chaosmonkey/SpringBootChaosMonkeyApp.java new file mode 100644 index 0000000000..16a0aea13b --- /dev/null +++ b/spring-boot/src/main/java/com/baeldung/chaosmonkey/SpringBootChaosMonkeyApp.java @@ -0,0 +1,15 @@ +package com.baeldung.chaosmonkey; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + * Created by adi on 8/2/18. + */ +@SpringBootApplication(scanBasePackages = { "com.baeldung.chaosmonkey" }) +public class SpringBootChaosMonkeyApp { + + public static void main(String[] args) { + SpringApplication.run(SpringBootChaosMonkeyApp.class, args); + } +} diff --git a/spring-boot/src/main/java/com/baeldung/chaosmonkey/controller/PermissionsController.java b/spring-boot/src/main/java/com/baeldung/chaosmonkey/controller/PermissionsController.java new file mode 100644 index 0000000000..6ceb117f4e --- /dev/null +++ b/spring-boot/src/main/java/com/baeldung/chaosmonkey/controller/PermissionsController.java @@ -0,0 +1,25 @@ +package com.baeldung.chaosmonkey.controller; + +import com.baeldung.chaosmonkey.service.PermissionsService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * Created by adi on 8/2/18. + */ +@RestController +@RequestMapping("/permissions") +public class PermissionsController { + + @Autowired private PermissionsService permissionsService; + + @GetMapping + public List getAllPermissions() { + return permissionsService.getAllPermissions(); + } + +} diff --git a/spring-boot/src/main/java/com/baeldung/chaosmonkey/service/PermissionsService.java b/spring-boot/src/main/java/com/baeldung/chaosmonkey/service/PermissionsService.java new file mode 100644 index 0000000000..435e262901 --- /dev/null +++ b/spring-boot/src/main/java/com/baeldung/chaosmonkey/service/PermissionsService.java @@ -0,0 +1,17 @@ +package com.baeldung.chaosmonkey.service; + +import org.springframework.stereotype.Service; + +import java.util.Arrays; +import java.util.List; + +/** + * Created by adi on 8/2/18. + */ +@Service +public class PermissionsService { + + public List getAllPermissions() { + return Arrays.asList("CREATE", "READ", "UPDATE", "DELETE"); + } +} diff --git a/spring-boot/src/main/resources/application.properties b/spring-boot/src/main/resources/application.properties index 8c02e528ab..629e880940 100644 --- a/spring-boot/src/main/resources/application.properties +++ b/spring-boot/src/main/resources/application.properties @@ -43,3 +43,34 @@ servlet.mapping=/dispatcherExampleURL #spring.banner.image.invert= //TODO contactInfoType=email + +#chaos monkey for spring boot props +management.endpoint.chaosmonkey.enabled=true +management.endpoint.chaosmonkeyjmx.enabled=true + +spring.profiles.active=chaos-monkey +#Determine whether should execute or not +chaos.monkey.enabled=true +#How many requests are to be attacked. 1: attack each request; 5: each 5th request is attacked +chaos.monkey.assaults.level=1 +#Minimum latency in ms added to the request +chaos.monkey.assaults.latencyRangeStart=3000 +#Maximum latency in ms added to the request +chaos.monkey.assaults.latencyRangeEnd=15000 +#Latency assault active +chaos.monkey.assaults.latencyActive=true +#Exception assault active +chaos.monkey.assaults.exceptionsActive=false +#AppKiller assault active +chaos.monkey.assaults.killApplicationActive=false +#Controller watcher active +chaos.monkey.watcher.controller=false +#RestController watcher active +chaos.monkey.watcher.restController=false +#Service watcher active +chaos.monkey.watcher.service=true +#Repository watcher active +chaos.monkey.watcher.repository=false +#Component watcher active +chaos.monkey.watcher.component=false + diff --git a/spring-cloud/spring-cloud-connectors-heroku/pom.xml b/spring-cloud/spring-cloud-connectors-heroku/pom.xml index 875aa5ceaa..f25c190d56 100644 --- a/spring-cloud/spring-cloud-connectors-heroku/pom.xml +++ b/spring-cloud/spring-cloud-connectors-heroku/pom.xml @@ -79,7 +79,7 @@ Brixton.SR7 - 2.19.1 + 2.21.0 9.4-1201-jdbc4 diff --git a/spring-cloud/spring-cloud-gateway/pom.xml b/spring-cloud/spring-cloud-gateway/pom.xml index db57373b6f..8babbff274 100644 --- a/spring-cloud/spring-cloud-gateway/pom.xml +++ b/spring-cloud/spring-cloud-gateway/pom.xml @@ -28,7 +28,7 @@ org.springframework.cloud - spring-cloud-starter-gateway + spring-cloud-starter org.springframework.boot @@ -54,27 +54,8 @@ - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - - 2.0.0.RC2 + 2.0.1.RELEASE 6.0.2.Final diff --git a/spring-cloud/spring-cloud-ribbon-client/pom.xml b/spring-cloud/spring-cloud-ribbon-client/pom.xml index eb8398848c..fd69dbe043 100644 --- a/spring-cloud/spring-cloud-ribbon-client/pom.xml +++ b/spring-cloud/spring-cloud-ribbon-client/pom.xml @@ -38,25 +38,6 @@ - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - Brixton.SR7 diff --git a/spring-reactive-kotlin/pom.xml b/spring-reactive-kotlin/pom.xml index 8eafe9f217..f2f0dc58ec 100644 --- a/spring-reactive-kotlin/pom.xml +++ b/spring-reactive-kotlin/pom.xml @@ -19,9 +19,6 @@ - UTF-8 - UTF-8 - 1.8 1.2.41 diff --git a/spring-rest-embedded-tomcat/pom.xml b/spring-rest-embedded-tomcat/pom.xml index edccbb17d5..1a1adce6db 100644 --- a/spring-rest-embedded-tomcat/pom.xml +++ b/spring-rest-embedded-tomcat/pom.xml @@ -85,7 +85,6 @@ - 2.19.1 2.9.2 1.8 1.8 diff --git a/spring-security-openid/pom.xml b/spring-security-openid/pom.xml index 9c498f3700..a2c0b6b119 100644 --- a/spring-security-openid/pom.xml +++ b/spring-security-openid/pom.xml @@ -51,27 +51,6 @@ - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - 2.2.1.RELEASE 1.0.9.RELEASE diff --git a/spring-thymeleaf/pom.xml b/spring-thymeleaf/pom.xml index c023dcdb5f..0926728aba 100644 --- a/spring-thymeleaf/pom.xml +++ b/spring-thymeleaf/pom.xml @@ -1,5 +1,5 @@ + 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-thymeleaf @@ -8,8 +8,9 @@ com.baeldung - parent-modules - 1.0.0-SNAPSHOT + parent-spring-5 + 0.0.1-SNAPSHOT + ../parent-spring-5 @@ -17,7 +18,7 @@ org.springframework spring-context - ${org.springframework-version} + ${spring.version} @@ -29,19 +30,38 @@ org.springframework spring-webmvc - ${org.springframework-version} + ${spring.version} + + + org.springframework.data + spring-data-commons + ${spring-data.version} + + + + javax.validation + validation-api + ${javax.validation-version} + + + org.hibernate.validator + hibernate-validator + ${hibernate-validator.version} + + org.springframework.security spring-security-web - ${springframework-security.version} + ${spring-security.version} org.springframework.security spring-security-config - ${springframework-security.version} + ${spring-security.version} + org.thymeleaf @@ -50,10 +70,9 @@ org.thymeleaf - thymeleaf-spring4 + thymeleaf-spring5 ${org.thymeleaf-version} - nz.net.ultraq.thymeleaf thymeleaf-layout-dialect @@ -64,60 +83,29 @@ thymeleaf-extras-java8time ${org.thymeleaf.extras-version} + javax.servlet javax.servlet-api - ${javax.servlet-version} + ${javax.servlet-api.version} provided - - - javax.validation - validation-api - ${javax.validation-version} - - - org.hibernate - hibernate-validator - ${hibernate-validator.version} - - + org.springframework spring-test - ${org.springframework-version} + ${spring.version} test - org.springframework.security spring-security-test - ${springframework-security.version} + ${spring-security.version} test - - - - - - org.springframework.data - spring-data-commons - ${springFramework-data.version} - @@ -131,7 +119,7 @@ false - + org.codehaus.cargo cargo-maven2-plugin @@ -151,7 +139,7 @@ - + org.apache.tomcat.maven tomcat7-maven-plugin @@ -176,22 +164,14 @@ - - 4.3.4.RELEASE - 4.2.0.RELEASE - 2.0.7.RELEASE - 3.1.0 - + 2.0.9.RELEASE 3.0.9.RELEASE - 3.0.0.RELEASE - 2.1.2 - - 1.1.0.Final - 5.3.3.Final - 5.2.5.Final + 3.0.1.RELEASE + 2.3.0 + 2.0.1.Final + 6.0.11.Final - 2.6 1.6.1 2.2 diff --git a/spring-thymeleaf/src/main/java/com/baeldung/thymeleaf/config/WebMVCConfig.java b/spring-thymeleaf/src/main/java/com/baeldung/thymeleaf/config/WebMVCConfig.java index 2e76877199..34a59ea391 100644 --- a/spring-thymeleaf/src/main/java/com/baeldung/thymeleaf/config/WebMVCConfig.java +++ b/spring-thymeleaf/src/main/java/com/baeldung/thymeleaf/config/WebMVCConfig.java @@ -2,6 +2,9 @@ package com.baeldung.thymeleaf.config; import java.util.Locale; +import nz.net.ultraq.thymeleaf.LayoutDialect; +import nz.net.ultraq.thymeleaf.decorators.strategies.GroupingStrategy; + import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.context.annotation.Bean; @@ -15,23 +18,20 @@ import org.springframework.web.servlet.ViewResolver; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.i18n.LocaleChangeInterceptor; import org.springframework.web.servlet.i18n.SessionLocaleResolver; -import org.thymeleaf.TemplateEngine; import org.thymeleaf.extras.java8time.dialect.Java8TimeDialect; -import org.thymeleaf.spring4.SpringTemplateEngine; -import org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver; -import org.thymeleaf.spring4.view.ThymeleafViewResolver; +import org.thymeleaf.spring5.ISpringTemplateEngine; +import org.thymeleaf.spring5.SpringTemplateEngine; +import org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver; +import org.thymeleaf.spring5.view.ThymeleafViewResolver; import org.thymeleaf.templatemode.TemplateMode; import org.thymeleaf.templateresolver.ITemplateResolver; import com.baeldung.thymeleaf.formatter.NameFormatter; import com.baeldung.thymeleaf.utils.ArrayUtil; -import nz.net.ultraq.thymeleaf.LayoutDialect; -import nz.net.ultraq.thymeleaf.decorators.strategies.GroupingStrategy; - @Configuration @EnableWebMvc @ComponentScan({ "com.baeldung.thymeleaf" }) @@ -39,10 +39,11 @@ import nz.net.ultraq.thymeleaf.decorators.strategies.GroupingStrategy; * Java configuration file that is used for Spring MVC and Thymeleaf * configurations */ -public class WebMVCConfig extends WebMvcConfigurerAdapter implements ApplicationContextAware { +public class WebMVCConfig implements WebMvcConfigurer, ApplicationContextAware { private ApplicationContext applicationContext; + @Override public void setApplicationContext(ApplicationContext applicationContext) { this.applicationContext = applicationContext; } @@ -77,7 +78,7 @@ public class WebMVCConfig extends WebMvcConfigurerAdapter implements Application return resolver; } - private TemplateEngine templateEngine(ITemplateResolver templateResolver) { + private ISpringTemplateEngine templateEngine(ITemplateResolver templateResolver) { SpringTemplateEngine engine = new SpringTemplateEngine(); engine.addDialect(new LayoutDialect(new GroupingStrategy())); engine.addDialect(new Java8TimeDialect()); diff --git a/spring-thymeleaf/src/main/java/com/baeldung/thymeleaf/config/WebMVCSecurity.java b/spring-thymeleaf/src/main/java/com/baeldung/thymeleaf/config/WebMVCSecurity.java index 46bff38a3f..ea51ca3cd9 100644 --- a/spring-thymeleaf/src/main/java/com/baeldung/thymeleaf/config/WebMVCSecurity.java +++ b/spring-thymeleaf/src/main/java/com/baeldung/thymeleaf/config/WebMVCSecurity.java @@ -27,7 +27,7 @@ public class WebMVCSecurity extends WebSecurityConfigurerAdapter { @Override protected void configure(final AuthenticationManagerBuilder auth) throws Exception { - auth.inMemoryAuthentication().withUser("user1").password("user1Pass").authorities("ROLE_USER"); + auth.inMemoryAuthentication().withUser("user1").password("{noop}user1Pass").authorities("ROLE_USER"); } @Override diff --git a/spring-thymeleaf/src/test/java/com/baeldung/thymeleaf/controller/FragmentsIntegrationTest.java b/spring-thymeleaf/src/test/java/com/baeldung/thymeleaf/controller/FragmentsIntegrationTest.java index 5bc45d0004..c6158b76b1 100644 --- a/spring-thymeleaf/src/test/java/com/baeldung/thymeleaf/controller/FragmentsIntegrationTest.java +++ b/spring-thymeleaf/src/test/java/com/baeldung/thymeleaf/controller/FragmentsIntegrationTest.java @@ -1,10 +1,22 @@ package com.baeldung.thymeleaf.controller; +import static org.hamcrest.Matchers.containsString; +import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.user; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +import javax.servlet.Filter; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.mock.web.MockHttpSession; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.request.RequestPostProcessor; import org.springframework.test.web.servlet.setup.MockMvcBuilders; @@ -15,21 +27,6 @@ import com.baeldung.thymeleaf.config.WebApp; import com.baeldung.thymeleaf.config.WebMVCConfig; import com.baeldung.thymeleaf.config.WebMVCSecurity; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.context.web.WebAppConfiguration; - -import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.user; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; -import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -import javax.servlet.Filter; - -import static org.hamcrest.Matchers.containsString; - @RunWith(SpringJUnit4ClassRunner.class) @WebAppConfiguration @ContextConfiguration(classes = { WebApp.class, WebMVCConfig.class, WebMVCSecurity.class, InitSecurity.class }) diff --git a/testing-modules/junit-5/pom.xml b/testing-modules/junit-5/pom.xml index c60cc00c2c..93365264ac 100644 --- a/testing-modules/junit-5/pom.xml +++ b/testing-modules/junit-5/pom.xml @@ -118,14 +118,14 @@ - 5.1.0 - 1.1.0 + 5.2.0 + 1.2.0 5.2.0 2.8.2 1.4.196 2.8.9 1.7.4 - 2.19.1 + 2.21.0 1.6.0 5.0.1.RELEASE diff --git a/testing-modules/junit5-migration/pom.xml b/testing-modules/junit5-migration/pom.xml index ae46b479bb..9d9d418774 100644 --- a/testing-modules/junit5-migration/pom.xml +++ b/testing-modules/junit5-migration/pom.xml @@ -80,10 +80,10 @@ - 5.1.0 - 1.1.0 + 5.2.0 + 1.2.0 5.2.0 - 2.19.1 + 2.21.0 1.6.0 diff --git a/testing-modules/test-containers/pom.xml b/testing-modules/test-containers/pom.xml index 2a8f434040..0ace187555 100644 --- a/testing-modules/test-containers/pom.xml +++ b/testing-modules/test-containers/pom.xml @@ -109,7 +109,7 @@ 1.7.2 42.2.2 3.12.0 - 2.19.1 + 2.21.0