diff options
author | 2020-07-01 19:13:36 +0000 | |
---|---|---|
committer | 2020-07-01 19:13:36 +0000 | |
commit | 55b5686e80479b217be90aef4a299d6c1d8ff8f5 (patch) | |
tree | 9b764959b235a5f0628133d91428ca021414332b /src/main | |
parent | 5f2f79ec59a88c8d8244af1892a3e5b33d85aacd (diff) | |
parent | 02f5d9e2c02c0b9fffdc494a9b7c87e0a4f7e000 (diff) |
Merge "MongoConfig - Removed Sonar warnings"
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/onap/aai/cacher/common/MongoConfig.java | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/main/java/org/onap/aai/cacher/common/MongoConfig.java b/src/main/java/org/onap/aai/cacher/common/MongoConfig.java index 5c1a541..ca063a7 100644 --- a/src/main/java/org/onap/aai/cacher/common/MongoConfig.java +++ b/src/main/java/org/onap/aai/cacher/common/MongoConfig.java @@ -48,7 +48,7 @@ import java.io.IOException; @Configuration public class MongoConfig { - private final static EELFLogger EELF_LOGGER = EELFManager.getInstance().getLogger(MongoConfig.class); + private static final EELFLogger EELF_LOGGER = EELFManager.getInstance().getLogger(MongoConfig.class); @Value("${mongodb.host}") private String MONGO_DB_HOST; @@ -61,9 +61,8 @@ public class MongoConfig { @Bean public MongoClient mongoClient(MongodProcess mongodProcess) { - try { - // To connect to mongodb server - MongoClient mongoC = new MongoClient(MONGO_DB_HOST, MONGO_DB_PORT); + // To connect to mongodb server + try (MongoClient mongoC = new MongoClient(MONGO_DB_HOST, MONGO_DB_PORT)) { // Now connect to your databases EELF_LOGGER.info("Connect to database successfully"); |