In Spring Boot 1.5.x, I was creating a custom RestTemplate like below: But, after migrating to Spring Boot 2.1.x, the above code doesn’t compile. Looks like requestFactory doesn’t take HttpComponentsClientHttpRequestFactory as an input parameter. Can anyone suggest how can I make the above code wo…
JPA/SpringBoot Repository for database view (not table)
I’m attempting to create a JPA entity for a view. From the database layer, a table and a view should be the same. However, problems begin to arise and they are two fold: When attempting to setup the correct annotations. A view does not have a primary key associated with it, yet without the proper @javax…
Does Java HTTP Client handle compression
I tried to find any mention of handling of compression in new Java HTTP Client but failed. Is there a built-in configuration to handle for e.g. gzip or deflate compression? I would expect to have a …
Why this error coming failed to load elasticsearch nodes in spring boot?
I am trying to use elasticsearch in my webapplication. I am using spring boot 2.0.6. I didn’t add any configuration file elastic search is auto configured by spring boot. I added spring data elastic search properties in application.properties like this spring-data-elasticsearch-3.0.11 elasticsearch-5.6.…
How to set TCP keep Alive from HttpClient?
My Java application which resides in AWS private subnet connects to an http server via AWS Nat gateway. I am calling a POST request via HttpClient to the HTTP server. That request will take more than 10 minutes to complete. I have configured a socket time out and connection timeout of 1 hour as this this a ba…
Grouping and Double sorting List
I went through all the manuals out there and all SO questions but still unable to figure this out… I have a List (integer represents age): I need to: group the list by age, sort by group sizes (descending), sort by age (descending) So using the example above the result would have to be like this: What I…
Is there an equivalent for Springs Resource in Micronaut?
I am migrating a tiny Spring Boot application to Micronaut 1.0.1 and I was wondering if there is an equivalent for org.springframework.core.io.Resource and their implementation such as ClasspathResource? In Spring Boot I inject a resource into a service using its constructor. How can I do this in Micronaut? A…
Netbeans is not getting installed in my Mac, it says JDK not found, though JDK is installed in the same
Error: Failure while executing the commands mentioned below:- /usr/bin/sudo -E — env LOGNAME=ajaygautam USER=ajaygautam USERNAME=ajaygautam /usr/sbin/installer -pkg /usr/local/Caskroom/netbeans/8.2/NetBeans 8.2.pkg -target / exited with 1. Here’s the output: installer: Error – NetBeans IDE c…
Put user in HttpSession with Spring Security default login and authenticate
I precise that I am a french student in 1st year of Java Developper. I’m developing a little multi-module app using: Spring Boot, Spring security, Hibernate, Spring Data, Spring MVC and Thymeleaf. I would like to set the User in the session, or at least the userId, at login. This way I don’t have …
Checking if a document exists in a Firestore collection
I have a Firestore collection tree in which I plan to store only one document. I want to check if that collection contains that document and if so, retrieve the id of the document! Any ideas/thoughts? Thanks 🙂 Answer If you want to check a particular document for existence based on its document id, please use…