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 求差集那个函数有问题,有无佬可以解决
    • ¥15 【提问】基于Invest的水源涵养
    • ¥20 微信网友居然可以通过vx号找到我绑的手机号
    • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
    • ¥15 解riccati方程组
    • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
    • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
    • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
    • ¥50 树莓派安卓APK系统签名
    • ¥65 汇编语言除法溢出问题