ahllahll 2013-12-18 13:54
浏览 2172

Spring , spark 构架使用了不同的cglib, 但是我需要在项目中同时使用它们

问题是, 我怎样在这个项目中, 按需要生成不同版本的 cglib类, 同时兼容2个构架.

maven

<dependency>
    <groupId>com.commons.algorithm</groupId>
    <artifactId>simulator</artifactId>
    <version>1.0</version>
</dependency>
<dependency> spring works with this
    <groupId>cglib</groupId>
    <artifactId>cglib</artifactId>
    <version>2.2.2</version>
</dependency>
<!--dependency> spark requires this
    <groupId>cglib</groupId>
    <artifactId>cglib</artifactId>
    <version>3.0</version>
</dependency-->
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-core</artifactId>
    <version>3.1.2.RELEASE</version>
</dependency>
<dependency> 
    <groupId>org.apache.spark</groupId>
    <artifactId>spark-core_2.9.3</artifactId>
    <version>0.8.0-incubating</version>
    <type>jar</type>
</dependency>

代码:

@SparkParameter(taskJarLocation = {"analysis/1.0/analysis-1.0.jar"})
@SparkCassandraParameter (keySpace="commons10", port = 9160)
@RunWith(value = Parameterized.class)
public class PerformanceExecutor {
private Simulator simulator;
private Analysis analysis;
private Algorithm algorithm;

public PerformanceExecutor(Simulator simulator, Analysis analysis, Algorithm algorithm){
    this.simulator = simulator;
    this.analysis = analysis;
    this.algorithm = algorithm;
}

@Parameters
public static Collection<Object[]> data() throws ClassNotFoundException, IOException {
    ApplicationContext ctx = new AnnotationConfigApplicationContext(TestConfiguration.class);
    CommonDao commonDao = ctx.getBean(CommonDao.class);
    OpinionDao opinionDao = ctx.getBean(OpinionDao.class);
    DataBaseAdaptor adaptor = new DataBaseAdaptorImpl(opinionDao, commonDao, 1);
    SparkRddHelper helper = new SparkRddHelper();
    Object[][] data = new Object[][]{{new RegisterSimulation(), new CommonRelationAnalysisTask(helper), new CommonRenewAlgorithm(adaptor)}};
    return Arrays.asList(data);
}

@Test
public void pushTest() throws Exception {
    simulator.start("src/main/resources/userCreated/users2.txt", 10); // <-- spring required
    analysis.runAnalysis(); // <-- spark required
    algorithm.process();
}

}

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
    • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
    • ¥15 乘性高斯噪声在深度学习网络中的应用
    • ¥15 运筹学排序问题中的在线排序
    • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
    • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
    • ¥15 C++ 头文件/宏冲突问题解决
    • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
    • ¥50 安卓adb backup备份子用户应用数据失败
    • ¥20 有人能用聚类分析帮我分析一下文本内容嘛