https://github.com/mhewedy/conditional-on-module
Library to implement Conditional on module
https://github.com/mhewedy/conditional-on-module
spring spring-boot
Last synced: 3 months ago
JSON representation
Library to implement Conditional on module
- Host: GitHub
- URL: https://github.com/mhewedy/conditional-on-module
- Owner: mhewedy
- Created: 2023-08-20T16:12:08.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2023-08-20T16:17:47.000Z (almost 2 years ago)
- Last Synced: 2025-02-06T12:12:59.899Z (5 months ago)
- Topics: spring, spring-boot
- Language: Java
- Homepage:
- Size: 65.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Conditional on Module
Example:
```java
public interface MyService {
Map getProductDetails(String productId);
}// this implementation will be used if okhttp is found on the classpath
@Service
@ConditionalOnModule("okhttp")
public static class OKHttpClientImpl implements MyService {@Override
public Map getProductDetails(String productId) {
// TODO
return null;
}
}// this implementation will be used if okhttp is NOT found on the classpath
@Service
@ConditionalOnMissingModule("okhttp")
public static class JavaHttpClientImpl implements MyService {@Override
public Map getProductDetails(String productId) {
// TODO
return null;
}
}
```