-
Notifications
You must be signed in to change notification settings - Fork 256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create Rick & Morty API #6
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GJ! Let`s improve your solution
} | ||
); | ||
} catch (IOException | InterruptedException e) { | ||
throw new RuntimeException(e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is better to throw custom exception instead of generic one
@EventListener(ApplicationReadyEvent.class) | ||
public void fetchData() { | ||
List<ExternalCharacterDto> characters = new ArrayList<>(); | ||
CharacterResponseDataDto response = loadData(characterUrl); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CharacterResponseDataDto response = loadData(characterUrl); | |
CharacterResponseDataDto characterResponse = loadData(characterUrl); |
service.saveAll(characters); | ||
} | ||
|
||
private CharacterResponseDataDto loadData(String url) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OPTIONAL: As an alternative way to make http requests it is possible to use feignClient, which from my point of view is a more suitable and agile way of making web clients and request. But actually for current task your solution in ok as well
No description provided.