在springcloudconfig的集群项目中,内网的服务器不能访问外网,搭建一个外网代理服务器,内网下的项目需要找云服务器上的配置文件时可能会出现寻找配置文件时出不了外网的情况。这时需要在项目中配置http的正向代理。
View Details1.配置代理
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
#打开profile文件 vim /etc/profile #添加Proxy代理信息(其中username和password根据需要填写,若无则不填写) http_proxy = http://username:password@proxy_ip:port/ https_proxy = http://username:password@proxy_ip:port/ ftp_proxy = http://username:password@proxy_ip:port/ export http_proxy export https_proxy export ftp_proxy #生效配置 source /etc/profile |
2.yum代理
1 2 3 4 |
#打开yum.conf文件 vim /etc/yum.conf #添加Proxy代理信息 proxy = http://username:password@proxy_ip:port/ |
3.wget代理
1 2 3 4 5 6 |
#打开/wgetrc文件 vim /etc/wgetrc #修改Proxy代理信息 http_proxy=http://username:password@proxy_ip:port/ ftp_proxy=http://username:password@proxy_ip:port/ |
https://blog.51cto.com/u_13950323/2431427
View Details一.下载squid for windows 下载地址: http://www.acmeconsulting.it/SquidNT.html https://www.jb51.net/softs/43599.html 二.Windows下安装squid与配置 1.解压squid-2.6.STABLE6-NT-bin.zip到C:\squid 2.单击[开始],选择“运行”,输入 cmd ,在命令提示符窗口内输入以下命令: C:\>cd c:\squid\etc C:\squid\etc>copy squid.conf.default squid.conf **将Squid的默认配置文件复制一份并起名为squid.conf C:\squid\etc>copy mime.conf.default mime.conf **将mime.conf.default复制一份并起名为mime.conf 3.编辑squid.conf,根据需要添加和修改以下内容 http_port 3128 ;定义squid监听端口 visible_hostname tianwei-itrus :定义机器名 cache_mem 64 MB ;定义代理服务器缓存 acl all src 0.0.0.0/0.0.0.0 acl manager proto cache_object acl localhost src 127.0.0.1/255.255.255.255 :定义本地网络为localhost acl outnetwork 192.168.10.0/255.255.255.0 acl SSL_ports port 443 acl Safe_ports port 80 # 定义http端口 acl Safe_ports port 21 # 定义ftp端口 acl Safe_ports port 443 # https acl Safe_ports port 70 # gopher acl Safe_ports port 210 # wais acl Safe_ports port 1025-65535 # unregistered […]
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 Details1. Docker命令行 Docker官方为了让用户快速了解Docker,提供了一个交互式教程,旨在帮助用户掌握Docker命令行的使用方法。但是由于Docker技术的快速发展,此交互式教程已经无法满足Docker用户的实际使用需求,所以让我们一起开始一次真正的命令行学习之旅。首先,Docker的命令清单可以通过运行 docker ,或者 docker help 命令得到: $ sudo docker 在Docker容器技术不断演化的过程中,Docker的子命令已经达到34个之多,其中核心子命令(例如:run)还会有复杂的参数配置。笔者通过结合功能和应用场景方面的考虑,把命令行划分为4个部分,方便我们快速概览Docker命令行的组成结构: 功能划分 命令 环境信息相关 info version 系统运维相关 attach build commit cp diff export images import / save / load inspect kill port pause / unpause ps rm rmi run start / stop / restart tag top wait 日志信息相关 events history logs Docker Hub服务相关 login pull / push search 1.1 参数约定 单个字符的参数可以放在一起组合配置,例如
1 |
docker run -t -i --name test busybox sh |
可以用这样的方式等同:
1 |
docker run -ti --name test busybox sh |
1.2 Boolean Boolean参数形式如: -d=false。注意,当你声明这个Boolean参数时,比如 docker run -d=true,它将直接把启动的Container挂起放在后台运行。 1.3 字符串和数字 参数如 --name=“” 定义一个字符串,它仅能被定义一次。同类型的如-c=0 定义一个数字,它也只能被定义一次。 1.4 后台进程 Docker后台进程是一个常驻后台的系统进程,值得注意的是Docker使用同一个文件来支持客户端和后台进程,其中角色切换通过-d来实现。这个后台进程是用来管理容器的,使用Docker --help可以得到更详细的功能参数配置, 如下图: Docker后台进程参数清单如下表: 参数 解释 --api-enable-cors=false 开放远程API调用的 CORS 头信息。这个接口开关对想进行二次开发的上层应用提供了支持。 -b, --bridge="" 挂载已经存在的网桥设备到 […]
View Details目标
创建Web项目的目录结构
可以启动Tomcat服务器
编写Servlet并访问成功
问题
IDEA社区版没有创建Web工程的选项
IDEA社区版没有Tomcat插件
由于在项目中经常需要使用到Java的对象拷贝和属性复制,如DTO、VO和数据库Entity之间的转换,因此本文对需要用到的相关方法、工具类做一个汇总,包括浅拷贝和深拷贝,方便在需要用到时作为参考。
View Details我的站点在443和80端口下都有部署,这样访问站点使用http和https时都可以访问到站点,但是使用http访问的站点一直会有不安全提示,这个体验很不好,就需要我们做一点工作让它自动跳转到有证书的https站点下面。 本文以站点https://www.huibenit.com为例说明怎么设置,服务器操作系统:windows2012 R2, IIS8.5 首先要做的准备是下载微软IIS下的一个Url重写模块 url-rewrite;下载地址:http://www.iis.net/downloads/microsoft/url-rewrite,目前的版本是2.1支持IIS7和IIS8。下载好后一路默认下一步安装完。 下面就开始介绍如何配置: (1)在运行里输入inetmgr打开IIS站点管理窗口,然后选择你需要设置的站点,找到Url 重写(Url rewrite)如下图所示: (2)双击“Url 重写”模块进入设置窗口,然后在右上角找到添加规则按钮,点击后如下图,再选择“空白规则”。 (3)规则设置如下: 名称:HTTPS跳转 条件:{HTTPS} 模式:off 操作类型选择:重定向 重定向URL:https://{HTTP_HOST}/{R:1} (4)最后填写完成后请点击右上角的应用(此步最重要)。 其实上面的设置过程只是一个图形操作窗口,最后填写的内容会保存在Web.Config中。我们也是可以通过修改web.config来实现上面的填写过程。 我把完整的Web.config粘贴出来如下:
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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
<?xml version="1.0" encoding="utf-8"?> <!-- For more information on how to configure your ASP.NET application, please visit https://go.microsoft.com/fwlink/?LinkId=301880 --> <configuration> <appSettings> <add key="webpages:Version" value="3.0.0.0" /> <add key="webpages:Enabled" value="false" /> <add key="ClientValidationEnabled" value="true" /> <add key="UnobtrusiveJavaScriptEnabled" value="true" /> </appSettings> <system.web> <compilation targetFramework="4.6.1" /> <httpRuntime targetFramework="4.6.1" /> <httpModules> <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" /> </httpModules> </system.web> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" /> <bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" /> <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" /> <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" /> <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" /> <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" /> <bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Runtime.InteropServices.RuntimeInformation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> </dependentAssembly> </assemblyBinding> </runtime> <system.webServer> <validation validateIntegratedModeConfiguration="false" /> <modules> <remove name="ApplicationInsightsWebTracking" /> <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" /> </modules> <rewrite> <rules> <rule name="HTTPS跳转" stopProcessing="true"> <match url="(.*)" /> <conditions> <add input="{HTTPS}" pattern="off" /> </conditions> <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" /> </rule> </rules> </rewrite> </system.webServer> <system.codedom> <compilers> <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701" /> <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+" /> </compilers> </system.codedom> </configuration> |
是不是很简单?只需要添加节:
1 2 3 4 5 6 7 8 9 10 11 |
<rewrite> <rules> <rule name="HTTPS跳转" stopProcessing="true"> <match url="(.*)" /> <conditions> <add input="{HTTPS}" pattern="off" /> </conditions> <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" /> </rule> </rules> </rewrite> |
from:https://lebang2020.cn/details/210106t51nqtom.html
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 Details