Skip to content

Commit 42bd620

Browse files
committed
polishing
1 parent 57aa1b3 commit 42bd620

3 files changed

Lines changed: 18 additions & 24 deletions

File tree

spring-data-rest-springfox/build.gradle

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,16 @@ sourceCompatibility = 1.8
2020
repositories {
2121
mavenLocal()
2222
mavenCentral()
23+
maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local/' }
2324
}
2425

2526

2627
dependencies {
2728
compile('org.springframework.boot:spring-boot-starter-data-jpa')
2829
compile('org.springframework.boot:spring-boot-starter-data-rest')
29-
compile('io.springfox:springfox-data-rest:2.7.0')
30-
compile('io.springfox:springfox-swagger2:2.7.0')
31-
compile('io.springfox:springfox-swagger-ui:2.7.0')
30+
compile('io.springfox:springfox-data-rest:2.7.1-SNAPSHOT')
31+
compile('io.springfox:springfox-swagger2:2.7.1-SNAPSHOT')
32+
compile('io.springfox:springfox-swagger-ui:2.7.1-SNAPSHOT')
3233
compile('com.h2database:h2:1.4.196')
3334
testCompile('org.springframework.boot:spring-boot-starter-test')
3435
}
Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,23 @@
11
package com.example.demo;
22

3-
import io.swagger.annotations.Api;
4-
import io.swagger.annotations.ApiModel;
5-
import io.swagger.annotations.ApiOperation;
6-
import io.swagger.annotations.ApiParam;
7-
import org.springframework.data.domain.Page;
3+
import io.swagger.annotations.*;
84
import org.springframework.data.repository.PagingAndSortingRepository;
95
import org.springframework.data.repository.query.Param;
106
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
11-
import org.springframework.web.bind.annotation.RequestParam;
127

13-
import java.awt.print.Pageable;
148
import java.util.List;
159

1610
@Api(tags = "Address Entity")
1711
@RepositoryRestResource(path = "addresses")
1812
public interface AddressRepository extends PagingAndSortingRepository<Address, Long> {
1913

20-
@ApiOperation("find all Addresses that are associated with a given Customer")
21-
List<Address> findByCustomerId(@Param("customerId") @RequestParam @ApiParam(name="customerId", value="ID of the customer") Long customerId);
14+
@ApiOperation("find all Addresses that are associated with a given Customer")
15+
List<Address> findByCustomerId(@Param("customerId") @ApiParam(name = "customerId", value = "ID of the customer", type = "body") Long customerId);
2216

23-
@Override
24-
@SuppressWarnings("unchecked")
25-
@ApiOperation("saves a new Address")
26-
Address save(Address address);
17+
@Override
18+
@SuppressWarnings("unchecked")
19+
@ApiOperation("saves a new Address")
20+
@ApiResponses({@ApiResponse(code = 201, message = "Created", response = Address.class)})
21+
Address save(Address address);
2722

2823
}

spring-data-rest-springfox/src/main/java/com/example/demo/SpringfoxConfiguration.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,14 @@
88
import springfox.documentation.spi.DocumentationType;
99
import springfox.documentation.spring.web.plugins.Docket;
1010

11-
import javax.servlet.ServletContext;
12-
1311
@Configuration
1412
public class SpringfoxConfiguration {
1513

16-
@Bean
17-
public Docket restApi(ServletContext servletContext) {
18-
return new Docket(DocumentationType.SWAGGER_2)
19-
.tags(new Tag("Address Entity", "Repository for Address entities"))
20-
.apiInfo(new ApiInfo("Customer Service API", "REST API of the Customer Service", "v42", null, null, null, null, Lists.newArrayList()));
21-
}
14+
@Bean
15+
public Docket docket() {
16+
return new Docket(DocumentationType.SWAGGER_2)
17+
.tags(new Tag("Address Entity", "Repository for Address entities"))
18+
.apiInfo(new ApiInfo("Customer Service API", "REST API of the Customer Service", "v42", null, null, null, null, Lists.newArrayList()));
19+
}
2220

2321
}

0 commit comments

Comments
 (0)