-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #121 from Sgitario/enable_test_for_13307
Updates after adding basic exception handling in REST services
- Loading branch information
Showing
10 changed files
with
51 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 7 additions & 5 deletions
12
602-spring-data-rest/src/main/java/org/acme/spring/data/rest/BookRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,29 @@ | ||
package org.acme.spring.data.rest; | ||
|
||
import com.sun.xml.bind.v2.model.core.ID; | ||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.data.repository.PagingAndSortingRepository; | ||
import org.springframework.data.rest.core.annotation.RepositoryRestResource; | ||
import org.springframework.data.rest.core.annotation.RestResource; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
@RepositoryRestResource(exported=false, path = "books", collectionResourceRel = "books") | ||
public interface BookRepository extends PagingAndSortingRepository<Book, Long> { | ||
|
||
@Override | ||
@RestResource(exported = true) | ||
Page<Book> findAll(Pageable pageable); | ||
|
||
@RestResource(exported = true) | ||
List<Book> findByOrderByNameDesc(); | ||
|
||
@Override | ||
@RestResource(path = "id") | ||
Optional<Book> findById(ID id); | ||
Optional<Book> findById(Long id); | ||
|
||
@Override | ||
@RestResource() | ||
Book save(Book book); | ||
} |
8 changes: 4 additions & 4 deletions
8
602-spring-data-rest/src/main/java/org/acme/spring/data/rest/LibraryRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
package org.acme.spring.data.rest; | ||
|
||
import com.sun.xml.bind.v2.model.core.ID; | ||
import java.util.Optional; | ||
|
||
import org.springframework.data.repository.CrudRepository; | ||
import org.springframework.data.rest.core.annotation.RestResource; | ||
|
||
import java.util.Optional; | ||
|
||
public interface LibraryRepository extends CrudRepository<Library, Long> { | ||
@Override | ||
@RestResource(path = "id") | ||
Optional<Library> findById(ID id); | ||
Optional<Library> findById(Long id); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
...ring-data-rest/src/test/java/org/acme/spring/data/rest/NativeLibraryRepositoryTestIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters