在springcloudconfig的集群项目中,内网的服务器不能访问外网,搭建一个外网代理服务器,内网下的项目需要找云服务器上的配置文件时可能会出现寻找配置文件时出不了外网的情况。这时需要在项目中配置http的正向代理。
View Details编译Spigotmc服务端时,由于网络原因总是失败,git和shell也均配置了代理,实际编译过程中还是遇到各种网络问题报错,如:java.net.SocketTimeoutException: Connect timed out之类的,怀疑是BuildTools.jar包执行过程中并没有走代理导致,因此尝试给jar包指定代理。亲测可用,jar包也走了代理,所有网络访问畅通无阻。 命令:
1 |
java -Dhttp.proxyHost={IP} -Dhttp.proxyPort={PORT} -Dhttps.proxyHost={IP} -Dhttps.proxyPort={PORT} -jar BuildTools.jar |
例如:
1 |
java -Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=1081 -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=1081 -jar BuildTools.jar |
from:https://xuchaoji.com/index.php/archives/290/
View Details目标
创建Web项目的目录结构
可以启动Tomcat服务器
编写Servlet并访问成功
问题
IDEA社区版没有创建Web工程的选项
IDEA社区版没有Tomcat插件
由于在项目中经常需要使用到Java的对象拷贝和属性复制,如DTO、VO和数据库Entity之间的转换,因此本文对需要用到的相关方法、工具类做一个汇总,包括浅拷贝和深拷贝,方便在需要用到时作为参考。
View DetailsQueryWrapper queryWrapper = new QueryWrapper<>(); 查询指定字段 通过select()查询指定字段,同时可对字段进行Mysql函数处理
1 |
queryWrapper.select("service_code as serviceCode", "sum(num) as num"); |
设置limit 通过last(),效果等同于limit
1 |
queryWrapper.last("limit 0,5"); |
查询条件中使用函数 例如,在查询IP时,想使用INET_ATON()函数,可以使用apply()实现
1 2 |
queryWrapper.apply("INET_ATON(qsip) <= INET_ATON({0})", ipQuery); queryWrapper.apply("INET_ATON(zzip) >= INET_ATON({0})", ipQuery); |
from:https://blog.csdn.net/qq_42594278/article/details/106625280
View Details博主在最近的开发中又遇到了关于定时调度的开发任务,在定时调度其实有很多的第三方平台可以接入,但是其实在SpringBoot有自带的定时任务注解@Scheduled。@Scheduled可以通过注解配置快速实现方法的定时调度,直接在方法加上@Scheduled注解即可。 一.@Scheduled注解参数 1.cron参数 这个参数是最经常使用的参数,表示接收一个cron参数,cron它是一个表达式,最多接收7个参数,从左到右分别表示:秒 分 时 天 月 周 年;参数以空格隔开,其中年不是必须参数,可以省略。
1 2 3 4 5 6 7 8 |
/** * cron 一共可以有7个参数 以空格分开 其中年不是必须参数 * [秒] [分] [小时] [日] [月] [周] [年] * 一下表示 */ @Scheduled(cron ="0 0 0 * * * ?") public void testScheduledCron(){ } |
注意!!! 在使用时需要在类上添加注解@EnableScheduling,表示开启定时任务。 cron参数意义: 序号 含义 是否必填 入参范围 可填通配符 1 秒 是 0-59 , – * / 2 分 是 0-59 , – * / 3 时 是 0-23 , – * / 4 日 是 1-31 , – * ? / L W 5 月 是 1-12 , – * / 6 周(周一 ~ 周日) 是 1-7 , – * ? / L # 8 年 否 1970-2099 , – * / 常用通配符: *:表示所有值 比如用在日 表示每一天。 ?:表示不指定值 比如周配置 […]
View Details1.单表查询
1 2 3 4 5 6 7 8 9 |
@GetMapping("/list") public TableDataInfo list(Student student){ LambdaQueryWrapper<Student> lqw = new LambdaQueryWrapper<Student>(); lqw.eq(Student::getName, student.getName()); lqw.like(Student::getClass,student.getClass()); lqw.between("age",student.getAge1(),student.getAge2()); lqw.orderByAsc("age"); List<Student> list = studentService.list(lqw); } |
对应的sql语句为:
1 |
select * from student where name = '?' and class like '%?%' and age between '?' and '?' order by '?' asc |
1.1、单表查询的基本用法 函数名 说明 例子 eq 等于 例:eq(“name”,“张子”) ===> name = ‘张子’ ne 不等于 例:ne(“name”,“张子”) ===> name <> ‘张子’ gt 大于 例:gt(“age”,“18”) ===> age>18 lt 小于 例:lt(“age”,“18”) ===> age<18 between 在值1到值2之间 例:between(“age”,18,30) ===> 18<age<30’ like 模糊查询 例:like(“name”,“张”) ===> name like ‘%张%’ isNull 字段为NULL 例:isNull(“name”) ===> name is null 2、多表查询
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
//Controller @GetMapping("/listAndClass") public TableDataInfo listAndClass(Student student) { QueryWrapper<Student > qw = new QueryWrapper<Student >(); if(StringUtils.isNotBlank(student.getName())){ qw.eq("s.name",student.getName()); } if(StringUtils.isNotBlank(student.getClassName())){ qw.like("c.name",student.getClassName()); } startPage(); List<Student > list = studentService.listAndClass(qw); return getDataTable(list); } //Service List<Student> listAndClass(QueryWrapper<Student> qw); //Service impl @Override public List<Student> listAndClass(QueryWrapper<Student> qw) { return this.getBaseMapper().listAndClass(qw); } //Mapper @Select("select s.*,c.name from student s left join class c on s.id = c.student_id "+ "${ew.customSqlSegment}") List<YwSpaqjgDj> listAndClass(@Param(Constants.WRAPPER) QueryWrapper<Student> qw); |
from:https://www.cnblogs.com/gongss/p/16727090.html
View Details//SerializerFeature.WriteDateUseDateFormat 使用日期字段格式序列化(2017-01-01),而不是用时间戳表示日期 JSON.toJSONString(data, SerializerFeature.WriteDateUseDateFormat)); from:https://www.cnblogs.com/gossip/p/6963957.html
View Details1. 单独仓库配置 打开Maven配置文件 apache-maven-3.6.3\conf\settings.xml 在<mirrors></mirrors>标签里新增一个mirror配置即可。
1 2 3 4 5 6 7 8 |
<mirrors> <mirror> <id>aliyun</id> <name>aliyun maven</name> <url>http://maven.aliyun.com/nexus/content/groups/public/</url> <mirrorOf>central</mirrorOf> </mirror> </mirrors> |
标签 作用 id 镜像的唯一标识 name 名称描述 url 地址 mirrorOf 指定镜像规则,什么情况下从镜像仓库拉取 mirrorOf规则 作用 * 匹配所有,所有内容都从镜像拉取 external:* 除了本地缓存的所有从镜像仓库拉取 central 覆盖默认的仓库 repo1,repo2 匹配仓库repo1和repo2,使用逗号分割多个远程仓库 比如:镜像配置的规则 <mirrorOf>repo1</mirrorOf>,意为:匹配到目标仓库 <id>repo1</id>; 所以maven认为目标仓库central被镜像了; 不再去 https://repo.maven.apache.org/maven2/ 地址下载jar包; 而是去镜像仓库 http://maven.aliyun.com/nexus/content/groups/public/ 下载jar包。 2. 多仓库配置 有时候我们需要的jar包公有仓库没有,此时就必须启用多仓库配置,使maven同时使用私有仓库和公有仓库。 在<profiles></profiles>标签里配置多个profile配置。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
<profiles> <profile> <id>aliyun-repo</id> <repositories> <repository> <id>aliyun</id> <url>http://maven.aliyun.com/nexus/content/groups/public/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> <updatePolicy>always</updatePolicy> </snapshots> </repository> </repositories> </profile> <profile> <id>jboss-repo</id> <repositories> <repository> <id>jboss</id> <url>http://repository.jboss.org/nexus/content/groups/public/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> <updatePolicy>always</updatePolicy> </snapshots> </repository> </repositories> </profile> <profile> <id>maven-repo</id> <repositories> <repository> <id>maven2</id> <url>http://central.maven.org/maven2/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> <updatePolicy>always</updatePolicy> </snapshots> </repository> </repositories> </profile> <profiles> |
在<activeProfiles></activeProfiles>标签里使用<activeProfile></activeProfile>标签启用配置。
1 2 3 4 5 |
<activeProfiles> <activeProfile>aliyun-repo</activeProfile> <activeProfile>jboss-repo</activeProfile> <activeProfile>maven-repo</activeProfile> </activeProfiles> |
from:https://www.aliang.link/pages/df2aeb/#_2-%E5%A4%9A%E4%BB%93%E5%BA%93%E9%85%8D%E7%BD%AE
View Details问题:安装java出现内部错误61003,安装成功输入java -version提示无法打开dll文件
原因:没有装visual c++2015 redistributable
解决方案 下载并安装该插件
安装 visual c++2015 redistributable
链接 https://www.microsoft.com/en-us/download/details.aspx?id=48145
View Details