- web - %date [%thread] %-5level %logger{36} - %message%n
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
diff --git a/spring-integration/src/main/java/com/baeldung/dsl/JavaDSLFileCopyConfig.java b/spring-integration/src/main/java/com/baeldung/dsl/JavaDSLFileCopyConfig.java
new file mode 100644
index 0000000000..7e91345f04
--- /dev/null
+++ b/spring-integration/src/main/java/com/baeldung/dsl/JavaDSLFileCopyConfig.java
@@ -0,0 +1,146 @@
+package com.baeldung.dsl;
+
+import java.io.File;
+import java.util.Scanner;
+import java.util.concurrent.TimeUnit;
+
+import org.springframework.context.annotation.AnnotationConfigApplicationContext;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.integration.annotation.IntegrationComponentScan;
+import org.springframework.integration.channel.PriorityChannel;
+import org.springframework.integration.config.EnableIntegration;
+import org.springframework.integration.core.GenericSelector;
+import org.springframework.integration.core.MessageSource;
+import org.springframework.integration.dsl.IntegrationFlow;
+import org.springframework.integration.dsl.IntegrationFlows;
+import org.springframework.integration.dsl.Pollers;
+import org.springframework.integration.file.FileReadingMessageSource;
+import org.springframework.integration.file.FileWritingMessageHandler;
+import org.springframework.messaging.MessageHandler;
+
+/**
+ * JavaDSLFileCopyConfig contains various Integration Flows created from various spring integration components.
+ * Activate only one flow at a time by un-commenting @Bean annotation from IntegrationFlow beans.
+ *
+ * Different flows are :
+ * - {@link #fileMover()} - default app - activated
+ * - {@link #fileMoverWithLambda()} - app with file writing expressions as lambda
+ * - {@link #fileMoverWithPriorityChannel()} - app with priority channel
+ * - {@link #fileReader()}, {@link #fileWriter()}, {@link #anotherFileWriter()} - app with bridge
+ */
+@Configuration
+@EnableIntegration
+@IntegrationComponentScan
+public class JavaDSLFileCopyConfig {
+
+ public static final String INPUT_DIR = "source";
+ public static final String OUTPUT_DIR = "target";
+ public static final String OUTPUT_DIR2 = "target2";
+
+ @Bean
+ public MessageSource sourceDirectory() {
+ FileReadingMessageSource messageSource = new FileReadingMessageSource();
+ messageSource.setDirectory(new File(INPUT_DIR));
+ return messageSource;
+ }
+
+ @Bean
+ public GenericSelector onlyJpgs() {
+ return new GenericSelector() {
+
+ @Override
+ public boolean accept(File source) {
+ return source.getName()
+ .endsWith(".jpg");
+ }
+ };
+ }
+
+ @Bean
+ public MessageHandler targetDirectory() {
+ FileWritingMessageHandler handler = new FileWritingMessageHandler(new File(OUTPUT_DIR));
+ handler.setExpectReply(false); // end of pipeline, reply not needed
+ return handler;
+ }
+
+ @Bean
+ public IntegrationFlow fileMover() {
+ return IntegrationFlows.from(sourceDirectory(), configurer -> configurer.poller(Pollers.fixedDelay(10000)))
+ .filter(onlyJpgs())
+ .handle(targetDirectory())
+ .get();
+ }
+
+ // @Bean
+ public IntegrationFlow fileMoverWithLambda() {
+ return IntegrationFlows.from(sourceDirectory(), configurer -> configurer.poller(Pollers.fixedDelay(10000)))
+ .filter(message -> ((File) message).getName()
+ .endsWith(".jpg"))
+ .handle(targetDirectory())
+ .get();
+ }
+
+ @Bean
+ public PriorityChannel alphabetically() {
+ return new PriorityChannel(1000, (left, right) -> ((File) left.getPayload()).getName()
+ .compareTo(((File) right.getPayload()).getName()));
+ }
+
+ // @Bean
+ public IntegrationFlow fileMoverWithPriorityChannel() {
+ return IntegrationFlows.from(sourceDirectory())
+ .filter(onlyJpgs())
+ .channel("alphabetically")
+ .handle(targetDirectory())
+ .get();
+ }
+
+ @Bean
+ public MessageHandler anotherTargetDirectory() {
+ FileWritingMessageHandler handler = new FileWritingMessageHandler(new File(OUTPUT_DIR2));
+ handler.setExpectReply(false); // end of pipeline, reply not needed
+ return handler;
+ }
+
+ // @Bean
+ public IntegrationFlow fileReader() {
+ return IntegrationFlows.from(sourceDirectory())
+ .filter(onlyJpgs())
+ .channel("holdingTank")
+ .get();
+ }
+
+ // @Bean
+ public IntegrationFlow fileWriter() {
+ return IntegrationFlows.from("holdingTank")
+ .bridge(e -> e.poller(Pollers.fixedRate(1, TimeUnit.SECONDS, 20)))
+ .handle(targetDirectory())
+ .get();
+ }
+
+ // @Bean
+ public IntegrationFlow anotherFileWriter() {
+ return IntegrationFlows.from("holdingTank")
+ .bridge(e -> e.poller(Pollers.fixedRate(2, TimeUnit.SECONDS, 10)))
+ .handle(anotherTargetDirectory())
+ .get();
+ }
+
+ public static void main(final String... args) {
+ final AbstractApplicationContext context = new AnnotationConfigApplicationContext(JavaDSLFileCopyConfig.class);
+ context.registerShutdownHook();
+ final Scanner scanner = new Scanner(System.in);
+ System.out.print("Please enter a string and press : ");
+ while (true) {
+ final String input = scanner.nextLine();
+ if ("q".equals(input.trim())) {
+ context.close();
+ scanner.close();
+ break;
+ }
+ }
+ System.exit(0);
+ }
+}
diff --git a/spring-integration/src/main/resources/logback.xml b/spring-integration/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-integration/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-integration/src/test/resources/logback-test.xml b/spring-integration/src/test/resources/logback-test.xml
index a807be0ca2..8f1be4eb7a 100644
--- a/spring-integration/src/test/resources/logback-test.xml
+++ b/spring-integration/src/test/resources/logback-test.xml
@@ -1,5 +1,15 @@
-
-
+
+
+ # Pattern of log message for console appender
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-jenkins-pipeline/src/main/resources/logback.xml b/spring-jenkins-pipeline/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-jenkins-pipeline/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-jersey/src/main/resources/logback.xml b/spring-jersey/src/main/resources/logback.xml
index ec0dc2469a..56af2d397e 100644
--- a/spring-jersey/src/main/resources/logback.xml
+++ b/spring-jersey/src/main/resources/logback.xml
@@ -2,7 +2,7 @@
- web - %date [%thread] %-5level %logger{36} - %message%n
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
diff --git a/spring-jinq/src/main/resources/logback.xml b/spring-jinq/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-jinq/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-jms/src/main/resources/logback.xml b/spring-jms/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-jms/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-jooq/pom.xml b/spring-jooq/pom.xml
index 713f7eb5ad..e1c13ef774 100644
--- a/spring-jooq/pom.xml
+++ b/spring-jooq/pom.xml
@@ -5,10 +5,10 @@
0.0.1-SNAPSHOT
- org.springframework.boot
- spring-boot-starter-parent
- 1.4.4.RELEASE
-
+ parent-boot-1
+ com.baeldung
+ 0.0.1-SNAPSHOT
+ ../parent-boot-1
@@ -192,13 +192,13 @@
3.8.6
1.4.193
- 4.3.4.RELEASE
+ 4.3.17.RELEASE
1.0.0
1.5
1.0.0
- 1.4.4.RELEASE
-
+ 1.5.13.RELEASE
+ org.jooq.example.spring.Application
\ No newline at end of file
diff --git a/spring-jooq/src/main/resources/logback.xml b/spring-jooq/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-jooq/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-kafka/src/main/resources/logback.xml b/spring-kafka/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-kafka/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-katharsis/src/main/resources/logback.xml b/spring-katharsis/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-katharsis/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-ldap/src/main/resources/logback.xml b/spring-ldap/src/main/resources/logback.xml
index 32b78577ee..7bd5154680 100644
--- a/spring-ldap/src/main/resources/logback.xml
+++ b/spring-ldap/src/main/resources/logback.xml
@@ -2,7 +2,7 @@
- web - %date [%thread] %-5level %logger{36} - %message%n
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
diff --git a/spring-mobile/src/main/resources/logback.xml b/spring-mobile/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-mobile/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-mockito/pom.xml b/spring-mockito/pom.xml
index 6aeaa9a1e8..d1fa7f410e 100644
--- a/spring-mockito/pom.xml
+++ b/spring-mockito/pom.xml
@@ -24,13 +24,13 @@
org.mockito
- mockito-all
+ mockito-core
${mockito.version}
- 1.10.19
+ 2.21.0
diff --git a/spring-mockito/src/main/java/com/baeldung/domain/util/MessageMatcher.java b/spring-mockito/src/main/java/com/baeldung/domain/util/MessageMatcher.java
index 05cb43e4df..51db07fde7 100644
--- a/spring-mockito/src/main/java/com/baeldung/domain/util/MessageMatcher.java
+++ b/spring-mockito/src/main/java/com/baeldung/domain/util/MessageMatcher.java
@@ -3,7 +3,7 @@ package com.baeldung.domain.util;
import com.baeldung.domain.model.Message;
import org.mockito.ArgumentMatcher;
-public class MessageMatcher extends ArgumentMatcher {
+public class MessageMatcher implements ArgumentMatcher {
private Message left;
@@ -12,16 +12,11 @@ public class MessageMatcher extends ArgumentMatcher {
}
@Override
- public boolean matches(Object object) {
- if (object instanceof Message) {
- Message right = (Message) object;
- return left.getFrom().equals(right.getFrom()) &&
- left.getTo().equals(right.getTo()) &&
- left.getText().equals(right.getText()) &&
- right.getDate() != null &&
- right.getId() != null;
- }
-
- return false;
+ public boolean matches(Message right) {
+ return left.getFrom().equals(right.getFrom()) &&
+ left.getTo().equals(right.getTo()) &&
+ left.getText().equals(right.getText()) &&
+ right.getDate() != null &&
+ right.getId() != null;
}
}
\ No newline at end of file
diff --git a/spring-mockito/src/main/resources/logback.xml b/spring-mockito/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-mockito/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-mustache/pom.xml b/spring-mustache/pom.xml
index 3a53c63f8c..4e7a1ba5a3 100644
--- a/spring-mustache/pom.xml
+++ b/spring-mustache/pom.xml
@@ -11,11 +11,10 @@
Demo project for Spring Boot
- org.springframework.boot
- spring-boot-starter-parent
- 1.5.4.RELEASE
-
-
+ parent-boot-1
+ com.baeldung
+ 0.0.1-SNAPSHOT
+ ../parent-boot-1
diff --git a/spring-mustache/src/main/resources/logback.xml b/spring-mustache/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-mustache/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-mvc-forms-jsp/pom.xml b/spring-mvc-forms-jsp/pom.xml
index a51f76f9e1..6c75c9299b 100644
--- a/spring-mvc-forms-jsp/pom.xml
+++ b/spring-mvc-forms-jsp/pom.xml
@@ -83,7 +83,6 @@
src/main/webapp
spring-mvc-forms
false
- ${deploy-path}
@@ -99,7 +98,6 @@
2.3.1
3.1.0
6.0.10.Final
- server default deploy directory
1.3.3
5.2.5.Final
6.0.6
diff --git a/spring-mvc-forms-jsp/src/main/resources/logback.xml b/spring-mvc-forms-jsp/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-mvc-forms-jsp/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-mvc-forms-thymeleaf/pom.xml b/spring-mvc-forms-thymeleaf/pom.xml
index 429bf3a5d4..07c49766ee 100644
--- a/spring-mvc-forms-thymeleaf/pom.xml
+++ b/spring-mvc-forms-thymeleaf/pom.xml
@@ -11,10 +11,10 @@
spring forms examples using thymeleaf
- org.springframework.boot
- spring-boot-starter-parent
- 2.0.0.RELEASE
-
+ parent-boot-2
+ com.baeldung
+ 0.0.1-SNAPSHOT
+ ../parent-boot-2
diff --git a/spring-mvc-forms-thymeleaf/src/main/resources/logback.xml b/spring-mvc-forms-thymeleaf/src/main/resources/logback.xml
new file mode 100644
index 0000000000..7d900d8ea8
--- /dev/null
+++ b/spring-mvc-forms-thymeleaf/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-mvc-java/README.md b/spring-mvc-java/README.md
index 6b05ef569c..c4a0e3579c 100644
--- a/spring-mvc-java/README.md
+++ b/spring-mvc-java/README.md
@@ -34,3 +34,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
- [Spring Core Annotations](http://www.baeldung.com/spring-core-annotations)
- [Using Spring ResponseEntity to Manipulate the HTTP Response](http://www.baeldung.com/spring-response-entity)
- [Using Spring @ResponseStatus to Set HTTP Status Code](http://www.baeldung.com/spring-response-status)
+- [Display RSS Feed with Spring MVC](http://www.baeldung.com/spring-mvc-rss-feed)
diff --git a/spring-mvc-java/pom.xml b/spring-mvc-java/pom.xml
index 9c6f9b57a8..83f2556fe0 100644
--- a/spring-mvc-java/pom.xml
+++ b/spring-mvc-java/pom.xml
@@ -141,6 +141,13 @@
com.google.code.gson
gson
+
+
+
+ com.rometools
+ rome
+ ${rome.version}
+
@@ -156,6 +163,7 @@
maven-resources-plugin
+ ${maven-resources-plugin.version}
@@ -276,6 +284,7 @@
2.6
2.7
1.6.1
+ 3.1.0
1.8.9
@@ -283,7 +292,13 @@
3.16-beta1
+
+ 1.10.0
+
2.2.4
+
+
+ com.baeldung.app.Application