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
41 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
  • 161
0 votes
1 answer
136 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
  • 109
1 vote
2 answers
52 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
0 votes
1 answer
184 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
1 vote
1 answer
124 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
  • 347
-1 votes
1 answer
74 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
  • 347
1 vote
1 answer
123 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
  • 33
1 vote
1 answer
50 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
0 votes
1 answer
55 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
162 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
169 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,520
4 votes
1 answer
93 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
  • 401
0 votes
0 answers
93 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
134 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
2 answers
88 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
257 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
98 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
144 views

Duplicate code in spring controllers

...
user9132502's user avatar
0 votes
2 answers
92 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
49 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
3 votes
0 answers
2k 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
  • 321
0 votes
0 answers
855 views

ResponseEntity return json object

...
hudson's user avatar
  • 1
1 vote
1 answer
75 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
973 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
891 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
78 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
88 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
86 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
2k 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
415 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
76 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
161 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
650 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
859 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 vote
1 answer
3k views

Handling multiple optional parameters in Spring

I have an endpoint in my RestAPI which can receive 3 optional parameters and then find information in the database with these parameters, also it is possible to combine the parameters. So, in my ...
Kalich's user avatar
  • 13
1 vote
0 answers
134 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
0 votes
1 answer
89 views

How do I divide Dao and Dao-Cache into different modules? [closed]

I want to improve performance for api. I design cache in dao layer. I use caffine cache. Basic code is: CacheConfig.java ...
study_20160808's user avatar
2 votes
0 answers
32 views

Idempotent Processing of Messages

Code ...
Regyn's user avatar
  • 143
0 votes
1 answer
179 views

Dynamically choose bean without Qualifier annotation

I have a service that gets an URL from the user input, extracts the body content of this URL, apply CSS, and finally returns the result as a stream. The tricky part is that I have different ...
LaChope's user avatar
  • 71
1 vote
0 answers
47 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
4 votes
2 answers
240 views

Are these Unit tests OK or am I implementing an antipattern or not following best practices

I am testing a Spring boot service using JUnit 5 and Mockito. I haven't spent much time on unit testing in the past so I'm not sure if I'm accidentally implementing an anti-pattern or not following ...
user2094257's user avatar
1 vote
1 answer
87 views

What to test on a rest API?

I created a rest controller with Spring Boot, I am trying to learn what I should write on my tests, right now I only check status codes and keys existence. I am planning to build an API to showcase at ...
Daniel Burgos's user avatar
1 vote
1 answer
358 views

An efficient way to order content in controller [Spring Boot]

My code works as intended. CategoryController class has getAllCategories method, which tells ContentOrderMap class to map differently ordered categories to their respective OrderType enum. The ...
Kleronomas's user avatar

1
2 3 4 5