This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sh内容: | |
source ~/.bash_profile | |
killall java | |
nohup java -jar /root/springbootdemo/springbootdemo-0.0.1-SNAPSHOT.jar > nohup.log 2>&1 & | |
执行命令 | |
sh /root/sh/restart-springboot.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
setlocal enabledelayedexpansion | |
set port=30056 | |
for /f "tokens=1-5" %%a in ('netstat -ano ^| find ":%port%"') do ( | |
if "%%e%" == "" ( | |
set pid=%%d | |
) else ( | |
set pid=%%e | |
) | |
echo !pid! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
source /etc/profile | |
basedir=`dirname $0` | |
cd $basedir | |
for i in `ls -t *.jar` | |
do | |
#echo $i | |
break | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.data.redis.core.RedisCallback; | |
import org.springframework.data.redis.core.RedisTemplate; | |
import org.springframework.stereotype.Component; | |
import java.util.Objects; | |
@Component("redisHelper") | |
public class RedisHelper { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//1. 开启功能@EnableScheduling | |
//2. 配置线程池 | |
//spring默认(不配置线程池)为单线程,一个任务执行完成才会执行下一个任务。 | |
@Configuration | |
public class TaskConfigure{ | |
@Bean | |
public TaskScheduler taskScheduler(){ | |
ThreadPoolTaskScheduler taskScheduler=new ThreadPoolTaskScheduler(); | |
taskScheduler.setPoolSize(20);//线程池 | |
return taskScheduler; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.alibaba.fastjson.JSON; | |
import com.fasterxml.jackson.databind.JavaType; | |
import com.fasterxml.jackson.databind.ObjectMapper; | |
import java.text.SimpleDateFormat; | |
import java.util.ArrayList; | |
import java.util.Date; | |
import java.util.HashMap; | |
import java.util.Iterator; | |
import java.util.List; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.alibaba.fastjson.JSONObject; | |
import org.apache.commons.httpclient.HttpClient; | |
import org.apache.commons.httpclient.HttpMethod; | |
import org.apache.commons.httpclient.methods.GetMethod; | |
import org.apache.commons.httpclient.methods.PostMethod; | |
import org.apache.http.*; | |
public class HttpClient{ | |
/** | |
* 发送application/json的post请求 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
共三步: | |
1. springboot-maven项目,引入依赖: | |
<dependency> | |
<groupId>com.github.jai-imageio</groupId> | |
<artifactId>jai-imageio-core</artifactId> | |
<version>1.4.0</version> | |
</dependency> | |
<dependency> | |
<groupId>net.java.dev.jna</groupId> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<configuration scan="true" scanPeriod="30 seconds" debug="true"> | |
<property name="LOG_HOME" value="logs"/> | |
<!--获取比info级别高(包括info级别)但除error级别的日志--> | |
<appender name="INFO-LOG" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
<filter class="ch.qos.logback.classic.filter.LevelFilter"> | |
<level>ERROR</level> | |
<onMatch>DENY</onMatch> | |
<onMismatch>ACCEPT</onMismatch> | |
</filter> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.ytkj.abims.common.vo.Result; | |
import lombok.extern.slf4j.Slf4j; | |
import org.springframework.ui.Model; | |
import org.springframework.web.bind.WebDataBinder; | |
import org.springframework.web.bind.annotation.ExceptionHandler; | |
import org.springframework.web.bind.annotation.InitBinder; | |
import org.springframework.web.bind.annotation.ModelAttribute; | |
import org.springframework.web.bind.annotation.RestControllerAdvice; |