We are using spring cloud config server backed by bitbucket for config files. We have configured multiple repositories in application.yml of config server. We want to make it available even if bitbucket is down. We are looking for a solution that can cache config repositories and in case bitbucket is down it …
Tag: spring-boot
For loop inside for loops code optimisation
I have an loop inside loop to remove the elements from the seconde loop, and what is present in the list has to perform certain actions. I wish to optimize the iteration and comparisons, can it be done? How do I optimize my logic shown below to avoid so many lines of code Answer After minLenghtOfEntities += f…
Which design pattern for merging 2 methods they differ in one place
I wonder which design pattern should I use in my case: I have 2 endpoints that use 2 service methods, each very similar, they differ only in invoking some different methods from the same service: My first service method (invoked by endpoint 1): The second endpoint uses very similar method that differs in prot…
Spring Data JPA @Convert throws Operations Not Allowed exception
I am using @Convert annotation to encrypt and decrypt certain columns. @Data @Entity @Table( name = “tlp_task_comment” ) public class TaskCommentModel implements Serializable { @Id @…
Hibernation error many to one. How to create it correctly?
I’m trying to create a many-to-one base, but when adding via .jsp gives an error, via H2 console everything adds ok! Please help me understand how to properly create a many-to-one relationship. It …
Problem with integrating Spring Boot backend + oauth with frontend app
I have backend Spring Boot app which uses data from Spotify api and it requires user to log in in order to provide my app with auth token. It works fine, but i have no idea how to integrate it with …
Continue consuming subsequent records in reactor kafka after deserialization exception
I am using reactor kafka and have a custom AvroDeserializer class for deserialization of messages. Now I have a case where for certain payloads the deserialization class throws an exception. My Kafka listener dies as soon as it tries to read such records. I tried handling this exception using onErrorReturn an…
How to define an MS SQL datasource for use in apache camel?
I am trying to create a data source for use with the Apache camel sql component and as per the documentation I have defined the spring data source properties and included the dependencies in my pom file: I have even defined a configured a data source as per numerous read examples (though if I am not mistaken,…
Spring boot / Java, mongodb SSL / TLS connectivity
I have two projects where I use spring boot + mongodb. In one project the spring boot version is 1.4.1.RELEASE and other project is 2.1.3.RELEASE. I have certificate(s), key in PEM format to onboard into truststore and keystore – One server certificate chain and other a client certificate and private ke…
Spring boot @Autowired not working in unit test case
As I understand that if we use spring stereotypes then we don’t need to use new keyword to create an instance. Spring manages that for us and provide us with the beans at runtime. And in order for Spring to inject those beans we need to use @Autowired annotation where we want Spring to inject that bean.…