Kafka consumer can not be turned off
[cps.git] / cps-service / src / main / java / org / onap / cps / config / AsyncConfig.java
index 4c96159..2d8f7fb 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * ============LICENSE_START=======================================================
  * Copyright (c) 2021 Bell Canada.
+ * Modifications Copyright (C) 2022 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -22,6 +23,7 @@ package org.onap.cps.config;
 
 import javax.validation.constraints.Min;
 import lombok.Setter;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
@@ -32,7 +34,8 @@ import org.springframework.validation.annotation.Validated;
 
 @EnableAsync
 @Configuration
-@ConfigurationProperties("notification.async-executor")
+@ConditionalOnProperty(name = "notification.enabled", havingValue = "true", matchIfMissing = true)
+@ConfigurationProperties("notification.async.executor")
 @Validated
 @Setter
 public class AsyncConfig {