Creating shared instance of singleton bean 'org.mybatis.spring.mapper.MapperScannerConfigurer#0'
时间: 2024-05-26 12:16:22 浏览: 180
这是一个 Spring 框架的日志信息,它表示正在创建一个名为 `org.mybatis.spring.mapper.MapperScannerConfigurer#0` 的单例 Bean 实例。这个 Bean 是用于扫描 MyBatis Mapper 接口的配置类,它会将 Mapper 接口注册到 Spring 容器中,以便在应用程序中使用。这个日志信息不是错误信息,只是 Spring 在启动时输出的一条提示信息,表明它正在执行需要的操作。如果你没有遇到其他的异常信息,应用程序应该可以正常运行。
相关问题
<bean name="sessionFatory" class="org.mybatis.spring.SqlSessionFactoryBean">
I'm sorry, as an AI language model, I cannot provide the complete code implementation of a bean configuration file without further context. However, I can provide you with the basic syntax and attributes of the "bean" tag in a Spring configuration file:
```xml
<bean
id="uniqueBeanId"
class="fullyQualifiedClassName"
scope="singleton/prototype"
init-method="initMethodName"
destroy-method="destroyMethodName">
<!-- bean properties or constructor arguments -->
</bean>
```
In your example, the "bean" tag defines a bean named "sessionFactory" with the class "org.mybatis.spring.SqlSessionFactoryBean". It is not clear whether there are any additional attributes or properties defined within the bean tag.
DEBUG - DispatcherServlet with name 'springmvc' processing GET request for [/spring0100_war/user/list] DEBUG - Looking up handler method for path /user/list DEBUG - Returning handler method [public java.lang.String com.edu.controller.UserController.queryAllUsers(org.springframework.ui.Model)] DEBUG - Returning cached instance of singleton bean 'UserController' DEBUG - Last-Modified value for [/spring0100_war/user/list] is: -1 DEBUG - Resolving exception from handler [public java.lang.String com.edu.controller.UserController.queryAllUsers(org.springframework.ui.Model)]: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.edu.service.UserService.queryAllUsers DEBUG - Resolving exception from handler [public java.lang.String com.edu.controller.UserController.queryAllUsers(org.springframework.ui.Model)]: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.edu.service.UserService.queryAllUsers DEBUG - Resolving exception from handler [public java.lang.String com.edu.controller.UserController.queryAllUsers(org.springframework.ui.Model)]: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.edu.service.UserService.queryAllUsers DEBUG - Could not complete request
从日志中可以看到,出现了 `org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)` 异常,这是因为 MyBatis 找不到名为 `com.edu.service.UserService.queryAllUsers` 的 SQL 语句引起的。
你可以再次检查一下 `com.edu.service.UserService.queryAllUsers` 的 Mapper XML 文件和 Mapper 接口文件是否都存在,是否都使用了相同的命名空间和 id,以及 SQL 语句的语法是否正确。
如果以上检查都没有问题,你可以在启动应用时开启 MyBatis 的 DEBUG 级别日志输出(参考上面的回答),进一步查看具体的错误信息,看看是否能够定位问题所在。
阅读全文