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.

47 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
6 votes
0 answers
2k views

Implement two level caching using spring's cache abstraction Cache and CacheManager

Details about spring's caching framework are here. When I was reading this link, I thought the composite cache mentioned there was one that used levels of caching based on the order given to the ...
shrewquest's user avatar
5 votes
0 answers
1k views

Exception handling: using @JsonProperty value to make error message

If the validation in RestController fails, I need to handle MethodArgumentNotValidException and provide an errorMessage, that ...
Georgii Lvov's user avatar
4 votes
0 answers
3k views

Reactive JWT authentication using Spring webflux

Greeting to all senior devs here. I'm trying to create a project for my small business. There are not many tutorial on how to create Reactive JWT authentication with Spring webflux. So I'm a bit ...
Patrick's user avatar
  • 331
3 votes
0 answers
174 views

Migrate customer and transaction data from CSV to MongoDB

I wrote a Java Spring Boot application with MongoDB that on every application start loads customer, account type and transaction details from CSV files to MongoDB. It has one end point that returns ...
user232946's user avatar
3 votes
0 answers
117 views

Learning Spring framework with Thymeleaf

I would like to ask you to point me some good direction with writing clean code with Spring framework and Java in general. I am creating a simple app, which has two main features: searching for beers ...
Suule's user avatar
  • 85
3 votes
0 answers
45 views

Separation of database and network calls

I have a API and the corresponding service method is like this: ...
Antony Vimal Raj's user avatar
3 votes
0 answers
96 views

Using functional interface arguments in methods of services injected via Spring

Here is the working code for my Spring service: ...
euhyen's user avatar
  • 31
3 votes
0 answers
424 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 ...
Viktor M.'s user avatar
  • 369
3 votes
0 answers
3k 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. ...
Max Grigoriev's user avatar
3 votes
0 answers
71 views

Initialising numerical properties from a text-based properties file

This is a Spring Framework-based datasource instantiator which reads its properties from the Spring Framework context, i.e. the values are initially all String from ...
Adam's user avatar
  • 139
2 votes
0 answers
152 views

Java Project Reactor/WebFlux token service

I'm trying to achieve a thread-safe reactive token service. The point is that all subscribers must wait until the token is received or updated (when expired). It works, but I want a second opinion ...
John Goode's user avatar
2 votes
0 answers
39 views

How to check gcp pupsub empty/inactitve subscribtion

I have an application that subscribes to a topic in GCP and when there is some messages over there it downloads them and sends them to a queue on ActiveMQ. In order to make this process fast I am ...
elmodeer's user avatar
2 votes
0 answers
32 views

Idempotent Processing of Messages

Code ...
Regyn's user avatar
  • 143
2 votes
0 answers
40 views

Collect messages from a job to send in body of one email

I have a Spring service that calls a few methods to ...
James's user avatar
  • 299
2 votes
0 answers
88 views

Java Spring web application

Here is a Java Spring web application built as an educational project that fetches and displays data returned from NASA's Mars Weather Service API. The project is essentially an attempt to reverse ...
jman25's user avatar
  • 43
2 votes
0 answers
82 views

JWT authentication system login through API

This is my first time writing an authentication system. Here's how it works, first client needs to send credential within authorization header like { Authorization : 'Basic ' + credential } through ...
Patrick's user avatar
  • 331
2 votes
0 answers
350 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 ...
DapperDan's user avatar
  • 409
2 votes
0 answers
961 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 ...
user2018303's user avatar
2 votes
0 answers
345 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 ...
Menelaos's user avatar
  • 251
2 votes
0 answers
71 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 ...
jokarl's user avatar
  • 143
2 votes
0 answers
4k 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 ...
frankieta's user avatar
  • 121
2 votes
0 answers
79 views

Generate a patch description from multiple SVN commits

I have a Spring app that is used to create patches for another application. My client retrieves a list of branches from a SVN repo through the initial AJAX call, then if one branch is chosen, another ...
dannemp's user avatar
  • 133
2 votes
0 answers
682 views

Pagination links for various lists using Spring-HATEOAS

I'm using Spring HATEOAS to create some links on my REST API. However, the entities i'm returning are very close, so the code to generate the links are the same: ...
Kaidjin's user avatar
  • 123
2 votes
0 answers
168 views

Implementing a long-running entity lock

Requirement I have an entity named ImportData which can be processed once in order to extract data from a file fed to the application. I need to make sure that, in ...
usr-local-ΕΨΗΕΛΩΝ's user avatar
2 votes
0 answers
68 views

Minimizing database overhead by storing additional information to the users authentication-object (Spring Security)

I am using Spring Security in order to check if a logged in user is authenticated. However, after authentication, as some actual requests come in, I would like to minimize the number of database calls ...
Stefan Falk's user avatar
2 votes
0 answers
778 views

NoSQL-based sequence generator

For my web application I have to generate a sequence of following format: <year><sometext><month><sequence> For example: ...
ring bearer's user avatar
1 vote
0 answers
72 views

Flexible AuthenticationExtractionWebFilter

I decided to share with you a portion of my gateway project. It's an authentication extraction filter that extracts authentication claims without being coupled to any specific authentication mechanism....
Sergey's user avatar
  • 511
1 vote
0 answers
36 views

FastAPI Class based Design

I am new to the FastApi world. Can somebody review my below Fast API design? It is working but doesn't follow ...
garg10may's user avatar
  • 214
1 vote
0 answers
34 views

Websocket code to be improved

This is the plain websocket code that connects with mobile app. Once we send a REST request from another service say B to our service A we send a websocket payload over the response. This runs in ...
darthwader's user avatar
1 vote
0 answers
61 views

Todo application using Spring Boot 3, Dockerized Postgres, Java 17, Maven

I'd like to have code review for backend of todo app. It has 2 main functionalities: Authentication and authorization using Spring Security and JWT token. CRUD for tasks In particular I'd like to ...
J.Olufsen's user avatar
  • 171
1 vote
0 answers
1k views

Spring Boot Integration Test with SQS and Elastic Search

I have the following integration test that starts with sending message to sqs queue and ends with checking elastic search if the associated object added to db. The part of application I want to test ...
Davis's user avatar
  • 53
1 vote
0 answers
25 views

Spring Boot Elastic Seemingly ignoring second Query

I have some code I've written which I need a review of (if possible) as I know I have a bug somewhere. Most likely due to my (lack) of understanding of some concepts in ElasticSearch and Spring. For ...
MetaCoder's user avatar
  • 153
1 vote
0 answers
145 views

Signing in with "Remember me" option implemented with Spring and Kotlin

I'm trying to implement authentication with "Remember me" option using Spring and Kotlin. I would really appriciate if someone could help me find potential issues with that implementation as ...
Weeedooo's user avatar
1 vote
0 answers
48 views

Implement Kafka Communication with Serialized Java objects

I want to implement Kafka Topic which sends and receives Serialized Java Objects based on this example. I tried this: Producer Config: ...
Peter Penzov's user avatar
1 vote
0 answers
57 views

Elastic search Java

Below is a json schema I have in elastic search ...
Iwowo Chisom's user avatar
1 vote
0 answers
72 views

Flatten nested lists in Java

I'm developing a complex app with Spring Boot and MongoDB. I have a Video class like the following. Note: All getters setters are omitted. ...
Nishakar's user avatar
  • 111
1 vote
0 answers
82 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. ...
Jin Kwon's user avatar
  • 133
1 vote
0 answers
87 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 ...
cbryant02's user avatar
  • 111
1 vote
0 answers
694 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 ...
user5846031's user avatar
1 vote
0 answers
1k 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 ...
cheffe's user avatar
  • 111
1 vote
0 answers
2k 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 ...
indusBull's user avatar
  • 133
1 vote
0 answers
3k views

Performance increase on Spring integration

I have been running a program to read a file having 6 million rows and validate each line and write the string containing the validation message to an output file. I am using spring integration to ...
Vinod Madan's user avatar
1 vote
1 answer
9k views

Detect that a class is marked by a custom annotation in Spring

I would like to enable application behaviour based on the presence of a custom annotation that marks the configuration class (normally named something like ...
Alex's user avatar
  • 353
0 votes
0 answers
115 views

Report generation code using Jasper and Spring boot

This outputs the report in HTML. This fetches all records for an entity and then lists them in the report. Wondering if this can be made generic, right now it is only one entity and 2 fields. Also ...
darthdearth's user avatar
0 votes
0 answers
51 views

Copy AWS S3 objects into DB

I have written a code which fetched the S3 objects from AWS s3 using S3 sdk and stores the same in our DB, the only problem is the task is repeated for three different services, the only thing is ...
jack's user avatar
  • 11
0 votes
0 answers
954 views

ResponseEntity return json object

...
hudson's user avatar
  • 1
0 votes
1 answer
134 views

is my code protected against SQL injections?

im using spring boot and CrudRepository for my queries, the project is about posting content on a blog, so I have a post record with id, creator name, post name, the content itself likes and dislikes: ...
Ellie's user avatar
  • 497