diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 5e86714a89..0000000000
--- a/.travis.yml
+++ /dev/null
@@ -1,24 +0,0 @@
-language: java
-
-before_install:
- - echo "MAVEN_OPTS='-Xmx2048M -Xss128M -XX:+CMSClassUnloadingEnabled -XX:+UseG1GC -XX:-UseGCOverheadLimit'" > ~/.mavenrc
-
-install: skip
-script: travis_wait 60 mvn -q install -Pdefault-first,default-second -Dgib.enabled=true
-
-sudo: required
-
-jdk:
- - oraclejdk8
-
-addons:
- apt:
- packages:
- - oracle-java8-installer
-
-cache:
- directories:
- - .autoconf
- - $HOME/.m2
-
-
diff --git a/README.md b/README.md
index 7f78cf1515..4cad075cc3 100644
--- a/README.md
+++ b/README.md
@@ -1,12 +1,16 @@
-The "REST with Spring" Classes
+The Courses
==============================
-Here's the Master Class of REST With Spring (along with the newly announced Boot 2 material):
-**[>> THE REST WITH SPRING - MASTER CLASS](http://www.baeldung.com/rest-with-spring-course?utm_source=github&utm_medium=social&utm_content=tutorials&utm_campaign=rws#master-class)**
-And here's the Master Class of Learn Spring Security:
-**[>> LEARN SPRING SECURITY - MASTER CLASS](http://www.baeldung.com/learn-spring-security-course?utm_source=github&utm_medium=social&utm_content=tutorials&utm_campaign=lss#master-class)**
+Here's the new "Learn Spring" course:
+**[>> LEARN SPRING - THE MASTER CLASS](https://www.baeldung.com/learn-spring-course?utm_source=github&utm_medium=social&utm_content=tutorials&utm_campaign=ls#master-class)**
+
+Here's the Master Class of "REST With Spring" (along with the new announced Boot 2 material):
+**[>> THE REST WITH SPRING - MASTER CLASS](https://www.baeldung.com/rest-with-spring-course?utm_source=github&utm_medium=social&utm_content=tutorials&utm_campaign=rws#master-class)**
+
+And here's the Master Class of "Learn Spring Security":
+**[>> LEARN SPRING SECURITY - MASTER CLASS](https://www.baeldung.com/learn-spring-security-course?utm_source=github&utm_medium=social&utm_content=tutorials&utm_campaign=lss#master-class)**
@@ -15,7 +19,7 @@ Java and Spring Tutorials
This project is **a collection of small and focused tutorials** - each covering a single and well defined area of development in the Java ecosystem.
A strong focus of these is, of course, the Spring Framework - Spring, Spring Boot and Spring Security.
-In additional to Spring, the following technologies are in focus: `core Java`, `Jackson`, `HttpClient`, `Guava`.
+In additional to Spring, the modules here are covering a number of aspects in Java.
Building the project
@@ -32,8 +36,15 @@ Running a Spring Boot module
====================
To run a Spring Boot module run the command: `mvn spring-boot:run` in the module directory
-###Running Tests
+Working with the IDE
+====================
+This repo contains a large number of modules.
+When you're working with an individual module, there's no need to import all of them (or build all of them) - you can simply import that particular module in either Eclipse or IntelliJ.
+
+
+Running Tests
+=============
The command `mvn clean install` will run the unit tests in a module.
To run the integration tests, use the command `mvn clean install -Pintegration-lite-first`
diff --git a/algorithms-miscellaneous-3/README.md b/algorithms-miscellaneous-3/README.md
index cd3711d573..ce0fde0415 100644
--- a/algorithms-miscellaneous-3/README.md
+++ b/algorithms-miscellaneous-3/README.md
@@ -1,4 +1,4 @@
-## Relevant articles:
+## Relevant Articles:
- [Java Two Pointer Technique](https://www.baeldung.com/java-two-pointer-technique)
- [Implementing Simple State Machines with Java Enums](https://www.baeldung.com/java-enum-simple-state-machine)
@@ -7,3 +7,4 @@
- [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 in Java](https://www.baeldung.com/folding-hashing-technique)
+- [Creating a Triangle with for Loops in Java](https://www.baeldung.com/java-print-triangle)
diff --git a/algorithms-miscellaneous-3/pom.xml b/algorithms-miscellaneous-3/pom.xml
index 3cebdd09ac..5999d33c86 100644
--- a/algorithms-miscellaneous-3/pom.xml
+++ b/algorithms-miscellaneous-3/pom.xml
@@ -1,5 +1,5 @@
To run this particular application with mvn you use the following command:
+ * {@code + * mvn spring-boot:run -Dstart-class=com.baeldung.springamqp.broadcast.BroadcastMessageApp + * } + */ +@SpringBootApplication +public class BroadcastMessageApp { + + private static String ROUTING_KEY_USER_IMPORTANT_WARN = "user.important.warn"; + private static String ROUTING_KEY_USER_IMPORTANT_ERROR = "user.important.error"; + + public static void main(String[] args) { + SpringApplication.run(BroadcastMessageApp.class, args); + } + + @Bean + public ApplicationRunner runner(RabbitTemplate rabbitTemplate) { + String message = " payload is broadcast"; + return args -> { + rabbitTemplate.convertAndSend(BroadcastConfig.FANOUT_EXCHANGE_NAME, "", "fanout" + message); + rabbitTemplate.convertAndSend(BroadcastConfig.TOPIC_EXCHANGE_NAME, ROUTING_KEY_USER_IMPORTANT_WARN, "topic important warn" + message); + rabbitTemplate.convertAndSend(BroadcastConfig.TOPIC_EXCHANGE_NAME, ROUTING_KEY_USER_IMPORTANT_ERROR, "topic important error" + message); + }; + } + + @RabbitListener(queues = { FANOUT_QUEUE_1_NAME }) + public void receiveMessageFromFanout1(String message) { + System.out.println("Received fanout 1 message: " + message); + } + + @RabbitListener(queues = { FANOUT_QUEUE_2_NAME }) + public void receiveMessageFromFanout2(String message) { + System.out.println("Received fanout 2 message: " + message); + } + + @RabbitListener(queues = { TOPIC_QUEUE_1_NAME }) + public void receiveMessageFromTopic1(String message) { + System.out.println("Received topic 1 (" + BINDING_PATTERN_IMPORTANT + ") message: " + message); + } + + @RabbitListener(queues = { TOPIC_QUEUE_2_NAME }) + public void receiveMessageFromTopic2(String message) { + System.out.println("Received topic 2 (" + BINDING_PATTERN_ERROR + ") message: " + message); + } +} diff --git a/spring-amqp/src/main/java/com/baeldung/springamqp/consumer/Consumer.java b/spring-amqp/src/main/java/com/baeldung/springamqp/consumer/Consumer.java deleted file mode 100644 index 42d7e88cbd..0000000000 --- a/spring-amqp/src/main/java/com/baeldung/springamqp/consumer/Consumer.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.baeldung.springamqp.consumer; - -public class Consumer { - public void listen(String foo) { - System.out.println(foo); - } -} \ No newline at end of file diff --git a/spring-amqp/src/main/java/com/baeldung/springamqp/producer/Producer.java b/spring-amqp/src/main/java/com/baeldung/springamqp/producer/Producer.java deleted file mode 100644 index b4067ed795..0000000000 --- a/spring-amqp/src/main/java/com/baeldung/springamqp/producer/Producer.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.baeldung.springamqp.producer; - -import org.springframework.amqp.core.AmqpTemplate; -import org.springframework.amqp.rabbit.core.RabbitTemplate; -import org.springframework.context.support.AbstractApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -public class Producer { - - public static void main(String[] args) throws InterruptedException { - AbstractApplicationContext ctx = new ClassPathXmlApplicationContext("beans.xml"); - AmqpTemplate template = ctx.getBean(RabbitTemplate.class); - template.convertAndSend("Hello, world!"); - Thread.sleep(1000); - ctx.destroy(); - } -} \ No newline at end of file diff --git a/spring-amqp/src/main/java/com/baeldung/springamqp/simple/HelloWorldMessageApp.java b/spring-amqp/src/main/java/com/baeldung/springamqp/simple/HelloWorldMessageApp.java new file mode 100644 index 0000000000..25dcdf29c1 --- /dev/null +++ b/spring-amqp/src/main/java/com/baeldung/springamqp/simple/HelloWorldMessageApp.java @@ -0,0 +1,38 @@ +package com.baeldung.springamqp.simple; + +import org.springframework.amqp.core.Queue; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.boot.ApplicationRunner; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; + +@SpringBootApplication +public class HelloWorldMessageApp { + + private static final boolean NON_DURABLE = false; + private static final String MY_QUEUE_NAME = "myQueue"; + + public static void main(String[] args) { + SpringApplication.run(HelloWorldMessageApp.class, args); + } + + @Bean + public ApplicationRunner runner(RabbitTemplate template) { + return args -> { + template.convertAndSend("myQueue", "Hello, world!"); + }; + } + + @Bean + public Queue myQueue() { + return new Queue(MY_QUEUE_NAME, NON_DURABLE); + } + + @RabbitListener(queues = MY_QUEUE_NAME) + public void listen(String in) { + System.out.println("Message read from myQueue : " + in); + } + +} diff --git a/spring-amqp/src/main/resources/beans.xml b/spring-amqp/src/main/resources/beans.xml deleted file mode 100644 index f6a966b0f6..0000000000 --- a/spring-amqp/src/main/resources/beans.xml +++ /dev/null @@ -1,35 +0,0 @@ - -