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
import com.meyl.spring.reactor.demo.model.Province; | |
import org.springframework.web.bind.annotation.GetMapping; | |
import org.springframework.web.bind.annotation.PathVariable; | |
import org.springframework.web.bind.annotation.RestController; | |
import java.util.ArrayList; | |
import java.util.List; | |
@RestController |
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
package com.meyl.spring.reactor.demo; | |
import com.meyl.spring.reactor.demo.model.Province; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import org.springframework.web.reactive.function.client.WebClient; | |
import reactor.core.publisher.Mono; | |
import java.time.Duration; | |
import java.time.Instant; |
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
List<Mono<Province>> list = Stream.of(9, 16, 19, 23, 31, 39) | |
.map(i -> client.get().uri("/province/{id}", i) | |
.retrieve().bodyToMono(Province.class)) | |
.collect(Collectors.toList()); |
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
Mono.when(list).block(); |
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
@Configuration | |
@EnableWebFlux | |
public class WebConfig implements WebFluxConfigurer { | |
@Override | |
public void addCorsMappings(CorsRegistry registry) { | |
registry.addMapping("/api/**") | |
.allowedOrigins("https://domain2.com") | |
.allowedMethods("PUT", "DELETE") |
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
@Configuration | |
@EnableWebFluxSecurity | |
public class HelloWebfluxSecurityConfig { | |
@Bean | |
public MapReactiveUserDetailsService userDetailsService() { | |
UserDetails user = User.withDefaultPasswordEncoder() | |
.username("user") | |
.password("user") | |
.roles("USER") |
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
@RunWith(SpringRunner.class) | |
@ContextConfiguration(classes = HelloWebfluxMethodApplication.class) | |
public class HelloWebfluxMethodApplicationTests { | |
@Autowired | |
ApplicationContext context; | |
WebTestClient rest; | |
@Before | |
public void setup() { |
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
import { Component } from '@angular/core'; | |
import { | |
trigger, | |
state, | |
style, | |
animate, | |
transition, | |
// etc... | |
} from '@angular/animations'; |
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
@Component({ | |
selector: 'app-root', | |
templateUrl: 'app.component.html', | |
styleUrls: ['app.component.css'], | |
animations: [ | |
// animation triggers go here | |
] | |
}) |
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
Map<String, String> map = new HashMap<>(); | |
map.put("phonenumber", phoneNumber); | |
map.put("newpassword", newpassword); | |
FirebaseUser mUser = FirebaseAuth.getInstance().getCurrentUser(); | |
mUser.getIdToken(true) | |
.addOnCompleteListener(new OnCompleteListener<GetTokenResult>() { | |
public void onComplete(@NonNull Task<GetTokenResult> task) { | |
if (task.isSuccessful()) { | |
String idToken = task.getResult().getToken(); |