Jean-Francois Leveque

Ajout de constructeur avec injection.

...@@ -25,14 +25,22 @@ import java.util.Set; ...@@ -25,14 +25,22 @@ import java.util.Set;
25 public class PublisherServiceSpring implements PublisherService { 25 public class PublisherServiceSpring implements PublisherService {
26 Logger logger = LoggerFactory.getLogger(getClass()); 26 Logger logger = LoggerFactory.getLogger(getClass());
27 27
28 - @Inject
29 PublisherRepository publisherRepository; 28 PublisherRepository publisherRepository;
30 -
31 - @Inject
32 PublisherVersionRepository publisherVersionRepository; 29 PublisherVersionRepository publisherVersionRepository;
30 + SharedService sharedService;
33 31
34 @Inject 32 @Inject
35 - SharedService sharedService; 33 + public PublisherServiceSpring(PublisherRepository publisherRepository,
34 + PublisherVersionRepository publisherVersionRepository,
35 + SharedService sharedService) {
36 + this.publisherRepository = publisherRepository;
37 + this.publisherVersionRepository = publisherVersionRepository;
38 + this.sharedService = sharedService;
39 + }
40 +
41 + //no args constructor to make it proxyable
42 + PublisherServiceSpring() {
43 + }
36 44
37 public void addNewPublisher(PublisherVersion publisherVersion) { 45 public void addNewPublisher(PublisherVersion publisherVersion) {
38 Publisher publisher = new Publisher(); 46 Publisher publisher = new Publisher();
...@@ -45,6 +53,7 @@ public class PublisherServiceSpring implements PublisherService { ...@@ -45,6 +53,7 @@ public class PublisherServiceSpring implements PublisherService {
45 this.savePublisherVersion(publisherVersion); 53 this.savePublisherVersion(publisherVersion);
46 this.savePublisher(publisher); 54 this.savePublisher(publisher);
47 } 55 }
56 +
48 public void addVersionToPublisher(Publisher publisher, PublisherVersion publisherVersion) { 57 public void addVersionToPublisher(Publisher publisher, PublisherVersion publisherVersion) {
49 logger.trace("debut addVersionToPublisher, publisherVersion = {}", publisherVersion); 58 logger.trace("debut addVersionToPublisher, publisherVersion = {}", publisherVersion);
50 Set<PublisherVersion> publisherVersionSet = publisher.getVersions(); 59 Set<PublisherVersion> publisherVersionSet = publisher.getVersions();
......