re base code
[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 })
30 public class CatalogBESpringConfig {
31
32     private static final int BEFORE_TRANSACTION_MANAGER = 0;
33     private final ComponentLocker componentLocker;
34
35     @Autowired
36     public CatalogBESpringConfig(ComponentLocker componentLocker) {
37         this.componentLocker = componentLocker;
38     }
39
40     @Bean(name = "lifecycleBusinessLogic")
41     public LifecycleBusinessLogic lifecycleBusinessLogic() {
42         return new LifecycleBusinessLogic();
43     }
44
45     @Bean(name = "transactionManager")
46     public TransactionManager transactionManager() {
47         return new TransactionManager();
48     }
49
50     @Bean(name = "asset-metadata-utils")
51     public AssetMetadataConverter assetMetadataConverter() {
52         return new AssetMetadataConverter();
53     }
54
55     @Bean(name = "componentLockAspect")
56     @Order(BEFORE_TRANSACTION_MANAGER)
57     public ComponentLockAspect componentLockAspect() {
58         return new ComponentLockAspect(componentLocker);
59     }
60
61
62 }