Updated indentation

This commit is contained in:
soni.sk@1969 2022-03-30 11:09:45 +05:30
parent 1d1791c90d
commit 31a9e429f1
4 changed files with 37 additions and 38 deletions

View File

@ -14,18 +14,17 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
@EnableSwagger2
public class ArticleApplication {
public static void main(String[] args) {
SpringApplication.run(ArticleApplication.class, args);
}
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build();
}
public static void main(String[] args) {
SpringApplication.run(ArticleApplication.class, args);
}
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build();
}
}

View File

@ -11,18 +11,18 @@ import com.baeldung.springboot.swagger.service.ArticleService;
@RestController
@RequestMapping("/articles")
public class ArticlesController {
@Autowired
private ArticleService articleService;
@GetMapping("")
public List<Article> getAllArticles(){
return articleService.getAllArticles();
}
@PostMapping("")
public void addArticle(@RequestBody Article article) {
articleService.addArticle(article);
}
@Autowired
private ArticleService articleService;
@GetMapping("")
public List<Article> getAllArticles() {
return articleService.getAllArticles();
}
@PostMapping("")
public void addArticle(@RequestBody Article article) {
articleService.addArticle(article);
}
}

View File

@ -13,7 +13,7 @@ public class Article {
//@JsonIgnore
//@JsonProperty(access = JsonProperty.Access.READ_ONLY)
//@ApiModelProperty(hidden = true)
@ApiParam(hidden = true)
//@ApiParam(hidden = true)
//@ApiModelProperty(readOnly = true)
private int id;
private String title;

View File

@ -9,17 +9,17 @@ import com.baeldung.springboot.swagger.model.Article;
@Service
public class ArticleService {
private List<Article> articles = new ArrayList<>();
public List<Article> getAllArticles(){
return articles;
}
public void addArticle(Article article) {
article.setId(articles.size()+1);
articles.add(article);
}
private List<Article> articles = new ArrayList<>();
public List<Article> getAllArticles() {
return articles;
}
public void addArticle(Article article) {
article.setId(articles.size() + 1);
articles.add(article);
}
}