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
0 answers
21 views

Hexagonal architecture in Spring Boot

I will be starting a new job soon and I'm learning about hexagonal applications implemented with Spring Boot. I found a ton of different resources and I became a bit lost. My main concerns are: How ...
yarv's user avatar
  • 1
-2 votes
0 answers
27 views

Startup code improving fetched from DB JPA

This is my startup code that joins two tables StoreConfiguration and GateConfiguration. I save the. Storeid is pk in store and FK for gate. What follows is the entity information: We store this on ...
darthwader's user avatar
0 votes
1 answer
34 views

Spring Boot old versions of endpoint

I have 5 versions of some endpoint. Only V4 and V5 are used currently on the frontend side. What should I do with the V1, V2 and V3 versions? Should I remove them when are not used anywhere? ...
Matley's user avatar
  • 133
1 vote
0 answers
54 views

AuthenticationWebFilter with no hard-coded dependency on a specific authentication scheme

I decided to share with you a portion of my gateway project. It's an authentication filter that (unlike Spring's own AuthenticationWebFilter with its hardcoded ...
Sergey's user avatar
  • 481
1 vote
1 answer
42 views

Spring Batch Item Writer Calling Stored Procedure

While migrating a Spring application to Spring Batch, I encountered a scenario where I need to process chunks of records from the database and invoke a stored procedure for each chunk. However, each ...
Vasanth's user avatar
  • 173
1 vote
1 answer
55 views

Inserting large number of rows into database with Spring boot

I need to insert many million rows + many GB of data into a database for a project that uses Spring boot. I recreated a minimal example with a one to many relationship and am trying to find the ...
Pux's user avatar
  • 155
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
0 votes
2 answers
50 views

How to find a more effective way to load a file and compare in the service

I have a malware detection system that includes a subsystem responsible for IBAN checks. Initially, this subsystem needs to load and parse data from a specific URL. Subsequently, it checks whether the ...
Nesly's user avatar
  • 17
1 vote
0 answers
33 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
59 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
1 answer
212 views

About self validated Java POJOs

I am currently experimenting with self validating Java beans in order to avoid the creation of objects with invalid states, while keeping the validation knowledge inside the bean. The goals I have in ...
silver_mx's user avatar
  • 119
2 votes
2 answers
58 views

Spring Boot REST API for moving toy robot in 5*5 grid [closed]

I have designed and coded REST APIs to move the toy robot in 5*5 grid. Please let me know any feedback on improvements, etc Complete Code here: https://github.com/pkkht/RobotRESTApp ...
Hariharan's user avatar
1 vote
1 answer
317 views

Spring Boot Azure Service Bus Listener

I would greatly appreciate your feedback and review of our Spring Boot Azure Service Bus listener implementation. Your insights and suggestions will help us ensure its efficiency and reliability. ...
Siyamcela Nxuseka's user avatar
2 votes
1 answer
223 views

blog RESTFUL api with posts and comments

I built RESTFUL api for a blog using java and spring boot(without a frontend). What it does the code manages all the http methods on a post inside the blog and comments on that post. the post consists ...
Ellie's user avatar
  • 497
0 votes
1 answer
128 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
2 votes
1 answer
145 views

Spring security configuration

I am new to spring boot and wanted to make a simple application with JWT authentication. There is one problem with the response having 401 status when it should have 403 but otherwise everything seems ...
Newbee's user avatar
  • 43
1 vote
1 answer
69 views

Rest API design with Spring Boot

In a recruitment interview I got this small projet to do at home: rest API written in Java using Spring Boot. As I didn't hear back from the company I wanted to have feedback from review. I am a rest ...
Dimitar Angelov's user avatar
1 vote
1 answer
63 views

Code to save account details and register based on payload

I have this flow for registering a user. They send an empty user account no to get a temp account no which then they use for verifying the OTP by email and phone. Both done they should register ...
rest_easy's user avatar
0 votes
2 answers
56 views

Naming of api calling methods to get an object by two different properties

I have the situation, where I have to methods in my api calling class that do basically the same thing. I have a profile that contains multiple account objects. These objects have their own UUID as a ...
monamona's user avatar
  • 425
0 votes
1 answer
183 views

Spring Boot Account API with React Frontend and Identicon Integration

I have recently been exploring React and Spring Boot, and I would greatly appreciate your feedback on a practice application that I have developed. The application consists of a Spring Boot backend ...
thebluepandabear's user avatar
1 vote
2 answers
175 views

Search/Query API cross parameter check

Background I was working on a coding challenge as part of an interview process. I had to create a REST API where the user can report sensor data and query derived metrics based on several filter ...
Peter Csala's user avatar
  • 8,820
4 votes
1 answer
101 views

Spring REST Endpoint for Saving a User Inquiry

Here's a piece of code from codebase I maintain/contribute to. It is a Spring REST controller, which exposes an endpoint to create user question. The question consists of title, description and ...
Sergey's user avatar
  • 481
0 votes
0 answers
113 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
2 votes
0 answers
150 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
0 votes
1 answer
119 views

Code that checks whether there is a holiday by calling another microservice

I call another microservice to check whether there is any holiday on any particular day. This will then add a comment in the db if the rest call doesn't fetch an empty list(a list of size 1). Here is ...
diaop's user avatar
  • 9
0 votes
1 answer
345 views

Assert MockMvc response by using Kotlin DSL

I build web application using Kotlin and Spring Boot, I use MockMvc to write integration test. I'm not satisfied how assertion looks like, here is typical assertion: ...
Mateusz's user avatar
  • 113
3 votes
2 answers
104 views

Spring boot shop application with error handling

I'm writing a simple online shop using spring boot, for learning purposes. Right now I have purchasing-service and a product-service. The purchasing-service makes requests to the product-service via ...
Eoin's user avatar
  • 263
2 votes
2 answers
158 views

Duplicate code in spring controllers

...
user9132502's user avatar
0 votes
2 answers
95 views

Java spring controller method to trigger e-mail verification procedure [closed]

For readability sake, is it better to use optionals or write my code in an iterative manner? Here's a route I'm working on, does this look readable do you? ...
user9132502'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
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
0 votes
0 answers
943 views

ResponseEntity return json object

...
hudson's user avatar
  • 1
1 vote
1 answer
76 views

Read from dynamic source and caching

I want to load JSON data from a link at the beginning of an application. I need to be a little bit about clear the following code. And also want to ask about another opinions that what could be the ...
Neslihan Bozer's user avatar
1 vote
1 answer
2k views

Collect and combine results of async calls returning completable futures in Java in a cleaner way?

I need an abstract way to implement this below functionality because in my code I have to use it in multiple places with different REST endpoints. If I ignore it will cause code duplication. Please ...
tomsheldon's user avatar
1 vote
0 answers
999 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
2 answers
1k views

Using Factory Design Pattern in Rest Controller of Spring

I used factory design pattern to identify the service according to the enum that comes from the api uri as request param. Everything seems okay according to me but cannot be sure if I used it right. <...
Abdu Muhammadal's user avatar
-1 votes
1 answer
79 views

Using Factory Design Pattern in Spring [closed]

I organized the factory design pattern but I'm not sure if I used it right or wrong. Here's my data model; ...
Abdu Muhammadal's user avatar
3 votes
1 answer
90 views

A controller for a Game Service

I have a Spring MVC controller but I'm not sure that it is a good or bad design. As far as I know, api versioning is missing but apart from that I implemented Swagger for documentation and added ...
Burak's user avatar
  • 31
3 votes
2 answers
90 views

Search code that performs in-memory search

This is the code I came across in our repository. This performs search in-memory and is invoked on service layer code. In our front end operators like EQUAL_TO and ...
user251118's user avatar
1 vote
1 answer
90 views

Cleaning Kotlin method which returns the document name after the id

I'm just getting to know the possibilities of Kotlin and mongoDB. I am writing a method that returns the name of the street after the ID. Everything works, but I find it quite sloppy. Empty String ...
AdamK's user avatar
  • 35
0 votes
1 answer
3k views

Spring boot: better way to handle response and exceptions

I am working on a quite a big Spring Boot web service and I wanted a standardized and simplified way to handle responses and exceptions by following fluent API design. So this is what I did and it ...
benjamin c's user avatar
1 vote
1 answer
92 views

Refactoring duplicated code with abstraction and generics

I have written simple command line project with Spring. And from what I think quality of code is pretty poor. I see what I could improve to remove duplicated code, but somehow I have no idea what ...
Suule's user avatar
  • 85
2 votes
1 answer
463 views

Simple game of Chutes and Ladders

I recently made a new project for Chutes and Ladders (the Hasbro version of Snakes and ladders) and it is located here: https://github.com/vchittar/ChutesAndLadders BoardLogic (implements an interface)...
smarty_pants's user avatar
0 votes
1 answer
78 views

Spring-WebFlux code to save per-user data [closed]

I'm using Spring-WebFlux with Spring-Security and I need to save data depending on the currently registered user. In order to do so, in my controller, I need to retrieve the data sent from both the ...
user246515'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
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
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
2 votes
1 answer
162 views

How can I rewrite the below parser code in Java

I have written a simple parser in Java for a study project. Can anyone see how I might improve the code below. I have been looking at the code myself for the last few days but I couldn't come up with ...
kiker's user avatar
  • 31
4 votes
2 answers
722 views

Spring Boot API - Avoiding Concurrency issues

I'm still in the process of learning Java / spring and I think I'm getting better. Now at this point I'm able to build a rest api BUT I'm at a lost at how to ensure I've no concurrency issues . I've ...
MetaCoder's user avatar
  • 153
2 votes
1 answer
916 views

Bank exercise with Java Spring Boot and JPA

I'm constructing a homework from my Spring Boot Course and so far I did the JPA layer and want to have some feedback, before start the business rules, about if the I could improve something or change ...
Gabriel Vendramini's user avatar

1
2 3 4 5