spring-guides / tut-rest

Building REST services with Spring :: Learn how to easily build RESTful services with Spring

Home Page:https://spring.io/guides/tutorials/rest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HATEOAS class BookmarkRestController @RequestMapping(method = RequestMethod.POST)

mdbudnick opened this issue · comments

Getting the error: Cannot infer type argument(s) for map(Function<? super T,? extends U>
For return accountRepository.findByUsername(userId)
.map(account -> {
Bookmark bookmark = bookmarkRepository
.save(new Bookmark(account, input.uri, input.description));

            Link forOneBookmark = new BookmarkResource(bookmark).getLink("self");

            return ResponseEntity.created(URI.create(forOneBookmark.getHref())).build();
        })

Will continue debugging.

Try to type some things here, backspace there, and it compiles correctly for seemingly no reason. Maybe an extra space? But I copied and pasted. sigh

Just in case someone else stumbles on this; For me, this error was actually a side-effect of missing imports. Adding all necessary imports resolved this.