描述:我正在使用MongoDB,它一直在请求数据源。我排除了以下内容:
exclude=DataSourceAutoConfiguration.class,
DataSourceTransactionManagerAutoConfiguration.class,
HibernateJpaAutoConfiguration.class,
JpaRepositoriesAutoConfiguration.class})
错误:
Error starting ApplicationContext. To display the conditions report re-run
your application with 'debug' enabled.
2018-10-29 11:03:25.968 ERROR 4676 --- [ restartedMain]
o.s.b.d.LoggingFailureAnalysisReporter :
说明:
***************************
APPLICATION FAILED TO START
***************************
Parameter 1 of method batchConfigurer in org.springframework.boot.autoconfigure.batch.BatchConfigurerConfiguration$JdbcBatchConfiguration required a bean of type 'javax.sql.DataSource' that could not be found.
- Bean method 'dataSource' not loaded because @ConditionalOnProperty (spring.datasource.jndi-name) did not find property 'jndi-name'
- Bean method 'dataSource' not loaded because @ConditionalOnClass did not find required class 'javax.transaction.TransactionManager'
Action:
Consider revisiting the entries above or defining a bean of type 'javax.sql.DataSource' in your configuration.
答案 0 :(得分:1)
Spring Boot适用于构建生产级应用程序。当用于构建Spring Batch应用程序时,它需要数据源来保留Spring Batch元数据(请参见BATCH-2704)。
但是您始终可以使用以下任何一种方式:
BatchConfigurer
并使用MapJobRepository
(请参阅here)希望这会有所帮助。