का उपयोग कर डेटासोर्स लोड करने में विफल रहता है मैंने स्प्रिंग बूट 1.0.2.RELEASE का उपयोग करके प्रोटोटाइप सफलतापूर्वक विकसित किया है (आज तक 1.0.1.RELEASE था)।स्प्रिंग बूट PostgreSQL ड्राइवर
मैं खोज की है और खोज की है और कोशिश की तरह समाधान है: Spring Boot jdbc datasource autoconfiguration fails on standalone tomcat Spring Boot/Spring Data import.sql doesn't run Spring-Boot-1.0.0.RC1
वे सब वसंत बूट काम कर जाने के लिए पता चलता है। एच 2 का उपयोग कर, सब कुछ काम करता है, लेकिन जब मैं PostgreSQL के लिए स्विच करने का प्रयास, मैं मिलता है जब:
loadConfiguration()
def loadConfiguration() {
def environment = hasProperty('env') ? env : 'dev'
project.ext.envrionment = environment
println "Environment is set to $environment"
def configFile = file('config.groovy')
def config = new ConfigSlurper("$environment").parse(configFile.toURL())
project.ext.config = config
}
buildscript {
ext {
springBootVersion = '1.0.2.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle- plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'
apply plugin: 'war'
apply plugin: 'groovy'
war {
baseName = 'test'
version = '0.0.1-SNAPSHOT'
}
configurations {
providedRuntime
}
repositories {
mavenCentral()
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-web:${springBootVersion}")
compile("org.springframework.boot:spring-boot-starter-thymeleaf:${springBootVersion}")
compile("org.springframework.boot:spring-boot-starter-jdbc:${springBootVersion}")
compile("org.springframework.boot:spring-boot-starter-data-jpa:${springBootVersion}")
compile("postgresql:postgresql:9.1-901.jdbc4")
//compile("com.h2database:h2")
testCompile("org.springframework.boot:spring-boot-starter-test:${springBootVersion}")
}
task wrapper(type: Wrapper) {
gradleVersion = '1.11'
}
application.properties:
spring.jpa.database=POSTGRESQL
spring.jpa.show-sql=false
spring.jpa.hibernate.ddl-auto=update
spring.database.driverClassName=org.postgresql.Driver
spring.datasource.url=jdbc:postgresql://localhost/cms
spring.datasource.username=cms
spring.datasource.password=NA
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration.entityManagerFactory(org.springframework.orm.jpa.JpaVendorAdapter)] threw exception; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [javax.sql.DataSource] is defined
मेरे build.gradle पालन है
application.properties को हटाने और निर्भरता को H2 पर वापस बदलना और सबकुछ ठीक है।
मैं नहीं मिल सकता है, जहां मैं गलत कर रहा हूँ :-(
बिल्कुल कॉपी-एन-पेस्ट टाइपो प्रश्न अपडेट मतलब नहीं?।! धन्यवाद! – mamruoc
एक टाइपो मिस्टके क्या है! ठीक है, डेटासोर्स और डेटाबेस नहीं * श्वास * – mamruoc