Questions tagged [spring-boot]
The spring-boot tag has no summary.
93 questions
3
votes
1
answer
306
views
Where should I store the access token in React?
I'm building a web app using Spring Boot (backend) and React (frontend).
My authentication is based on JWT, with both access token and refresh token.
The refresh token is stored in an HTTP-only ...
1
vote
4
answers
195
views
Is it good practice to return ApiResponse from a Spring service layer?
I'm working on a Spring Boot application with a VoucherService and VoucherController. I currently have the service method return an ApiResponse<T> directly, like this:
@Transactional
public ...
0
votes
1
answer
236
views
How should ViewModels and Services communicate in a JavaFX + Spring Boot MVVM application?
I'm building a JavaFX + Spring Boot application using the MVVM pattern.
I’m building a generic “wizard” in a JavaFX + Spring Boot MVVM app. A WizardViewModel drives a sequence of steps (STEP_ONE → ...
1
vote
2
answers
271
views
Is Spring Boot Unit Test Coverage with Integration tests only a bad practice?
I have recently come across a few codebases at work where the previous developers chose to reach the >80% coverage criteria by writing only integration tests with the @SpringBootTest annotation ...
1
vote
1
answer
111
views
Handling order Id In OMS system on application level [closed]
Situation: Order Handling in OMS System: In my OMS system, orders are pushed from an online platform with a unique orderId.
Since the orderId is generated by the online platform, I cannot make it auto-...
1
vote
0
answers
87
views
Best practice: slightly different logic on multi mapping endpoint
Suppose I've got a spring controller as follows:
⋮
@RestController
public class MyController {
⋮
@PostMapping(value = { "publicAPI/addItem", "internalAPI/addItem" })
...
2
votes
3
answers
728
views
Is there a way to avoid a lot of calls to other microservices from one single service request?
I'm developing a Microservices Web Chat Application using Spring boot and Websockets.
Right now my concern is the following: it seems like each one of my microservices need to make a lot of calls to ...
-3
votes
1
answer
144
views
How to format request and response
I am new to backend REST API development. I am creating the CRUD APIs for books using spring boot.
I have a model class lets say 'user'. It will have many fields, like id, name, email, status, ...
3
votes
2
answers
455
views
Populating Cache in microservices
These days I was asked by our technological leader to populate a cache.
The exact nature of the request impacts a back-end (BE) system that operates on a database through a client library.
The BE is a ...
-2
votes
3
answers
340
views
How do I build my application with high throughput in mind? (Need guidance)
I am building a Spring boot REST API app that is part of a microservice architecture project. What I am planning:
My app listens for events from two other services and after some business logic, ...
1
vote
2
answers
829
views
Handling Distributed Transactions with CompletableFuture in Spring
I'm looking for an opinion about an approach for dealing with distributed transactions. In a Spring Boot program, how can I implement the following business process without sacrificing to code ...
2
votes
3
answers
1k
views
How can I avoid duplicate annotations when validating both Entity and DTOs?
I am using the Spring Boot framework to create a RESTFUL API and I need a way to avoid the duplication of validation rules when using multiple DTOs as request/response objects for my endpoints.
Using ...
6
votes
5
answers
8k
views
What to cover with integration tests?
I'm working on adding unit/integration tests to an existing project (Java/Spring Boot) and I've been investigating on how they are "separated" in order to cover the test cases and how to ...
0
votes
0
answers
314
views
better structure of a software project to prevent circular dependencies
I am contacting you today regarding a recent problem with circular dependencies. It's about a Spring boot application that accepts data via a Rest API and then forwards it to an internal Spring ...
-1
votes
1
answer
1k
views
Microservices architecture for spring boot application
I have a Spring Boot application which is containerized. The application has become huge with lots of complications and its difficult to maintain it. So I am thinking of breaking it into microservices....
1
vote
1
answer
676
views
Designing Clean Architecture(Hexagonal) for a Spring Boot Application : Project Layout and Class Organization
I'm currently in the process of integrating Clean Architecture into my Spring Boot project and I'm seeking advice on the ideal project structure and the types of classes and projects that should be ...
-2
votes
1
answer
124
views
How to Implement Spring Boot Endpoint for Confluent Cloud-Like Batch Payloads?
I'm currently working on a Spring Boot application where I need to create an endpoint similar to the one mentioned in the Confluent Cloud documentation (link).
The cURL example provided in the ...
1
vote
1
answer
335
views
How to write custom implementation of a service/flow for a tenant in a multi-tenant microservice system?
I have a Java Spring boot microservice in production which supports multi-tenancy and the tenants are isolated at database level. This microservice exposes REST APIs for communication. During a ...
1
vote
1
answer
689
views
The recommended Spring Boot project structure leads to repetitive code
When implementing projects in Spring Boot (especially CRUD applications), I often find myself writing a lot of repetitive code that just calls functions and services from lower layers. For example, ...
-1
votes
2
answers
657
views
Where does a Spring Application reside in Hexagonal Architecture
During this weekend I read "Get Your Hands Dirty on Clean Architecture" by Tom Hombergs. I am working on a microservice that was born with Hexagonal Architecture in mind, so I was able to ...
-1
votes
3
answers
226
views
Choosing an Approach for Microservice Communications
I'm developing a doctor-patient system that consists of two microservices, namely the "doctor" and "patient" microservices. Both doctors and patients share some common attributes, ...
0
votes
1
answer
244
views
How to persist Objects with the same parent
I am trying to build a "world" consisting of Fields
for simplicity lets say there is a water and town field
i created two classes
@Entity
@Inheritance(strategy = InheritanceType....
0
votes
0
answers
606
views
What is the Best Practice for handling multiple Entities that behave identically?
Because I have multiple entities with unique fields, I need multiple repositories for each one even though each Entity will be handled exactly the same. What is the best way to handle these separate ...
1
vote
4
answers
5k
views
Multithreaded processing of single REST requests
Background:
We're providing an API that provides information about all users within a given group. Our API is a high level facade over another low-level REST API.
To gather those information we first ...
-1
votes
1
answer
428
views
When does a REST API stops being one in terms of state management?
As far as I understand, there is no certain boundaries for the RESTness of an API. However, I would like your help to understand how large and long (in terms of running time) a caching or state ...
-1
votes
1
answer
1k
views
What is the recommended approach for loading a Java Keystore from memory in a SpringBoot application running in a Docker container?
I am looking for a solution to load a Java Keystore dynamically from memory instead of from a file on disk. Can you suggest any libraries or best practices for this scenario in the context of Java, ...
0
votes
2
answers
1k
views
Best practice for storing a static pdf file in a web app
I've to store a static pdf with an user guide of my application.
I'm using Spring boot and Angular 12, what is the best way to store it?
Put the file on resource folder of Spring boot?
Put the file ...
-1
votes
1
answer
692
views
How to design my API that interacts with a third party API and persists to a database
I'm building a web app that will integrate with the Etsy REST API and persist information in a database for things like order information, listings, etc. Essentially a panel to manage Etsy orders and ...
0
votes
1
answer
3k
views
Spring Boot - How to return mocked data based on spring profile
I have a Spring Boot REST API application that uses different profiles like dev, test, prod, etc
It also makes a call to another API to retrieve some data like:
Client ---> MYAPI ---> ...
0
votes
1
answer
2k
views
JPA/Hibernate/Spring - What if M side of @OneToMany is not relevant for business logic?
I am writing a Spring Boot REST API using JPA, so I have my application layers consisting of
controllers
services
repositories
entities
models for request, response, DTOs
This question is mainly ...
0
votes
0
answers
1k
views
How does Spring boot and Postgres handle the concurrent updates?
I want to understand how does Spring Boot and Postgresql DB handle the concurrent requests for updating a value in DB. Consider this example of facebook likes, if there are multiple instances of ...
0
votes
2
answers
5k
views
Simple Java Spring Boot Cache for multi-container system
I have a requirement to cache some static data as it is being consumed by our system. There is a static API that gives a map of records and we are fetching the corresponding record based on request.
...
0
votes
0
answers
552
views
Spring Boot: Best approach for aggregating DTOs over multiple services
I have the following situation in my spring boot application:
I use unidirectional relationship modelling for my database entities, in order to prevent difficulties with a bidirectional approach. (...
4
votes
4
answers
1k
views
What are the advantages of externalizing application configurations?
I was learning about micro services with spring boot and came across spring cloud config server which is used to exernalise application configuration.The advantage it state is that one can change the ...
-1
votes
2
answers
498
views
How to deal with upsert PUT requests in a Spring Boot web application without crossing service and controller layers?
I've got a pretty simple web service that I need to add a PUT endpoint for that can handle upserts. This application is primarily a middleware layer to handle logging, caching and instrumentation in ...
0
votes
1
answer
49
views
Is there a set of guidelines on how to handle/code execution of Spring Microservices RESTful API calls?
I'm building a RESTful web api using Spring Microservices. I am following the Controller/Service/Repository Structure.
Where can I find some guidelines on what the responsibility of each class should ...
1
vote
4
answers
1k
views
Are static classes/methods good for pure business logic?
I have a service class that performs some operations.
One of the operations is a piece of code long enough to warrant extracting to a new class and unit test it in isolation:
@Service
public class ...
2
votes
3
answers
2k
views
What we called this design pattern and it is same as strategy pattern?
abstract class BaseService {
public void doSomething();
}
class AService extends BaseService {
public void doSomething(){
// Do something...
}
}
class BService extends BaseService {
...
2
votes
2
answers
13k
views
Is it a good practice to Mock entity manager in spring boot unit testing
I currently design an API using spring boot. In my service layer, I use Entity Manager for accessing the database. I have provided a method in my service layer below as an example.
public Object ...
0
votes
0
answers
128
views
Design : How to divide the responsibility in micro services
I have two micro services built using spring boot,
One micro service is: "payment" Which handles actions related to payments.
Like creating a payment link.
Getting the latest status of ...
0
votes
1
answer
427
views
How to design a rest api for updating collection(ArrayList) of Resource in Spring boot?
I have a resource called Client and it has the following attributes id, name, redirect URLs(ArrayList).
class Client{
int id;
String name;
List<String> redirectUrls;
}
I have all CRUD ...
0
votes
1
answer
572
views
How to define API notations for multiple tables data in the response
The question is specific to the API notation shown in the screen under the heading Table Name with the comment Joins Multiple Tables. I am using Spring Boot with JPA (Database: RDBMS)
I have defined ...
2
votes
1
answer
3k
views
Implementing transactional entity lockouts with Spring and JPA
Spring Boot/Java 8/MySQL here.
I have a widgets table in my MySQL DB that is modeled by a JPA entity like so:
@Entity
@Table(name = "widgets")
@Data
public class Widget {
@Column(name = ...
0
votes
1
answer
4k
views
Blacklist JWT tokens or whitelist JWT tokens
I am working on a Spring Boot web application. The REST APIs are secured by JWT tokens. Currently I have only access token generated (not implemented refresh token concept).
My question is related to ...
1
vote
2
answers
439
views
In Publish-subscribe pattern can a microservice publish message for itself
I am designing a somewhat complex flow in publish subscribe pattern using AWS SNS, SQS , Microservice and Lambda functions. To break the whole flow into multiple logical & smaller sub-flows I am ...
0
votes
2
answers
110
views
What's the right way to handle authentication of users across 2 web applications
There are 2 independently functioning web applications. Web-app1: (Flutter+Django+Postgres). Web-app2: (Angular+Spring+Postgres). Each of the web-apps has its own user database and are functioning ...
0
votes
2
answers
1k
views
Which design pattern to use to make a mix of in-sequence and parallel HTTP calls?
We have to make a bunch of HTTP calls from Java/Spring-Boot application which will be mix of in-sequence and parallel.
Level 1 : We make 3 parallel calls to Services 1 , 2 and 3
Level 2: After service ...
0
votes
1
answer
491
views
How to use single Spring-Boot instance to cater to multiple environments?
We have a Spring-Boot Web application currently deployed to 7 environments (DEV, SIT, UAT, Pre-Prod, Prod, etc.). This application connects to other REST services, which has different URLs for each of ...
2
votes
4
answers
2k
views
How to compare passwords which is stored in DB in encrypted form in secure way?
Recently In an interview I was asked this question -
Question- If are storing passwords in encrypted format in DB and in future when user login into our website how will we perform authentication?
Me:...
0
votes
1
answer
312
views
Does it make sense to create a WAR anymore?
This is more specific to spring boot projects and applications whose main USP is its APIs. Now that we can simply create a JAR file deploy it anywhere, what is the point of WARs? Is there a specific ...