public interface GreetingService {
void sayHello(String name);
}
@Service
public class GreetingServiceImpl implements GreetingService {
@Override
public void sayHello(String name) {
System.out.println("Hello, " + name + "!");
}
}
@Component
public class HelloWorldComponent {
@Reference
private GreetingService greetingService;
public void sayHello() {
greetingService.sayHello("World");
}
}
public class Application {
public static void main(String[] args) {
ServiceRegistry registry = new ServiceRegistry();
AnnotationProcessor processor = new AnnotationProcessor(registry);
HelloWorldComponent helloWorldComponent = new HelloWorldComponent();
}
}