File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package ee .cdi ;
2+
3+ import javax .enterprise .inject .Specializes ;
4+ import javax .inject .Inject ;
5+ import javax .servlet .ServletException ;
6+ import javax .servlet .annotation .WebServlet ;
7+ import javax .servlet .http .HttpServlet ;
8+ import javax .servlet .http .HttpServletRequest ;
9+ import javax .servlet .http .HttpServletResponse ;
10+ import java .io .IOException ;
11+
12+ @ WebServlet ("/spec" )
13+ public class SpecializationLesson extends HttpServlet {
14+ @ Inject
15+ Spec spec ;
16+ @ Override
17+ protected void doGet (HttpServletRequest req , HttpServletResponse resp ) throws ServletException , IOException {
18+ spec .print ();
19+ }
20+ }
21+ class Spec {
22+ public void print () {
23+ System .out .println ("spec" );
24+ }
25+ }
26+ class ASpec extends Spec {
27+ public void print () {
28+ System .out .println ("a" );
29+ }
30+ }
31+ @ Specializes
32+ class BSpec extends ASpec {
33+ @ Override
34+ public void print () {
35+ System .out .println ("b" );
36+ }
37+ }
You can’t perform that action at this time.
0 commit comments