I have a FreeMarker configuration: And dependencies from build.gradle: It works okay. But when I set following dependency in build.gradle: implementation ‘org.springframework.boot:spring-boot-starter-data-rest’ I’ll get an error: Seems like spring-data-rest provides configured FreeMarker too…
Tag: spring
HTTP Basic Authentication using Spring Boot’s Java based configuration
I am trying to set up a simple Spring Boot application secured with HTTP Basic Authentication using a single user with a hard-coded password. So far, I got it working using XML based configuration. How can I achieve the same result using Java based configuration? SecurityConfig.java spring-security.xml Note: …
Jpa Enum error with Smallint type in postgres
I want to put enum in my entity. But I have an error with validation which JPA wonts smallint set as enum. How I can solve this issue. “Schema-validation: wrong column type encountered in column [status] in table [order]; found [int2 (Types#SMALLINT)], but expecting [int4 (Types#INTEGER)]”[enter i…
SpringBoot cache not working for non parameter methods
I have one spring boot application pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www….
Dependency error in Spring boot for Spring session and Redis. What is the correct dependency i have to use?
I have angular 2 front-end and spring boot back-end.I want to use username and password for login and then use x-auth-token to check session for each request sent from angular.I want to use Redis to store session.But i keep getting the below error when connecting to Redis.My assumption is my dependency versio…
spring try catch vs try(statement) catch – spring
I wanted to know the difference (if any) between try(statement?){} catch() and try{} catch(), that I saw applied in Spring, and if I’m also correct in .net. I have tried both but have not seen any difference. Is it for performance or just a choice? example: Answer Just wanted to mention two things befor…
convert back to class type List from GenericEntity – anonymous class
I am getting class cast exception at line 7 in the code below. I have written line 1-3 to provide data that comes from a rest service call and these line can’t be changed from my side. I must cast the response to List Answer Thank you @Michael. I had to run a getEntity on gEntity and then cast it
Google Cloud Java SDK with Workload Identity?
Trying to figure out how to authenticate with the storage API from within a GKE cluster. Code: getApplicationDefault() is documented to use these means to authenticate with the API: Credentials file pointed to by the {@code GOOGLE_APPLICATION_CREDENTIALS} environment variable Credentials provided by the Googl…
Send html table with Spring Boot Mail
I want to create service that will send email messages to recipients. This message should be presented as a table which is filled from entity fields. I’m using Spring Boot Mail. Solved this task with StringBuilder. Simple MailSender configuration: Entity: Method in one of the service to send email: Serv…
Not able to prevent multiple concurrent login from the same user in spring security with spring boot
** Here I have edited my code as to see that i’m currently using in memory authentication for this purpose Here is my Security configuration file, What I want to achieve is for one user to not have concurrent sessions. With this code I can login with same user on multiple tabs. Eventhough the user has a…