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

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.

0
votes
0answers
15 views

adding jms in the rest api flow

In my spring boot app, I am trying to fit in the sender and receiver logic for JMS queue as described here I've put the content of "Sender.java" and "Receiver.java" classes from the above ...
0
votes
0answers
33 views

Split data equally to Thread in java

Is this efficient way to split the record which is comes from database? So that the thread will process the record based on the start and end points. Step 1: Get the total number of records from ...
0
votes
0answers
23 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
23 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
11 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 that is a right way of doing it or ...
1
vote
2answers
65 views

Reporting sums of shopping carts

I have an object (ShoppingCart) that has a list of CartItems, which contains the related ...
2
votes
1answer
196 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
38 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
31 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
43 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
32 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
43 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
50 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
157 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
36 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
167 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
37 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
72 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
110 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
406 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
260 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 ...
1
vote
0answers
42 views

Wrap Business Object to DTO with additional fields [closed]

My REST service has 3 layers: Persistence Layer - database entities live here Business Logic Layer - business objects live here Access Layer - data transfer objects live here The flow for reading a ...
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
73 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
43 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
91 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 ...
0
votes
0answers
29 views

Handling entities and data with repositories in service layer

In general this backstory does not matter but just to explain the code: The server handles users and user groups. User groups are able to "discover" places - at this point in time these places are ...
4
votes
1answer
171 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
67 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
111 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
699 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
2k 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
555 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
561 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
26 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
1k 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
47 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
87 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
54 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 ...
1
vote
0answers
50 views

Configuration for Embedded Broker ActiveMQ

This is my configuration for sending messages to an embedded broker. Also, the first bean method is used to just create and start the broker. It doesn't return any instance. Please a take a look at ...
3
votes
1answer
92 views

Using Maven Profiles to divide functionality

We have a Spring Boot parser application, that supports a bunch of formats. We need to divide this Parser application into several types. Each such type is simply defined by the set of formats ...
2
votes
2answers
7k views

Transaction in spring boot

I am using spring boot in my application. ...