は私が含まれている実行可能なJARのAを持っているインタフェース:SpringBoot:java -cpを使ってJARから実行可能なJARに@Autowire Beanを置くことはできますか?
JAR AIでinterface FooInterface {
void foo();
...
}
FooInterfaceのimplmenetation autowireしようとしているクラスもあります。他のプロジェクトBIでは
class Other{
@Autowired
FooInterface fooInterfaceImplementation;
...
}
外部ライブラリとしてのjar Aを持っており、 FooInterfaceの実装:
@Component
class BarClass implements FooInterface {
void foo(){...}
...
}
私はrunnableを実行しようとしています.JAR Bのクラスを持つJARをcommを使って実行しようとしています。そして、:
java -jar A.jar -cp B.jar
しかし、それは次の例外で終了します。
Exception in thread "main" org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.ocado.cfc.optimisation.AlgorithmInterface' available
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:348)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:335)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1093)
at com.ocado.cfc.optimisation.Executable.main(Executable.java:81)
それはそのように必要なBeanをautowireすることは可能ですか?
ご協力いただきありがとうございます。