Skip to content

Instantly share code, notes, and snippets.

@danielgospodinow
Last active August 5, 2019 11:17
Show Gist options
  • Save danielgospodinow/b02b1f0c7509ab7f2e687a9ff0500a93 to your computer and use it in GitHub Desktop.
Save danielgospodinow/b02b1f0c7509ab7f2e687a9ff0500a93 to your computer and use it in GitHub Desktop.
Calcualtor Consumer
import com.dg.osgi.calculator.provider.api.Calculator;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
@Component
public class CalculatorConsumer {
@Reference
private Calculator calculator;
@Activate
public void activate() {
int a = 7;
int b = 14;
System.out.println(String.format("The multiplication of %d and %d is: %d", a, b, calculator.multiply(a, b)));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment