Using dependency injection for DozerBeanMapper
diff --git a/credential-store/credential-api/src/main/java/org/apache/custos/credential/api/AppConfig.java b/credential-store/credential-api/src/main/java/org/apache/custos/credential/api/AppConfig.java
new file mode 100644
index 0000000..8a2ee86
--- /dev/null
+++ b/credential-store/credential-api/src/main/java/org/apache/custos/credential/api/AppConfig.java
@@ -0,0 +1,15 @@
+package org.apache.custos.credential.api;
+
+import org.dozer.DozerBeanMapper;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class AppConfig {
+
+ // Use for future custom mapping scenarios https://www.java-success.com/dozer-with-spring-maven-tutorial/
+ @Bean
+ public DozerBeanMapper dozerBeanMapper() {
+ return new DozerBeanMapper();
+ }
+}
diff --git a/credential-store/credential-api/src/main/java/org/apache/custos/credential/api/controllers/SSHCredentialsController.java b/credential-store/credential-api/src/main/java/org/apache/custos/credential/api/controllers/SSHCredentialsController.java
index b949526..a6063e5 100644
--- a/credential-store/credential-api/src/main/java/org/apache/custos/credential/api/controllers/SSHCredentialsController.java
+++ b/credential-store/credential-api/src/main/java/org/apache/custos/credential/api/controllers/SSHCredentialsController.java
@@ -16,7 +16,8 @@
@Autowired
private VaultManager vaultManager;
- final private DozerBeanMapper mapper = new DozerBeanMapper();
+ @Autowired
+ private DozerBeanMapper mapper;
@RequestMapping(value = "/ssh/{gateway}/{token}", method = RequestMethod.GET)
public SSHCredential getSSHCredential(@PathVariable("gateway") String gateway, @PathVariable("token") String token) throws Exception {