applied spring formatter, temp removed gradle to support deployment with buildpacks

This commit is contained in:
Oded Shopen 2024-09-10 21:34:58 +03:00
parent 2371f6af56
commit 6f93676ace
10 changed files with 97 additions and 35 deletions

View file

@ -0,0 +1,25 @@
apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
name: petclinic-route
annotations:
healthcheck.gslb.tanzu.vmware.com/service: spring-petclinic
healthcheck.gslb.tanzu.vmware.com/path: /
healthcheck.gslb.tanzu.vmware.com/port: "80"
spec:
parentRefs:
- group: gateway.networking.k8s.io
kind: Gateway
name: default-gateway
sectionName: http-petclinic
rules:
- backendRefs:
- group: ""
kind: Service
name: spring-petclinic
port: 8080
weight: 1
matches:
- path:
type: PathPrefix
value: /

View file

@ -0,0 +1,18 @@
apiVersion: apps.tanzu.vmware.com/v1
kind: ContainerApp
metadata:
creationTimestamp: null
name: spring-petclinic
spec:
nonSecretEnv:
- name: SPRING_PROFILES_ACTIVE
value: postgres-openai
build:
buildpacks: {}
nonSecretEnv:
- name: BP_JVM_VERSION
value: "17"
path: ../..
ports:
- name: main
port: 8080

View file

@ -27,9 +27,17 @@ class AIFunctionConfiguration {
return petclinicAiProvider.addPetToOwner(request); return petclinicAiProvider.addPetToOwner(request);
}; };
} }
} }
record AddPetRequest (Pet pet, Integer ownerId) {}; record AddPetRequest(Pet pet, Integer ownerId) {
record OwnerRequest (Owner owner) {}; };
record OwnersResponse(List<Owner> owners) {};
record AddedPetResponse(Owner owner) {}; record OwnerRequest(Owner owner) {
};
record OwnersResponse(List<Owner> owners) {
};
record AddedPetResponse(Owner owner) {
};

View file

@ -12,4 +12,5 @@ public class LoggingAdvisor implements RequestResponseAdvisor {
System.out.println("Request: " + request); System.out.println("Request: " + request);
return request; return request;
} }
} }

View file

@ -8,6 +8,7 @@ import org.springframework.web.client.RestClient;
@Configuration @Configuration
public class PetclinicAIConfiguration { public class PetclinicAIConfiguration {
@Bean @Bean
public RestClient restClient() { public RestClient restClient() {
return RestClient.create(); return RestClient.create();
@ -17,4 +18,5 @@ public class PetclinicAIConfiguration {
public ChatMemory chatMemory() { public ChatMemory chatMemory() {
return new InMemoryChatMemory(); return new InMemoryChatMemory();
} }
} }

View file

@ -9,6 +9,7 @@ import org.springframework.stereotype.Service;
@Service @Service
public class PetclinicAiProvider { public class PetclinicAiProvider {
OwnerRepository ownerRepository; OwnerRepository ownerRepository;
public PetclinicAiProvider(OwnerRepository ownerRepository) { public PetclinicAiProvider(OwnerRepository ownerRepository) {

View file

@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
@RequestMapping("/") @RequestMapping("/")
public class PetclinicChatClient { public class PetclinicChatClient {

6
tanzu.yml Normal file
View file

@ -0,0 +1,6 @@
apiVersion: config.tanzu.vmware.com/v1
configuration:
dev:
paths:
- .tanzu/config/
kind: TanzuConfig