Skip to content
Advertisement

Tag: spring

Spring Cloud Gateway for composite API calls?

I am starting to build a Microservice API Gateway, and I am considering Spring Cloud to help me with the routing. But some calls to the Gateway API will need multiple requests to different services. Lets say I have 2 services: Order Details Service and Delivery Service. I want to have a Gateway endpoint GET /orders/{orderId} that makes a call

How to apply the PathPatternParser introduced in Spring 5?

I want to create a GET request that takes a filepath as a path variable. As described in the Spring documentation found here, this should be possible by using the following: /resources/{*path}. I am using Spring Boot 2.1.2 which uses Spring 5. However when I set up my controller method like this, the request doesn’t match the route. An expected

@PostConstruct and @PreDestroy annotations do not work

I have TennisCoach class: And such main class: Expected output is: Inside default constructor Inside postconstructor DailyFortune Practice your backhand volley Inside predestroyer But I get this: Inside default constructor DailyFortune Practice your backhand volley It seems like @PostContruct and @PreDestroy annotations do not work correctly. I cannot find the reason of my problem. Answer If you use java 9+

How to implement Decorator pattern in Spring Boot

I know how to implement and use a decorator pattern without Spring. Because in this pattern you yourself control the process of creating components and you can perform dynamic behavior adding. Below is an example of implementation without using Spring: I am interested in how to implement the same example but with the help of spring beans. Because I don’t

Accessing spring bean proxy reference itself

I have an issue with @Cacheable and @CacheEviction annotations. When I call these methods in the bean where they are declared, the aop part is not getting executed. The underlying reason for this is that the bean access to its own instance itself, instead of accessing the spring proxy. I have read this question where it is said that in

Advertisement