public interface HubReaderServiceInterface {
String fetchAllPosts(String url) throws IOException;
}
public class HubReaderService implements HubReaderServiceInterface {
public String fetchAllPosts(String url) throws IOException {
...
}
}
public class Foo {
@Inject
private HubReaderServiceInterface hrService;
public void fetchToFile(String filePath, String hubUrl) throws IOException {
String allPosts = hrService.fetchAllPosts(hubUrl);
...
}
}
Почему объект не инжектируется? Аннотация @Inject из javax.inject.Inject. В resources/META-INF/beans.xml:
<beans xmlns="java.sun.com/xml/ns/javaee"
xmlns:xsi="www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="java.sun.com/xml/ns/javaee java.sun.com/xml/ns/javaee/beans_1_0.xsd">
</beans>