@@ -42,15 +42,16 @@
org.thymeleaf.extras
- thymeleaf-extras-springsecurity4
+ thymeleaf-extras-springsecurity5
org.springframework.social
spring-social-facebook
+ ${spring.social.facebook.version}
-
+
org.springframework.boot
spring-boot-starter-data-jpa
@@ -60,6 +61,12 @@
com.h2database
h2
+
+
+ net.bytebuddy
+ byte-buddy-dep
+ ${bytebuddy.version}
+
@@ -93,5 +100,10 @@
+
+
+ 1.10.9
+ 2.0.3.RELEASE
+
\ No newline at end of file
diff --git a/spring-social-login/src/main/java/com/baeldung/config/Application.java b/spring-social-login/src/main/java/com/baeldung/config/Application.java
index 5d083d2d47..c65df6dbfe 100644
--- a/spring-social-login/src/main/java/com/baeldung/config/Application.java
+++ b/spring-social-login/src/main/java/com/baeldung/config/Application.java
@@ -3,7 +3,7 @@ package com.baeldung.config;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
-import org.springframework.boot.web.support.SpringBootServletInitializer;
+import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
@SpringBootApplication
diff --git a/spring-social-login/src/main/java/com/baeldung/config/SecurityConfig.java b/spring-social-login/src/main/java/com/baeldung/config/SecurityConfig.java
index 3d3081fef9..152c7b229a 100644
--- a/spring-social-login/src/main/java/com/baeldung/config/SecurityConfig.java
+++ b/spring-social-login/src/main/java/com/baeldung/config/SecurityConfig.java
@@ -1,8 +1,7 @@
package com.baeldung.config;
-import com.baeldung.security.FacebookSignInAdapter;
-import com.baeldung.security.FacebookConnectionSignup;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@@ -14,22 +13,27 @@ import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.social.connect.ConnectionFactoryLocator;
import org.springframework.social.connect.UsersConnectionRepository;
import org.springframework.social.connect.mem.InMemoryUsersConnectionRepository;
+import org.springframework.social.connect.support.ConnectionFactoryRegistry;
import org.springframework.social.connect.web.ProviderSignInController;
+import org.springframework.social.facebook.connect.FacebookConnectionFactory;
+
+import com.baeldung.security.FacebookConnectionSignup;
+import com.baeldung.security.FacebookSignInAdapter;
@Configuration
@EnableWebSecurity
@ComponentScan(basePackages = { "com.baeldung.security" })
public class SecurityConfig extends WebSecurityConfigurerAdapter {
+
+ @Value("${spring.social.facebook.appSecret}")
+ String appSecret;
+
+ @Value("${spring.social.facebook.appId}")
+ String appId;
@Autowired
private UserDetailsService userDetailsService;
- @Autowired
- private ConnectionFactoryLocator connectionFactoryLocator;
-
- @Autowired
- private UsersConnectionRepository usersConnectionRepository;
-
@Autowired
private FacebookConnectionSignup facebookConnectionSignup;
@@ -55,7 +59,19 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Bean
// @Primary
public ProviderSignInController providerSignInController() {
+ ConnectionFactoryLocator connectionFactoryLocator = connectionFactoryLocator();
+ UsersConnectionRepository usersConnectionRepository = getUsersConnectionRepository(connectionFactoryLocator);
((InMemoryUsersConnectionRepository) usersConnectionRepository).setConnectionSignUp(facebookConnectionSignup);
return new ProviderSignInController(connectionFactoryLocator, usersConnectionRepository, new FacebookSignInAdapter());
}
+
+ private ConnectionFactoryLocator connectionFactoryLocator() {
+ ConnectionFactoryRegistry registry = new ConnectionFactoryRegistry();
+ registry.addConnectionFactory(new FacebookConnectionFactory(appId, appSecret));
+ return registry;
+ }
+
+ private UsersConnectionRepository getUsersConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator) {
+ return new InMemoryUsersConnectionRepository(connectionFactoryLocator);
+ }
}
\ No newline at end of file
diff --git a/spring-swagger-codegen/spring-swagger-codegen-app/README.md b/spring-swagger-codegen/spring-swagger-codegen-app/README.md
index 1cb9e35d99..8740b17ba3 100644
--- a/spring-swagger-codegen/spring-swagger-codegen-app/README.md
+++ b/spring-swagger-codegen/spring-swagger-codegen-app/README.md
@@ -1,3 +1,3 @@
## Spring Swagger Codegen App
-This module contains the code for [Generate Spring Boot REST Client with Swagger](http://www.baeldung.com/spring-boot-rest-client-swagger-codegen).
+This module contains the code for Generate Spring Boot REST Client with Swagger.
diff --git a/spring-thymeleaf-2/README.md b/spring-thymeleaf-2/README.md
index d5c5ead43d..a8c067a443 100644
--- a/spring-thymeleaf-2/README.md
+++ b/spring-thymeleaf-2/README.md
@@ -13,4 +13,5 @@ This module contains articles about Spring with Thymeleaf
- [Working with Boolean in Thymeleaf](https://www.baeldung.com/thymeleaf-boolean)
- [Working With Custom HTML Attributes in Thymeleaf](https://www.baeldung.com/thymeleaf-custom-html-attributes)
- [How to Create an Executable JAR with Maven](https://www.baeldung.com/executable-jar-with-maven)
+- [Spring MVC Data and Thymeleaf](https://www.baeldung.com/spring-mvc-thymeleaf-data)
- [[<-- prev]](/spring-thymeleaf)
diff --git a/spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/currencies/CurrenciesController.java b/spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/currencies/CurrenciesController.java
new file mode 100644
index 0000000000..206cf32683
--- /dev/null
+++ b/spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/currencies/CurrenciesController.java
@@ -0,0 +1,22 @@
+package com.baeldung.thymeleaf.currencies;
+
+import java.util.List;
+import java.util.Locale;
+import java.util.Set;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+@Controller
+public class CurrenciesController {
+
+ @GetMapping(value = "/currency")
+ public String exchange(
+ @RequestParam(value = "amount", required = false) String amount,
+ @RequestParam(value = "amountList", required = false) List amountList,
+ Locale locale) {
+
+ return "currencies/currencies";
+ }
+}
diff --git a/spring-thymeleaf-3/src/main/resources/templates/currencies/currencies.html b/spring-thymeleaf-3/src/main/resources/templates/currencies/currencies.html
new file mode 100644
index 0000000000..c2f44265dd
--- /dev/null
+++ b/spring-thymeleaf-3/src/main/resources/templates/currencies/currencies.html
@@ -0,0 +1,21 @@
+
+
+
+
+ Currency table
+
+
+ Currency format by Locale
+
+
+ Currency Arrays format by Locale
+
+
+ Remove decimal values
+
+
+ Replace decimal points
+
+
+
\ No newline at end of file
diff --git a/spring-thymeleaf-3/src/test/java/com/baeldung/thymeleaf/currencies/CurrenciesControllerIntegrationTest.java b/spring-thymeleaf-3/src/test/java/com/baeldung/thymeleaf/currencies/CurrenciesControllerIntegrationTest.java
new file mode 100644
index 0000000000..02bf8a9ee0
--- /dev/null
+++ b/spring-thymeleaf-3/src/test/java/com/baeldung/thymeleaf/currencies/CurrenciesControllerIntegrationTest.java
@@ -0,0 +1,68 @@
+package com.baeldung.thymeleaf.currencies;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest
+@AutoConfigureMockMvc(printOnlyOnFailure = false)
+public class CurrenciesControllerIntegrationTest {
+
+ @Autowired
+ private MockMvc mockMvc;
+
+ @Test
+ public void whenCallCurrencyWithSpanishLocale_ThenReturnProperCurrency() throws Exception {
+ mockMvc.perform(MockMvcRequestBuilders.get("/currency")
+ .header("Accept-Language", "es-ES")
+ .param("amount", "10032.5"))
+ .andExpect(status().isOk())
+ .andExpect(content().string(containsString("10.032,50 €")));
+ }
+
+ @Test
+ public void whenCallCurrencyWithUSALocale_ThenReturnProperCurrency() throws Exception {
+ mockMvc.perform(MockMvcRequestBuilders.get("/currency")
+ .header("Accept-Language", "en-US")
+ .param("amount", "10032.5"))
+ .andExpect(status().isOk())
+ .andExpect(content().string(containsString("$10,032.50")));
+ }
+
+ @Test
+ public void whenCallCurrencyWithRomanianLocaleWithArrays_ThenReturnLocaleCurrencies() throws Exception {
+ mockMvc.perform(MockMvcRequestBuilders.get("/currency")
+ .header("Accept-Language", "ro-RO")
+ .param("amountList", "10", "20", "30"))
+ .andExpect(status().isOk())
+ .andExpect(content().string(containsString("10,00 RON, 20,00 RON, 30,00 RON")));
+ }
+
+ @Test
+ public void whenCallCurrencyWithUSALocaleWithoutDecimal_ThenReturnCurrencyWithoutTrailingZeros() throws Exception {
+ mockMvc.perform(MockMvcRequestBuilders.get("/currency")
+ .header("Accept-Language", "en-US")
+ .param("amount", "10032"))
+ .andExpect(status().isOk())
+ .andExpect(content().string(containsString("$10,032")));
+ }
+
+ @Test
+ public void whenCallCurrencyWithUSALocale_ThenReturnReplacedDecimalPoint() throws Exception {
+ mockMvc.perform(MockMvcRequestBuilders.get("/currency")
+ .header("Accept-Language", "en-US")
+ .param("amount", "1.5"))
+ .andExpect(status().isOk())
+ .andExpect(content().string(containsString("1,5")));
+ }
+}
diff --git a/stripe/pom.xml b/stripe/pom.xml
index 07d2968f5f..48505c9e4e 100644
--- a/stripe/pom.xml
+++ b/stripe/pom.xml
@@ -11,9 +11,9 @@
com.baeldung
- parent-boot-1
+ parent-boot-2
0.0.1-SNAPSHOT
- ../parent-boot-1
+ ../parent-boot-2
@@ -28,9 +28,6 @@
org.projectlombok
lombok
- ${lombok.version}
-
com.stripe
diff --git a/stripe/src/main/java/com/baeldung/stripe/ChargeRequest.java b/stripe/src/main/java/com/baeldung/stripe/ChargeRequest.java
index a5c056b659..190911afb3 100644
--- a/stripe/src/main/java/com/baeldung/stripe/ChargeRequest.java
+++ b/stripe/src/main/java/com/baeldung/stripe/ChargeRequest.java
@@ -13,4 +13,27 @@ public class ChargeRequest {
private Currency currency;
private String stripeEmail;
private String stripeToken;
+ public String getDescription() {
+ return description;
+ }
+ public int getAmount() {
+ return amount;
+ }
+ public Currency getCurrency() {
+ return currency;
+ }
+ public String getStripeEmail() {
+ return stripeEmail;
+ }
+ public String getStripeToken() {
+ return stripeToken;
+ }
+ public void setDescription(String description) {
+ this.description = description;
+ }
+ public void setCurrency(Currency currency) {
+ this.currency = currency;
+ }
+
+
}
diff --git a/stripe/src/main/resources/application.properties b/stripe/src/main/resources/application.properties
new file mode 100644
index 0000000000..f36df33897
--- /dev/null
+++ b/stripe/src/main/resources/application.properties
@@ -0,0 +1,2 @@
+STRIPE_SECRET_KEY=
+STRIPE_PUBLIC_KEY=
\ No newline at end of file
diff --git a/stripe/src/main/resources/static/index.html b/stripe/src/main/resources/static/index.html
index 090a01e91d..d7ba2bef91 100644
--- a/stripe/src/main/resources/static/index.html
+++ b/stripe/src/main/resources/static/index.html
@@ -1,7 +1,7 @@
-
+
diff --git a/terraform/README.md b/terraform/README.md
new file mode 100644
index 0000000000..b2a9539727
--- /dev/null
+++ b/terraform/README.md
@@ -0,0 +1,4 @@
+### Relevant Articles:
+
+- [Introduction to Terraform](https://www.baeldung.com/ops/terraform-intro)
+- [Best Practices When Using Terraform](https://www.baeldung.com/ops/terraform-best-practices)
diff --git a/testing-modules/assertion-libraries/README.md b/testing-modules/assertion-libraries/README.md
index d69457fdeb..ca4cc86f7e 100644
--- a/testing-modules/assertion-libraries/README.md
+++ b/testing-modules/assertion-libraries/README.md
@@ -10,4 +10,4 @@
- [Custom Assertions with AssertJ](http://www.baeldung.com/assertj-custom-assertion)
- [Using Conditions with AssertJ Assertions](http://www.baeldung.com/assertj-conditions)
- [AssertJ Exception Assertions](http://www.baeldung.com/assertj-exception-assertion)
-
+- [Asserting Log Messages With JUnit](https://www.baeldung.com/junit-asserting-logs)
diff --git a/testing-modules/junit5-annotations/README.md b/testing-modules/junit5-annotations/README.md
index 02d4cd652a..bd51bb3d2d 100644
--- a/testing-modules/junit5-annotations/README.md
+++ b/testing-modules/junit5-annotations/README.md
@@ -7,3 +7,4 @@ This module contains articles about JUnit 5 Annotations
- [JUnit 5 Conditional Test Execution with Annotations](https://www.baeldung.com/junit-5-conditional-test-execution)
- [JUnit5 Programmatic Extension Registration with @RegisterExtension](https://www.baeldung.com/junit-5-registerextension-annotation)
- [Guide to JUnit 5 Parameterized Tests](https://www.baeldung.com/parameterized-tests-junit-5)
+- [Writing Templates for Test Cases Using JUnit 5](https://www.baeldung.com/junit5-test-templates)
diff --git a/testing-modules/mockito-2/README.md b/testing-modules/mockito-2/README.md
index 6c9ddee01d..329228186f 100644
--- a/testing-modules/mockito-2/README.md
+++ b/testing-modules/mockito-2/README.md
@@ -5,3 +5,4 @@
- [Mockito Strict Stubbing and The UnnecessaryStubbingException](https://www.baeldung.com/mockito-unnecessary-stubbing-exception)
- [Mockito and Fluent APIs](https://www.baeldung.com/mockito-fluent-apis)
- [Mocking the ObjectMapper readValue() Method](https://www.baeldung.com/mockito-mock-jackson-read-value)
+- [Introduction to Mockito’s AdditionalAnswers](https://www.baeldung.com/mockito-additionalanswers)