From a1b5d77656e8582fd4f094ceef19098816c353e5 Mon Sep 17 00:00:00 2001 From: geroza Date: Wed, 19 Dec 2018 16:37:10 -0200 Subject: [PATCH] Migrated the following modules, nos using parent-boot-2: spring-protobuf spring-mockito spring-mustache spring-kafka spring-jooq spring-cucumber spring-aop spring-amqp-simple --- .../baeldung/springamqpsimple/SpringAmqpConfig.java | 2 +- .../springamqpsimple/broadcast/BroadcastConfig.java | 2 +- .../src/test/resources/application.yaml | 5 +++++ spring-jooq/pom.xml | 7 ++++--- spring-kafka/pom.xml | 2 -- .../com/baeldung/spring/kafka/KafkaApplication.java | 8 ++++---- .../com/baeldung/NameServiceTestConfiguration.java | 2 +- spring-protobuf/pom.xml | 13 +------------ .../java/com/baeldung/protobuf/Application.java | 6 ++++++ 9 files changed, 23 insertions(+), 24 deletions(-) create mode 100644 spring-amqp-simple/src/test/resources/application.yaml diff --git a/spring-amqp-simple/src/main/java/com/baeldung/springamqpsimple/SpringAmqpConfig.java b/spring-amqp-simple/src/main/java/com/baeldung/springamqpsimple/SpringAmqpConfig.java index f6c82b635e..3bb0dbf33c 100644 --- a/spring-amqp-simple/src/main/java/com/baeldung/springamqpsimple/SpringAmqpConfig.java +++ b/spring-amqp-simple/src/main/java/com/baeldung/springamqpsimple/SpringAmqpConfig.java @@ -35,7 +35,7 @@ public class SpringAmqpConfig { } @Bean - SimpleMessageListenerContainer container(ConnectionFactory connectionFactory, + SimpleMessageListenerContainer SpringAmqpContainer(ConnectionFactory connectionFactory, MessageListenerAdapter listenerAdapter) { SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(); container.setConnectionFactory(connectionFactory); diff --git a/spring-amqp-simple/src/main/java/com/baeldung/springamqpsimple/broadcast/BroadcastConfig.java b/spring-amqp-simple/src/main/java/com/baeldung/springamqpsimple/broadcast/BroadcastConfig.java index 1d02b4dad9..c1df053c02 100644 --- a/spring-amqp-simple/src/main/java/com/baeldung/springamqpsimple/broadcast/BroadcastConfig.java +++ b/spring-amqp-simple/src/main/java/com/baeldung/springamqpsimple/broadcast/BroadcastConfig.java @@ -61,7 +61,7 @@ public class BroadcastConfig { } @Bean - public SimpleRabbitListenerContainerFactory container(ConnectionFactory connectionFactory, SimpleRabbitListenerContainerFactoryConfigurer configurer) { + public SimpleRabbitListenerContainerFactory BroadcastContainer(ConnectionFactory connectionFactory, SimpleRabbitListenerContainerFactoryConfigurer configurer) { SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory(); configurer.configure(factory, connectionFactory); return factory; diff --git a/spring-amqp-simple/src/test/resources/application.yaml b/spring-amqp-simple/src/test/resources/application.yaml new file mode 100644 index 0000000000..aa7a91bac5 --- /dev/null +++ b/spring-amqp-simple/src/test/resources/application.yaml @@ -0,0 +1,5 @@ +spring: + rabbitmq: + username: guest + password: guest + host: localhost \ No newline at end of file diff --git a/spring-jooq/pom.xml b/spring-jooq/pom.xml index c1f9dbff5b..8bce500a86 100644 --- a/spring-jooq/pom.xml +++ b/spring-jooq/pom.xml @@ -129,6 +129,9 @@ com.baeldung.jooq.introduction.db src/main/java + + + @@ -185,14 +188,12 @@ - 3.8.6 + 3.11.7 1.4.193 - 4.3.17.RELEASE 1.0.0 1.5 1.0.0 - 1.5.13.RELEASE org.jooq.example.spring.Application diff --git a/spring-kafka/pom.xml b/spring-kafka/pom.xml index e710f1ac03..67e732d819 100644 --- a/spring-kafka/pom.xml +++ b/spring-kafka/pom.xml @@ -30,11 +30,9 @@ com.fasterxml.jackson.core jackson-databind - - 1.1.3.RELEASE 2.6.7 diff --git a/spring-kafka/src/main/java/com/baeldung/spring/kafka/KafkaApplication.java b/spring-kafka/src/main/java/com/baeldung/spring/kafka/KafkaApplication.java index 50978d5ea9..4ee7f40335 100644 --- a/spring-kafka/src/main/java/com/baeldung/spring/kafka/KafkaApplication.java +++ b/spring-kafka/src/main/java/com/baeldung/spring/kafka/KafkaApplication.java @@ -22,7 +22,7 @@ public class KafkaApplication { public static void main(String[] args) throws Exception { ConfigurableApplicationContext context = SpringApplication.run(KafkaApplication.class, args); - + MessageProducer producer = context.getBean(MessageProducer.class); MessageListener listener = context.getBean(MessageListener.class); /* @@ -102,7 +102,7 @@ public class KafkaApplication { } public void sendMessageToPartion(String message, int partition) { - kafkaTemplate.send(partionedTopicName, partition, message); + kafkaTemplate.send(partionedTopicName, partition, null, message); } public void sendMessageToFiltered(String message) { @@ -124,13 +124,13 @@ public class KafkaApplication { private CountDownLatch greetingLatch = new CountDownLatch(1); - @KafkaListener(topics = "${message.topic.name}", group = "foo", containerFactory = "fooKafkaListenerContainerFactory") + @KafkaListener(topics = "${message.topic.name}", groupId = "foo", containerFactory = "fooKafkaListenerContainerFactory") public void listenGroupFoo(String message) { System.out.println("Received Messasge in group 'foo': " + message); latch.countDown(); } - @KafkaListener(topics = "${message.topic.name}", group = "bar", containerFactory = "barKafkaListenerContainerFactory") + @KafkaListener(topics = "${message.topic.name}", groupId = "bar", containerFactory = "barKafkaListenerContainerFactory") public void listenGroupBar(String message) { System.out.println("Received Messasge in group 'bar': " + message); latch.countDown(); diff --git a/spring-mockito/src/test/java/com/baeldung/NameServiceTestConfiguration.java b/spring-mockito/src/test/java/com/baeldung/NameServiceTestConfiguration.java index 2c63ff6203..c50377a22a 100644 --- a/spring-mockito/src/test/java/com/baeldung/NameServiceTestConfiguration.java +++ b/spring-mockito/src/test/java/com/baeldung/NameServiceTestConfiguration.java @@ -11,7 +11,7 @@ import org.springframework.context.annotation.Profile; public class NameServiceTestConfiguration { @Bean @Primary - public NameService nameService() { + public NameService nameServiceTest() { return Mockito.mock(NameService.class); } } diff --git a/spring-protobuf/pom.xml b/spring-protobuf/pom.xml index 3d7b7efd7c..372f969bd7 100644 --- a/spring-protobuf/pom.xml +++ b/spring-protobuf/pom.xml @@ -36,21 +36,10 @@ - - - - org.springframework.boot - spring-boot-maven-plugin - - true - - - - - 3.1.0 1.4 + com.baeldung.protobuf.Application diff --git a/spring-protobuf/src/main/java/com/baeldung/protobuf/Application.java b/spring-protobuf/src/main/java/com/baeldung/protobuf/Application.java index 76f0e45244..d8aa34eb7c 100644 --- a/spring-protobuf/src/main/java/com/baeldung/protobuf/Application.java +++ b/spring-protobuf/src/main/java/com/baeldung/protobuf/Application.java @@ -4,7 +4,9 @@ import com.baeldung.protobuf.BaeldungTraining.Course; import com.baeldung.protobuf.BaeldungTraining.Student; import com.baeldung.protobuf.BaeldungTraining.Student.PhoneNumber; import com.baeldung.protobuf.BaeldungTraining.Student.PhoneType; + import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.context.annotation.Bean; import org.springframework.http.converter.protobuf.ProtobufHttpMessageConverter; import org.springframework.web.client.RestTemplate; @@ -17,6 +19,10 @@ import java.util.Map; @SpringBootApplication public class Application { + + public static void main(String[] args) { + new SpringApplicationBuilder(Application.class).run(args); + } @Bean RestTemplate restTemplate(ProtobufHttpMessageConverter hmc) {