polishing

This commit is contained in:
Tom Hombergs
2017-08-02 23:15:20 +02:00
parent 57aa1b3d00
commit 42bd620471
3 changed files with 18 additions and 24 deletions

View File

@@ -20,15 +20,16 @@ sourceCompatibility = 1.8
repositories {
mavenLocal()
mavenCentral()
maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local/' }
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.springframework.boot:spring-boot-starter-data-rest')
compile('io.springfox:springfox-data-rest:2.7.0')
compile('io.springfox:springfox-swagger2:2.7.0')
compile('io.springfox:springfox-swagger-ui:2.7.0')
compile('io.springfox:springfox-data-rest:2.7.1-SNAPSHOT')
compile('io.springfox:springfox-swagger2:2.7.1-SNAPSHOT')
compile('io.springfox:springfox-swagger-ui:2.7.1-SNAPSHOT')
compile('com.h2database:h2:1.4.196')
testCompile('org.springframework.boot:spring-boot-starter-test')
}

View File

@@ -1,28 +1,23 @@
package com.example.demo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.data.domain.Page;
import io.swagger.annotations.*;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.web.bind.annotation.RequestParam;
import java.awt.print.Pageable;
import java.util.List;
@Api(tags = "Address Entity")
@RepositoryRestResource(path = "addresses")
public interface AddressRepository extends PagingAndSortingRepository<Address, Long> {
@ApiOperation("find all Addresses that are associated with a given Customer")
List<Address> findByCustomerId(@Param("customerId") @RequestParam @ApiParam(name="customerId", value="ID of the customer") Long customerId);
@ApiOperation("find all Addresses that are associated with a given Customer")
List<Address> findByCustomerId(@Param("customerId") @ApiParam(name = "customerId", value = "ID of the customer", type = "body") Long customerId);
@Override
@SuppressWarnings("unchecked")
@ApiOperation("saves a new Address")
Address save(Address address);
@Override
@SuppressWarnings("unchecked")
@ApiOperation("saves a new Address")
@ApiResponses({@ApiResponse(code = 201, message = "Created", response = Address.class)})
Address save(Address address);
}

View File

@@ -8,16 +8,14 @@ import springfox.documentation.service.Tag;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import javax.servlet.ServletContext;
@Configuration
public class SpringfoxConfiguration {
@Bean
public Docket restApi(ServletContext servletContext) {
return new Docket(DocumentationType.SWAGGER_2)
.tags(new Tag("Address Entity", "Repository for Address entities"))
.apiInfo(new ApiInfo("Customer Service API", "REST API of the Customer Service", "v42", null, null, null, null, Lists.newArrayList()));
}
@Bean
public Docket docket() {
return new Docket(DocumentationType.SWAGGER_2)
.tags(new Tag("Address Entity", "Repository for Address entities"))
.apiInfo(new ApiInfo("Customer Service API", "REST API of the Customer Service", "v42", null, null, null, null, Lists.newArrayList()));
}
}