springboot刚入门遇到的bug

-- 1、有些类没有被注入到springboot中,导致报错找不到类

Description:

Field userMapper in com.zty.audio.service.impl.UserServiceImpl required a bean of type 'com.zty.audio.mapper.UserMapper' that could not be found.


Action:

Consider defining a bean of type 'com.zty.audio.mapper.UserMapper' in your configuration.

--1、解决方法:

       

-- 2、spring整合其他数据持久层时(例如 mybatis ),没有先在application.yml配置中配置好,导致找不到url报错

Description:

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

Reason: Failed to determine a suitable driver class

Action:

Consider the following:

If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).

--2、解决方法:

    1、先不加载整合持久层数据库框架的jar包,这样就不会报错

    2、在application.ynl配置好数据源

  

猜你喜欢

转载自www.cnblogs.com/ridong12345/p/9318617.html