小编wil*_*lix的帖子

什么是python 3.3和3.3m之间的区别

python 3.3和3.3m有什么区别

我正在使用Ubuntu 13.04 Raring,在我的系统上我有python2.7和python3.3(我知道2和3之间的差异)

但我也安装了python3.3m(它不是3.3的符号链接).那么它m代表什么呢?

python python-3.3

27
推荐指数
2
解决办法
5285
查看次数

如何动态生成bean列表

海伊

我正在寻找一种“简化”/缩短我的弹簧配置的方法。我有这个通用服务,看起来像:

public class GenericService<T> {
   private Class<T> targetClass;
   public void setTargetClass(Class<T> targetClass) {this.targetClass = targetClass;}
   public void doSomething() {...}
}
Run Code Online (Sandbox Code Playgroud)

在我的 spring-config.xml 文件中

<bean id="entity1Service" class="GenericService">
   <property name="targetClass" value="model.Entity1" />
</bean>

<bean id="entity2Service" class="GenericService">
   <property name="targetClass" value="model.Entity2" />
</bean>

...
Run Code Online (Sandbox Code Playgroud)

我正在尝试建立一个工厂来为我构建所有这些服务,以便我可以在 spring-config.xml 中编写类似的内容

<bean class="ServiceFactory">
   <property name="targets">
      <list>
        <value>model.Entity1</value>
        <value>model.Entity2</value>
      </list>
    </property>
</bean>
Run Code Online (Sandbox Code Playgroud)

这将生成 2 个 bean(一个名为entity1Service,另一个名为entity2Service)。得到它?

我该如何开始?我看过 BeanFactory (不要与 FactoryBean 混淆!),但没能明白如何连接所有东西。

如果我的工厂可以扫描我的包并在找到实体时生成服务(通过注释或接口实现),那就更好了,有点像 spring-data 中的 @EnableJpaRepositories 注释对所有 JpaRepository 接口所做的那样。

感谢您提供任何见解、示例、指示...

w。

java configuration spring factory spring-data

5
推荐指数
1
解决办法
8141
查看次数

标签 统计

configuration ×1

factory ×1

java ×1

python ×1

python-3.3 ×1

spring ×1

spring-data ×1