/spring-data-example

Spring Boot Snowdrop Spring Data Booster

Primary LanguageHTMLApache License 2.0Apache-2.0

Purpose

A example that demonstrates how to configure and deploy a Spring Boot app using Snowdrop’s Spring Data support, its embedded Infinispan support to be exact.

Deploying and interacting with the example

Spring Boot running locally

  • Run the app

mvn spring-boot:run

You then have 3 fields with which you can limit the search: author (auto-complete), text’s content and release date. You can also select the order field and direction.

If any results match your critera, they should be listed below, once you hit "Search".

  • Spring Data repository usage

The whole idea behind Spring Data is to use this simple repository interfaces. This is the one we use in this example.

public interface BookRepository extends SnowdropCrudRepository<Book, Integer> {
    List<Book> findByAuthorLike(String author);

    Stream<Book> findByTitleLike(String title);

    List<Book> findByReleaseDate(LocalDate date, Pageable pageable);

    List<Book> findByAuthor(String author, Pageable pageable);

    List<Book> findByContentContains(String content, Pageable pageable);
}

Snowdrop and Spring Data

Currently we use Infinispan embedded integration. But the Snowdrop Spring Data project has other integrations as well — with JPA, Infinispan remote and Google App Engine’s Datastore.