Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 26 days 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 (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-08-20T16:17:47.000Z (over 1 year ago)
- Last Synced: 2024-10-11T07:22:26.682Z (about 1 month 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;
}
}
```