mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Make data-jpa conditional on DataSource bean
This commit is contained in:
parent
4fd7fc015e
commit
cb7cc3991b
@ -16,9 +16,14 @@
|
||||
|
||||
package org.springframework.boot.autoconfigure.data;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
@ -32,9 +37,11 @@ import org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean;
|
||||
* @see EnableJpaRepositories
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnBean(DataSource.class)
|
||||
@ConditionalOnClass(JpaRepository.class)
|
||||
@ConditionalOnMissingBean(JpaRepositoryFactoryBean.class)
|
||||
@Import(JpaRepositoriesAutoConfigureRegistrar.class)
|
||||
@AutoConfigureAfter(DataSourceAutoConfiguration.class)
|
||||
public class JpaRepositoriesAutoConfiguration {
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user