Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

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

0
votes
1answer
80 views

Best approach for web service that calls other web services

The scenario is: client makes request to server A Server A makes potentially multiple requests to server B. Edit to clarify, server A makes the requests concurrently using Futures. Server A blocks ...
0
votes
1answer
25 views

Best way to handle environment specif fields in Hibernate

We have one microservice that will be deployed on two different environments(A and B). There are some common fields and also some are specific to the environment. Example: SomeEntity for environment ...
0
votes
1answer
26 views

Spring Boot - Extending 'Base' or 'Common' JARs

Here is the situation at work: We have a 'framework/patchwork' team that is responsible for setting up . However it is hardly consistent. Recently, we received implementation for work that did not ...
-1
votes
0answers
24 views

Creating a simple web page for member submission [closed]

I worked only with Java Backend before, so at the first time doing web dev, i have some questions. Goal : To create a simple website where user can register information and save it into database. My ...
1
vote
1answer
48 views

Where to store static contents

Recently I am developing a new feature for my web application that must be Release Independent. The feature requires to show some predefined data. Those data will rarely be changed or updated. Here ...
1
vote
0answers
27 views

How to make rest api end points in swagger UI pre authenticated in Spring BOOT

I have written a spring boot rest API application with OAuth.I have integrated swagger UI for API documentation. I want the API endpoints on swagger UI to be accessible without an access token. Please ...
1
vote
3answers
87 views

HATEOAS APIs and front end development

We are developing a tool from scratch based on a Spring backend and VueJs frontend. I am primarily working on the backend and came to know about the HATEOAS principle of developing REST APIs and ...
1
vote
2answers
48 views

Returning JPA Entities in Rest Api's?

Recently Ive seen so many devs working with the stack Spring/JPA and returning all these JPA entities on their rest controllers. In my opinion it's a BAD PRACTICE for several reason such: ...
1
vote
2answers
164 views

Is it okay to put all your error handling on facade layer?

I am doing a Java Spring-Boot backend project and I am implementing a controller-facade-service pattern on my structure. So is it best to put all my error handling on the facade layer, while the ...
-1
votes
1answer
188 views

what is the use of DTO instead of Entity

I am working on RCP application, I am new to this application. Spring beans are used to write business logic to save/fetch entities. But, instead of sending entities directly to client we are ...
1
vote
0answers
44 views

Putting the rowmapper inside the domain class

Normally in java the RowMapper is placed in its own class. Instead, what about this design, putting the RowMapper inside each domain object, and giving all of them a consistent name: public class ...
1
vote
0answers
44 views

Maven plugin to operate at parent and child module levels?

I have a large multi-module java/maven application where each child module is it's own java application and the root parent pom defines the standard dependencies pom.xml - parent pom - child1/pom.xml ...
3
votes
1answer
101 views

IEC 62304, Are Software Frameworks (Spring/JEE/Angular/React) considered SOUP?

Im working on the implementation of an IEC 62304 compliant development process in our company and I have a question considering SOUP (Software of unknown Provenance). Our goal is the develop a web ...
0
votes
0answers
42 views

API searchable with pagination and faceting

I have a Rest API that enables searching/sorting/faceting and pagination using spring data solr and spring web. I have managed to produce a json output like: { "_embedded": "objects": [ ...
3
votes
3answers
113 views

Handling domain errors in the API

I'm working on building an API interface on-top of a domain-driven architecture. The domain layer has a bunch of specific exception classes (i.e. NameIsRequiredException, CannotPublishDraftException, ...
1
vote
2answers
153 views

How to correctly split a monolith and rely on the same domain

Context I'm developing a Spring Boot java application. Currently it is a monolith with the rest API and the front end (vaadin driven) in the same big project. Although this is very easy to develop ...
0
votes
0answers
406 views

Repository vs. DAO (again)

In general this back-story does not matter but just to explain the code below: The server handles users and user groups. User groups are able to "discover" places - at this point in time these places ...
0
votes
1answer
95 views

Given an implementation of a Service Layer and Repository layer, should you make tests of both?

Currently I have an entity called Product with the respective ProductRepository and ProductService. For ProductService, I have tests for: Read (Covering Create too) Update Delete Besides achieving ...
0
votes
1answer
1k views

Data Objects for each layer(DTO vs Entity vs Response objects)

Let's say I'm building a Customer web application(in Spring Boot 2), which also exposes rest end points. I'm modeling my application into 3 layers. 1) a) UI - CustomerDTO b) REST - ...
0
votes
2answers
70 views

Spring application context - dependency chaos

I am new in a team working on a grown and complex Spring MVC application. The application context is widely wired using @Autowire annotated constructors. This seems to be the main reason for the issue ...
0
votes
0answers
108 views

Scoped beans as dependencies - Use proxy or make it dependent/prototype scoped?

Regarding overall performance, when used as a dependency of a higher scoped bean, is it better to downgrade a bean scope to prototype or dependent instead of using proxies? Consider a scenario where ...
2
votes
1answer
164 views

What is the better place to create the Binding and Queue on RPC communication: Consumer or Producer?

I was talking with part of my team about the responsibility for who own the Binding and Queue creation. We are using Spring framework. In async communication they agree that the responsability to ...
0
votes
1answer
113 views

How to not leak the auditing information to the business layer

From a REST API, we write to the database. We want to store who was the person that triggered this change. We have this information at the controller layer. The saving happens at the repository layer (...
0
votes
2answers
222 views

Design public API - String or generic type?

My team needs to design an API which sends objects to a queue in the cloud and retrieves objects from it. The data is inserted into the queue as byte[]. We have 2 ideas until now which I would love ...
0
votes
2answers
67 views

From a mobile application client to API/microservices

Let's say I have a mobile client for answering questions and then purchasing a widget. For example, I might have 10 screens from my UI with about 8 questions per screen. Imagine there is a screen ...
3
votes
2answers
732 views

Java: Is it okay to abuse Spring beans (@Component) rather than use static final utility classes?

I'm torn between using DI and static utility classes on my code. I currently created a DateUtil static class that is only meant to be accessed statically. This class is responsible for just creating ...
0
votes
2answers
104 views

Should I create a Repository Container to get my repositories?

@Component public class RepositoryContainer { @Autowired public CommentRepository commentRepository; @Autowired public ItemRepository itemRepository; @Autowired public ...
2
votes
2answers
818 views

Maintaining stateful information in REST API

I am developing a REST API which accepts JSON using Spring Boot. I use Spring Security for authentication. I have a use case where I have two services, one to test connection to a 3rd party system and ...
2
votes
1answer
3k views

Project Structure of Domain Driven Design in maven Java Spring-Boot [closed]

My team is in dilemma, we have an existing maven spring-boot Java8 project with following onion architechture. controller --> service --> dao --> jpa repositories ...
3
votes
1answer
2k views

Are Spring beans declared as static a poor design choice?

The question is pretty straightforward, I'll try to explain why I want some explainations. (All of this is my 1½-year junior Java developer opinion, which may be more than incomplete. Which is why I ...
1
vote
2answers
190 views

Ways to store objects, inherited from one superclass in a database

For my personal project I need to store 2D shapes in a Postgres database. For example Circle, Pentagon, Rectangle and so on. At first I've done it like so: all shapes are inherited from an abstract ...
0
votes
0answers
42 views

Best way to implement a unified database of several shared database

i'm implementing a sync service that store the database of a device into another. Right now, the source system use a very simple table schema: The PK is a varchar(40) always. To do the sync, I ...
0
votes
1answer
426 views

In implementing layered API architecture with Spring MVC Boot, how to connect to various endpoints

If you want to implement a layered API design for example, you may have one API layer that represents the application layer. And I assume that the application layer is represented by an endpoint and ...
3
votes
3answers
244 views

IOC container & accessing Implementation from the container

Background As mentioned in this article, Inversion of Control can be achieved through various mechanisms such as: Strategy design pattern, Service Locator pattern(SLP), Factory pattern, and ...
2
votes
1answer
235 views

Creating interface fields to inject vs Objects?

In the tutorial I'm doing it uses interfaces to inject things, for example it uses a IHotDrink interface, then creates a Tea class that implements IHotDrink. It then has a third class called ...
6
votes
1answer
287 views

Should DTO have same structure as payload?

I have a usecase where I am supposed to store entire payload from a third party API in addition to the DTO, say XYZDto, its translated to. There are two ways to achieve that - Translate the payload ...
1
vote
0answers
262 views

Proper handling of JWTs within a Spring Cloud distributed system

I hope this question isn't a bit low level, however I'm seeking clarification around what I've implemented in terms of design and best practises. Using Spring Cloud, along with Zuul I have a ...
5
votes
3answers
1k views

DDD - Is anemic domain model an antipattern? Shoud we be using rich domain models? [closed]

Anemic domain model was criticized a long time ago by Evans and Fowler, since apparently it goes against object oriented principles, etc. The DDD community is clearly aligned with this statements. ...
-1
votes
1answer
851 views

Does Web Socket block thread while keeping connection as regular http connection does?

Let's take Spring web socket (with tomcat) for example. Does Web Socket blocks thread while keeping the connection between server and client? (For example, connection can last 2-3 hours). ( Does web ...
-1
votes
1answer
163 views

IOC principle - Servlet container implementation

IOC principle can be implemented, using either: Dependency Injection Service locator pattern This article also supports these two approaches for implementing IOC principle. Spring IOC container is ...
0
votes
0answers
307 views

An efficient way to consume 6 billion records from Oracle using spring jpa

I'm using spring boot+spring data jpa to consume records from Oracle as streams. The table was not designed with a primary key. So looking at the existing values, the only way I could differentiate ...
1
vote
0answers
1k views

Using import.sql vs persisting JPA entities

In Hibernate ORM & Spring Boot, during the SessionFactory creation, SQL DML statements can be executed to create tables and/or insert data via files such as import.sql defined in the javax....
3
votes
0answers
576 views

Understanding the data flow in Spring REST layered architecture

I am new to Spring as well as layered architecture. So am a bit confused as how data flows among the different layers. What so far I have understood is: Layers: Controller (which accepts requests) ...
0
votes
1answer
901 views

How to represent and validate website URLs for a JPA entity

I have an application that will allow the user to enter and store (in a DB) a website URL for a company. The only requirement (as of now) beyond entry of the website URL is to validate that the URL is ...
-1
votes
1answer
2k views

Spring Exception Handling. Custom exception per Http status?

I'm just designing the exception handling for the REST interface on our Spring server. As we will have multiple REST controllers, a central exception handling is desired. Spring offers the solution ...
57
votes
4answers
10k views

Are there exceptional cases where we can accept duplicate code?

I'm working on a software project where we have to build three APIs. One for the home banking channel, one for the agency channel and a third for the mobile channel. The agency API is the most ...
2
votes
2answers
402 views

Reserving database independence using Spring JPA

We are planning to use Spring Boot with JPA for our next project and I am wondering how much flexibility JPA gives in reality. If we start developing using a self-hosted PostgreSQL server and later ...
0
votes
1answer
228 views

Moving to a Micro-services style architecture

Use-case: As part of an Airline Application I am building - I am developing a set of (RESTful) API's each for Flights, Lounges, Loyalty etc. There are some common methods which should be accessible ...
2
votes
1answer
2k views

What will be the best practice to handle duplicate entry in DB in Spring MVC, throwing Exception or other way?

I am currently working a School Management project using Spring stack, Kotlin as programming language and Neo4j for storage solution. Here is the scenario, I am creating a Class entry in the DB. ...
0
votes
1answer
621 views

Design and setup a centralized logging with microservices / docker

I am developing on a a large webapp system that has multiple docker containers. Imagine a webapp but with many external restful services running on different containers. A microservices setup. I ...