April 2018
Intermediate to advanced
382 pages
10h 11m
English
@ApplicationPath("webresources")public class Application extends javax.ws.rs.core.Application {}
public class User implements Serializable { private String name; private String email; //DO NOT FORGET TO ADD THE GETTERS AND SETTERS}
Our User class doesn't have a default constructor, so CDI doesn't know how to construct the class when it tries to inject it. So, we create a factory class and use the @Produces annotation over its methods:
public class UserFactory implements Serializable{ @Produces public User getUser() { return new User("Elder Moraes", "elder@eldermoraes.com"); ...Read now
Unlock full access