150,218 questions
Score of 1
1 answer
71 views
How to preserve custom fields from an OAuth2 token response and use them in Spring Authorization Server JWT generation?
I am integrating a third-party OAuth2 Authorization Code provider with a Spring Security + Spring Authorization Server based application.
The provider supports only OAuth2 Authorization Code Flow and ...
Score of 1
1 answer
89 views
How to declare quorum queues with RabbitAmqpAdmin in Spring AMQP 1.0?
I am implementing a messaging solution using Spring Boot and RabbitMQ where our primary requirement is high availability and message safety. Because of this, our goal is to ensure that all queues are ...
Score of 1
1 answer
113 views
Spring Security: recommended way to handle per-user permissions with JWT without hitting the DB twice per request?
I'm using Spring Boot 3 / Spring Security 6 with JPA. My JWT contains only the user's email. On every request, my filter loads the User entity from the DB and puts it in the
SecurityContext:
String ...
Score of 1
1 answer
203 views
Existing JAXBElement leads to ClassNotFound/DefNotFound on Java 11 [duplicate]
(This question is a bit of a special case of other, but similar, questions. As the accepted answer shows, the solution here is related to configuration of the boot-gradle task/plugin, not a question ...
Score of 3
3 answers
228 views
What should I do when a REST request times out but the operation may still be running?
My Spring Boot service calls another API to start an operation that can take a few minutes:
My service -> POST /operations -> Provider
Normally the provider returns an operationId which I store ...
Score of 0
1 answer
91 views
Hibernate 7 join ManyToOne including null values and multiple keys
My project is build on Springboot 4, with JpaRepositories on Hibernate 7
I need to create a REST endpoint that will return a structure that is modeled like this on OpenAPI:
openapi: 3.2.0
info:
...
Score of 2
2 answers
102 views
How to log reason Spring Boot tests are not using cached application context?
I have several JUnit 5 integration tests extending one base class. The base declares @SpringBootTest, but Spring appears to start multiple application contexts.
@SpringBootTest(classes = ...
Score of -2
1 answer
147 views
Modeling a hierarchical staff role system alongside a plain customer role: same User entity or split into Customer/Employee? [closed]
I'm building an e-commerce backend in Spring Boot with Spring Security. Currently I have a single User entity that implements UserDetails, used for both customers and staff (admins/managers/employees),...
Score of 2
2 answers
180 views
How should I handle retries when a Spring Boot service provisions a PostgreSQL cluster through a cloud API?
I'm working on a Spring Boot service that provisions PostgreSQL clusters through a cloud provider's API.
The provider's API is asynchronous, so my endpoint roughly works like this:
POST /clusters
...
Score of 0
3 answers
183 views
React App.jsx page not able to make web socket connection with Spring Boot backend
Here is the App.jsx, all the packages are installed:
import React, { useState, useEffect, useRef } from 'react';
import SockJS from 'sockjs-client';
import { Client } from '@stomp/stompjs';
function ...
Score of 0
1 answer
87 views
Where to put SPRING_APPLICATION_JSON when testing Spring Boot application? [duplicate]
I wonder where I should put SPRING_APPLICATION_JSON to be loaded when used with @SpringBootTest?
I originally thought that I could put a file spring.application.json into test resources, but this is ...
Score of 1
1 answer
107 views
Spring Boot REST server generated with OpenAPI generator doesn't find a Jackson pattern validator for a date-time field generated as an OffsetDateTime
I've received an OpenAPI specification that has rules for the format a date-time can have, regarding milliseconds or microseconds precision especially.
I.e. I have this definition for a date-time ...
Score of 5
1 answer
222 views
How to access current attempt count in Spring Boot 4's native for soft vs hard retry limits?
With the native retry support in Spring Boot 4 / Spring Framework, org.springframework.core.retry.RetryPolicy uses a simplified method signature:
public interface RetryPolicy {
boolean shouldRetry(...
Score of 4
2 answers
158 views
spring-boot-maven-plugin:start starts multiples instances of my application as wished, but stop only ends one
I have a Spring Boot application that I customize through external properties files.
During Maven's pre-integration-test, I launch three instances of it, through org.springframework.boot:spring-boot-...
Score of 0
0 answers
78 views
How to declare optional Maven dependencies when building Spring Boot auto-configuration with Gradle?
I am writing my own Spring Boot Auto-configuration here https://github.com/moonclipse/raygun-spring-boot.
The starter has optional spring-mvc and spring-ws integration. I write it using Gradle's ...