Updated indentation
This commit is contained in:
parent
1d1791c90d
commit
31a9e429f1
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue