JAVA-3536 Move spring-rest-shell module

This commit is contained in:
mikr
2020-12-30 22:57:22 +01:00
parent 24ef4eaa19
commit 08435be190
8 changed files with 2 additions and 3 deletions
@@ -0,0 +1,13 @@
package com.baeldung;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
@@ -0,0 +1,40 @@
package com.baeldung.acticle;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
@Entity
public final class Article {
@Id
@GeneratedValue
private Long id;
private String title;
private String content;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
}
@@ -0,0 +1,18 @@
package com.baeldung.acticle;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import java.util.Optional;
@RepositoryRestResource(
path = "articles",
collectionResourceRel = "articles",
itemResourceRel = "article"
)
public interface ArticleRepository extends CrudRepository<Article, Long> {
Optional<Article> findByTitle(@Param("title") String title);
}