Difference between CDI and EJB singleton (#6915)
* Singleton injection examples and tests added * code and tests implemented
This commit is contained in:
28
jee-7/src/main/java/com/baeldung/singleton/Car.java
Normal file
28
jee-7/src/main/java/com/baeldung/singleton/Car.java
Normal 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 + "]";
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user