Last active
November 11, 2015 00:52
-
-
Save smaldini/8763d0ad2233ba52d35a to your computer and use it in GitHub Desktop.
Spring 5 "Reactive Features" in action powered and demonstrated here with Reactor Streams
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
@Controller | |
public class TestController { | |
@Autowired | |
//Some reactive database repository | |
private final ProfileRepository profileRepository; | |
public TestController(ProfileRepository profileRepository){ | |
this.profileRepository = profileRepository; | |
} | |
@RequestMapping("/create-profile") | |
@ResponseBody | |
//Decode input in a non blocking fashion | |
public Stream<Profile> createProfile(@RequestBody Stream<Profile> profiles) { | |
//transform input Profiles into saved Profile and pass them back in response | |
return profiles.flatMap(profileRepository::save); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment