Skip to content

Spring boot Mongo DB .yml configuration

When I use MySQL and hibernate for spring boot, I use below configuration in .yml file If it is mongoDB instead of MySQL and hibernate how does it change? Answer The mongodb properties are all prefixed with spring.data.mongodb. For user property you would use The list of available mongodb properties are here:…

Multiple dependency versions with Gradle 5

I need to support 2 different versions of the same library (to support a legacy version), es4hadoop for Apache Spark. Version 6.2.2(https://mvnrepository.com/artifact/org.elasticsearch/elasticsearch-spark-13_2.10/6.2.2) Version 6.3.2 (https://mvnrepository.com/artifact/org.elasticsearch/elasticsearch-spark-13…

Second root module in IntelliJ’s maven module view

I have a multimodule maven application with parent pom as follows: now in intelliJ’s maven module view i can see all modules however communication-management is displayed twice and i dont know why. From the structure of my application it seems like it shouldn’t be visible as root but somehow is. H…

Space complexity of the piece of code below?

I came across this question while I was doing some interview prep. The choices given were: O(n) O(n^2) From what I understand the answer should have been O(n) as on every iteration a new instance of the array is being created and the previous reference is being lost. However, the book mentions the answer to b…

Refactor regex Pattern into Java flavor pattern

I have a regex pattern created on regex101.com: https://regex101.com/r/cMvHlm/7/codegen?language=java however, that regex does not seem to work in my Java program (I use spring toolsuite as IDE): I get the following error: Is there a way to find out where index 1337 is? Answer The main problem with the regex …

Java(8): How to extract an specific class item from objects array?

I need to work on an Objects array which has the following value: The code which creates the objects array is: I need to extract a value from the ApplicationConfiguration type item. Note that it is not always the first array item! For start, I tried to do the following: in order to get a list with the specifi…

IllegalStateException: “Duplicate key” for Collectors.toMap()

Reference Question: Numbers which constitute the Maximum sum I was writing a program which would print the elements which have constituted to the maximum sum. I have been able to pass through any random scenario but when my maximum sum constitutes of two sets, my code fails. My code: For example when i am giv…