HATEOAS methods not found

My controller can't seem to find the HATEOAS methods like "linkTo". Am I missing something? pom.xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0"...

Gradle | Spring boot dependencies are not excluding

I'm trying to get log4j to work in a project that I'm working on. I added the relevant log4j dependencies in build.gradle and excluded the Spring boot starter logging so it can work. This worked...

Springfox @RestController naming

I'm getting some minor troubles using Springfox. I can't set a name to @RestController classes. I'm using Spring boot and Swagger2. The following code will produce a controller named...

Logback conversion rule parametrizing

Is there any way of parametrizing conversion rule in Logback? I've tried adding child nodes, additional attributes and I don't see a way to do it. <conversionRule conversionWord="boundedMsg"...

Spring Boot enabling CORS by application.properties

I using Spring Boot API RESTful that get up automatically by your Entities Class. I'm consuming this apiRest from a front-end web app but it gives me this error: No 'Access-Control-Allow-Origin'...

How to set rate limit for each user in Spring Boot?

I am developing a Spring Boot Rest API which handles a lots of incoming request calls. My Controller is something like below: @RestController public class ApiController { List<ApiObject> ...

H2 not creating/updating table in my Spring Boot app. Something's wrong with my Entity?

I want to keep some data in H2 database by making a CRUD repository, using Hibernate. I can't get the database to store my entries whatsoever. Currently, I'm trying to achieve that during updating...

Added Springfox Swagger-UI and it's not working, what am I missing?

Following the instructions here: http://www.baeldung.com/swagger-2-documentation-for-spring-rest-api I added these dependencies to my project: compile...

Spring cloud gateway response never arrives

I was trying out Spring Cloud Gateway (Finchley.M5). Then I built up this simple project based on Springboot 2 (2.0.0.M7): Eureka Spring Cloud Gateway A service (WebFlux @RestController) When...

How to dynamically ignore a property on Jackson serialization

I have an entity with multiple @ManyToOne associations. I am using spring-boot to expose a REST API. Currently, I have multiple REST API's which return a JSON response of the whole entity,...

Parameter 0 of constructor in ... required a bean of type... that could not be found

I'm walking through a pivotal 'guide' project, my first time uploading files in Spring. I've implemented the code exactly as the guide specifies but still am getting the following error: Parameter...

Spring Boot application stuck at: Initializing Spring DispatcherServlet 'dispatcherServlet'

I am upgrading a Spring Boot application from version 1.5.6 to 2.1.1. When I start the application, it gets stuck at this line: INFO: Initializing Spring DispatcherServlet...

no multipart boundary was found

Using Rest Client Chrome tool, I am uploading a JSON file say sample.json in my request. Getting below exception. Tried Passing header as multipart/form-data and also no passing the latter. But...

How do I get user details in controller of Spring Boot OIDC app?

I have adapted the code from here to call a MitreID OIDC server. My controller: public final String home(Principal p) { final String username =...

SonarQube rule: "Using command line arguments is security-sensitive" in Spring Boot application

SonarQube is just showing a Critical security issue in the very basic Spring Boot application. In the main method. @SpringBootApplication public class Application { public static void...

How to download a file from Google Cloud Storage and return it in Spring controller

I have a Spring Boot application. Users can login to my application and upload files. All the files of users are stored in a Google Cloud Storage. Now, I want the users to be able to download...

Authenticating With Azure Directory and Fetch the Valid User Roles From Database

I have to design a application for an organization where Authentication need to be happen Using SSO with Azure Directory using spring boot. All the employee Information is stored in the AD. My...

How to mock JWT authenticaiton in a Spring Boot Unit Test?

I Have added JWT Authentication using Auth0 to my Spring Boot REST API following this example. Now, as expected, my previously working Controller unit tests give a response code of401 Unauthorized...

Swagger UI redirecting to /swagger-ui/index.html?configUrl=/v3/api-docs/swagger-config

I am using springdoc-openapi-ui, when I hit http://localhost:8080/swagger-ui.html URL it is always redirecting to http://localhost:8080/swagger-ui/index.html?configUrl=/v3/api-docs/swagger-config....

Suddenly Springfox Swagger 3.0 is not working with spring webflux

Application was working with Springfox Swagger 3.0 few days back. Suddenly it is stopped working. The Jar file which was created before a week is still working but now when we try to build a new...

Java file outside of source root intelliJ

I have cloned a spring boot project from GitLab having multiple branches in IntelliJ. I checkout to the branch in which I want to work. But I am getting "Java file outside of source root" on all...

Redis spring session bean not updated

I am trying to switch my http session to redis in my spring boot application. When the first request comes to backend it's being filtered by authentication filter. One duty of this filter is to...

ClassNotFoundException on org.springframework.test.context.TestContextAnnotationUtils when upgrading Spring Boot to 2.4.2

In my POM I upgraded the version of Spring Boot from 2.3.5.RELEASE to 2.4.2. As a result, mvn clean test now fails with error java.lang.NoClassDefFoundError:...

Whitelist endpoint in spring-webflux security without context root path

I am trying to whitelist all the custom endpoints which are ending with /health but in WebFlux Security I'm unable to use a regular expression to match all end-points. e.g. /app/health,...

Spring boot app with OAuth 2.0 Azure AD Authentication throws invalid credentials when deployed on AWS ECS Service configured with a Load Balancer

We have implemented Azure AD OAuth 2.0 authentication in spring boot application. It gives the Microsoft login. After entering credentials it takes to page. https://xxx.xxx.xxx/login?error#. This...

SpringBoot how to set connection fetch size for Hikari Pool and jdbcTemplate

I'm looking for a way to configure Hikari Connection Pool for Spring DataSource explicitly set fetchSize for resultSet. Here is my application.properties #...

Configure Spring Gateway with Spring Authorization Server

I have Spring Gateway application with the following Gradle dependencies: implementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-gateway' implementation...

What is the easiest way in Maven pom.xml to upgrade all usages of log4j2 to 2.15.0, including dependencies using log4j2? See CVE-2021-44228

A severe security vulnerability was found for log4j2 <= 2.14.1 (see https://nvd.nist.gov/vuln/detail/CVE-2021-44228). How can I update the pom.xml of a Spring Boot application to make sure that...

Spring Boot, OAuth2 authentication is lost between requests

EDIT: log from org.springframework.security: 2022-01-17 12:31:03.495 IST 2022-01-17 10:31:03.495 DEBUG [080-exec-5] o.s.s.w.s.SessionManagementFilter - Request requested invalid session id...

Spring boot mockito mock method according to input parameters

I have an special case that I have no idea about how to solve. I am testing a service class method with spring boot, junit and mockito. In the class method I am testing, it call an internal method...