Simple embedded Kafka test example with spring boot

Embedded Kafka tests work for me with below configs, Annotation on test class @EnableKafka @SpringBootTest(classes = {KafkaController.class}) // Specify @KafkaListener class if its not the same class, or not loaded with test config @EmbeddedKafka( partitions = 1, controlledShutdown = false, brokerProperties = { “listeners=PLAINTEXT://localhost:3333”, “port=3333” }) public class KafkaConsumerTest { @Autowired KafkaEmbedded kafkaEmbeded; @Autowired KafkaListenerEndpointRegistry … Read more

What are the advantages and disadvantages of using feign over RestTemplate

Feign allows you to abstract the mechanics of calling a REST service. Once you configure and annotate the Feign interface, you can call a REST service by making a simple Java function call. The actual implementation of making a REST call is handled at runtime by Feign. This means that the implementation can be configured … Read more

The bean ‘metaDataSourceAdvisor’, defined in null, could not be registered

Okay, I found the issue myself: I had @EnableGlobalMethodSecurity twice in my project: @Configuration @EnableWebSecurity @EnableGlobalMethodSecurity(prePostEnabled = true) // <– public class WebSecurityConfig extends WebSecurityConfigurerAdapter { } and @SpringBootApplication @EnableJpaRepositories(basePackages = {“mz.server.spring.repository”}) @EnableGlobalMethodSecurity(prePostEnabled = true, proxyTargetClass = true) // <– @EntityScan(basePackages = “mz.server.hibernate.model”) @EnableTransactionManagement @EnableScheduling public class Application { } So that’s a nice new … Read more

spring-boot application without a datasource

It is possible to run a spring boot application without datasource. You must disable the auto configuration for the datasource and may be for JPA also : @EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class,HibernateJpaAutoConfiguration.class}) The exception you posted is something else, as written in the comments, you have something in the classpath that references the missing class of apache geronimo. So … Read more

Spring Boot 2.0 disable default security

According to the new updates in Spring 2.0, if Spring Security is on the classpath, Spring Boot will add @EnableWebSecurity.So adding entries to the application.properties ain’t gonna work (i.e it is no longer customizable that way). For more information visit the official website Security changes in Spring Boot 2.0 Albeit not sure about your requirement … Read more