Difference between CDI and EJB singleton (#6915)

* Singleton injection examples and tests added

* code and tests implemented
This commit is contained in:
enpy
2019-05-08 16:40:54 +02:00
committed by maibin
parent 57ec69ad3b
commit 8209ec4a1f
5 changed files with 286 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
package com.baeldung.singleton;
public class Car {
private String type;
private String model;
private boolean serviced = false;
public Car(String type, String model) {
super();
this.type = type;
this.model = model;
}
public boolean isServiced () {
return serviced;
}
public void setServiced(Boolean serviced) {
this.serviced = serviced;
}
@Override
public String toString() {
return "Car [type=" + type + ", model=" + model + "]";
}
}