Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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;
}
}
```