diff options
author | Guangrong Fu <fu.guangrong@zte.com.cn> | 2021-12-28 10:14:42 +0800 |
---|---|---|
committer | Guangrong Fu <fu.guangrong@zte.com.cn> | 2022-08-11 20:18:53 +0800 |
commit | a796bda2f8e2db093ce9f528f6e5960e4aa1b22c (patch) | |
tree | 04642b9f3be109a5ccc051e4876851aa0b4fa3f3 /rulemgt/src/main/java/org/onap/holmes/rulemgt/RuleActiveApp.java | |
parent | 71ad58788ebfd666f6922fd9c16f77a9a4e39e27 (diff) |
Migrate from DW to Springboot
Issue-ID: HOLMES-511
Signed-off-by: Guangrong Fu <fu.guangrong@zte.com.cn>
Change-Id: I1be0775a4fc8b754218cd584a5de7af96b2ee0e2
Diffstat (limited to 'rulemgt/src/main/java/org/onap/holmes/rulemgt/RuleActiveApp.java')
-rw-r--r-- | rulemgt/src/main/java/org/onap/holmes/rulemgt/RuleActiveApp.java | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/rulemgt/src/main/java/org/onap/holmes/rulemgt/RuleActiveApp.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/RuleActiveApp.java index cedcde0..3d60a11 100644 --- a/rulemgt/src/main/java/org/onap/holmes/rulemgt/RuleActiveApp.java +++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/RuleActiveApp.java @@ -1,5 +1,5 @@ /** - * Copyright 2017-2020 ZTE Corporation. + * Copyright 2017-2022 ZTE Corporation. * <p> * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,36 +16,37 @@ package org.onap.holmes.rulemgt; -import io.dropwizard.setup.Environment; +import lombok.extern.slf4j.Slf4j; import org.onap.holmes.common.ConfigFileScanner; -import org.onap.holmes.common.dropwizard.ioc.bundle.IOCApplication; -import org.onap.holmes.common.utils.transactionid.TransactionIdFilter; import org.onap.holmes.rulemgt.dcae.ConfigFileScanningTask; +import org.springframework.boot.ApplicationArguments; +import org.springframework.boot.ApplicationRunner; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.web.servlet.ServletComponentScan; +import org.springframework.context.annotation.ComponentScan; -import javax.servlet.DispatcherType; -import java.util.EnumSet; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; -public class RuleActiveApp extends IOCApplication<RuleAppConfig> { +@Slf4j +@SpringBootApplication +@ServletComponentScan +@ComponentScan(basePackages = {"org.onap.holmes"}) +public class RuleActiveApp implements ApplicationRunner { - public static void main(String[] args) throws Exception { - new RuleActiveApp().run(args); + public static void main(String[] args) { + SpringApplication.run(RuleActiveApp.class, args); } @Override - public void run(RuleAppConfig configuration, Environment environment) throws Exception { - super.run(configuration, environment); - + public void run(ApplicationArguments args) { ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor(); service.scheduleAtFixedRate( new ConfigFileScanningTask(new ConfigFileScanner()), 60L, ConfigFileScanningTask.POLLING_PERIOD, TimeUnit.SECONDS); - environment.servlets().addFilter("customFilter", new TransactionIdFilter()).addMappingForUrlPatterns(EnumSet - .allOf(DispatcherType.class), true, "/*"); - Initializer.setReadyForMsbReg(true); } } |