1
CamelでSpringブートアプリケーションの単体テストを行っています。アプリケーションが実行されると、それは@ComponentApache CamelでSpringテストのユニットテストでBeanとして@Componentを取得できない
@Component("agencyExporterProcessor")
public class AgencyExporterProcessor {}
として設定されているBeanを取得することができますし、私はこのようなBeanを取得:
from(getTriggerExportEndpoint())
.routeId(getTriggerExportId())
// When shutting down, Camel will wait until the batch completed
.shutdownRunningTask(ShutdownRunningTask.CompleteAllTasks)
.log("[SamCustomExporter] - RouteId:${routeId} - Begin at ${date:now:MM/dd/yyyy HH:mm:ss.SSS}")
.setHeader(Messaging.Names.SAM_DATA_AGENCY_CONFIGURATION_HEADER_KEY.toString(), constant(getConfiguration()))
// Initialize a list to store exported CSV file names
.bean(agencyExporterProcessor, "prepareExportedFileList")
をしかし、私はテストすると、ルートは、Bean「を取得することはできません
org.apache.camel.FailedToCreateRouteException: Failed to create route agencyExporterRoute_triggerExport at: >>> Bean[ref:agencyExporterProcessor method:prepareExportedFileList] <<< in route: Route(agencyExporterRoute_triggerExport)[[From[direct:agency... because of No bean could be found in the registry for: agencyExporterProcessor
これは私が私のユニットテストクラスの構成方法である:
@DirtiesContext
@RunWith(SpringRunner.class)
@EnableAutoConfiguration
@SpringBootApplication
@SpringBootTest(classes = SamCustomExporterSpringApplication.class,
webEnvironment = SpringBootTest.WebEnvironment.NONE)
public class AgencyExporterRouteTest extends BaseRouteTestSupport {}
アドバイスをお願いします。多くのおかげで
申し訳ありませんが、これは私のミスです。はい、私はイプセン氏が好きです。しかし、それでもまだこのエラーがあります –
コンポーネントパッケージのベースパッケージは同じでなければなりません。両方のクラスのパッケージの場所は何ですか? – priyas