Comments (7)
Actually ended up changing:
return this.bookmarkRepository.findOne(bookmarkId);
to:
Optional<Bookmark> bookmark = this.bookmarkRepository.findById(bookmarkId);
if (bookmark.isPresent()) {
return bookmark.get();
} else {
return null;
}
The application compiles and runs as expected so far. Would love feedback on whether this is the way to go or not.
from tut-rest.
@RaMdsC
This might indeed be the case. Looking at the documentation for Spring v1.5.x the method findOne()
is inherited from the CrudRepository
interface and has the signature:
T findOne(ID id)
while in the current version of Spring this method is inherited from QueryByExampleExecutor
and has the signature:
<S extends T> Optional<S> findOne(Example<S> example)
In the current implementation of CrudRepository
this method does not exist.
from tut-rest.
+1
from tut-rest.
+1
from tut-rest.
Had exactly the same problem. Also tried to replace findOne(bookmarkId)
with getOne(bookmarkId)
. Ended up with the same solution as @matthewbryancurtis - using an Optional
and returning null
when there is no bookmark. Even though it doesn't seem right to return null
when the method declares Bookmark
as the return type.
But here is the funny thing. A slightly elder version of the same tutorial found here: https://github.com/joshlong/bookmarks/tree/tutorial does compile (in the end, if skipTests
is set) and can be made to run as expected. Don't know why.
from tut-rest.
Tested and working straightaway on clean Ubuntu 17.10.
Apache Maven 3.5.0
OpenJDK 1.8.0_171
Maven defaults to Spring Boot v1.5.1.RELEASE
I will post further updates as i do some more testing, it seems like an incompatibility issue.
UPDATE 1:
Tested and also working straightaway on clean Ubuntu 16.04.
Apache Maven 3.3.9
OpenJDK 1.8.0_171
Maven defaults to Spring Boot v1.5.1.RELEASE
from tut-rest.
Resolved via 7f3644e
from tut-rest.
Related Issues (20)
- Complete Building REST services with Spring tutorial with OrderNotFoundAdvice Class HOT 1
- Misleading Put method in non-REST EmployeeController HOT 1
- Confused by DELETE http://localhost:8080/orders/4/cancel HOT 1
- isse in postman to post mapping HOT 2
- unable to proceed when adding links in one method of EmployeeController class HOT 1
- Order Controller /cancel Mapping Feedback HOT 2
- Error: The method methodOn(Class) is undefined for the type EmployeeController. HOT 4
- Error: java.lang.IllegalArgumentException: Invalid character found in method name [] . HTTP method names must be tokens HOT 3
- Missing Code Snippets in README.md HOT 1
- Logging of preloading data has changed HOT 1
- Link to HAL returns 404 HOT 3
- Package imports for Jakarta are not correct with latest version of Spring Boot HOT 1
- Employee.java imports javax.persistence-api.* not found HOT 2
- Mentioning correct curl commands for Windows HOT 1
- Not a managed entity error HOT 5
- 415 when attempting to post json object HOT 2
- warning: You aren't using a compiler supported by lombok, so lombok will not work and has been disabled. Your processor is: org.gradle.api.internal.tasks.compile.processing.IncrementalProcessingEnvironment Lombok supports: OpenJDK javac, ECJ HOT 3
- Duplicated, outdated tutorial HOT 5
- EntityModel is Deprecated
- Improvements for beginners HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tut-rest.