Question: Use ArticleRepository as Spring Data JPA repository and inject it into Articleservice. Configure the Article class as a Hibernate entity. It should correspond to the
Use ArticleRepository as Spring Data JPA repository and inject it into Articleservice.
Configure the Article class as a Hibernate entity. It should correspond to the article table in the database.
Implement a findById method it should return the article with the given id if it exists in the database, or return an empty article otherwise.
Implement a findByTitle ra method it should return list of articles with title containing given argument
Implement a create method it should insert an article into the database and return its generated id existing article. If there is no article with the given id you should throw a RuntimeException rith withessage "Article not found".
Implement a delete ra method that allows an article to be deleted.
Add validation to the create a and update methods check whether content does not contain any words defined in the blacklist. The blacklist is defined as a configuration property articles.blacklist in which contains commaseparated words, for example: bannedword bannedword if If validation fails, throw a Runt imeException a with message
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
