Skip to content
Snippets Groups Projects
Commit 66de0d44 authored by Maciej Szarlinski's avatar Maciej Szarlinski
Browse files

Switch off springboot-petclinic-server, adjust client side urls to call API Gateway

parent 395612bc
No related branches found
No related tags found
No related merge requests found
Showing
with 148 additions and 71 deletions
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.samples.petclinic.api</groupId>
<artifactId>petclinic-api-gateway</artifactId>
......@@ -23,51 +23,130 @@
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zuul</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Camden.SR1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zuul</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.samples</groupId>
<artifactId>springboot-petclinic-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>petclinic</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
</configuration>
<executions>
<execution>
<!-- Spring Boot Actuator displays build-related information if a META-INF/build-info.properties file is present -->
<goals>
<goal>build-info</goal>
</goals>
<configuration>
<additionalProperties>
<encoding.source>${project.build.sourceEncoding}</encoding.source>
<encoding.reporting>${project.reporting.outputEncoding}</encoding.reporting>
<java.source>${maven.compiler.source}</java.source>
<java.target>${maven.compiler.target}</java.target>
</additionalProperties>
</configuration>
</execution>
</executions>
</plugin>
<!-- Spring Boot Actuator displays build-related information if a META-INF/build-info.properties file is present -->
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>revision</goal>
</goals>
</execution>
</executions>
<configuration>
<verbose>true</verbose>
<dateFormat>yyyy-MM-dd'T'HH:mm:ssZ</dateFormat>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties
</generateGitPropertiesFilename>
</configuration>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.4.13</version>
<configuration>
<imageName>${docker.image.prefix}/springboot-petclinic</imageName>
<dockerDirectory>src/main/docker</dockerDirectory>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
<forceTags>true</forceTags>
<imageTags>
<imageTag>${project.version}</imageTag>
<imageTag>latest</imageTag>
</imageTags>
<useConfigFile>true</useConfigFile>
</configuration>
</plugin>
</plugins>
</build>
</project>
package org.springframework.samples.petclinic.api.infrastructure.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@Configuration
public class WebConfig extends WebMvcConfigurerAdapter {
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/").setViewName("index");
}
}
......@@ -53,16 +53,6 @@ public class PetResource {
return petService.findPetTypes();
}
//TODO: unused?
// @GetMapping("/owners/{ownerId}/pets/new")
// public String initCreationForm(@PathVariable("ownerId") int ownerId, Map<String, Object> model) {
// Owner owner = ownerService.findOwnerById(ownerId);
// Pet pet = new Pet();
// owner.addPet(pet);
// model.put("pet", pet);
// return "pets/createOrUpdatePetForm";
// }
@PostMapping("/owners/{ownerId}/pets")
@ResponseStatus(HttpStatus.NO_CONTENT)
public void processCreationForm(
......@@ -76,7 +66,7 @@ public class PetResource {
save(pet, petRequest);
}
@PutMapping("/owners/{ownerId}/pets/{petId}")
@PutMapping("/owners/*/pets/{petId}")
@ResponseStatus(HttpStatus.NO_CONTENT)
public void processUpdateForm(@RequestBody PetRequest petRequest) {
save(petService.findPetById(petRequest.getId()), petRequest);
......@@ -93,7 +83,7 @@ public class PetResource {
petService.savePet(pet);
}
@GetMapping("/pets/{petId}")
@GetMapping("owners/*/pets/{petId}")
public PetDetails findPet(@PathVariable("petId") int petId) {
return new PetDetails(petService.findPetById(petId));
}
......
......@@ -40,7 +40,7 @@ public class VisitResource {
this.visitService = visitService;
}
@PostMapping("/pets/{petId}/visits")
@PostMapping("owners/*/pets/{petId}/visits")
@ResponseStatus(HttpStatus.NO_CONTENT)
public void create(
@Valid @RequestBody Visit visit,
......@@ -50,7 +50,7 @@ public class VisitResource {
visitService.saveVisit(visit);
}
@GetMapping("/pets/{petId}/visits")
@GetMapping("owners/*/pets/{petId}/visits")
public List<Visit> visits(@PathVariable("petId") int petId) {
return visitService.findVisitsByPetId(petId);
}
......
......@@ -16,7 +16,6 @@
<modules>
<module>springboot-petclinic-client</module>
<module>springboot-petclinic-server</module>
<module>petclinic-clients-service</module>
<module>petclinic-vets-service</module>
<module>petclinic-visits-service</module>
......@@ -32,11 +31,6 @@
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.samples</groupId>
<artifactId>spring-petclinic-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
......
......@@ -4,4 +4,4 @@ angular.module('ownerDetails')
.component('ownerDetails', {
templateUrl: 'scripts/owner-details/owner-details.template.html',
controller: 'OwnerDetailsController'
});
\ No newline at end of file
});
......@@ -4,4 +4,4 @@ angular.module('ownerForm')
.component('ownerForm', {
templateUrl: 'scripts/owner-form/owner-form.template.html',
controller: 'OwnerFormController'
});
\ No newline at end of file
});
......@@ -4,4 +4,4 @@ angular.module('vetList')
.component('vetList', {
templateUrl: 'scripts/vet-list/vet-list.template.html',
controller: 'VetListController'
});
\ No newline at end of file
});
......@@ -4,4 +4,4 @@ angular.module('visits')
.component('visits', {
templateUrl: 'scripts/visits/visits.template.html',
controller: 'VisitsController'
});
\ No newline at end of file
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment