diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/Bootstrap.java b/flink/src/main/java/com/navercorp/pinpoint/flink/Bootstrap.java index 6e82edbbf420..fb9ce30b69f5 100644 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/Bootstrap.java +++ b/flink/src/main/java/com/navercorp/pinpoint/flink/Bootstrap.java @@ -37,7 +37,7 @@ import org.apache.logging.log4j.Logger; import org.springframework.context.ApplicationContext; import org.springframework.context.ConfigurableApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; import java.util.ArrayList; import java.util.List; @@ -54,7 +54,7 @@ public class Bootstrap { private final StatisticsDao statisticsDao; - private final ClassPathXmlApplicationContext applicationContext; + private final ApplicationContext applicationContext; private final TBaseFlatMapper tbaseFlatMapper; private final FlinkProperties flinkProperties; @@ -70,7 +70,7 @@ public class Bootstrap { private final AgentStatHandler agentStatHandler; private Bootstrap() { - applicationContext = new ClassPathXmlApplicationContext("applicationContext-flink.xml"); + applicationContext = new AnnotationConfigApplicationContext(FlinkModule.class); tbaseFlatMapper = applicationContext.getBean("tbaseFlatMapper", TBaseFlatMapper.class); flinkProperties = applicationContext.getBean("flinkProperties", FlinkProperties.class); diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/FlinkModule.java b/flink/src/main/java/com/navercorp/pinpoint/flink/FlinkModule.java new file mode 100644 index 000000000000..08f73cf8452d --- /dev/null +++ b/flink/src/main/java/com/navercorp/pinpoint/flink/FlinkModule.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 NAVER Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package com.navercorp.pinpoint.flink; + +import com.navercorp.pinpoint.common.server.cluster.zookeeper.config.ClusterConfigurationFactory; +import com.navercorp.pinpoint.flink.cache.FlinkCacheConfiguration; +import com.navercorp.pinpoint.flink.dao.hbase.ApplicationDaoConfiguration; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; +import org.springframework.context.annotation.ImportResource; + +@Configuration +@ComponentScan(basePackages = { + "com.navercorp.pinpoint.common.server.util" +}) +@ImportResource({ + "classpath:applicationContext-flink.xml", + + "classpath:applicationContext-flink-profile.xml", + "classpath:applicationContext-flink-extend.xml", + "classpath:applicationContext-flink-clean.xml", + "classpath:applicationContext-hbase.xml", +}) +@Import({ + FlinkCacheConfiguration.class, + ApplicationDaoConfiguration.class, + + ClusterConfigurationFactory.class +}) +public class FlinkModule { + +} diff --git a/flink/src/main/resources/applicationContext-cache.xml b/flink/src/main/resources/applicationContext-cache.xml deleted file mode 100644 index 7aa78c991c49..000000000000 --- a/flink/src/main/resources/applicationContext-cache.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/flink/src/main/resources/applicationContext-flink.xml b/flink/src/main/resources/applicationContext-flink.xml index 14a6ca79b00e..22cd1ee4c41e 100644 --- a/flink/src/main/resources/applicationContext-flink.xml +++ b/flink/src/main/resources/applicationContext-flink.xml @@ -1,25 +1,12 @@ + http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> - - - - - - - - -