I have below scenario in our project.
@Named("a")
class A{ }
@Specializes
class B extends A{ }
@Specializes
class C extends B{ }
class Test{
@Inject
A a1;
}
In the test class, I want to inject the c class instance to the reference variable a1. I tried and it always injecting B.
How to do this?
Some more information:
I also want to mentioned that each of these 3 classes are in defferent projects. I'm tring to access the method from xhtml file not from Test class I'm using EL .
project1---> A
@Named("links")
@ApplicationScoped
class A{
public String getMethod1(){
}
}
project2(dependency to project1)----> B
@Specializes
class B extends A{
@Override
public String getMethod1(){
}
}
project3(dependency to project1,project2)---->C
@Specializes
class C extends B{
@Override
public String getMethod1(){
}
}
project4(dependency to project1,project2,project3)--->
MyPage.xhtm
<ui:include src="#{links.method1()}">
</ui:include>
When I'm trying to access by using EL 'links' always pointing the Class B.
Please advice me here.
The issue with my project structure with multiple maven modules. It lead to transitive dependency of the modules.