Coder Social home page Coder Social logo

itsdf07

数据管理系统:SpringBoot + MySql + mybatis 一、创建项目 1、File - New - Project - Spring Initializr - Next - A -Next - B - Next - C - Finish

A-> Group:com.itsdf07 A-> Artifact:itsdf07 A-> Package:com.itsdf07

B-> Web: Spring Web B-> Template Engines: Thymeleaf B-> SQL: MySQL Dirver\JDBC API\MyBatis Framework

C-> Project name:itsdf07

二、启动 1、运行项目启动类,程序入口:Itsdf07Application.java 备注:运行时,会报以下异常: Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2019-11-22 16:37:04.302 ERROR 13712 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :

***************************
APPLICATION FAILED TO START
***************************

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).


Process finished with exit code 1

异常原因:因为我们创建Spring Boot项目时,在选择组件时添加了mysql、mybatis,但现在还没有配置数据库,导致项目启动报错。 解决方案: 1、在application.properties中进行配置 2、不采用1的方式,而采用更简洁的application.yml,配置如下: server: port: 8087

spring:
    datasource:
        name: test
        url: jdbc:mysql://localhost:3306/itsdf07
        username: root
        password: 
        driver-class-name: com.mysql.jdbc.Driver


其中因为mysql默认是实用最新的,所以当前最新的是mysql是8.0.x,对应的驱动是
所以运行时会报以下异常:
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
解决方案:
    2.1、降低数据库版本,即在pom.xml中对应的mysql降低版本
    2.2、数据库的相关配置(driver-class-name),把com.mysql.jdbc.Driver替换成com.mysql.cj.jdbc.Driver

三、项目整合mybatis

mybatis: mapper-locations: classpath:mapper/*.xml #注意:一定要对应mapper映射xml文件的所在路径 type-aliases-package: com.aso.itsdf07.entity # 注意:对应实体类的路径

itsdf07's Projects

androidutilsold icon androidutilsold

个人技术沉淀工具集合库:内部仅以依赖的形式,集成分散开的各个jcenter库,实现可以统一一步集成所有个人工具类,亦可独立使用工具类

appmvp icon appmvp

用于封装并验证MVP框架模式的稳定性

baseutils icon baseutils

用于积累技术点沉淀,并发布于https://bintray.com/平台中,通过compile 'xxx:xxx:xxx'进行依赖使用

immersionbar icon immersionbar

android 4.4以上沉浸式状态栏和沉浸式导航栏管理,适配横竖屏切换、刘海屏、软键盘弹出等问题,可以修改状态栏字体颜色和导航栏图标颜色,以及不可修改字体颜色手机的适配,适用于Activity、Fragment、DialogFragment、Dialog,PopupWindow,一句代码轻松实现,以及对bar的其他设置,详见README。简书请参考:http://www.jianshu.com/p/2a884e211a62

javautils icon javautils

励志沉淀相关的java基础,并用可视化界面展示出来

makejardemo icon makejardemo

在Android Studio工具中通过Gradle进行module打包成jar包

mobileinfo icon mobileinfo

用来查看手机信息,内部集成了大部分的查询信息,基本能满足使用者需求

okhttp3 icon okhttp3

基于OkHttp3封装的网络请求库——致力于最简洁、功能最全、可灵活扩展的网络操作API

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.