aa5cdac691a509c8f7cf079163c2ebf8c4815281
[sdc.git] / catalog-be / src / main / java / org / openecomp / sdc / config / CatalogBESpringConfig.java
1 package org.openecomp.sdc.config;
2
3 import org.openecomp.sdc.be.components.impl.ComponentLocker;
4 import org.openecomp.sdc.be.components.impl.lock.ComponentLockAspect;
5 import org.openecomp.sdc.be.components.lifecycle.LifecycleBusinessLogic;
6 import org.openecomp.sdc.be.ecomp.converters.AssetMetadataConverter;
7 import org.openecomp.sdc.common.transaction.mngr.TransactionManager;
8 import org.springframework.beans.factory.annotation.Autowired;
9 import org.springframework.context.annotation.Bean;
10 import org.springframework.context.annotation.ComponentScan;
11 import org.springframework.context.annotation.Configuration;
12 import org.springframework.core.annotation.Order;
13
14 @Configuration
15 @ComponentScan({"org.openecomp.sdc.be.user",
16         "org.openecomp.sdc.be.impl",
17         "org.openecomp.sdc.be.auditing.impl",
18         "org.openecomp.sdc.be.distribution",
19         "org.openecomp.sdc.be.switchover.detector",
20         "org.openecomp.sdc.be.tosca",
21         "org.openecomp.sdc.be.components.validation",
22         "org.openecomp.sdc.be.components.impl",
23         "org.openecomp.sdc.be.components.path",
24         "org.openecomp.sdc.be.components.merge",
25         "org.openecomp.sdc.be.components.csar",
26         "org.openecomp.sdc.be.components.property",
27         "org.openecomp.sdc.be.datamodel.utils",
28         "org.openecomp.sdc.be.components.upgrade"})
29 public class CatalogBESpringConfig {
30
31     private static final int BEFORE_TRANSACTION_MANAGER = 0;
32     private final ComponentLocker componentLocker;
33
34     @Autowired
35     public CatalogBESpringConfig(ComponentLocker componentLocker) {
36         this.componentLocker = componentLocker;
37     }
38
39     @Bean(name = "lifecycleBusinessLogic")
40     public LifecycleBusinessLogic lifecycleBusinessLogic() {
41         return new LifecycleBusinessLogic();
42     }
43
44     @Bean(name = "transactionManager")
45     public TransactionManager transactionManager() {
46         return new TransactionManager();
47     }
48
49     @Bean(name = "asset-metadata-utils")
50     public AssetMetadataConverter assetMetadataConverter() {
51         return new AssetMetadataConverter();
52     }
53
54     @Bean(name = "componentLockAspect")
55     @Order(BEFORE_TRANSACTION_MANAGER)
56     public ComponentLockAspect componentLockAspect() {
57         return new ComponentLockAspect(componentLocker);
58     }
59
60
61 }