2022 Developer Survey is open! Take survey.

Questions tagged [spring]

Spring is a module based open source framework to build robust Java / Java EE applications.

Filter by
Sorted by
Tagged with
-2 votes
0 answers
16 views

Refresh code changes on multiple instances w/out restarting service in a Java Spring Boot Application with spring-actuator & bus refresh with Kinesis

I want to refresh/reload configuration changes without restarting the service. I have microservices built on Java 8 and Spring Boot. I have decided to achieve this with the help of **spring-boot-...
user avatar
-1 votes
1 answer
78 views

API request and response from event consumer

How to expose an API using the traditonal request-response style while internally it handles it in event driven way (pure or partially event driven), given that if callback style may not be possible ...
user avatar
  • 109
-1 votes
2 answers
56 views

Best practices for API design for an E-Commerce System

I have a few basic questions on how to implement an API for a basic e-commerce system. The relevant entities are Customer, Puffle, and Review. Each Puffle can have zero or more Reviews. Each Review is ...
user avatar
0 votes
1 answer
23 views

Modularized authentication providers for Spring application

At our company, we have multiple products which share authentication settings. In particular, we use Spring LDAP, but since our use case and configuration is more complex, we would like to use ...
user avatar
  • 300
0 votes
1 answer
73 views

Am I understanding OAuth2 correctly and is what I am trying to achieve possible?

I am creating a web application which has three distinct components as far as I understand. A Nuxt frontend, and Spring Boot backend and Google OAuth2 for authentication using OpenID Connect. Nuxt can ...
user avatar
0 votes
0 answers
26 views

Securing an API in production with Spring Security

At work I have to develop an API that queries data from a Hbase Cluster. They asked me to implement basic authentication in order to secure this API. The use case is very simple. For the moment we ...
user avatar
0 votes
0 answers
34 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
1 vote
4 answers
204 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
0 votes
0 answers
53 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
1 vote
3 answers
99 views

Exposing multiple classes from the representive package for one entity

I have a simple app for storing the movies, that exposes REST API. I am using spring-boot. I am using this simple app as an example, however, the question is more about general good practice. I am ...
user avatar
  • 181
0 votes
0 answers
47 views

Spring Cloud Gateway - combine service-to-service authentication with user authentication

We are trying to find the best option for applications from the Public Cloud being used by corporate (internal users) to be able to make authenticated calls to APIs published in the internal network. ...
user avatar
  • 9
0 votes
0 answers
45 views

How should I handle keys in production

I'm creating an authorisation service, which does signing using a key. For local development I was randomly generating a key on application start-up. Now I'm deploying to the cloud (currently going ...
user avatar
1 vote
1 answer
89 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
0 votes
3 answers
265 views

Is it an anti-pattern to extract common configuration code as a library and reuse it across microservices?

Is it an anti-pattern to extract common configuration code as a library and reuse it across microservices? I am breaking down a monolith app into a few of microservices. What I stumbled upon is: since ...
user avatar
  • 27
0 votes
0 answers
326 views

How to draw internal patterns used by the Spring boot framework in UML class diagrams?

I am currently in university and doing some practical work as a module. The professor demands that we work with the waterfall model and we are currently in the design phase. The requirements for the ...
user avatar
  • 131
0 votes
3 answers
391 views

Frontend/backend SPA communication: how to handle a list of string options

I have single page application with an Angular frontend and a Spring REST-backend. What is the proper way to handle a list of string-based options in the fronted the enduser can select from, which ...
user avatar
0 votes
1 answer
49 views

How best to structure my Service/Repository layers when persisting a Many to One object?

I'm working on a project where I need to do CRUD operations on Book and Library objects. Naturally the relationship between Book and Library is Many to One, like so: @Entity @Getter @Setter @...
user avatar
1 vote
1 answer
740 views

Authentication with JWT in HTTP only cookie without refresh token

The motto of the upcoming question is "I don't know what I don't know". I would like to know if there are downsides or security risks with an authentication implementation. Right now, I'm ...
user avatar
0 votes
2 answers
178 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
  • 111
0 votes
0 answers
61 views

Using JWT token to create spring session

I have a web application like this: An angular frontend for client and a spring MVC backend for admin panel. A angular web application requests a JWT token from tomcat/spring MVC. The angular ...
user avatar
0 votes
1 answer
120 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
  • 111
-2 votes
1 answer
81 views

Approach to build a modularity Java (Web) Application

I'm on the way to build a modular Java web project with some pluggable modules - like Jira and Confluence for example. My first thought was to build a project with Spring and OSGi, I started finding a ...
user avatar
  • 265
2 votes
4 answers
498 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
0 votes
2 answers
96 views

Interface and Implementation Classes

I know various forms of this question have come up before, but none of them quite seem to answer in a way that I can apply to / understand in relation to what I regularly see others doing. ...
user avatar
0 votes
1 answer
107 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
1 answer
314 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
0 answers
54 views

How can I design a secure content verification web application?

In my country, there is a high number of fraudulent doctor's sick letter as they are manually written on paper. I'm designing a web application to combat this issue and have the whole process ...
user avatar
2 votes
0 answers
174 views

Determining when to use Serverless vs Containerized application (AWS Lambda vs ECS) - Is Java Spring dead?

I work for an organization that heavily leverages AWS. There is a strong push that every team move from containers deployed on ECS to leverage AWS Lambda and step functions for (almost) every project....
user avatar
1 vote
1 answer
108 views

What are the best way to publish application event in a spring boot application?

My goal is to collect/publish different types of information from the application. We use Kafka for the event bus. Consider the following sample code. class UserService { public User ...
user avatar
2 votes
1 answer
2k views

Best way to handle lazy models with mapstruct and spring transnational scope

In a typical Java Spring Web APP: we have the following layers: Model [DB Models] Repositories [where you have queries to DB] Services [Business service where you have the @Transactional annotation] ...
user avatar
  • 341
1 vote
0 answers
44 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 votes
3 answers
432 views

Should methods with business logic be made private? [duplicate]

So I am writing a project using Spring Boot. All of my logic resides in @Service classes. I have separated each service class based on entity. For example - If I have two independent entities A and B, ...
user avatar
  • 143
0 votes
1 answer
76 views

Structure and placement of a exporting module

Its an infrastructure monitoring application. We have a spring boot (2.x) based Service Oriented Architecture (SOA) with multiple modules in our project and the center point is a REST services module ...
user avatar
  • 49
1 vote
2 answers
290 views

Confusion about layered architecture

Given a layered architecture consisting of presentation layer business logic layer data (access) layer and a SPA web application communicating through REST endpoints with the backend (eg Angular and ...
user avatar
  • 27
1 vote
2 answers
183 views

Authenticating requests from third party users to our APIs

We have a web app which has certain APIs. Users of our webapp will use these APIs when they login to our webapp (like how many records me as a user do I own, user specific, etc). We are creating ...
user avatar
  • 119
2 votes
0 answers
459 views

How to achieve both: clean (hexagonal) architecture with JPA goodies?

How do I achieve two things at the same time writing Java Spring Application: Clean Architecture JPA goodies (@Transactional, Optimistic Locking, dirty checking, etc.) I like the idea of database/...
user avatar
3 votes
3 answers
253 views

Layered architecture horizontal dependencies

I'm working on a spring boot REST service. It's divided into three layers: REST controllers, services, persistence/DAO. We have multiple services and persistence repositories. We have the following ...
user avatar
  • 39
1 vote
1 answer
107 views

Where to handle duplicate key exceptions in multy layer application

+-------------+ +--------+ +----------+ | repository +-------->+service +------->+controller| +-------------+ +-^------+ +------------+ +-------------+ | ...
user avatar
0 votes
1 answer
5k views

Best practice for references in DTOs and entities in Spring

Given the following architecture and frameworks: Spring Boot Application with Spring Data JPA (Hibernate is used as OR mapper); layered architecture as followed. REST layer Service layer Persistence ...
user avatar
  • 27
0 votes
2 answers
1k views

How to design front-end to handle multiple back-end versions

In my company, we're using Spring Boot to implement backend API and React to implement frontend including Web interface and Android/iOS apps. Since our product is an Enterprise software, customers ...
user avatar
  • 245
4 votes
2 answers
456 views

How to avoid DI dependency cycle for observer pattern

In my project I'm using the observer pattern in several places, i.e. the subject notifies the observers about something, and expect them to act. The subject does not know anything about the details of ...
user avatar
  • 159
1 vote
2 answers
110 views

Web server archicture

This may seem like an odd question but it's something I've yet to find a "proper" answer for. I've tried googling but I don't get anything useful (maybe I'm looking for the wrong terms). I'm ...
user avatar
1 vote
1 answer
299 views

Spring Boot/Batch: Should every Job be separate Maven module?

I'm building a backend service powered by Spring Batch which enables to define and Jobs. Currently, I have several jobs, that essentially, aren't related one to another. So, I have one application....
user avatar
  • 89
2 votes
1 answer
418 views

How to build a modular/extensible Spring Boot application?

I'm developing a Spring boot / Batch application. What I'd like to do is to have a separated module for every job. This is a reasonable decision because different tasks (Spring Batch Job) have ...
user avatar
  • 89
1 vote
0 answers
4k views

Spring Data MongoDB: Update document based on multiple identifiers with Composite ID vs. MongoTemplate upsert vs. MongoRepository find & save

I'm wondering for best practices to upsert a document based on two identifiers. @Document(collection = "cars") public class CarEntity { @Id private ObjectId id; private String ...
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
-1 votes
2 answers
151 views

is this microservice design fine?

I have recently decided upon a micro service design to merge two Spring Boot applications. I basically have 2 applications that deliver two entirely different front ends, but share user accounts. ...
user avatar
  • 13
3 votes
2 answers
531 views

Where to save JWT token?

We(in my company) use to save the JWT token in the cookie. The web application is on Spring boot + JSP application. So the flow is, in a successful login service send a JWT token, that token has been ...
user avatar
2 votes
1 answer
115 views

Handling OAuth 2.0 access token

I am creating a rest template to consume REST API secured by OAuth 2.0. The provider has implemented an expiry for the access token for 5 mins. So Using the rest template, I will be calling the ...
user avatar
0 votes
1 answer
75 views

Where Should You Add a Shared Maven Module as a Dependency in an N-tier Architecture

In a simple web architecture using Spring and Maven where it consists of following layers: Controller Service Repository Shared Where in shared module all the classes that are used among different ...
user avatar
  • 165

1
2 3 4 5 6