Spring webflux反应式api始终返回404错误
这是我的主课Spring webflux反应式api始终返回404错误,spring,rest,post,http-status-code-404,spring-webflux,Spring,Rest,Post,Http Status Code 404,Spring Webflux,这是我的主课 @SpringBootApplication @ComponentScan(basePackages= {"com.test" }) public class Application { public static void main(String... args) { System.setProperty("spring.devtools.restart.enabled", "false"); Properties pr
@SpringBootApplication
@ComponentScan(basePackages= {"com.test"
})
public class Application {
public static void main(String... args) {
System.setProperty("spring.devtools.restart.enabled", "false");
Properties props = BootProperties.forService(
"test", "test", "test");
new SpringApplicationBuilder(
Application.class)
.properties(props)
.run(args);
}
RestController
@RestController
public class PersonController {
private ARepository aRepo;
PersonController(ARepository aRepo) {
this.aRepo = aRepo;
}
@PostMapping(path = "/books", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
public Mono<VO> createBook(@Valid @RequestBody VO vo) {
return apply(vo);
}
public Mono<VO> apply(VO vo) {
Mono<VO> alternate = Mono.fromCallable(() -> {
return aRepo.findById(vo.getId1(), vo.getId2());
}).flatMapMany(Flux::fromIterable).next().map(n -> build(vo, n)).subscribeOn(Schedulers.elastic());
return alternate;
}
@RestController
公共类个人控制器{
私人储蓄账户;
人员控制员(aRepo){
this.aRepo=aRepo;
}
@PostMapping(path=“/books”,consumes=MediaType.APPLICATION\u JSON\u VALUE,products=MediaType.APPLICATION\u JSON\u VALUE)
公共Mono createBook(@Valid@RequestBody-VO){
返回应用(vo);
}
公共单声道应用(VO){
Mono alternate=Mono.fromCallable(()->{
返回aRepo.findById(vo.getId1(),vo.getId2());
}).flatMapMany(Flux::fromIterable).next().map(n->build(vo,n)).subscribeOn(Schedulers.elastic());
返回候补;
}
你可以发布你如何处理你的请求吗http:/localhost:8080/app-env2/books请求体{“id1”:“678”、“id2”:“275”}app-env2?尝试删除那是上下文路径我在你的代码示例中看不到任何定义的上下文路径你可以发布你如何处理你的请求吗http:/localhost:8080/app-env2/books请求体{“id1”:“678”,“id2”:“275”}app-env2?尝试删除该上下文路径。在代码示例中,我看不到任何已定义的上下文路径