yidao620c / SpringBootBucket

Springboot bucket
MIT License
1.05k stars 709 forks source link

springboot多数据源配置启动一直报这个错啊,请问时怎么回事? #15

Open wccJava opened 5 years ago

wccJava commented 5 years ago

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userMapper' defined in file [D:\IDEA\idea2019\springboot\springboot-datasource\target\classes\com\spring\datasource\mapper\UserMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required

lzyqssn commented 5 years ago

你看看你是不是没有注入sqlSessionFactory  和 sqlSessionTemplate。或者没有写@Bean注解。另外还有可能是你注入这两个的时候没有指定名字。发自我的华为手机-------- 原始邮件 --------主题:[yidao620c/SpringBootBucket] springboot多数据源配置启动一直报这个错啊,请问时怎么回事? (#15)发件人:wccJava 收件人:yidao620c/SpringBootBucket 抄送:Subscribed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userMapper' defined in file [D:\IDEA\idea2019\springboot\springboot-datasource\target\classes\com\spring\datasource\mapper\UserMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required

—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or mute the thread.

wccJava commented 5 years ago

@lzyqssn 感谢您的回答!我仔细看了demo发现并没有对这两点进行注入,如果注入,请问如何注入?

lzyqssn commented 5 years ago

提供一下你的代码看看。

------------------ 原始邮件 ------------------ 发件人: "wccJava"notifications@github.com; 发送时间: 2019年6月5日(星期三) 晚上8:00 收件人: "yidao620c/SpringBootBucket"SpringBootBucket@noreply.github.com; 抄送: "1097842122"1097842122@qq.com;"Mention"mention@noreply.github.com; 主题: Re: [yidao620c/SpringBootBucket] springboot多数据源配置启动一直报这个错啊,请问时怎么回事? (#15)

@lzyqssn 感谢您的回答!我仔细看了demo发现并没有对这两点进行注入,如果注入,请问如何注入?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

wccJava commented 5 years ago

@lzyqssn 我明天把工程打包发您邮件,如果您有空可以帮我看看!感谢!

wccJava commented 5 years ago

@lzyqssn 您好我已经发送demo到您的邮箱上了,您有空可以的话指点一下!谢谢!