Questions tagged [spring-boot]
The spring-boot tag has no usage guidance.
81
questions
-2
votes
0
answers
88
views
How to handle a Spring service class too big? [closed]
I have a Spring Boot app with a fat service implementation ServiceImpl that throws the Sonar issue :
Classes should not have too many methods
The service has two public methods: create() and update()...
0
votes
1
answer
60
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 ...
-1
votes
0
answers
29
views
Spring Reactive Restful APIs - Is it really a non-blocking model?
I know that is possible to build my entire Spring boot application in reactive way.
So if my application uses R2DBC, I can do something like:
@Repository
public interface PersonRepository extends ...
-2
votes
1
answer
50
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 ...
0
votes
0
answers
53
views
Should we use sessions instead of bearer tokens with OpenID Connect server-side authorization code flows?
I want to build an app with a SPA (Angular) frontend and a REST API (Spring Boot) backend.
I want a modern account system for this app: users log in through OpenID Connect, using either a social login ...
0
votes
1
answer
73
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
176
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
157
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
132
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
76
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
146
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 ...
0
votes
1
answer
1k
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
134
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
398
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
402
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
421
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
863
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
862
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
643
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
2k
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
341
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. (...
2
votes
4
answers
544
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
261
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
35
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
951
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
825
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 {
...
1
vote
2
answers
7k
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
104
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
197
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
408
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 ...
1
vote
1
answer
1k
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
2k
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
256
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
73
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
514
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
279
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
1k
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
146
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 ...
-1
votes
2
answers
939
views
How to have dependency between two different microservices?
I am implementing quora like application in which I have Post(question, answers, comments, likes/dislikes) as one microservice and User details as another microservice. I need user details in the post ...
0
votes
1
answer
129
views
Direct communication between message-driven bounded context
My project comprises of serveral bounded context which communicate with each other with RabbitMQ
The front end of the project is written in C# and the backend is in Java.
The RabbitMQ communication ...
2
votes
1
answer
1k
views
Refresh tokens by example using Angular and Spring Boot
I am designing out an app that would have an Angular frontend and Spring Boot (Java) backend.
I was considering (but not married to) the prospect of JWT-based authentication:
User logs in with ...
3
votes
2
answers
2k
views
Can DTO have helper method that operates on DTO fields?
I wonder where to add method that reads my dto WindowDto.getPath().getPoints() and based on this collections returns some value (that value will be needed in some different srevices in my app):
public ...
0
votes
1
answer
443
views
Spring Boot + MongoDB project structure and database creation
I'm planning to start a new Spring Boot project with MongoDB. I'm very familiar with Spring Boot, but all of my past projects used MySQL.
Each of my projects has the following directory, that holds ...
0
votes
0
answers
507
views
Spring boot, n-tier layer structure naming conventions
I am currently developing a huge project in my company with N-Tier Layer architecture using spring boot but I can not sure about the package and class namings. In our project, we have a complex ...
0
votes
1
answer
104
views
Normalize timestamp values or have multiple SQL queries
I have a Spring Boot application to implement a RESTful API. One of the GET requests have two query parameters: from and until (of type date). Those parameters are optional, so user-agents can send ...
1
vote
0
answers
110
views
Reusable module using spring framework with spring-boot application modules?
I have a maven module which will handle DB interactions for various scenarios. I want this module to use spring framework so we can leverage the standard DI and integration test capabilities. This ...
-2
votes
1
answer
309
views
Handling Legacy Database with Spring Boot Java
We are given a task to create an Web Service API for a mobile application. The problem is we have to use a legacy database that is not normalized and its very tedious to work with. We are accustomed ...
1
vote
0
answers
80
views
Multitenancy - Multischema DB and should we handle by individual microservice basis?
I am looking into the revamping my organization's application by moving from a monolithic into a microservice-architecture. My database is a multi-schema shared in one database. Each of these schemas ...
-1
votes
2
answers
736
views
Common library for classes and communication between microservices?
I have been working on a project that is being built around a microservices architecture. We are thinking on using a message broker, such as RabbitMQ, for both synchronous (via RPC) and asynchronous ...
0
votes
1
answer
153
views
Implementing a user ID system like Discords for a web app using Java Spring, JPA, Hibernate and MySQL
I’m trying to create a web application with a forum and user profile along with other functions. However I’m thinking about how I might implement an ID for each user. The best way I’ve seen other ...