Spring Bean が jar ファイルで注釈を使用した場合、クラスに mythe Bean インスタンスをロードするにはどうすればよいですか?
jarファイルで
package org.java.service.test;
@Service(value = "MyService")
public class MyService {
@Resource(name = "myproperties")
private Properties properties;
}
私のプロジェクトでは
package org.java.project.test;
@Service(value = "OtherService")
public class OtherService {
@Resource(name = "MyService")
private MyService myService;
}
spring-beans.xml 内
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" ....>
<context:annotation-config/>
<context:component-scan base-package=org.java.service.test, org.java.project.test"/>
.....
</beans>
私も以下のように試してみましたが、うまくいきません
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" ....>
<context:annotation-config/>
<context:component-scan base-package="org.java.service.test"/>
<context:component-scan base-package="org.java.project.test"/>
.....
</beans>