Questions tagged [spring]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
10 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 ...
0
votes
1answer
41 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
80 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
57 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,...
0
votes
1answer
83 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
25 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
29 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
23 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
37 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 ...
7
votes
3answers
473 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 ...
3
votes
0answers
55 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
43 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
134 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 ...
-5
votes
1answer
183 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
154 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
190 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
183 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
110 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
1k 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
2answers
133 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
vote
2answers
103 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 ...
1
vote
0answers
42 views

Javax Validation Annotations in Spring - is it always appropriate? [closed]

I've recently become more fond of javax validation annotations and creating custom ones when I feel they may be appropriate. But... I can't figure if it's design-appropriate to use them for everything....
0
votes
2answers
88 views

User friendly webapp configuration

I'm planning to develop a web application that would run on-premise at the customer. I'm quite unsure about the whole process of setting up the site in a user-friendly way, but mostly disturbed by the ...
-1
votes
1answer
77 views

Pattern for for REST API who's response depends on behavior of requests to other services

Some one help me with my design paralysis! Assume a microservice (probably going to be implemented in Spring Boot) that has implemented an run of the mill REST API, and after receiving an initial ...
0
votes
0answers
70 views

Two JPA read/write Entities vs SpringJdbcTemplate for implementing CQRS without event sourcing?

So we are trying to implement DDD and CQRS (without event sourcing). I am need of clarity about the implementation details (Spring + JPA). DDD with multiple small aggregate roots require @Entity ...
0
votes
2answers
256 views

performance suggestions on Aggregate root containing thousands of child entities

I understand that DDD is a design concept and implementation through ORMs are tricky but help me understand how would you solve this problem? So here is my confusion on changing on aggregates only ...
0
votes
2answers
76 views

What to test when testing an API? [closed]

When testing an API (with, for example, Java), what parts should I actually be testing when calling methods of my Controller class (e.g. a Spring RestController)? For example, lets say I've got a ...
2
votes
4answers
140 views

Make a class depends on its own ports instead of injecting dependency interfaces

I just have an idea about dependency management in Spring IOC environment that seems to be better than the typical approach, but I am not sure because I can't find any references or example out there ...
0
votes
0answers
480 views

dealing with too many DTO / Java

We are building an pseudo-rest API (because no body cares/funds for a full blown rest API for internal use - which is OK). So we have elements of Rest API (links for resources, API naming conventions ...
0
votes
2answers
113 views

Does creating multiple REST services calling each other from a monolithic EJB application right approach to make them microservices later?

We are doing an architectural refactoring to convert a monolithic J2EE EJB application to Spring services. In order to do that I'm creating services by breaking the application against the joints of ...
1
vote
1answer
77 views

Is the way I am doing client-side rendering bad practice? [closed]

I am working on my first web development project, SQLite4Web. Long story short: SQLite4Web is a web interface for SQLite database files. The user can access their database via /db/{dbToken}, where ...
1
vote
1answer
83 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 ...
1
vote
3answers
313 views

How to reduce dependency on IOC Framework (Frameworks in general)

I was watching a presentation by Uncle Bob. In the end of that presentation (last 10 min), He argued that we should abstract everything (Even frameworks) from our business logic. JAVA EE does a great ...
0
votes
0answers
54 views

Messaging engine architecture with front-end and ORM layer (spring)

I'm looking to push my first QuickFixJ messaging engine into production, and I would like to know the best way to do so. Bear with me. The gist of the responsibilities is as follows: Through ...
-2
votes
1answer
383 views

How to serve the front-end in a Spring microservice architecture?

I want to create the following distributed system: Spring back-end microservices containing the domain logic, a UAA (authentication) service, a Eureka service registry/discovery, a Spring Cloud Config ...
1
vote
0answers
201 views

Performance impact of JPARepository save() on a large database table with index

We have a few tables with a large amount of data and with indexes on those tables to help in faster retrieval. We are also using Spring Data JPA JpaRepository for adding data to those tables using the ...
0
votes
0answers
60 views

Two Web clients and Java server (HTTP and Websockets)

I have 3 software components of a Web Application: 1. JS-client application 1 (JSApp1) 2. Java Spring (REST and Websockets) server app (SRV) 3. JS-client application 2 (JSApp2) My current task is to ...
0
votes
1answer
159 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 ...
2
votes
1answer
332 views

Handling an empty path variable request

I have a scenario where I can take a student Id as input via a part variable and return some data back as JSON objects where JavaScript handles the response as a part of AJAX call. Suppose the method ...
3
votes
1answer
162 views

Java inheritance error handling scenario

I looked multiple places for some advice on how to solve this before asking this question, but I couldn't find something similar to this. So I have the following scenario in Java Spring Integration ...
0
votes
1answer
65 views

Should I postfix application.yml?

My project structure (Spring / maven): src / main / resources / application.yml src / test / resources / application.yml This is working well (when I launch test, it takes the test application.yml). ...
-1
votes
2answers
127 views

Dealing with data download which could take days to download

I have a situation on the front end where a user clicks on “Download” button and the query behind the scenes is going to take over a day. I have a Spring boot web app running as far as web services ...
0
votes
1answer
157 views

Java Design Pattern to Use for switching between 2 different endpoints

I have a legacy service that is running on-prem and have built a new service that runs on cloud which provides the same functionality. I have another java (spring) service which consumes the on-prem ...
1
vote
2answers
1k views

Streaming file content efficiently without risking resource leaks

I have to rectifiy an application that basically serves content by using two REST endpoints. Both endpoints transfer files to the browser, one endpoint does so by providing the file in binary format, ...
3
votes
2answers
652 views

How do entities, DTO, DOA work together and what’s their role within a system?

Most of my work is written in Java using Spring Boot. In a recent project my entities contained no business logic, Spring Data was used to handle repositories and I have service classes that ...
1
vote
0answers
51 views

Is separating a Spring Boot REST API into interface and implementation a good practice?

I "herited" a lot of Spring Boot code which is basically an asortment of REST Webservices. All those webservices are separated into an interface and an implementation and I find it hard get a grasp of ...
3
votes
1answer
2k views

How to deal with large data in Websocket message?

I wrote a websocket server in Spring Boot and a client in Javascript. These work fine. I also wrote a second client in Java. When this one attempts to handle a frame after connecting to the host, I ...
0
votes
1answer
213 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
56 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 ...
1
vote
1answer
148 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 ...