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
0answers
20 views

Java spring DefaultMessageListenerContainer and dynamic queues

We have a number of message queues (ActiveMQ) feeding our system and for each one we have a Spring DefaultMessageListenerContainer receiving the messages from the queue (set up in code, not XML). We ...
-1
votes
3answers
85 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, ...
0
votes
1answer
45 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 ...
1
vote
2answers
126 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 ...
1
vote
2answers
74 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 ...
0
votes
0answers
76 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/...
0
votes
0answers
8 views

Scale spring-batch instances executed from within a web container

I am re-designing our current ETL for file ingestion where spring-batch containers will be deployed on Kubernetes. Each file type is processed by a different job, which will be triggered on demand via ...
0
votes
0answers
21 views

How to support alternative behaviour at the end of a pipeline when the new behaviour is decided at the beginning?

Let's assume we have a few loosely coupled components that form a pipeline. At the end is an file generating component. A new requirement comes in that requires an parallel alternative behaviour for ...
2
votes
3answers
81 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 ...
0
votes
0answers
96 views

Eureka cluster for service registry with only one IP address

I want to use the Eureka cluster with service discovery. As it said in the documentation, Eureka's nodes can share their state with other nodes. If one Eureka node fails, others still have all ...
1
vote
1answer
49 views

Where to handle duplicate key exceptions in multy layer application

+-------------+ +--------+ +----------+ | repository +-------->+service +------->+controller| +-------------+ +-^------+ +------------+ +-------------+ | ...
0
votes
1answer
272 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 ...
0
votes
0answers
26 views

Spring JPA shared repositories - do I need an intermediary data access point?

I am developing multiple Spring Boot projects that share the same DB, and therefore Entity and Repository classes/interfaces. The Entities and Repositories are stored in a "common" library so that one ...
0
votes
2answers
90 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 ...
3
votes
2answers
186 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 ...
1
vote
2answers
97 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 ...
1
vote
1answer
79 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....
2
votes
1answer
102 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 ...
0
votes
0answers
1k 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 String id; private String color; ...
0
votes
0answers
24 views

Database design and Spring fetch type eager

I am working on an application Angular/Spring boot. This is the database shema (there were minor changes) In the backend part (Spring boot) we are using fetchtype eager, it means when i load mission ...
-1
votes
1answer
583 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 ...
-1
votes
2answers
138 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. ...
2
votes
2answers
208 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 ...
2
votes
1answer
86 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 ...
0
votes
0answers
14 views

Organizing spring profile : specific case with unit test and multi module

This could be viewed as a follow-up of Organizing maven modules and spring profiles with a more specific case. I currently have an application with a GUI (mix of Swing for Cartography/JavaFX/Spring). ...
0
votes
0answers
32 views

Can reactive streams simplify API development even for low-scale applications?

The mainstream opinion about using a reactive non-blocking backend is that it increases performance for large numbers of clients but sacrifices maintainability due to increased complexity. I am in a ...
0
votes
1answer
34 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 ...
1
vote
2answers
84 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 ...
0
votes
0answers
44 views

Certificate Management in Multiple Microservice Spring Boot Servers

Let's assume we have multiple microservice Spring Boot (2.x) applications (Spring MVC with Maven build management) where they are accessed by clients. All of the microservices expose REST APIs, and ...
3
votes
1answer
176 views

Is this a good design for wrapping asynchronous API calls into a RESTful interface?

I'm working with an API that has many asynchronous calls and handlers. I'd like to extend these with a RESTful interface and endpoints in spring. I'm imagining the usual Controller and Service layers, ...
1
vote
0answers
16 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 ...
-1
votes
1answer
55 views

If you use Spring dependency injection does the unit test require some Spring stuff?

I completely understand, I think, how injecting a dependency of a class allows that dependency to be mocked and the class to be tested with the mocked version. What I am not sure about is if you use @...
-3
votes
1answer
90 views

Should vanilla solutions be avoided in Spring web applications?

I am making a Java and Spring webapp that scrapes data from a web and then publishes it through an API. Some of the raw scrapped data is in the form of Set<SomeObject> which I then convert to a ...
1
vote
1answer
76 views

Best approach to handle user statuses and keep their history

I am developing a Spring application which has a few different modules. There will be a bunch of users added in the database. I want to add a feature, which will allow me to track users' availability,...
-1
votes
1answer
117 views

What is the best practice to insert two similar records in sql server db table which will be sent to two different destinations?

I am working on parsing a file and inserting records into SQL Server DB.The database table structure will be something like this: A Users table which contains (id, name, address, destinationName,...
0
votes
0answers
27 views

Microservices: Changing DB Usernames at Runtime and Carrying Session Settings Across Other Services

Currently, our database is a shared database separate schema. Under the current architecture, all users start at the entry schema, which we called as APP, before the identity of the user (upon ...
0
votes
0answers
34 views

Test a Spring @Service that uses Specifications?

I defined a User entity as follows. @Data @Entity @EqualsAndHashcode(of = {"id"}) @NoArgsConstructor public class User { public User(@NonNull String username) { this.id = UUID.randomUUID....
0
votes
0answers
62 views

oauth2 + angular - Most elegant way to pass the JWT auth token

I have an angular application, which is querying an API as a client (written on Spring Boot 2.2.1 + Spring 5.2.1) that supports 3rd party authentication over OAuth2. The API has altogether 3 different ...
0
votes
0answers
40 views

Is it a good practice to store session in two different places?

I have a use case like this and I am wondering if this solution is a good practice or not. Say I have a website called dashboard.com and this is only for US region. When users login here, I am ...
8
votes
3answers
2k views

“Depend on abstractions, not on concretions” what is the exact meaning of this term

I was reading SOLID principles on a website, in which for D - Dependency Inversion Principle it says: “Depend on abstractions, not on concretions” In other words. we should design our software in ...
3
votes
1answer
76 views

How would I approach collecting statistic across a method call chain?

Let's say I have an processing pipeline. It receives a file, converts the file to data, interprets the data, and then persists it. At every step of this way, I would need to collect statistics, so I ...
0
votes
1answer
140 views

How can we better maintain a large amount of DbUnit datasets?

The project I'm currently working on a Spring Boot project, and I have a question regarding testing against the database. Our testing tech is currently JUnit 4, Mockito and DbUnit, and we test ...
0
votes
3answers
148 views

What typical hardware improvements can be made to improve a Web app's performance?

We have a Single-Page (SPA) Ajax-based Java Spring/Hibernate app running in Tomcat 8.5. The app's performance is acceptable, but not lightning-fast. A typical Insert Record takes 3-4 sec., e.g. 05 ...
-4
votes
1answer
737 views

What do you think about DTOs in Spring Data JPA project?

First of all, I am not a junior programmer. I'm just looking for best-practice. How do you use entities and DTOs into your Spring Data JPA projects? Assume there is our layers: Repositories (as ...
2
votes
1answer
156 views

Better practice of workaround for implementing a type field in Java

We have a class in our company's main library as follows: public class User { private long id; private UserType type; // Getters, setters, constructors, etc. } and have several options ...
4
votes
2answers
193 views

How to write dynamic (non ORM) repositories that can return only the necessary data without creating many methods or data-objecs?

We're currently developing a Spring application that uses jdbcTemplates for the repository. We have a lot of functions that only require specific combinations of columns in our database. It would be ...
0
votes
1answer
596 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 ...
1
vote
2answers
183 views

Angular + Spring Application

I use Spring for backend work and Angular for frontend and maintain each in separate repositories. This was because I considered both the frontend and backend completely separate projects, IE a new ...
0
votes
1answer
3k views

Jpa Repository save inside a for loop

I have this requirement: Csv Upload (using opencsv) Should display if the record is inserted (if it doesn't exist in the db) or updated (if it exists). Eg.: 5 records inserted 2 records updated. ...
1
vote
1answer
266 views

JHipster generated endpoints adds header messages

I'm adding new functionality to an existing application it was done using JHipster. I've notice that some endpoints follow this pattern: return ResponseUtil.wrapOrNotFound(updatedUser, ...

1
2 3 4 5 6