Basic examples on cdi and beans validation

This commit is contained in:
2015-04-30 01:33:05 +02:00
commit 23bf95316c
31 changed files with 878 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
package test1_cdi;
import javax.enterprise.inject.*;
import javax.inject.Inject;
import java.util.logging.Logger;
/**
* Created by Giovanni on 26/04/2015.
*/
public class ClassProducer {
@Inject
Logger l;
@Inject @StudentI(implementation = student_implementations.one)
Student s;
@Produces @NumberOfStudents
private int number_of_students(){
return 10;
}
@Produces
private int number_of_students_2(){
return 20;
}
private void clean (@Disposes int s) {
l.info("Do something to clean the producer");
}
private void clean2(@Disposes @NumberOfStudents int s) {
l.info("Do something to clean the producer");
}
}