Spring Boot + Elastic Search in Docker CRUD Project| Spring Boot | Elasticsearch | Docker | EnggAdda

  Рет қаралды 4,392

EnggAdda

EnggAdda

Күн бұрын

Пікірлер: 7
@김승범-n2d
@김승범-n2d Жыл бұрын
I also made a service logic to delete and modify it separately, but it doesn't work with Postman. (Return Code X). Is the reason why deletion and modification are not related to elasticsearch technology?
@김승범-n2d
@김승범-n2d Жыл бұрын
The service logic is as follows. @PatchMapping("/products/{id}") public ResponseEntity updateProduct(@RequestBody @Valid final ProductUpdateRequestDto productUpdateRequestDto, @PathVariable final int id) { return ResponseEntity.status(200).body(productService.updateProduct(productUpdateRequestDto, id)); } @DeleteMapping("/products/{id}") public ResponseEntity deleteProduct(@PathVariable final int id) { productService.deleteProduct(id); return ResponseEntity.status(204).build(); } The service logic is as follows. In the case of modification, we implemented it to receive dto in the parameter from the domain and process it.
@enggadda
@enggadda Жыл бұрын
I don't think so , give me sometime will check and let you know
@김승범-n2d
@김승범-n2d Жыл бұрын
@@enggadda The service logic for deletion and modification is as follows. public ProductResponseDto updateProduct(final ProductUpdateRequestDto productUpdateRequestDto, final int id) { Product product = productRepository.findById(id); checkFindProductIsEmpty(product); product.updateProduct(productUpdateRequestDto); productRepository.save(product); return ProductResponseDto.toDto(product); } public void deleteProduct(final int id) { Product product = productRepository.findById(id); checkFindProductIsEmpty(product); productRepository.delete(product); } private void checkFindProductIsEmpty(final Product product) { if(product == null) { throw new ProductNotFoundException(PRODUCT_NOT_FOUND_MESSAGE); } } private void checkFindProductListIsEmpty(final List products) { if(products.isEmpty()) { throw new ProductNotFoundException(PRODUCT_NOT_FOUND_MESSAGE); } } p.s Is there a reason why you didn't add @Transactional annotation to the service??
@김승범-n2d
@김승범-n2d Жыл бұрын
@@enggadda Just in case, I tried to change the HTTP method to Put instead of Patch, but it was not updated.
@tusharpathade7670
@tusharpathade7670 Жыл бұрын
why 7.17.9 version and not latest one?
@enggadda
@enggadda Жыл бұрын
It was working for me latest one was not working so choose this version
Perfect Pitch Challenge? Easy! 🎤😎| Free Fire Official
00:13
Garena Free Fire Global
Рет қаралды 90 МЛН
Do NOT Learn Kubernetes Without Knowing These Concepts...
13:01
Travis Media
Рет қаралды 321 М.
ELK using Docker Compose | Elasticsearch Logstash Kibana Tutorial
17:24
Aggregation and Monitoring Logs  for Springboot JDK 17using ELK & Docker
1:02:49
Spring Boot + Elasticsearch 8 CRUD Example
26:54
JavaInUse
Рет қаралды 1,6 М.