Stack Exchange Network

Stack Exchange network consists of 175 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
The results are in! See what nearly 90,000 developers picked as their most loved, dreaded, and desired coding languages and more in the 2019 Developer Survey.

Questions tagged [spring]

The Spring Framework provides a comprehensive programming and configuration model for modern Java-based enterprise applications - on any kind of deployment platform. A key element of Spring is infrastructural support at the application level: Spring focuses on the "plumbing" of enterprise applications so that teams can focus on application-level business logic, without unnecessary ties to specific deployment environments.

1
vote
0answers
16 views

Implement search for JPA and Spring

I'm trying to implement properly search functionality for database table. I tried this approach: Controller: ...
0
votes
0answers
14 views

Order matching logic sequencing issue [closed]

I have developed a trading exchange where orders are matched in real-time with least possible latency. The order matching service logic is functioning correctly. However, there's a minute error in the ...
2
votes
1answer
47 views

Effective & Secure Method to populate Access Token for authorization header in Rest Template

I am trying to consume a REST endpoint by using the RestTemplate Library provided by the spring framework. The endpoint also demands a Bearer Access Token as its authorization header, which is only ...
4
votes
2answers
75 views

Rest Controller in Spring Boot for Rock Paper Scissors REST API

I have created a Spring Boot Microservice for playing Rock Paper Scissrors. I have tried to follow best practices, but still would appreciate some critique on my code. Thanks. ...
2
votes
0answers
158 views

Let Them Eat Lists, Eventually (Asynchronous Generic List Consumption with Spring and CompletableFuture)

I want to reduce some repeated code in my Java 1.8/Spring Boot application, and to that end I tried to make a reuseable asynchronous utility module. In essence its an async List.forEach that takes a ...
0
votes
1answer
26 views

Spring Boot methods to add and remove relationships

I have a Spring Boot application and I wrote a piece of code to manage relationships between two entities. The code consists mostly in these two methods: ...
3
votes
1answer
70 views

Inserting 50k rows with Spring Data and JPA [closed]

I am using Spring Data JPA with Spring boot application. My requirement is to insert 50K rows in JPA entity table in one hour or less. I have 3 entities A, B and C. Entity A has a one to many ...
0
votes
0answers
33 views

Spring Component Thread Safe

Recently I refactored an application to start using spring, and after some research, I found out that @Component is not thread safe. The class is this: (It's a converter from xlsx to json string) <...
1
vote
1answer
25 views

Spring TaskScheduling with HashMap

I am currently developing a Task Scheduler to run different methods at a certain time. In general it is a Spring-boot application an task execution/scheduling is just a very tiny piece of the whole ...
0
votes
0answers
40 views

Join (custom) query in Spring Data JPA

I'm trying to make a REST service using Spring Boot and Spring Data. I have written a query using join and have achieved the required o/p but I'm curious to know if ...
1
vote
2answers
71 views

Reporting sums of shopping carts

I have an object (ShoppingCart) that has a list of CartItems, which contains the related ...
2
votes
1answer
706 views

CSV file download in Spring

I recently worked on a module, in which I implemented the functionality of downloading the CSV files. ...
0
votes
2answers
36 views

Printing the status of a database insertion as JSON

The controller is currently inserting a record into the database and returning a JSON response as shown below in the try-catch block. I can see the ...
1
vote
1answer
44 views

Testing a service that makes database calls, without a database

I'm working on a new service, for the past year I haven't needed to write tests from scratch. I've either been bug fixing, or adding features that require modification of tests, but not writing ...
1
vote
0answers
66 views

Handling slow processing the Spring batch way

We are using spring-batch to extract data from a SAP system, during processing we pass the extracted full texts to a tagging service, in the end the enriched documents are stored in Solr to be served ...
0
votes
1answer
45 views

Refactor REST service with overcomplicated logic

Need to perform such actions: receive JSON from REST extract nexted JSON document calculate hash of the nested document add some fields to extracted document and save it in database return response ...
1
vote
1answer
46 views

Simple JDBC Query By Example (QBE) for Spring JDBC Template

This is a quick and dirty QBE method that covers about 60% of my use cases in my DAO. I just wanted to see if someone would take a quick look at it to see if there are any issues. ...
1
vote
0answers
42 views

Java Multipart text file analysis to zip

So I am working on a project that should take .txt file as an input and analyze words in it (assuming all words are English). Program must run asynchronously. Final output should be multiple .txt ...
1
vote
0answers
59 views

Business logic validation as custom Bean Validation annotations?

This is not my solution but that of an existing application I am enhancing. Basically what they are doing is annotating a Form.java with a custom validator that ...
1
vote
1answer
52 views

Spring API that performs RSA encryption with exception handling [closed]

I'm creating a rest api using Spring which utilize javax.crypto as library to do some encryption stuff. While everything works well, I'm curious whether the error handling like this is acceptable or ...
0
votes
0answers
20 views

Untangling a data class where annotations from different frameworks mix

The framework mix problem I'm using two frameworks -- PingIdentity's SCIM 2 SDK, which uses Jackson, and Spring LDAP -- to deserialise a SCIM resource (i.e. JSON) to a Java object then write it to an ...
2
votes
1answer
212 views

Dropbox Java Spring Boot connector

I've created a service that connects to Dropbox and makes it possible to download and upload files, create and list folders and remove file or folder. Full code is available on GitHub: https://github....
2
votes
1answer
37 views

More elegant way to construct the S3 path name with given options

I have a method that generates the S3 key prefix according to the provided args. However, my gut feeling is that this method is not as elegant as it should be, maybe I just don't have an eye for it. ...
3
votes
1answer
235 views

Spring Boot Websocket STOMP Crud

I have a personal project that runs the backend under spring boot that implements websocket for real-time functionality and I apply it to a crud operations. Although the code is working and work as ...
0
votes
1answer
40 views

Convert automatically into a centralized bean for multiple domain objects

I am creating a project which will respond to collect multiple bean object, save it to the database and return the status of the transaction. There can be multiple objects that can be sent from the ...
0
votes
3answers
73 views

Spring Boot DAO

I am using spring boot with NamedParameter JDBC. Please suggest any improvements to my code. This DAO first determines which datasource to connect to which is based off the condition of the request ...
2
votes
1answer
183 views

Create annotation to validate JWT in Spring controller instead of filter

I developed a Spring RESTful service that uses a JWT for authorization. To the validity of this JWT, i used two different implementations. Create a filter to intercept every request and validate ...
0
votes
1answer
581 views

Toy Robot coding puzzle with Java

The following code is my solution to a code challenge I submitted a few days ago. I got rejected straight away with no feedback and I've wondered why. Here is the full code repo. Requirements ...
2
votes
0answers
382 views

Create HttpClient using PoolingHttpClientConnectionManager

I have a java service class which will call a REST service and get response back. It is working fine in developer environment where less requests are made, but I still wanted to get a review. My ...
2
votes
1answer
67 views

Inject a list of processes to execute using spring DI

I have couple of MessageProcessors. One of the Processor will log the payload. Other ...
1
vote
1answer
81 views

Kotlin API - endpoint for users

I am writing API in Kotlin - this is my first code in this language. I implemented a very primitive 'player' endpoint. I was wondering if I am doing everything ok (please don't mind the static ...
1
vote
1answer
72 views

Copying notes takes a very long time

I am working on a Spring-MVC application in which we have note like functionality. Notes can have attachments, history, etc. There is a method to copy notes. When a note has a large number of ...
2
votes
1answer
45 views

Obtaining information about the logged in user

I currently have a special service to obtain information about the logged in user. I have an interface ...
2
votes
0answers
112 views

Unit/Integration Tests for Maven plugin that creates Skipper packages

I am writing an extension to a maven mojo (spring-cloud-skipper-maven-plugin) and I am now writing tests that interact with a skipper server. However, getting the ...
4
votes
1answer
214 views

User registration - Controller, service and repository layers in Spring framework

I'm writting a registration feature currently and I I'm confused how to divide logic between layers. Can you review this code and tell if it's good way to do? In try-catch block I publish event to ...
0
votes
1answer
69 views

Spring: Creating a Mutable Common Command Object or Controller Interceptor

I'm integrating with a 3rd party vendor that has Users and Organizations in it. My tool is a user administration tool that ...
3
votes
0answers
132 views

Bloom filter algorithm usage in spring boot rest service

I have implemented spring boot rest service which has only one function - get status of invoices by unique ID. In the scope of this task I have implemented Bloom filter algorithm to avoid unnecessary ...
2
votes
0answers
60 views

Initiate, propagate, validate, send, and marshal a message in Spring

Purpose of code The goal of this code is to: Initiate a message propagation to other systems Validate that the given message adheres to its XSD schema, and then marshall it Send it on a Camel route ...
1
vote
0answers
760 views

Spring Boot + Spring Batch - feedback

I am newbie to Spring Framework. I am trying to move table data from one vendor database to another vendor database using Spring Boot + Spring Batch. I am looking for feedback if this correct approach ...
1
vote
0answers
3k views

Pagination using Spring MVC and Hibernate

My company develops a Spring web application that exposes a REST API and right now we're starting to look into pagination for the methods that load data from some heavy tables. We initially looked ...
0
votes
1answer
3k views

Map DTOs and Models within the Service Layer due to a missing Business Layer

The following is the story of a UserCredentialsDto that arrived at one of my endpoints and how it finds its way through all the layers namely REST Layer Service ...
2
votes
0answers
722 views

Implementation of reactive file write from InputStream

I want to implement reactive write to file. In low level, it uses NIO and Futures. After reading this section I created this code but maybe there's more clean or less code solution. Thanks. ...
0
votes
1answer
599 views

REST API design using spring boot

The following API caters to CRUD operations on users and their corresponding filters (kind of rules). These filters are applied on incoming data from various sources basing on user and then a variety ...
1
vote
0answers
27 views

Retrieving the count of users with complete and incomplete profiles

Problem I have to display the count of total users with Incomplete and Complete Profiles. Incomplete Profiles are those which will have 4 fields of String type. ...
2
votes
1answer
48 views

Generating Report Data in CSV format for various cases

I have to show report data for various cases in text-csv format as soon as the user click's on the given URI's. The given cases are: End_Customer Data Incomplete Profiles. Total Connections Below ...
3
votes
1answer
2k views

Custom ResponseModel for Spring Controller - ResponseEntity<?>

I created a custom responseModel to have a standard json responseModel for some of my different RestController. Superclass TransactionResponseModel: ...
1
vote
0answers
48 views

Approach for validation in domain layer

I was struggling for some time with proper implementation of domain validation in the context of domain entity and it's properties. By the time validation comes down to check if property value matches ...
1
vote
1answer
1k views

SpringData: filtering fields of Entity in Repository

My entity is Office. In office repository I would like to find all office Addresses: ...
0
votes
1answer
93 views

Refactoring service class which communicates with external API

Below is the class definition which I created as a POC for some project, at present the class does too much thing and I don't know how to what would be a good design i.e. which object to use as DI etc....
2
votes
1answer
56 views

Java orchestration calls from two CRUD endpoints

Here is my orchestration endpoint where I call customer endpoint and product endpoint. Product endpoint contains info about what customer have what product. I do not like how it look and smells as ...