Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/308.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java SpringBeanAutowiringInterceptor-配置为按名称而不是按类型自动连线?_Java_Spring_Ejb 3.0_Autowired - Fatal编程技术网

Java SpringBeanAutowiringInterceptor-配置为按名称而不是按类型自动连线?

Java SpringBeanAutowiringInterceptor-配置为按名称而不是按类型自动连线?,java,spring,ejb-3.0,autowired,Java,Spring,Ejb 3.0,Autowired,我正在EJB3无状态会话bean中使用SpringBeanAutowiringInterceptor,如中所述 在SpringConfig.xml中: <bean id="myCustomService1" class="...MyService"/> <bean id="myCustomService2" class="...MyService"/> 不幸的是,EJB自动连接似乎默认为byType模式,我找不到方法将其更改为byName模式 这可能吗?如果可能,如何实

我正在EJB3无状态会话bean中使用
SpringBeanAutowiringInterceptor
,如中所述

在SpringConfig.xml中:

<bean id="myCustomService1" class="...MyService"/>
<bean id="myCustomService2" class="...MyService"/>
不幸的是,EJB自动连接似乎默认为
byType
模式,我找不到方法将其更改为
byName
模式


这可能吗?如果可能,如何实现?

您是否尝试过使用
限定符

@Autowired
@Qualifier("myCustomService1")
    public void setMyCustomService2(MyService svc) {
    this.service = svc;
}    

您是否尝试过使用
限定符

@Autowired
@Qualifier("myCustomService1")
    public void setMyCustomService2(MyService svc) {
    this.service = svc;
}    
@Autowired
@Qualifier("myCustomService1")
    public void setMyCustomService2(MyService svc) {
    this.service = svc;
}