first commit
This commit is contained in:
commit
96f1241e95
40
api-gateway/pom.xml
Normal file
40
api-gateway/pom.xml
Normal file
@ -0,0 +1,40 @@
|
||||
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.shop</groupId>
|
||||
<artifactId>parent-service-new</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>api-gateway</artifactId>
|
||||
<name>api-gateway</name>
|
||||
<description>API Gateway</description>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-gateway</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-starter-webflux-api</artifactId>
|
||||
<version>2.0.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-starter-webflux-ui</artifactId>
|
||||
<version>2.0.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@ -0,0 +1,12 @@
|
||||
package com.shop.apigateway;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class ApiGatewayApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ApiGatewayApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
39
api-gateway/src/main/resources/application.properties
Normal file
39
api-gateway/src/main/resources/application.properties
Normal file
@ -0,0 +1,39 @@
|
||||
eureka.client.serviceUrl.defaultZone=http://@localhost:8761/eureka
|
||||
#eureka.client.serviceUrl.defaultZone=http://localhost:8761/eureka
|
||||
#eureka.instance.metadata-map.user=${spring.security.user.name}
|
||||
#eureka.instance.metadata-map.password=${spring.security.user.password}
|
||||
#eureka.instance.metadata-map.user=eureka
|
||||
#eureka.instance.metadata-map.password=password
|
||||
spring.application.name=api-gateway
|
||||
#eureka.client.proxyHost=eureka
|
||||
#eureka.client.proxyPort=password
|
||||
|
||||
|
||||
logging.level.root=INFO
|
||||
logging.level.org.springframeword.cloud.gateway.route.RouteDefinitionLocator=DEBUG
|
||||
logging.level.org.springframework.web: DEBUG
|
||||
logging.level.org.springframeword.cloud.gateway=TRACE
|
||||
|
||||
#Product Service Route
|
||||
spring.cloud.gateway.routes[0].id=product-service
|
||||
spring.cloud.gateway.routes[0].uri=lb://product-service
|
||||
spring.cloud.gateway.routes[0].predicates[0]=Path=/api/product
|
||||
|
||||
#Order Service Route
|
||||
spring.cloud.gateway.routes[1].id=order-service
|
||||
spring.cloud.gateway.routes[1].uri=lb://order-service
|
||||
spring.cloud.gateway.routes[1].predicates[0]=Path=/api/order
|
||||
|
||||
#Discovery Service Route
|
||||
spring.cloud.gateway.routes[2].id=discovery-service
|
||||
spring.cloud.gateway.routes[2].uri=http://localhost:8761
|
||||
spring.cloud.gateway.routes[2].predicates[0]=Path=/eureka/web
|
||||
spring.cloud.gateway.routes[2].filters[0]=SetPath=/
|
||||
|
||||
#Discovery Service Static Ressources Route
|
||||
spring.cloud.gateway.routes[3].id=discovery-service-static
|
||||
spring.cloud.gateway.routes[3].uri=http://localhost:8761
|
||||
spring.cloud.gateway.routes[3].predicates[0]=Path=/eureka/**
|
||||
|
||||
|
||||
#spring.security.oauth2.resourceserver.jwt.issuer-uri=http://localhost:8181/realms/spring-boot-microservices-realm
|
||||
21
discovery-service/pom.xml
Normal file
21
discovery-service/pom.xml
Normal file
@ -0,0 +1,21 @@
|
||||
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.shop</groupId>
|
||||
<artifactId>parent-service-new</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>discovery-service</artifactId>
|
||||
<name>discovery-service</name>
|
||||
<description>Discovery Service</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@ -0,0 +1,25 @@
|
||||
package com.shop.discoveryservice;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableEurekaServer
|
||||
public class DiscoveryServerApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(DiscoveryServerApplication.class, args);
|
||||
}
|
||||
// @Autowired
|
||||
// private UserDetailsManager userDetailsManager;
|
||||
//
|
||||
// @Bean
|
||||
// public CommandLineRunner commandLineRunner() {
|
||||
// return args -> {
|
||||
// UserDetails user = User.withDefaultPasswordEncoder().username("eureka").password("password").roles("USER", "ADMIN").build();
|
||||
//
|
||||
// userDetailsManager.createUser(user);
|
||||
// };
|
||||
// }
|
||||
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
{"properties": [
|
||||
{
|
||||
"name": "eureka.username",
|
||||
"type": "java.lang.String",
|
||||
"description": "A description for 'eureka.username'"
|
||||
},
|
||||
{
|
||||
"name": "eureka.password",
|
||||
"type": "java.lang.String",
|
||||
"description": "A description for 'eureka.password'"
|
||||
}
|
||||
]}
|
||||
23
discovery-service/src/main/resources/application.properties
Normal file
23
discovery-service/src/main/resources/application.properties
Normal file
@ -0,0 +1,23 @@
|
||||
eureka.instance.hostname=localhost
|
||||
eureka.client.register-with-eureka=false
|
||||
eureka.client.fetch-registry=false
|
||||
#server.port=8761
|
||||
|
||||
server.port=8761
|
||||
|
||||
spring.freemarker.template-loader-path= classpath:/templates/
|
||||
spring.freemarker.prefer-file-system-access= false
|
||||
|
||||
#eureka.username=${EUREKA_USER:eureka}
|
||||
#eureka.password=${EUREKA_PASSWORD:password}
|
||||
|
||||
logging.level.org.springframework.web: DEBUG
|
||||
logging.level.org.hibernate: DEBUG
|
||||
|
||||
logging.level.org.springframework.security=DEBUG
|
||||
|
||||
|
||||
spring.security.user.name=eureka
|
||||
spring.security.user.password=password
|
||||
eureka.client.proxyHost=eureka
|
||||
eureka.client.proxyPort=password
|
||||
13
discovery-service/src/main/resources/logback-spring.xml
Normal file
13
discovery-service/src/main/resources/logback-spring.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<configuration>
|
||||
<!-- andere Konfigurationseinstellungen -->
|
||||
|
||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</root>
|
||||
</configuration>
|
||||
47
inventory-service-mv/pom.xml
Normal file
47
inventory-service-mv/pom.xml
Normal file
@ -0,0 +1,47 @@
|
||||
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.shop</groupId>
|
||||
<artifactId>parent-service-new</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>inventory-service-mv</artifactId>
|
||||
<properties>
|
||||
|
||||
|
||||
<maven.compiler.source>20</maven.compiler.source>
|
||||
<maven.compiler.target>20</maven.compiler.target>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@ -0,0 +1,33 @@
|
||||
package com.shop.inventoryservice;
|
||||
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
import com.shop.inventoryservice.model.Inventory;
|
||||
import com.shop.inventoryservice.repository.InventoryRepository;
|
||||
|
||||
@SpringBootApplication
|
||||
public class InventoryServiceApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(InventoryServiceApplication.class, args);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CommandLineRunner loadData(InventoryRepository inventoryRepository) {
|
||||
return args -> {
|
||||
Inventory inventory = new Inventory();
|
||||
inventory.setSkuCode("phone1");
|
||||
inventory.setQuantity(100);
|
||||
|
||||
Inventory inventory2 = new Inventory();
|
||||
inventory2.setSkuCode("phone2");
|
||||
inventory2.setQuantity(0);
|
||||
|
||||
inventoryRepository.save(inventory);
|
||||
inventoryRepository.save(inventory2);
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package com.shop.inventoryservice.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.shop.inventoryservice.dto.InventoryResponse;
|
||||
import com.shop.inventoryservice.service.InventoryService;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/inventory")
|
||||
public class InventoryController {
|
||||
|
||||
private final InventoryService inventoryService;
|
||||
|
||||
@GetMapping
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
public List<InventoryResponse> isInStock(@RequestParam("skuCode") List<String> skuCode) {
|
||||
return inventoryService.isInStockIn(skuCode);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.shop.inventoryservice.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class InventoryResponse {
|
||||
private String skuCode;
|
||||
private boolean isInStock;
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package com.shop.inventoryservice.model;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Entity
|
||||
@Table(name = "t_inventory")
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class Inventory {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String skuCode;
|
||||
private Integer quantity;
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.shop.inventoryservice.repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.shop.inventoryservice.model.Inventory;
|
||||
|
||||
@Repository
|
||||
public interface InventoryRepository extends JpaRepository<Inventory, Long> {
|
||||
|
||||
public Optional<Inventory> findBySkuCode(String skuCode);
|
||||
|
||||
public List<Inventory> findBySkuCodeIn(List<String> skuCodes);
|
||||
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
package com.shop.inventoryservice.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.shop.inventoryservice.dto.InventoryResponse;
|
||||
import com.shop.inventoryservice.repository.InventoryRepository;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class InventoryService {
|
||||
private final InventoryRepository inventoryRepository;
|
||||
|
||||
public boolean isInStock(String skuCode) {
|
||||
return inventoryRepository.findBySkuCode(skuCode).isPresent();
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public List<InventoryResponse> isInStockIn(List<String> skuCode) {
|
||||
System.out.print(inventoryRepository.findBySkuCodeIn(skuCode).size());
|
||||
return inventoryRepository.findBySkuCodeIn(skuCode).stream().map(
|
||||
inv -> InventoryResponse.builder().skuCode(inv.getSkuCode()).isInStock(inv.getQuantity() > 0).build())
|
||||
.toList();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
spring.datasource.url=jdbc:mysql://localhost:3306/inventory-service?useSSL=false
|
||||
spring.datasource.username=root
|
||||
spring.datasource.password=nEFK0Nu7OLW78NZl4VJj
|
||||
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
|
||||
|
||||
|
||||
# Hibernate properties
|
||||
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect
|
||||
|
||||
# TODO
|
||||
spring.jpa.hibernate.ddl-auto=create-drop
|
||||
#spring.jpa.hibernate.ddl-auto=update
|
||||
#logging.level.org.springframework.web: DEBUG
|
||||
#logging.level.org.hibernate: DEBUG
|
||||
|
||||
# assign random port i.e. allow multiple parallel instances
|
||||
server.port=0
|
||||
|
||||
spring.application.name=inventory-service
|
||||
#eureka.client.serviceUrl.defaultZone=http://localhost:8763/eureka
|
||||
eureka.client.serviceUrl.defaultZone=http://eureka:password@localhost:8761/eureka
|
||||
@ -0,0 +1,13 @@
|
||||
package com.shop.inventoryservice;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
class InventoryServiceApplicationTests {
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
}
|
||||
|
||||
}
|
||||
56
order-service-mv/pom.xml
Normal file
56
order-service-mv/pom.xml
Normal file
@ -0,0 +1,56 @@
|
||||
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.shop</groupId>
|
||||
<artifactId>parent-service-new</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>order-service-mv</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-webflux</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.projectreactor</groupId>
|
||||
<artifactId>reactor-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@ -0,0 +1,13 @@
|
||||
package com.shop.orderservice;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class OrderServiceApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(OrderServiceApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.shop.orderservice.config;
|
||||
|
||||
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.reactive.function.client.WebClient;
|
||||
|
||||
@Configuration
|
||||
public class WebClientConfig {
|
||||
|
||||
@Bean
|
||||
@LoadBalanced
|
||||
public WebClient.Builder webClientBuilder() {
|
||||
return WebClient.builder();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package com.shop.orderservice.controller;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.shop.orderservice.dto.OrderRequest;
|
||||
import com.shop.orderservice.service.OrderService;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/order")
|
||||
public class OrderController {
|
||||
|
||||
private final OrderService orderService;
|
||||
|
||||
@PostMapping
|
||||
@ResponseStatus(HttpStatus.CREATED)
|
||||
public String placeOrder(@RequestBody OrderRequest request) {
|
||||
orderService.placeOrder(request);
|
||||
return "order placed";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.shop.orderservice.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class InventoryResponse {
|
||||
private String skuCode;
|
||||
private boolean isInStock;
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.shop.orderservice.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class OrderLineItemsDto {
|
||||
private Long id;
|
||||
private String skuCode;
|
||||
private BigDecimal price;
|
||||
private Integer quantity;
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.shop.orderservice.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class OrderRequest {
|
||||
private List<OrderLineItemsDto> orderLineItemsDtoList;
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
package com.shop.orderservice.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import jakarta.persistence.CascadeType;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.OneToMany;
|
||||
import jakarta.persistence.Table;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Entity
|
||||
@Table(name = "t_orders")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Order {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private Long id;
|
||||
private String orderNumber;
|
||||
@OneToMany(cascade = CascadeType.ALL)
|
||||
private List<OrderLineItems> items;
|
||||
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package com.shop.orderservice.model;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Entity
|
||||
@Table(name = "t_orders_line_items")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class OrderLineItems {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private long id;
|
||||
private String skuCode;
|
||||
private Integer quantity;
|
||||
private BigDecimal price;
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package com.shop.orderservice.repository;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.shop.orderservice.model.Order;
|
||||
|
||||
@Service
|
||||
public interface OrderRepository extends JpaRepository<Order, Long> {
|
||||
|
||||
public Order save(Order order);
|
||||
|
||||
}
|
||||
@ -0,0 +1,63 @@
|
||||
package com.shop.orderservice.service;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.reactive.function.client.WebClient;
|
||||
|
||||
import com.shop.orderservice.dto.InventoryResponse;
|
||||
import com.shop.orderservice.dto.OrderLineItemsDto;
|
||||
import com.shop.orderservice.dto.OrderRequest;
|
||||
import com.shop.orderservice.model.Order;
|
||||
import com.shop.orderservice.model.OrderLineItems;
|
||||
import com.shop.orderservice.repository.OrderRepository;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
@Transactional
|
||||
public class OrderService {
|
||||
|
||||
private final OrderRepository orderRepository;
|
||||
private final WebClient.Builder webClientBuilder;
|
||||
|
||||
public void placeOrder(OrderRequest orderRequest) {
|
||||
Order order = new Order();
|
||||
order.setOrderNumber(UUID.randomUUID().toString());
|
||||
|
||||
List<OrderLineItems> orderLineItems = orderRequest.getOrderLineItemsDtoList().stream().map(this::mapToDto)
|
||||
.toList();
|
||||
order.setItems(orderLineItems);
|
||||
// call inventory
|
||||
List<String> skuCodes = order.getItems().stream().map(OrderLineItems::getSkuCode).toList();
|
||||
Map<String, List<String>> skus = new HashMap<>();
|
||||
skus.put("skuCode", skuCodes);
|
||||
InventoryResponse[] inventoryResponseArray = webClientBuilder.build().get()
|
||||
.uri("http://inventory-service/api/inventory",
|
||||
uriBuilder -> uriBuilder.queryParam("skuCode", skuCodes).build())
|
||||
.retrieve().bodyToMono(InventoryResponse[].class).block();
|
||||
|
||||
Boolean allProductsInStock = Arrays.stream(inventoryResponseArray).allMatch(InventoryResponse::isInStock);
|
||||
|
||||
if (allProductsInStock) {
|
||||
orderRepository.save(order);
|
||||
} else {
|
||||
throw new IllegalArgumentException("not in stock");
|
||||
}
|
||||
}
|
||||
|
||||
private OrderLineItems mapToDto(OrderLineItemsDto itemDto) {
|
||||
OrderLineItems item = new OrderLineItems();
|
||||
item.setPrice(itemDto.getPrice());
|
||||
item.setSkuCode(itemDto.getSkuCode());
|
||||
item.setQuantity(itemDto.getQuantity());
|
||||
return item;
|
||||
}
|
||||
|
||||
}
|
||||
21
order-service-mv/src/main/resources/application.properties
Normal file
21
order-service-mv/src/main/resources/application.properties
Normal file
@ -0,0 +1,21 @@
|
||||
|
||||
|
||||
spring.datasource.url=jdbc:mysql://localhost:3306/order-service?useSSL=false
|
||||
spring.datasource.username=root
|
||||
spring.datasource.password=nEFK0Nu7OLW78NZl4VJj
|
||||
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
|
||||
|
||||
|
||||
# Hibernate properties
|
||||
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect
|
||||
|
||||
spring.jpa.hibernate.ddl-auto=create
|
||||
#logging.level.org.springframework.web: DEBUG
|
||||
#logging.level.org.hibernate: DEBUG
|
||||
|
||||
server.port=8099
|
||||
|
||||
spring.application.name=order-service
|
||||
|
||||
eureka.client.serviceUrl.defaultZone=http://eureka:password@localhost:8761/eureka
|
||||
#eureka.client.serviceUrl.defaultZone=http://localhost:8763/eureka
|
||||
@ -0,0 +1,13 @@
|
||||
package com.shop.orderservice;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
class OrderServiceApplicationTests {
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
}
|
||||
|
||||
}
|
||||
66
pom.xml
Normal file
66
pom.xml
Normal file
@ -0,0 +1,66 @@
|
||||
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.shop</groupId>
|
||||
<artifactId>parent-service-new</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>product-service-mv</module>
|
||||
<module>inventory-service-mv</module>
|
||||
<module>order-service-mv</module>
|
||||
<module>discovery-service</module>
|
||||
<module>api-gateway</module>
|
||||
</modules>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>3.1.1</version>
|
||||
</parent>
|
||||
<properties>
|
||||
<spring-cloud.version>2022.0.2</spring-cloud.version>
|
||||
</properties>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.testcontainers</groupId>
|
||||
<artifactId>testcontainers-bom</artifactId>
|
||||
<version>1.18.3</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-dependencies</artifactId>
|
||||
<version>${spring-cloud.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>
|
||||
<groupId>org.projectlombock</groupId>
|
||||
<artifactId>lombock</artifactId>
|
||||
</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
</project>
|
||||
48
product-service-mv/pom.xml
Normal file
48
product-service-mv/pom.xml
Normal file
@ -0,0 +1,48 @@
|
||||
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.shop</groupId>
|
||||
<artifactId>parent-service-new</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>product-service-mv</artifactId>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-mongodb</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.testcontainers</groupId>
|
||||
<artifactId>mongodb</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.testcontainers</groupId>
|
||||
<artifactId>junit-jupiter</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@ -0,0 +1,13 @@
|
||||
package com.shop.productservice;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class ProductServiceApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ProductServiceApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
package com.shop.productservice.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.shop.productservice.dto.ProductRequest;
|
||||
import com.shop.productservice.dto.ProductResponse;
|
||||
import com.shop.productservice.service.ProductService;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/product")
|
||||
@RequiredArgsConstructor
|
||||
public class ProductController {
|
||||
|
||||
private final ProductService productService;
|
||||
|
||||
@PostMapping
|
||||
@ResponseStatus(HttpStatus.CREATED)
|
||||
public void createProduct(@RequestBody ProductRequest productRequest) {
|
||||
productService.createProduct(productRequest);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
public List<ProductResponse> getAllProducts() {
|
||||
return productService.getAllProducts();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
package com.shop.productservice.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class ProductRequest {
|
||||
private String name;
|
||||
private String description;
|
||||
private BigDecimal price;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public BigDecimal getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(BigDecimal price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
package com.shop.productservice.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class ProductResponse {
|
||||
private String id;
|
||||
private String name;
|
||||
private String description;
|
||||
private BigDecimal price;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public BigDecimal getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(BigDecimal price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package com.shop.productservice.model;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Document(value= "product")
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@Data
|
||||
public class Product {
|
||||
@Id
|
||||
private String id;
|
||||
private String name;
|
||||
private String description;
|
||||
private BigDecimal price;
|
||||
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.shop.productservice.repository;
|
||||
|
||||
import org.springframework.data.mongodb.repository.MongoRepository;
|
||||
|
||||
import com.shop.productservice.model.Product;
|
||||
|
||||
public interface ProductRepository extends MongoRepository<Product, String>{
|
||||
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
package com.shop.productservice.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.shop.productservice.dto.ProductRequest;
|
||||
import com.shop.productservice.dto.ProductResponse;
|
||||
import com.shop.productservice.model.Product;
|
||||
import com.shop.productservice.repository.ProductRepository;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class ProductService {
|
||||
|
||||
private final ProductRepository productRepository;
|
||||
|
||||
public void createProduct(ProductRequest productRequest) {
|
||||
Product product = Product.builder()
|
||||
.name(productRequest.getName())
|
||||
.description(productRequest.getDescription())
|
||||
.price(productRequest.getPrice())
|
||||
.build();
|
||||
|
||||
productRepository.save(product);
|
||||
log.info("Product {} is saved", product.getId());
|
||||
}
|
||||
|
||||
public List<ProductResponse> getAllProducts() {
|
||||
List<Product> products = productRepository.findAll();
|
||||
return products.stream().map(this::mapToProductResponse).toList();
|
||||
}
|
||||
|
||||
private ProductResponse mapToProductResponse(Product product) {
|
||||
return ProductResponse.builder()
|
||||
.id(product.getId())
|
||||
.name(product.getName())
|
||||
.description(product.getDescription())
|
||||
.price(product.getPrice())
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
spring.data.mongodb.uri=mongodb+srv://hendrikwienhold:SSIhV1NEZPnxb466@mycluster.efc09xm.mongodb.net/?retryWrites=true&w=majority
|
||||
spring.data.mongodb.database=product-service
|
||||
|
||||
server.port=0
|
||||
spring.application.name=product-service
|
||||
eureka.client.serviceUrl.defaultZone=http://eureka:password@localhost:8761/eureka
|
||||
|
||||
@ -0,0 +1,58 @@
|
||||
package com.shop.productservice;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
||||
import org.testcontainers.containers.MongoDBContainer;
|
||||
import org.testcontainers.junit.jupiter.Container;
|
||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.shop.productservice.dto.ProductRequest;
|
||||
import com.shop.productservice.repository.ProductRepository;
|
||||
|
||||
@SpringBootTest
|
||||
@Testcontainers
|
||||
@AutoConfigureMockMvc
|
||||
class ProductServiceApplicationTests {
|
||||
|
||||
@Autowired
|
||||
private ProductRepository productRepository;
|
||||
|
||||
@Container
|
||||
static MongoDBContainer mongoDBContainer = new MongoDBContainer("mongo:6.0.6");
|
||||
|
||||
@Autowired
|
||||
private MockMvc mockMVC; // mock api calls
|
||||
|
||||
@Autowired
|
||||
private ObjectMapper objectMapper; // to convert object <-> json
|
||||
|
||||
@BeforeEach
|
||||
void cleanup() {
|
||||
productRepository.deleteAll();
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldCreateProduct() throws Exception {
|
||||
ProductRequest productRequest = getProductRequest();
|
||||
mockMVC.perform(MockMvcRequestBuilders.post("/api/product").contentType(MediaType.APPLICATION_JSON)
|
||||
.content(objectMapper.writeValueAsString(productRequest)));
|
||||
Assertions.assertEquals(1, productRepository.findAll().size());
|
||||
}
|
||||
|
||||
private ProductRequest getProductRequest() {
|
||||
return ProductRequest.builder().name("Samsung S20").description("Telefon").price(BigDecimal.valueOf(850))
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
server.port=8089
|
||||
|
||||
spring.data.mongodb.uri=mongodb+srv://hendrikwienhold:SSIhV1NEZPnxb466@mycluster.efc09xm.mongodb.net/?retryWrites=true&w=majority
|
||||
spring.data.mongodb.database=test
|
||||
|
||||
spring.application.name=product-service
|
||||
eureka.client.serviceUrl.defaultZone=http://localhost:8761/eureka
|
||||
2
src/main/resources/application.properties
Normal file
2
src/main/resources/application.properties
Normal file
@ -0,0 +1,2 @@
|
||||
spring.security.user.name=eureka
|
||||
spring.security.user.password=password
|
||||
Loading…
x
Reference in New Issue
Block a user