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 mysql , 用自己创建的本地主机和用户名 登录不上
    • ¥15 关于#web项目#的问题,请各位专家解答!
    • ¥15 vmtools环境不正常
    • ¥15 请问如何在Ubuntu系统中安装使用microsoft R open?
    • ¥15 jupyter notebook
    • ¥30 informer时间序列预测
    • ¥20 SSR引物多态性分析
    • ¥15 大漠插件在Win11易语言注册调用和免注册灵异事件,VS上注册调用完全没问题
    • ¥15 Addressable缓存机制做热更新的问题