Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#noissue] Change xml config to java config in flink module #10212

Merged
merged 1 commit into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -54,7 +54,7 @@

private final StatisticsDao statisticsDao;

private final ClassPathXmlApplicationContext applicationContext;
private final ApplicationContext applicationContext;

private final TBaseFlatMapper tbaseFlatMapper;
private final FlinkProperties flinkProperties;
Expand All @@ -70,7 +70,7 @@
private final AgentStatHandler agentStatHandler;

private Bootstrap() {
applicationContext = new ClassPathXmlApplicationContext("applicationContext-flink.xml");
applicationContext = new AnnotationConfigApplicationContext(FlinkModule.class);

Check warning on line 73 in flink/src/main/java/com/navercorp/pinpoint/flink/Bootstrap.java

View check run for this annotation

Codecov / codecov/patch

flink/src/main/java/com/navercorp/pinpoint/flink/Bootstrap.java#L73

Added line #L73 was not covered by tests

tbaseFlatMapper = applicationContext.getBean("tbaseFlatMapper", TBaseFlatMapper.class);
flinkProperties = applicationContext.getBean("flinkProperties", FlinkProperties.class);
Expand Down
48 changes: 48 additions & 0 deletions flink/src/main/java/com/navercorp/pinpoint/flink/FlinkModule.java
Original file line number Diff line number Diff line change
@@ -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 {

Check warning on line 46 in flink/src/main/java/com/navercorp/pinpoint/flink/FlinkModule.java

View check run for this annotation

Codecov / codecov/patch

flink/src/main/java/com/navercorp/pinpoint/flink/FlinkModule.java#L46

Added line #L46 was not covered by tests

}
10 changes: 0 additions & 10 deletions flink/src/main/resources/applicationContext-cache.xml

This file was deleted.

15 changes: 1 addition & 14 deletions flink/src/main/resources/applicationContext-flink.xml
Original file line number Diff line number Diff line change
@@ -1,25 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">

<import resource="classpath:applicationContext-flink-profile.xml"/>
<import resource="classpath:applicationContext-flink-extend.xml"/>
<import resource="classpath:applicationContext-flink-clean.xml"/>
<import resource="classpath:applicationContext-hbase.xml"/>
<import resource="classpath:applicationContext-cache.xml"/>

<context:component-scan
base-package="com.navercorp.pinpoint.common.server.util,
com.navercorp.pinpoint.collector.mapper.thrift.stat"/>

<bean class="com.navercorp.pinpoint.common.server.cluster.zookeeper.config.ClusterConfigurationFactory"/>
<bean id="flinkProperties" class="com.navercorp.pinpoint.flink.config.FlinkProperties"/>
<bean class="com.navercorp.pinpoint.flink.dao.hbase.ApplicationDaoConfiguration"/>

<bean id="tcpReceiverProperties" class="com.navercorp.pinpoint.flink.config.DataReceiverProperties"/>

Expand Down