MongoRepository深度解析

  • Post author:
  • Post category:其他

MongoRepository接口解析 在Mongo数据库中,Repository类有点像mysql的mapper文件的意思,但是比mapper文件更加的简单。 /** * 继承的MongoRepository接口中, * 泛型1是对应的domain包中的实体类 * 泛型2是该类的对应的文档主键 * 记得贴上Repository注解,该类的对象交由spring容器管理 */ @Repository…

继续阅读 MongoRepository深度解析

MongoRepository 基本使用

  • Post author:
  • Post category:其他

转载自:https://www.jianshu.com/p/f47621a224a6 叙述 MongoRepository有以下方法 介绍 count()统计总数 count(Example< S > example)条件统计总数 delete(T entities)通过对象信息删除某条数据 deleteById(ID id)通过id删除某条数据 deleteALL(Iterable&…

继续阅读 MongoRepository 基本使用

【Spring】定时任务@Scheduled多线程问题

  • Post author:
  • Post category:其他

SpringBoot使用@scheduled定时执行任务的时候是在一个单线程中,如果有多个任务,其中一个任务执行时间过长,则有可能会导致其他后续任务被阻塞直到该任务执行完成。也就是会造成一些任务无法定时执行的错觉。 可以通过如下代码进行测试: @Scheduled(cron = "0/1 * * * * ? ") public void deleteFile() throws Interrupte…

继续阅读 【Spring】定时任务@Scheduled多线程问题

Py小工具: .sql转JavaBean一步到位

  • Post author:
  • Post category:python

简介我一般数据表结构是用PowerDesigner来建, 建完就需要建Model也即一堆javaBean, 如果没有辅助工具挨个建要累死, 于是用python写了这样一个辅助小工具, 仅需复制下PowerDesigner中Preview中的sql语句, 然后双击下工具就直接生成出所有数据表的javaBean了 源码: https://github.com/shuoGG1239/SqlToXXX 效…

继续阅读 Py小工具: .sql转JavaBean一步到位

php string format,PHP字符串之格式化字符串

  • Post author:
  • Post category:php

如果有一个字符串$str = '99.9';,怎么样使这个字符串变成99.90呢? 我们需要用到PHP的格式化字符串函数sprintf() 函数说明:sprintf(格式, 要转化的字符串) 返回:格式化好的字符串 例子: $str = '99.9'; $result = sprintf('%01.2f', $str); echo $result;//结果显示99.90 解释下,上面例子中的格式 …

继续阅读 php string format,PHP字符串之格式化字符串

python的类class定义及其初始化

  • Post author:
  • Post category:python

定义类,功能,属性 一般类名首字母大写 class Calculator: #名字和价格是属性 name="jisuanqi" price=28 #定义的四个函数是功能 def add(self,x,y): print(self.name)#这里指的是函数的属性-名字 result=x+y print(result) def subtract(self,x,y): print(x-y) def m…

继续阅读 python的类class定义及其初始化

Solidity 常用方法总结

  • Post author:
  • Post category:solidity

block中的方法 blockhash(uint blockNumber)返回(bytes32):给定块的哈希-仅适用于256个最新块,不包括当前块 block.blockhash(uint blockNumber) returns (bytes32):给定块的散列 - 仅适用于256个最近的块 block.coinbase (address):当前块矿工的地址 block.difficulty …

继续阅读 Solidity 常用方法总结

solidity合约入门

  • Post author:
  • Post category:solidity

基本类型 int 用intx和uintx来申明,其中x是一个8-256之间的8的倍数,表示有多少个bit。如int8 ,uint32。比较:<=,<,==,!=,>=,>位运算:&,|,^,~,<<,>>数值运算:加减乘除,%取余,指数。0的0次方等于1type(x).min和type(x).max给出该类型的上下界 溢出会被截断 addre…

继续阅读 solidity合约入门

SpringBoot 中 static 静态工具方法获取配置文件属性值

  • Post author:
  • Post category:java

一、使用 @PostConstruct 注解 1.1、原理 @PostContruct 是Java自带的注解,在方法上加该注解会在项目启动的时候执行该方法,也可以理解为在spring容器初始化的时候执行该方法。 1.2、代码 import org.springframework.beans.factory.annotation.Value; import org.springframework.s…

继续阅读 SpringBoot 中 static 静态工具方法获取配置文件属性值

使用Gson将Object转String出现\u003d 的原因

  • Post author:
  • Post category:java

在使用Gson将Object转json字符串,或者将实体类例如:User转为json的过程中,最终的结果会在值中出现\u003d 出现这个的原因是 Gson gson = new Gson() 造成的 这个时候需要使用 Gson gson = new GsonBuilder().disableHtmlEscaping().create();  实例化一个gson gson.toJson(map) …

继续阅读 使用Gson将Object转String出现\u003d 的原因