All Questions
23 questions
4
votes
2
answers
433
views
Springboot - Authentication Service
I am developing a Web application using Spring boot (I am a beginner). How can I make my code better?
This code is from "AuthenticationService.java".
I first made an interface for defining ...
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.
<...
3
votes
1
answer
113
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 ...
1
vote
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 ...
0
votes
1
answer
140
views
Microservice in Springboot
I wrote two microservices in Springboot and tried to follow the best practices. I would appreciate any suggestions about any improvement that I can make on the whole codebase. What are the parts of ...
1
vote
1
answer
186
views
13
votes
2
answers
2k
views
Stack Overflow clone
I have to write a simple web application using the Java Spring framework as my course project. So I decided to write a simple Stack Overflow clone. My application has the following features:
...
4
votes
2
answers
14k
views
Return a 404 when a resource is not found in Spring Boot
I wrote this code in order to return a http status of not found to my users in case the resource is not present in the DB.
...
14
votes
4
answers
3k
views
Unit testing Video Service class
I wrote my first unit testing code on a service class using Mockito. The code looks like this:
...
4
votes
1
answer
30k
views
Simple Banking application in Spring boot, JPA, REST where balance can be transferred among predefined accounts and transaction history retrievable
I want to create a very simple banking application where (i) predefined accounts with a positive balance can send money (ii) requesting balance and a list of transactions can be found.
I have ...
3
votes
1
answer
3k
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 ...
0
votes
1
answer
68
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:
...
1
vote
2
answers
148
views
Reporting sums of shopping carts
I have an object (ShoppingCart) that has a list of CartItems, which contains the related ...
2
votes
1
answer
6k
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
1
answer
86
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 ...