【发布时间】:2015-01-26 08:00:54
【问题描述】:
我正在尝试使用 application.properties 文件来配置 Spring Boot 必须使用的数据源。
我在里面放了以下属性:
spring.datasource.driverClassName=org.postgresql.Driver
spring.datasource.user=test
spring.datasource.password=test
spring.datasource.jdbcUrl=jdbc:postgresql://localhost:5432/test
application.properties 文件被其他系统很好地使用。但我无法让它用于自动数据源配置。
我仍然收到此异常:
org.springframework.beans.factory.BeanCreationException: Cannot determine embedded database url for database type NONE.
包含并加载了 postgresql 驱动程序。我可以使用Configuration 类和与上面相同的参数来配置数据源。
我还将@EnableAutoConfiguration 和@EnableJpaRepositories 添加到我的Application.class。
有什么线索吗?
【问题讨论】:
-
类路径上是否有受支持的
DataSource实现之一(例如Tomcat JDBC)? -
是的,我有。当我手动配置数据源时,它就像一个魅力。
标签: spring jpa spring-boot