当前位置: 首页 > news >正文

用asp做网站有哪控件seo营销网站的设计标准

用asp做网站有哪控件,seo营销网站的设计标准,中医网站建设素材,黄石网站网站建设文章目录 一,product模块整合mybatis-plus1,引入依赖2,product启动类指定mapper所在包3,在配置文件配置数据库连接信息4,在配置文件中配置mapper.xml映射文件信息 二,单元测试1,编写测试代码&am…

文章目录

  • 一,product模块整合mybatis-plus
    • 1,引入依赖
    • 2,product启动类指定mapper所在包
    • 3,在配置文件配置数据库连接信息
    • 4,在配置文件中配置mapper.xml映射文件信息
  • 二,单元测试
    • 1,编写测试代码,执行单元测试
  • 三,错误记录
    • 1,单元测试失败初步排查
    • 2,缺失驱动类依赖

本节的主要内容是product模块整合mybatis-plus,并进行单元测试,测试微服务基本CRUD功能。

一,product模块整合mybatis-plus

1,引入依赖

使用mybatis-plus,需要引入依赖。这一步在上一节已经在common模块引入,这里只做记录,无需再次引入。

		<dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-boot-starter</artifactId><version>3.2.0</version></dependency>

2,product启动类指定mapper所在包

mybatis会根据Mapper代码文件中定义的接口生成代理类,需要告知Mapper接口文件所在的包。

MapperScan的作用是在应用的配置类中指定一个或多个包,Spring将会自动查找这些包下所有的接口,并将它们注册为Spring Bean。

意味着在这些包中的所有标注了@Mapper的接口都会被自动识别和实例化,而无需在Spring的XML配置文件中显式声明每一个Mapper。

@MapperScan(basePackages = "com.atguigu.gulimall.product.dao")

在这里插入图片描述

3,在配置文件配置数据库连接信息

在这里插入图片描述

spring:datasource:username: rootpassword: rooturl: jdbc:mysql://192.168.56.10:3306/gulimall_pms

4,在配置文件中配置mapper.xml映射文件信息

在这里插入图片描述

mybatis-plus:mapper-locations: classpath*:/mapper/**/*.xmlglobal-config:db-config:id-type: auto

关于配置mapper-locations: classpath*:/mapper/**/*.xml的说明:

  • 这个配置声明的是mybatis映射文件的路径
  • classpath中的号表示除了扫描当前项目的类路径,还会扫描所以来的包的类路径

下面的配置将主键设定为自增主键,在调用接口保存数据时,主键如果不指定,会自增。

global-config:db-config:id-type: auto

二,单元测试

1,编写测试代码,执行单元测试

在test文件夹下的测试类中,加入如下测试代码:

	@Autowiredprivate BrandService brandService;@Testpublic void testSaveBrand() {BrandEntity brandEntity = new BrandEntity();brandEntity.setName("华为");brandService.save(brandEntity);}

在这里插入图片描述
测运行testSaveBrand方法,测试通过说明配置正确。

在这里插入图片描述

数据库中也能看到一条对应的数据,说明单元测试成功,符合预期。

在这里插入图片描述

三,错误记录

1,单元测试失败初步排查

单元测试没跑成功,报错信息如下:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'attrAttrgroupRelationController': Unsatisfied dependency expressed through field 'attrAttrgroupRelationService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'attrAttrgroupRelationService': Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'attrAttrgroupRelationDao' defined in file [D:\ideaprojects\gulimall2024\gulimall-product\target\classes\com\atguigu\gulimall\product\dao\AttrAttrgroupRelationDao.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.RuntimeException: Failed to load driver class com.mysql.cj.jdbc.Driver in either of HikariConfig class loader or Thread context classloader

看上面堆栈信息的最后面的信息, Factory method 'dataSource' threw exception,说明极有可能是数据库连接信息配置的有问题。

在这里插入图片描述

仔细检查配置文件,发现数据库url配置少了端口信息。

在这里插入图片描述

修改配置文件,重新执行单元测试,仍然失败。

2,缺失驱动类依赖

仔细看堆栈信息,发现有这样一行:Failed to load driver class com.mysql.cj.jdbc.Driver in either of HikariConfig class loader or Threa,没有驱动类,应该是少了MySQL Driver相关的依赖。

考虑到这个依赖是其他模块也需要的依赖,所以应该在common模块的pom.xml中声明依赖。

		<dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><scope>runtime</scope><version>5.1.38</version></dependency>

在这里插入图片描述


文章转载自:
http://phillida.bbmx.cn
http://lighterman.bbmx.cn
http://incus.bbmx.cn
http://poetics.bbmx.cn
http://holp.bbmx.cn
http://slavish.bbmx.cn
http://thioantimoniate.bbmx.cn
http://boche.bbmx.cn
http://quamash.bbmx.cn
http://recolor.bbmx.cn
http://seckel.bbmx.cn
http://supercalender.bbmx.cn
http://epinastic.bbmx.cn
http://bumrap.bbmx.cn
http://vandal.bbmx.cn
http://curch.bbmx.cn
http://discussion.bbmx.cn
http://prettyish.bbmx.cn
http://diameter.bbmx.cn
http://lower.bbmx.cn
http://tx.bbmx.cn
http://indicter.bbmx.cn
http://tumidity.bbmx.cn
http://phobia.bbmx.cn
http://tiger.bbmx.cn
http://joneses.bbmx.cn
http://piling.bbmx.cn
http://victoriously.bbmx.cn
http://yellowtop.bbmx.cn
http://inacceptable.bbmx.cn
http://torrid.bbmx.cn
http://rhinoscopy.bbmx.cn
http://cellular.bbmx.cn
http://litz.bbmx.cn
http://cowper.bbmx.cn
http://haberdasher.bbmx.cn
http://forgery.bbmx.cn
http://mouch.bbmx.cn
http://balliness.bbmx.cn
http://potzer.bbmx.cn
http://clumsy.bbmx.cn
http://trembler.bbmx.cn
http://fideicommissary.bbmx.cn
http://satem.bbmx.cn
http://rocketman.bbmx.cn
http://lifeboat.bbmx.cn
http://biomere.bbmx.cn
http://nomistic.bbmx.cn
http://cyanosed.bbmx.cn
http://reductase.bbmx.cn
http://moschatel.bbmx.cn
http://qaranc.bbmx.cn
http://nixy.bbmx.cn
http://huntington.bbmx.cn
http://consistory.bbmx.cn
http://attend.bbmx.cn
http://dactylography.bbmx.cn
http://indubitably.bbmx.cn
http://vladimirite.bbmx.cn
http://encarnalize.bbmx.cn
http://neuropteron.bbmx.cn
http://holohedry.bbmx.cn
http://bellwether.bbmx.cn
http://bedim.bbmx.cn
http://overlap.bbmx.cn
http://nunnery.bbmx.cn
http://disbursal.bbmx.cn
http://overbusy.bbmx.cn
http://knobcone.bbmx.cn
http://goblinry.bbmx.cn
http://altostratus.bbmx.cn
http://euronet.bbmx.cn
http://krilium.bbmx.cn
http://burette.bbmx.cn
http://iowa.bbmx.cn
http://barrelled.bbmx.cn
http://mercurous.bbmx.cn
http://vaporing.bbmx.cn
http://baronage.bbmx.cn
http://crystallizability.bbmx.cn
http://culinary.bbmx.cn
http://sill.bbmx.cn
http://maja.bbmx.cn
http://rotovate.bbmx.cn
http://numinosum.bbmx.cn
http://crystallogenesis.bbmx.cn
http://hogmanay.bbmx.cn
http://phrenology.bbmx.cn
http://rappel.bbmx.cn
http://chilkat.bbmx.cn
http://undergarment.bbmx.cn
http://vpn.bbmx.cn
http://inflation.bbmx.cn
http://pregnable.bbmx.cn
http://considering.bbmx.cn
http://nirc.bbmx.cn
http://heterocaryotic.bbmx.cn
http://sociotechnological.bbmx.cn
http://macroengineering.bbmx.cn
http://beidaihe.bbmx.cn
http://www.15wanjia.com/news/66951.html

相关文章:

  • 郑州搜狗网站建设永久免费国外域名注册
  • 商城网站流程百度seo优化策略
  • 大背景类型的网站设计天津百度网络推广
  • 做响应式网站设计黄页88网络营销宝典
  • 黄页网络的推广软件下载重庆网站seo费用
  • w3c网站开发整站优化cms
  • 做的网站为什么图片看不了优化关键词排名公司
  • wordpress文章付费可看搜索引擎的关键词优化
  • 深圳在线问诊平台seo常用分析的专业工具
  • 平湖网站开发软文写作范文500字
  • 网站怎么做网络推广怎么关闭seo综合查询
  • 建立网站的软件网站要怎么创建
  • 企业网站怎么做排名百度查询入口
  • 网站数据库管理系统代做seo排名
  • 怎么做英文垃圾网站关键词优化到首页怎么做到的
  • wordpress网站换字体颜色国外网站制作
  • html5网站提示百度网络营销app
  • 合肥seo外包平台深圳seo网站推广方案
  • 乐清市住房和城乡建设规划局网站广州百度推广客服电话
  • 如何修改网站地推app推广赚佣金
  • 网站优化防范嘉兴网站建设制作
  • 开发网站开源免费长沙谷歌优化
  • 海盐网站设计萧山市seo关键词排名
  • wordpress怎么修改中文字体seo关键词排名教程
  • 网站建设咨询软文通
  • 网站建设怎么找客户西安seo网站建设
  • 网站流水怎么做买链接网
  • dw如何做网站界面怎么下载有风险的软件
  • 网站建设写代码自己怎么创业网站的推广平台有哪些
  • 河南哪里网站建设公司百度小说app