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.

Filter by
Sorted by
Tagged with
0
votes
0answers
11 views

Reactive, multi-step service method

I've found many examples online of simple reactive services to do CRUD. I'm thinking about more complex services, specifically, what would be the best way to handle a "do A then do B then ..." method. ...
1
vote
0answers
28 views

Pipe ResponseSpec's Body

I'm writing a utility method which pipes given ResponseSpec's body and gives to the caller a change to read it. ...
0
votes
0answers
29 views

Springboot/hibernate queries result optimization

I am developing a Springboot application, and my requirements are the following: I have 8 sql queries, that I have to run in parallel and that return a single result. My entities using this sql ...
3
votes
1answer
85 views

Rest Api with generic crud operations

I am learning how to create a rest api in which I've decided to use generic for crud operation. I am attaching the code which I have written so far. Please have a look. Thanks for the review in ...
2
votes
1answer
66 views

Spring RESTful API handling errors

I made a Spring RESTful api as backend for a website. I would like to get feedback on coverage of errors and the response I return accordingly, am I using the status codes correctly? Basically ...
2
votes
1answer
46 views

Bookscraper - SpringBoot app to scrape data from online bookstores

BookstoreScraper is application based on Spring Boot. It allows to scrape data from two biggest polish online bookstores - EMPIK and MERLIN. You can scrap books within 3 options: bestsellers most ...
2
votes
2answers
196 views

Spring service for playing Rock Paper Scissors

I had created a service which does the actual play of Rock Paper Scissors. Below is the service which takes a PlayRequest and updates the State of Player objects given by the PlayerService. So the ...
1
vote
0answers
40 views

Lightweight, modular Discord bot - tips and feedback on the code?

The full project is up on GitHub. The codebase is super small as it stands. I'm brand new to reactive programming and Spring, and would mostly like insight on those two things. Asynchronous ...
3
votes
0answers
54 views

Using functional interface arguments in methods of services injected via Spring

Here is the working code for my Spring service: ...
1
vote
0answers
64 views

Spring boot for a blog REST API

I'm working on a blog REST API and I would like to get some opinions on where to place the logic for a single operation to filter posts. I have Category and Post in the model package. A category has ...
-2
votes
1answer
37 views
2
votes
1answer
77 views

Implement search for JPA and Spring

I'm trying to implement properly search functionality for database table. I tried this approach: Controller: ...
2
votes
1answer
190 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
130 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
209 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
32 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
157 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
59 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
33 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
394 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
76 views

Reporting sums of shopping carts

I have an object (ShoppingCart) that has a list of CartItems, which contains the related ...
2
votes
1answer
3k 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
55 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
229 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
54 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
74 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
43 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
91 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
56 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 ...
2
votes
1answer
370 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
39 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. ...
4
votes
1answer
354 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
42 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
79 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
354 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
1k 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
598 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
71 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
96 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
74 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
47 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
146 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
329 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
73 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
175 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
61 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
924 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 ...
1
vote
1answer
4k 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 ...