简体   繁体   English

OpenApi 3.0 显示所有 HTTP 方法

[英]OpenApi 3.0 shows all af the HTTP methods

My OpenApi gone crazy... i created 2 simple rest APIs我的 OpenApi 疯了...我创建了 2 个简单的 rest API

    @RequestMapping("/inWithHibernate")
    @PutMapping
    public void inDbMobile() {
        hibernateInsert.inDB();
    }

    @RequestMapping("/outWithHibernate")
    @GetMapping
    public MobileEntity outDbMobile(@RequestParam(name = "id")Long id) {
        return hibernateInsert.fromDB(id);
    }

as i understand it it should show one Put method and one Get method...Instead of that is shows all of the methods, can you please explain what is happening?据我了解,它应该显示一种 Put 方法和一种 Get 方法...而不是显示所有方法,您能解释一下发生了什么吗?

my dependency我的依赖

        <dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-ui</artifactId>
            <version>1.6.12</version>
        </dependency>

OpenApi3.0

The @RequestMapping tells Spring that any HTTP request with the specified path should be mapped to the corresponding method. @RequestMapping告诉 Spring 任何具有指定路径的 HTTP 请求都应该映射到相应的方法。 The path should be specified as an argument of the @PutMapping and @GetMapping annotations and the @RequestMapping annotation should be removed.该路径应指定为@PutMapping@GetMapping注释的参数,并且应删除@RequestMapping注释。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM