我想将休眠空间与 mysql 和 spring boot 一起使用。我试过但失败了。application.properties 文件如下
spring.datasource.url=jdbc:mysql://localhost:3306/tour_management
spring.datasource.username=root
spring.datasource.password=admin
endpoints.actuator.enabled=true
endpoints.info.enabled=true
spring.jpa.properties.hibernate.dialect =
org.hibernate.spatial.dialect.mysql.MySQLSpatial5InnoDBDialect
spring.jpa.database-platform =
org.hibernate.spatial.dialect.mysql.MySQLSpatial5InnoDBDialect
@Data
@Entity(name = "Place")
public class PlaceEntity extends BaseEntity {
@Id
@GeneratedValue
@Column(name = "ID")
private long id;
@Column(name = "NAME")
private String name;
@Column(name = "CODE")
private String code;
@Column(name = "LONGITUDE")
private Double longitude;
@Column(name = "LATITUDE")
private Double latitude;
@Column(name = "LOCATION",columnDefinition = "geometry(Point,4326)")
private Point location;
}
但是我在部署时遇到异常
buildscript {
ext {
springBootVersion = '1.5.7.RELEASE'
}
repositories {
mavenCentral()
maven {
url "http://www.hibernatespatial.org/repository"
}
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-
plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
group = 'com.fm'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
maven {
url "http://www.hibernatespatial.org/repository"
}
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-actuator')
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('mysql:mysql-connector-java')
compile('org.projectlombok:lombok:1.14.8')
compile('org.springframework.boot:spring-boot-starter-web')
compile('com.vividsolutions:jts:1.13')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
原因:org.hibernate.boot.registry.selector.spi.StrategySelectionException:无法将名称 [org.hibernate.spatial.dialect.mysql.MySQLSpatial5InnoDBDialect] 解析为 org.hibernate 的策略 [org.hibernate.dialect.Dialect]。 boot.registry.selector.internal.StrategySelectorImpl.selectStrategyImplementor(StrategySelectorImpl.java:113) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
有没有版本相关的问题???