I am not able to run my Spring Boot application with embedded Tomcat. It was working fine till now and I did not make any changes in configuration. When i run the application as Spring Boot App in eclipse the tomcat stops immediately during startup. I tried restarting machine, eclipse, refreshing project, rec…
Create @MockBean with qualifier by annotating class?
In my Spring Boot test I’m using 2 mock beans with different qualifiers: Since I’m not using these beans explicitly, I would rather move them away from the class body, as the @MockBean annotation is now repeatable: However, I need to pass in a qualifier as well, since they have the same type. Any …
DateTimeFormatter can not parse date with decimal 0 after second in Java 8
I am using Java 8. I am trying to parse a date to string with DateTimeFormatter. But it gives the following error. My attempt and error are given below. My code: Error: Text ‘2019-02-06 00:00:00.0’ could not be parsed, unparsed text found at index 19. Stacktrace follows: Message: Text ‘2019-…
Java program failing to map Native memory allocation
Java program failing to allocate Native memory even after enough RAM is available. The program crashes repeatedly after failing with os_commit exceptions. Any recommendation to update to tune Java Heap etc. As per the logs you can see that there is enough memory available Resource Utilization JMap Output Java…
Concatenate the words to obtain a single word with the longest possible substring composed of a single letter
An array of N words is given. Each word consists of small letters (‘a’- ‘z’). Our goal is to concatenate the words in such a say as to obtain a single word with the longest possible sub-string …
FireStore date query not working as expected
I have doc which has a date object. Code to init Firestore: Code to query: I am always getting all the records and looks like the where clause is not getting applied. On Firebase console I see that the endDate is stored as timestamp. Doc from Firebase console: Answer Cloud Firestore queries are immutable, whi…
aggregate not found in the event store
I am trying to add data using CQRS framework AXON. But while hitting the API(used to add an order). I am getting the below error:- But i already have an Aggregate in my code(OrderAggregate.Java). The Full code can be found at – https://github.com/iftekharkhan09/OrderManagementSystem API to add Order …
Flatmap nested collection
I have a list of objects, some of them can be collections. I would like to get a stream of plain objects. I would like to get a stream with elements. I have tried I also checked an example which shows how to use a recursive function which flattens a collection. However, in this example .collect(Collectors.toL…
I cannot @Spy Object in Cucumber Spring Boot Test in two Steps Definitions
I’m having a problem running cucumber test with Spring Boot 2. I have two steps definitions and in both clases I try to spy an object with mockito trying to capture the argument passed to one method of this class. The point is that since Cucumber only allows one Spring Application Context Configuration …
Can I use deprecated classes?
Will using deprecated classes cause severe problems to the program? What is the meaning of deprecated? Can I still work with deprecated classes? An example for it is the ProgressDialog view in Android. It deprecated from API 26 and the replacement is the ProgressBar view. What happens if I will still use the …