What causes “Unsatisfied dependency expressed through method 'setTargetDatastore' parameter 0”?












0














I'm a complete novice regarding Spring applications, and I'm trying to integrate a project using Kotlin + Spring + GORM (Which requires usage of Groovy). When I try to run it I get:




Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'messageController': Unsatisfied dependency expressed through method 'setTargetDatastore' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException




I have just 5 files in the project, including the build.gradle.



Message.groovy



import grails.gorm.annotation.Entity
import groovy.transform.ToString
import org.grails.datastore.gorm.GormEntity

@ToString
@Entity
class Message implements GormEntity<Message> {
String user;
String date;
String message;
}


Message.service



import domain.Message
import groovy.transform.CompileStatic
import org.springframework.stereotype.Service

@CompileStatic
@grails.gorm.services.Service(Message)
@Service
interface MessageService {
List<Message> findAll()
}


MessageController.groovy



@RestController
@Transactional
class MessageController {

@Autowired
MessageService messageService

@RequestMapping("/")
List<String> index() {
return messageService.findAll().collect { "[" + it.user + "@" + it.date + ": " + it.message + "]" }
}

@RequestMapping(value = "/save/", method = RequestMethod.POST)
String save(@RequestBody Message message) {
message.save()
return "Saved"
}
}


App.kt



@SpringBootApplication
class SimManagerApplication

fun main(args: Array<String>) {

SpringApplication.run(SimManagerApplication::class.java, *args)
}


build.gradle dependencies



dependencies {
compile('org.springframework.boot:spring-boot-starter-quartz')
compile('org.springframework.boot:spring-boot-starter-web')
compile('com.fasterxml.jackson.module:jackson-module-kotlin')
compile('com.vaadin:vaadin-spring-boot-starter')
compile('org.flywaydb:flyway-core')
compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
compile("org.jetbrains.kotlin:kotlin-reflect")

compile("com.h2database:h2")

compile("eu.vaadinonkotlin:vok-rest:0.6.2")
compile('org.codehaus.groovy:groovy-all:2.5.4')
compile("org.flywaydb:flyway-core:5.2.0")

compile "org.grails:gorm-hibernate5-spring-boot:6.1.6.RELEASE"
compile "org.hibernate:hibernate-core:5.1.0.Final"
compile "org.hibernate:hibernate-ehcache:5.1.0.Final"

runtime "org.apache.tomcat:tomcat-jdbc:8.5.0"
runtime "org.apache.tomcat.embed:tomcat-embed-logging-log4j:8.5.0"
runtime "org.slf4j:slf4j-api:1.7.10"

}


and as simple as that, the project fails to start. What, exactly, causes the UnsatisfiedDependencyException? Is there a simple straightforward way to solve it?.



Thank you very much in advance.










share|improve this question


















  • 1




    Please provide the full error. usually it contains the problem description.
    – daggett
    Dec 27 '18 at 22:00










  • Slightly related, but do you really need GORM? I find that Spring Data JPA often provides the same ease of use, plus it might be a little bit better aligned with the rest of Spring. Also, why are you using Groovy and Kotlin in the same project? That's asking for problems.
    – Erik Pragt
    Dec 27 '18 at 23:57


















0














I'm a complete novice regarding Spring applications, and I'm trying to integrate a project using Kotlin + Spring + GORM (Which requires usage of Groovy). When I try to run it I get:




Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'messageController': Unsatisfied dependency expressed through method 'setTargetDatastore' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException




I have just 5 files in the project, including the build.gradle.



Message.groovy



import grails.gorm.annotation.Entity
import groovy.transform.ToString
import org.grails.datastore.gorm.GormEntity

@ToString
@Entity
class Message implements GormEntity<Message> {
String user;
String date;
String message;
}


Message.service



import domain.Message
import groovy.transform.CompileStatic
import org.springframework.stereotype.Service

@CompileStatic
@grails.gorm.services.Service(Message)
@Service
interface MessageService {
List<Message> findAll()
}


MessageController.groovy



@RestController
@Transactional
class MessageController {

@Autowired
MessageService messageService

@RequestMapping("/")
List<String> index() {
return messageService.findAll().collect { "[" + it.user + "@" + it.date + ": " + it.message + "]" }
}

@RequestMapping(value = "/save/", method = RequestMethod.POST)
String save(@RequestBody Message message) {
message.save()
return "Saved"
}
}


App.kt



@SpringBootApplication
class SimManagerApplication

fun main(args: Array<String>) {

SpringApplication.run(SimManagerApplication::class.java, *args)
}


build.gradle dependencies



dependencies {
compile('org.springframework.boot:spring-boot-starter-quartz')
compile('org.springframework.boot:spring-boot-starter-web')
compile('com.fasterxml.jackson.module:jackson-module-kotlin')
compile('com.vaadin:vaadin-spring-boot-starter')
compile('org.flywaydb:flyway-core')
compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
compile("org.jetbrains.kotlin:kotlin-reflect")

compile("com.h2database:h2")

compile("eu.vaadinonkotlin:vok-rest:0.6.2")
compile('org.codehaus.groovy:groovy-all:2.5.4')
compile("org.flywaydb:flyway-core:5.2.0")

compile "org.grails:gorm-hibernate5-spring-boot:6.1.6.RELEASE"
compile "org.hibernate:hibernate-core:5.1.0.Final"
compile "org.hibernate:hibernate-ehcache:5.1.0.Final"

runtime "org.apache.tomcat:tomcat-jdbc:8.5.0"
runtime "org.apache.tomcat.embed:tomcat-embed-logging-log4j:8.5.0"
runtime "org.slf4j:slf4j-api:1.7.10"

}


and as simple as that, the project fails to start. What, exactly, causes the UnsatisfiedDependencyException? Is there a simple straightforward way to solve it?.



Thank you very much in advance.










share|improve this question


















  • 1




    Please provide the full error. usually it contains the problem description.
    – daggett
    Dec 27 '18 at 22:00










  • Slightly related, but do you really need GORM? I find that Spring Data JPA often provides the same ease of use, plus it might be a little bit better aligned with the rest of Spring. Also, why are you using Groovy and Kotlin in the same project? That's asking for problems.
    – Erik Pragt
    Dec 27 '18 at 23:57
















0












0








0







I'm a complete novice regarding Spring applications, and I'm trying to integrate a project using Kotlin + Spring + GORM (Which requires usage of Groovy). When I try to run it I get:




Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'messageController': Unsatisfied dependency expressed through method 'setTargetDatastore' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException




I have just 5 files in the project, including the build.gradle.



Message.groovy



import grails.gorm.annotation.Entity
import groovy.transform.ToString
import org.grails.datastore.gorm.GormEntity

@ToString
@Entity
class Message implements GormEntity<Message> {
String user;
String date;
String message;
}


Message.service



import domain.Message
import groovy.transform.CompileStatic
import org.springframework.stereotype.Service

@CompileStatic
@grails.gorm.services.Service(Message)
@Service
interface MessageService {
List<Message> findAll()
}


MessageController.groovy



@RestController
@Transactional
class MessageController {

@Autowired
MessageService messageService

@RequestMapping("/")
List<String> index() {
return messageService.findAll().collect { "[" + it.user + "@" + it.date + ": " + it.message + "]" }
}

@RequestMapping(value = "/save/", method = RequestMethod.POST)
String save(@RequestBody Message message) {
message.save()
return "Saved"
}
}


App.kt



@SpringBootApplication
class SimManagerApplication

fun main(args: Array<String>) {

SpringApplication.run(SimManagerApplication::class.java, *args)
}


build.gradle dependencies



dependencies {
compile('org.springframework.boot:spring-boot-starter-quartz')
compile('org.springframework.boot:spring-boot-starter-web')
compile('com.fasterxml.jackson.module:jackson-module-kotlin')
compile('com.vaadin:vaadin-spring-boot-starter')
compile('org.flywaydb:flyway-core')
compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
compile("org.jetbrains.kotlin:kotlin-reflect")

compile("com.h2database:h2")

compile("eu.vaadinonkotlin:vok-rest:0.6.2")
compile('org.codehaus.groovy:groovy-all:2.5.4')
compile("org.flywaydb:flyway-core:5.2.0")

compile "org.grails:gorm-hibernate5-spring-boot:6.1.6.RELEASE"
compile "org.hibernate:hibernate-core:5.1.0.Final"
compile "org.hibernate:hibernate-ehcache:5.1.0.Final"

runtime "org.apache.tomcat:tomcat-jdbc:8.5.0"
runtime "org.apache.tomcat.embed:tomcat-embed-logging-log4j:8.5.0"
runtime "org.slf4j:slf4j-api:1.7.10"

}


and as simple as that, the project fails to start. What, exactly, causes the UnsatisfiedDependencyException? Is there a simple straightforward way to solve it?.



Thank you very much in advance.










share|improve this question













I'm a complete novice regarding Spring applications, and I'm trying to integrate a project using Kotlin + Spring + GORM (Which requires usage of Groovy). When I try to run it I get:




Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'messageController': Unsatisfied dependency expressed through method 'setTargetDatastore' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException




I have just 5 files in the project, including the build.gradle.



Message.groovy



import grails.gorm.annotation.Entity
import groovy.transform.ToString
import org.grails.datastore.gorm.GormEntity

@ToString
@Entity
class Message implements GormEntity<Message> {
String user;
String date;
String message;
}


Message.service



import domain.Message
import groovy.transform.CompileStatic
import org.springframework.stereotype.Service

@CompileStatic
@grails.gorm.services.Service(Message)
@Service
interface MessageService {
List<Message> findAll()
}


MessageController.groovy



@RestController
@Transactional
class MessageController {

@Autowired
MessageService messageService

@RequestMapping("/")
List<String> index() {
return messageService.findAll().collect { "[" + it.user + "@" + it.date + ": " + it.message + "]" }
}

@RequestMapping(value = "/save/", method = RequestMethod.POST)
String save(@RequestBody Message message) {
message.save()
return "Saved"
}
}


App.kt



@SpringBootApplication
class SimManagerApplication

fun main(args: Array<String>) {

SpringApplication.run(SimManagerApplication::class.java, *args)
}


build.gradle dependencies



dependencies {
compile('org.springframework.boot:spring-boot-starter-quartz')
compile('org.springframework.boot:spring-boot-starter-web')
compile('com.fasterxml.jackson.module:jackson-module-kotlin')
compile('com.vaadin:vaadin-spring-boot-starter')
compile('org.flywaydb:flyway-core')
compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
compile("org.jetbrains.kotlin:kotlin-reflect")

compile("com.h2database:h2")

compile("eu.vaadinonkotlin:vok-rest:0.6.2")
compile('org.codehaus.groovy:groovy-all:2.5.4')
compile("org.flywaydb:flyway-core:5.2.0")

compile "org.grails:gorm-hibernate5-spring-boot:6.1.6.RELEASE"
compile "org.hibernate:hibernate-core:5.1.0.Final"
compile "org.hibernate:hibernate-ehcache:5.1.0.Final"

runtime "org.apache.tomcat:tomcat-jdbc:8.5.0"
runtime "org.apache.tomcat.embed:tomcat-embed-logging-log4j:8.5.0"
runtime "org.slf4j:slf4j-api:1.7.10"

}


and as simple as that, the project fails to start. What, exactly, causes the UnsatisfiedDependencyException? Is there a simple straightforward way to solve it?.



Thank you very much in advance.







spring gradle groovy kotlin gorm






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Dec 27 '18 at 20:03









Anderson Martínez

11




11








  • 1




    Please provide the full error. usually it contains the problem description.
    – daggett
    Dec 27 '18 at 22:00










  • Slightly related, but do you really need GORM? I find that Spring Data JPA often provides the same ease of use, plus it might be a little bit better aligned with the rest of Spring. Also, why are you using Groovy and Kotlin in the same project? That's asking for problems.
    – Erik Pragt
    Dec 27 '18 at 23:57
















  • 1




    Please provide the full error. usually it contains the problem description.
    – daggett
    Dec 27 '18 at 22:00










  • Slightly related, but do you really need GORM? I find that Spring Data JPA often provides the same ease of use, plus it might be a little bit better aligned with the rest of Spring. Also, why are you using Groovy and Kotlin in the same project? That's asking for problems.
    – Erik Pragt
    Dec 27 '18 at 23:57










1




1




Please provide the full error. usually it contains the problem description.
– daggett
Dec 27 '18 at 22:00




Please provide the full error. usually it contains the problem description.
– daggett
Dec 27 '18 at 22:00












Slightly related, but do you really need GORM? I find that Spring Data JPA often provides the same ease of use, plus it might be a little bit better aligned with the rest of Spring. Also, why are you using Groovy and Kotlin in the same project? That's asking for problems.
– Erik Pragt
Dec 27 '18 at 23:57






Slightly related, but do you really need GORM? I find that Spring Data JPA often provides the same ease of use, plus it might be a little bit better aligned with the rest of Spring. Also, why are you using Groovy and Kotlin in the same project? That's asking for problems.
– Erik Pragt
Dec 27 '18 at 23:57














0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53950282%2fwhat-causes-unsatisfied-dependency-expressed-through-method-settargetdatastore%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53950282%2fwhat-causes-unsatisfied-dependency-expressed-through-method-settargetdatastore%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Mossoró

Error while reading .h5 file using the rhdf5 package in R

Pushsharp Apns notification error: 'InvalidToken'