title: No operations defined in spec! I get this error when I try to run spring boot application using swagger
body: <p>I'm working with ecommerce spring boot application using swagger. When I try to run my application I get message as &quot;No operations defined in spec!&quot;</p>
  <p>This is Api code:</p>
  <pre><code>package com.ecommerce.demo.repository;
  
  import com.ecommerce.demo.model.Category;
  import org.springframework.data.jpa.repository.JpaRepository;
  import org.springframework.stereotype.Repository;
  
  @Repository
  public interface CategoryRepo extends JpaRepository&lt;Category, Integer&gt; {
  
  }
  </code></pre>
  <p>Configuration file :</p>
  <pre><code>import org.springframework.web.servlet.config.annotation.CorsRegistry;
  import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
  
  @Configuration
  class Webconfig {
  
      @Bean
      public WebMvcConfigurer corsConfigurer() {
          return new WebMvcConfigurer() {
              @Override
              public void addCorsMappings(CorsRegistry registry) {
                  registry.addMapping(&quot;/**&quot;)
                          .allowedOrigins(&quot;*&quot;)
                          .allowedMethods(&quot;GET&quot;, &quot;PUT&quot;, &quot;POST&quot;, &quot;PATCH&quot;, &quot;DELETE&quot;, &quot;OPTIONS&quot;);
              }
          };
      }
  }
  </code></pre>
  <p>Here is the dependencies that I'm using:</p>
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;io.springfox&lt;/groupId&gt;
      &lt;artifactId&gt;springfox-swagger2&lt;/artifactId&gt;
      &lt;version&gt;2.9.2&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;io.springfox&lt;/groupId&gt;
      &lt;artifactId&gt;springfox-swagger-ui&lt;/artifactId&gt;
      &lt;version&gt;2.9.2&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
      &lt;scope&gt;test&lt;/scope&gt;
  &lt;/dependency&gt;
  </code></pre>
  <p>Here is my model :</p>
  <pre><code>package com.ecommerce.demo.model;
  
  import javax.persistence.Column;
  import javax.persistence.Entity;
  import javax.persistence.GeneratedValue;
  import javax.persistence.GenerationType;
  import javax.persistence.Id;
  import javax.persistence.Table;
  import javax.validation.constraints.NotBlank;
  
  @Entity
  @Table(name=&quot;categories&quot;)
  public class Category {
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      private Integer id;
  
      @Column(name = &quot;category_name&quot;)
      private @NotBlank String categoryName;
  
      private @NotBlank String description;
  
      @Column(name = &quot;image_url&quot;)
      private @NotBlank String imageUrl;
  
      public Integer getId() {
          return id;
      }
  
      public void setId(Integer id) {
          this.id = id;
      }
  
      public String getCategoryName() {
          return categoryName;
      }
  
      public void setCategoryName(String categoryName) {
          this.categoryName = categoryName;
      }
  
      public String getDescription() {
          return description;
      }
  
      public void setDescription(String description) {
          this.description = description;
      }
  
      public String getImageUrl() {
          return imageUrl;
      }
  
      public void setImageUrl(String imageUrl) {
          this.imageUrl = imageUrl;
      }
  }
  </code></pre>
  <p>Repository :</p>
  <pre><code>package com.ecommerce.demo.repository;
  
  import com.ecommerce.demo.model.Category;
  import org.springframework.data.jpa.repository.JpaRepository;
  import org.springframework.stereotype.Repository;
  
  @Repository
  public interface CategoryRepo extends JpaRepository&lt;Category, Integer&gt; {
  
  }
  </code></pre>
  <p>Here is Service :</p>
  <pre><code>package com.ecommerce.demo.service;
  
  import com.ecommerce.demo.model.Category;
  import com.ecommerce.demo.repository.CategoryRepo;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Service;
  
  @Service
  public class CategoryService {
      @Autowired
      CategoryRepo categoryRepo;
  
      public void createCategory(Category category){
          categoryRepo.save(category);
  
      }
  }
  </code></pre>
  <p>And Controller :</p>
  <pre><code>package com.ecommerce.demo.controller;
  
  import com.ecommerce.demo.model.Category;
  import com.ecommerce.demo.service.CategoryService;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.web.bind.annotation.PostMapping;
  import org.springframework.web.bind.annotation.RequestBody;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RestController;
  
  @RestController
  @RequestMapping(&quot;category&quot;)
  public class CategoryController {
  
      @Autowired
      CategoryService categoryService;
  
      @PostMapping(&quot;/create&quot;)
      public String createCategory(@RequestBody Category category){
          categoryService.createCategory(category);
          return &quot;success&quot;;
      }
  }
  </code></pre>
  <p>Swagger doesn't recognise the api.What's the problem in this code?</p>