Question: ```
class Employee:
    def __init__(self, name, salary, increment):
        self.name = name
        self.salary = salary
        self.increment = increment

    @property
    def salaryafterIncre(self):
        return self.salary * (1+self.increment)

    @salaryafterIncre.setter
    def salaryafterIncre(self):
        self.salary = self.salary * (1+self.increment)

e1 = Employee("shubh", 10000, 0.1)
print(e1.salaryafterIncre)
e1.salaryafterIncre()
print(e1.salary)

```

Answer: 
What about

```java
@Configuration
public class Config {

  @Bean
  public RestTemplate restTemplate() {
    return new RestTemplate();
  }

  @Bean
  public ModelMapper modelMapper(final CurrencyConverterService currencyConverter) {
    ModelMapper modelMapper = new ModelMapper();
    ...
  }
  ...
}

```

when you create a bean you can pass other beans as parameter
Solution 1: use javax.inject.Provider
-------------------------------------

Assuming you are using Maven you can add the following dependency:

```xml
        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
            <version>1</version>
        </dependency>

```

And then in CurrencyConverterService inject an instance of `javax.inject.Provider` of `RestTemplate`:

```java
import javax.inject.Provider;
...
@Service
@RequiredArgsConstructor
public class CurrencyConverterService {
    ...
    private final Provider<RestTemplate> restTemplate;

```

And retrieve the instance with `restTemplate.get()`.

However this will still fail during runtime in case of circular usage.

Solution 2: resolve cyclic dependency
-------------------------------------

Assuming you do *not* need the `CurrencyConverterService` for constructing `RestTemplate` the more stable solution is to create a second class producing the `RestTemaplate` (you can have as many classes annotated with `@Configuration` or `@Component` as you want):

```java
@Configuration
public class RestTemplateProducer {

    @Bean
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }

}

```