#Code review request for Spring Boot application.
1 messages · Page 1 of 1 (latest)
Instead of WebClient you can use RestTemplate https://github.com/playerblair/CatalogingAppV2/blob/main/src/main/java/dev/playerblair/catalogingapp/api/service/ApiServiceImpl.java#L15
pro being you dont need to touch reactive stuff
@Data
@AllArgsConstructor
public class GenreWrapper {
private String name;
}
for stuff like this just use a record
public record GenreWrapper(String name) {}
isnt RestClient the modern approach of RestTemplate?
Correct. Please don't use WebClient anymore.
maybe - but either way no need for the reactive client
just in general I want to tell you to learn a sql database and avoid mongo
whatever you were told about its flexibility is a lie
NoSQL has its uses, but I wouldn't start with it.
I have used sql database before, I just wanted to try nosql for a change
for code like this
@Override
public List<Manga> findByDynamicCriteria(MangaFilter filter) {
Query query = new Query();
List<Criteria> criteria = new ArrayList<>();
if (filter.getQuery() != null && !filter.getQuery().isEmpty()) {
criteria.add(Criteria.where("title").regex(filter.getQuery(), "i"));
}
you can avoid the != null a by having a default list
I saw that RestTemplate was maintenance mode so i used WebClient with block instead.
yeah apparently there is a new thing, but its not webclient
other than that, strongly consider grouping your code up
ok, i didn't know this a thing
reading what you have right now, you need to jump between multiple packages to understand what any route does
how should i structure instead? should I just use controller-service-repository instead grouping with api-manga
try putting everything except ApiService (which probably can have a better name) and model in one package to start
I explained this a good deal to someone yesterday, let me find the thread
@faint pier
Your question has been closed due to inactivity.
If it was not resolved yet, feel free to just post a message below
to reopen it, or create a new thread.
Note that usually the reason for nobody calling back is that your
question may have been not well asked and hence no one felt confident
enough answering.
When you reopen the thread, try to use your time to improve the quality
of the question by elaborating, providing details, context, all relevant code
snippets, any errors you are getting, concrete examples and perhaps also some
screenshots. Share your attempt, explain the expected results and compare
them to the current results.
Also try to make the information easily accessible by sharing code
or assignment descriptions directly on Discord, not behind a link or
PDF-file; provide some guidance for long code snippets and ensure
the code is well formatted and has syntax highlighting. Kindly read through
https://stackoverflow.com/help/how-to-ask for more.
With enough info, someone knows the answer for sure 👍