Home > database >  OpenApi 3.0 shows all af the HTTP methods
OpenApi 3.0 shows all af the HTTP methods

Time:11-14

My OpenApi gone crazy... i created 2 simple rest APIs

    @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 ?

my dependency

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

OpenApi3.0

CodePudding user response:

The @RequestMapping tells Spring that any HTTP request with the specified path should be mapped to the corresponding method. The path should be specified as an argument of the @PutMapping and @GetMapping annotations and the @RequestMapping annotation should be removed.

  • Related