tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john77eipe <john77e...@gmail.com>
Subject TomEE and CDI
Date Sun, 04 May 2014 09:53:37 GMT
I'm a start in CDI. 

To test CDI. I created 2 classes.

public class Exam {
	@Inject
	private Student student;
	
	private int examCode;
	
	@PostConstruct
	private void init(){
		System.out.println("Init in Exam");
		this.setExamCode(11);
	}
}

public class Student {
	private String name;
	
	@PostConstruct
	public void init(){
		System.out.println("Init in Student");
		this.name = "John Eipe";
	}
}


Isn't it possible to do this in Servlet's doGet.

Exam exam = new Exam();
System.out.println(exam);

But I don't see Injection happening.



--
View this message in context: http://openejb.979440.n4.nabble.com/TomEE-and-CDI-tp4669131.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Mime
View raw message