Questions tagged [spring-boot]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
9 votes
2 answers
8k views

Should I validate dtos or entities? [closed]

I want to place validation in one layer for the reason of simple code maintenance. I was thinking of entity validation, cause this protects directly database. Am I right, or should I add validation ...
user avatar
  • 201
7 votes
3 answers
5k views

Is it a good idea to share repositories across microservices in Spring Boot Application?

We are migrating a desktop application into web based Spring Boot micro services application with a client imposed mandate of using their existing MySQL database, so all micro services share a common ...
user avatar
4 votes
1 answer
1k views

Spring Boot - What is the purpose of Autowired Constructors?

I’ve been developing in Spring Boot for just over a year but have yet to understand the benefits of using an Autowired constructor and I was wondering if someone could explain this to me and what ...
user avatar
2 votes
4 answers
605 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:...
user avatar
  • 147
2 votes
4 answers
226 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 ...
user avatar
  • 129
2 votes
2 answers
2k views

Spring Boot REST Java Microservice: Why Use Maven Submodules?

I have seen a project which uses Maven submodules. The project itself is a spring boot application that exposes Restful API endpoints for a microservice ex: Customer Service (getCustomers, ...
user avatar
2 votes
3 answers
463 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 { ...
user avatar
2 votes
3 answers
100 views

A question on microservice boundaries around monitoring

I have a microservice, lets call it microservice A. It talks to another microservice's REST endpoint, lets call that one microservice B. I'm monitoring the health of microservice A using the ...
user avatar
2 votes
1 answer
866 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 ...
user avatar
2 votes
0 answers
230 views

Send push notifications from ActiveMQ

I am trying to figure out how to send push notifications back to the client in the following ActiveMQ scenario: I have a spring boot web application #1 deployed on tomcat on RHEL server. From the ...
user avatar
  • 151
1 vote
2 answers
2k 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 ...
user avatar
1 vote
2 answers
160 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 ...
user avatar
1 vote
2 answers
833 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 ...
user avatar
  • 121
1 vote
4 answers
321 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 ...
user avatar
1 vote
1 answer
141 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 = ...
user avatar
1 vote
2 answers
957 views

How to share entity classes (JPA) among projects, where not all have DB access?

So, I have project in which several WebServices will be created (REST). For the sake of simplicity, Lets name them A, B, and C. A and B handle different tasks, but both of them consume C, which is the ...
user avatar
1 vote
1 answer
131 views

Spring Boot Controller Unit Test Strategy

All of the controllers in our project are as dumb as we can make them. Rightfully so, they simply validate the incoming payload, hand the request over to a service layer, and return whatever response ...
user avatar
  • 111
1 vote
0 answers
50 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 ...
user avatar
1 vote
0 answers
70 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 ...
user avatar
1 vote
0 answers
25 views

Spring Security SAML and RSA session

This is probably a design/architectural question. My app uses RSA initiated SSO using SAML for authentication and from there on my app uses its own session to manage the request. There is a flaw in ...
user avatar
  • 119
1 vote
0 answers
557 views

Design of Spring boot endpoint that returns large amount of data continously until complete

I'm developing a web application using Spring Boot and React, that needs to return information about hotels from different cities: As an input of the controller, I receive a list of cities that can ...
user avatar
  • 137
1 vote
2 answers
576 views

How to abstract the data layer when using Spring Data?

I have decided to try to create my own board game implementation. Probably going to use a REST-api to expose the contract. I'll figure out what database, communication, ... tools I'm going to use once ...
user avatar
1 vote
0 answers
73 views

How to build Spring Boot multimodule app build to separate WARs and shared library/dependencies?

Currently, I'm trying to migrate multimodule angular + spring 4 app build with ant and ivy to Spring Boot and build it with Gradle. The issue is that I don’t how to create build upon some custom ...
user avatar
1 vote
2 answers
219 views

How to design a process and use the business rules for sending alerts/notifications

Currently working on designing a process which demands me to send alerts like email notifications to the users which meet a business criteria(we can also call business rules). I want to make this ...
user avatar
0 votes
2 answers
189 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 ...
user avatar
  • 119
0 votes
2 answers
2k views

Using Spring Boot's @ConfigurationProperties without violating Law of Demeter

My apps commonly have one or more prop holders. These holders contain config data used in the app such as: @Component @ConfigurationProperties(prefix="app.orders") @Data //lombok public class ...
user avatar
  • 285
0 votes
1 answer
111 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 ...
user avatar
  • 143
0 votes
2 answers
131 views

Microservices: how far should coupling / decoupling of application parts relying on the same data backends go?

I am in the process of migrating a pretty much monolithic PHP application to microservices. With the development pipeline, docker containerisation, CI/CD and scalability in mind, what would be the ...
user avatar
  • 133
0 votes
1 answer
86 views

To And From Date Validation in Model

In my Springboot project I need to perform a validation of the type validFromDate<validToDate. I was wondering whether would it be a good or bad practice to place a validation in the model itself (...
user avatar
0 votes
1 answer
31 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 ...
user avatar
  • 753
0 votes
1 answer
178 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 ...
user avatar
  • 103
0 votes
2 answers
68 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 ...
user avatar
  • 3
0 votes
1 answer
134 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 ...
user avatar
  • 119
0 votes
1 answer
91 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 ...
user avatar
0 votes
1 answer
348 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 ...
user avatar
  • 103
0 votes
1 answer
55 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 ...
user avatar
  • 109
0 votes
1 answer
99 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 ...
user avatar
0 votes
1 answer
131 views

Is an antipattern returning differente objects in a single rest method?

I have seen around the Internet several rest web services with the following behaviour. In case there are any errors, they return a Error object, otherwise they return, say, MyClass. See the ...
user avatar
0 votes
1 answer
5k views

Is it okay to have one Service with two different Repositories in Spring Boot MVC?

I have a backend Spring Boot API that should have one(?) endpoint that returns some statistics to display in a frontend. These statistics are calculated from data that comes from two different ...
user avatar
  • 109
0 votes
1 answer
2k views

In a Spring Boot Project, would you use interfaces for entities or not?

I am currently on the decision, whether to use interfaces throughout my whole spring project or not. I scouted some open source projects and saw, that many big projects are handling that quite ...
user avatar
  • 11
0 votes
0 answers
23 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 ...
user avatar
  • 109
0 votes
0 answers
46 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 ...
user avatar
0 votes
2 answers
67 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. ...
user avatar
0 votes
0 answers
77 views

Which design to follow to override a flag from a jar in the application using it?

At my workplace, there are lot of Java/Spring/Spring-Boot based applications which have a common jar added as maven dependency. This common jar is always used as a SNAPSHOT dependency and I am not ...
user avatar
  • 119
0 votes
0 answers
47 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. (...
user avatar
0 votes
0 answers
35 views

For a SpringBoot REST API + React frontend independent CORS project, best method to implement messaging between users?

I have been looking into adding the messaging functionality to my application and I have been struggling to figure out the best approach to take. Everything seems very heavy and complex, I have been ...
user avatar
0 votes
0 answers
57 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 ...
user avatar
  • 101
0 votes
1 answer
71 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 ...
user avatar
0 votes
1 answer
1k 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 ...
user avatar
0 votes
0 answers
301 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 ...
user avatar
  • 9