Commit d82479d0 authored by Quxl's avatar Quxl

第一次提交

parents
/target/
/.settings/
.classpath
.project
\ No newline at end of file
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.egolm</groupId>
<artifactId>jobs</artifactId>
<version>0.0.1-SNAPSHOT</version>
<description>B2B计划任务</description>
<properties>
<start-class>com.egolm.jobs.JobsApplication</start-class>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.9.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.38</version>
</dependency>
<dependency>
<groupId>com.egolm</groupId>
<artifactId>common</artifactId>
<version>0.0.1-RELEASE</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.1.6</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
</dependency>
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>2.3.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>${start-class}</mainClass>
<layout>ZIP</layout>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>my</id>
<name>my</name>
<url>http://git.egolm.com:9003/nexus/content/groups/public/</url>
</repository>
<repository>
<id>repo1</id>
<name>repo1</name>
<url>http://repo1.maven.org/maven2/</url>
</repository>
<repository>
<id>mvnrepository</id>
<name>mvnrepository</name>
<url>http://mvnrepository.com/</url>
</repository>
</repositories>
</project>
\ No newline at end of file
package cn.ossip.jobs;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.ApplicationContext;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@EnableCaching
@EnableSwagger2
@SpringBootApplication
@EnableTransactionManagement
public class JobsApplication {
private static ApplicationContext applicationContext;
public static void main(String[] args) {
applicationContext = SpringApplication.run(JobsApplication.class, args);
}
public static ApplicationContext getApplicationContext() {
return applicationContext;
}
public static Object getBean(String name){
return getApplicationContext().getBean(name);
}
public static <T> T getBean(Class<T> clazz){
return getApplicationContext().getBean(clazz);
}
public static <T> T getBean(String name, Class<T> clazz){
return getApplicationContext().getBean(name, clazz);
}
}
package cn.ossip.jobs.config;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.view.json.MappingJackson2JsonView;
import com.egolm.common.bean.Rjx;
@Component
public class ExceptionHandler implements HandlerExceptionResolver {
private static final Log logger = LogFactory.getLog(ExceptionHandler.class);
@Override
public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
ModelAndView mav = new ModelAndView(new MappingJackson2JsonView());
try {
response.setContentType("application/json");
if (ex instanceof XException) {
mav.addAllObjects(((XException) ex).getRjx());
} else {
mav.addAllObjects(Rjx.jsonErr().setMessage("未处理异常[" + ex.getClass().getName() + ":" + ex.getMessage() + "]"));
}
} catch (Exception e) {
mav.addAllObjects(Rjx.jsonErr().setMessage("异常处理失败"));
} finally {
logger.error("", ex);
}
return mav;
}
}
package cn.ossip.jobs.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
@Configuration
public class SwaggerConfig {
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.basePackage("com.egolm.jobs"))
.paths(PathSelectors.any())
.build();
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("在线文档")
.description("在线文档")
.termsOfServiceUrl("NO terms of service")
.version("1.0")
.build();
}
}
package cn.ossip.jobs.config;
import java.util.EventListener;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.boot.web.servlet.ServletListenerRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.RequestContextListener;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {
@Override
public void configurePathMatch(PathMatchConfigurer configurer) {
configurer.setUseSuffixPatternMatch(false).setUseTrailingSlashMatch(false);
}
@Bean
public ServletListenerRegistrationBean<EventListener> getDemoListener(){
ServletListenerRegistrationBean<EventListener> registrationBean = new ServletListenerRegistrationBean<>();
registrationBean.setListener(new RequestContextListener());
return registrationBean;
}
public static HttpServletRequest getRequest() {
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
if(servletRequestAttributes != null) {
return servletRequestAttributes.getRequest();
}
return null;
}
public static HttpServletResponse getResponse() {
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
if(servletRequestAttributes != null) {
return servletRequestAttributes.getResponse();
}
return null;
}
public static HttpSession getSession() {
HttpServletRequest request = WebMvcConfig.getRequest();
if(request != null) {
return request.getSession();
}
return null;
}
}
package cn.ossip.jobs.config;
import com.egolm.common.bean.Rjx;
public class XException extends RuntimeException {
private static final long serialVersionUID = 1L;
private Rjx rjx = Rjx.jsonErr().setStatus(500).setMessage("ERROR");
public XException(String msg) {
super(msg);
rjx.setMessage(msg);
}
public XException(String msg, Throwable e) {
super(msg, e);
rjx.setMessage(msg);
}
public XException(String msg, int code) {
super(msg);
rjx.setMessage(msg);
rjx.setStatus(code);
}
public XException(String msg, int code, Throwable e) {
super(msg, e);
rjx.setMessage(msg);
rjx.setStatus(code);
}
public Rjx getRjx() {
return rjx;
}
public static void assertNotBlank(Object obj, String message) {
if(obj == null || obj.toString().trim().equals("")) {
throw new XException((message == null || message.trim().equals("")) ? "对象不能为空" : message);
}
}
}
package cn.ossip.jobs.config.datasource;
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.PlatformTransactionManager;
import com.alibaba.druid.pool.DruidDataSource;
import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.common.jdbc.dialect.MySqlDialect;
@Configuration
public class ScheduleDataSourceConfig {
@Bean
@Qualifier("shopDataSource")
@ConfigurationProperties(prefix = "spring.datasource.schedule")
public DataSource getDataSource() {
return DataSourceBuilder.create().type(DruidDataSource.class).build();
}
@Bean
@Qualifier("shopTxManager")
public PlatformTransactionManager getTransactionManager(@Qualifier("shopDataSource")DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
@Bean
@Qualifier("shopJdbcTemplate")
public JdbcTemplate getJdbcTemplate(@Qualifier("shopDataSource")DataSource dataSource) {
JdbcTemplate jdbcTemplate = new JdbcTemplate();
jdbcTemplate.setDataSource(dataSource);
jdbcTemplate.setDialect(new MySqlDialect());
jdbcTemplate.setSql_level(3);
return jdbcTemplate;
}
}
\ No newline at end of file
package cn.ossip.jobs.config.datasource;
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.PlatformTransactionManager;
import com.alibaba.druid.pool.DruidDataSource;
import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.common.jdbc.dialect.MySqlDialect;
@Configuration
public class ShopDataSourceConfig {
@Bean
@Primary
@Qualifier("shopDataSource")
@ConfigurationProperties(prefix = "spring.datasource.shop")
public DataSource getDataSource() {
return DataSourceBuilder.create().type(DruidDataSource.class).build();
}
@Bean
@Primary
@Qualifier("shopTxManager")
public PlatformTransactionManager getTransactionManager(@Qualifier("shopDataSource")DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
@Bean
@Primary
@Qualifier("shopJdbcTemplate")
public JdbcTemplate getJdbcTemplate(@Qualifier("shopDataSource")DataSource dataSource) {
JdbcTemplate jdbcTemplate = new JdbcTemplate();
jdbcTemplate.setDataSource(dataSource);
jdbcTemplate.setDialect(new MySqlDialect());
jdbcTemplate.setSql_level(3);
return jdbcTemplate;
}
}
\ No newline at end of file
package cn.ossip.jobs.config.schedule;
import java.util.Date;
public class JobCommon {
private String sJobID;
private Integer nRunFlg;
private String sCronExpression;
private Date dRunTime;
private Object data;
public String getsJobID() {
return sJobID;
}
public void setsJobID(String sJobID) {
this.sJobID = sJobID;
}
public Integer getnRunFlg() {
return nRunFlg;
}
public void setnRunFlg(Integer nRunFlg) {
this.nRunFlg = nRunFlg;
}
public String getsCronExpression() {
return sCronExpression;
}
public void setsCronExpression(String sCronExpression) {
this.sCronExpression = sCronExpression;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
public Date getdRunTime() {
return dRunTime;
}
public void setdRunTime(Date dRunTime) {
this.dRunTime = dRunTime;
}
}
package cn.ossip.jobs.config.schedule;
import java.util.Properties;
import javax.sql.DataSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
@Configuration
public class ScheduleConfig {
public static final String JOB_PARAM_KEY = "JOB_PARAM_KEY";
public enum RunFlag {
RUN(1),
PAUSE(0);
private final int value;
private RunFlag(int value) {
this.value = value;
}
public int getValue() {
return value;
}
}
@Bean
public SchedulerFactoryBean schedulerFactoryBean(DataSource dataSource) {
SchedulerFactoryBean factory = new SchedulerFactoryBean();
factory.setDataSource(dataSource);
Properties properties = new Properties();
properties.put("org.quartz.scheduler.instanceName", "SCHEDULER-JX");
properties.put("org.quartz.scheduler.instanceId", "AUTO");
properties.put("org.quartz.threadPool.class", "org.quartz.simpl.SimpleThreadPool");
properties.put("org.quartz.threadPool.threadCount", "20");
properties.put("org.quartz.threadPool.threadPriority", "5");
properties.put("org.quartz.jobStore.class", "org.quartz.impl.jdbcjobstore.JobStoreTX");
properties.put("org.quartz.jobStore.isClustered", "true");
properties.put("org.quartz.jobStore.clusterCheckinInterval", "15000");
properties.put("org.quartz.jobStore.maxMisfiresToHandleAtATime", "1");
properties.put("org.quartz.jobStore.misfireThreshold", "12000");
properties.put("org.quartz.jobStore.tablePrefix", "QRTZ_");
factory.setQuartzProperties(properties);
factory.setSchedulerName("SCHEDULER-JX");
factory.setStartupDelay(30);
factory.setApplicationContextSchedulerContextKey("applicationContext");
factory.setOverwriteExistingJobs(true);
factory.setAutoStartup(true);
return factory;
}
}
package cn.ossip.jobs.config.schedule;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.quartz.QuartzJobBean;
import com.egolm.common.StringUtil;
public class ScheduleJob extends QuartzJobBean {
private static final Logger logger = LoggerFactory.getLogger(ScheduleJob.class);
/**
* 计划任务执行入口
*/
@Override
protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
JobCommon jobCommon = (JobCommon)context.getMergedJobDataMap().get(ScheduleConfig.JOB_PARAM_KEY);
String sJobID = jobCommon.getsJobID();
Object data = jobCommon.getData();
logger.info("Schedule Run, sJobID=" + sJobID + ", data=" + StringUtil.toJson(data));
if(data == null) {
throw new XScheduleException("任务定义实体[data]不能为空");
}
}
}
package cn.ossip.jobs.config.schedule;
import java.util.Date;
import org.quartz.CronScheduleBuilder;
import org.quartz.CronTrigger;
import org.quartz.JobBuilder;
import org.quartz.JobDataMap;
import org.quartz.JobDetail;
import org.quartz.JobKey;
import org.quartz.ScheduleBuilder;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.SimpleScheduleBuilder;
import org.quartz.SimpleTrigger;
import org.quartz.Trigger;
import org.quartz.TriggerBuilder;
import org.quartz.TriggerKey;
import com.egolm.common.StringUtil;
import cn.ossip.jobs.config.schedule.ScheduleConfig.RunFlag;
/**
* Quartz Schedule 工具
* @author Quxl
*
*/
public class ScheduleUtils {
/**
* 任务名称前缀
*/
private final static String JOB_NAME = "TASK_";
/**
* 获取触发器key
* @param jobId jobId
* @return TriggerKey
*/
public static TriggerKey getTriggerKey(String jobId) {
return TriggerKey.triggerKey(JOB_NAME + jobId);
}
/**
* 获取jobKey
* @param jobId jobId
* @return JobKey
*/
public static JobKey getJobKey(String jobId) {
return JobKey.jobKey(JOB_NAME + jobId);
}
/**
* 获取表达式触发器
* @param scheduler scheduler
* @param jobId jobId
* @return CronTrigger
*/
public static Trigger getTrigger(Scheduler scheduler, String jobId) {
try {
return scheduler.getTrigger(getTriggerKey(jobId));
} catch (SchedulerException e) {
throw new XScheduleException("获取定时任务CronTrigger出现异常", e);
}
}
/**
* 创建定时任务
* @param scheduler scheduler
* @param jobCommon scheduleJob
*/
public static void createScheduleJob(Scheduler scheduler, JobCommon jobCommon) {
try {
String sJobID = jobCommon.getsJobID();
String sCronExpression = jobCommon.getsCronExpression();
Date dRunTime = jobCommon.getdRunTime();
Integer nRunFlg = jobCommon.getnRunFlg();
TriggerKey triggerKey = getTriggerKey(sJobID);
JobKey jobKey = getJobKey(sJobID);
Trigger trigger = null;
if(StringUtil.isNotBlank(sCronExpression)) {
trigger = TriggerBuilder.newTrigger().withIdentity(triggerKey).withSchedule(CronScheduleBuilder.cronSchedule(sCronExpression).withMisfireHandlingInstructionDoNothing()).build();
} else if(dRunTime != null) {
trigger = TriggerBuilder.newTrigger().withIdentity(triggerKey).withSchedule(SimpleScheduleBuilder.simpleSchedule().withIntervalInSeconds(3).withRepeatCount(0)).startAt(dRunTime).build();
} else {
throw new XScheduleException("创建触发器缺少必要条件(sCronExpression或dRunTime)");
}
JobDetail jobDetail = JobBuilder.newJob(ScheduleJob.class).withIdentity(jobKey).build();
jobDetail.getJobDataMap().put(ScheduleConfig.JOB_PARAM_KEY, jobCommon);
scheduler.scheduleJob(jobDetail, trigger);
if (nRunFlg == RunFlag.PAUSE.getValue()) {
pauseJob(scheduler, sJobID);
}
} catch (SchedulerException e) {
throw new XScheduleException("创建定时任务失败", e);
}
}
/**
* 更新定时任务
* @param scheduler scheduler
* @param jobCommon scheduleJob
*/
public static void updateScheduleJob(Scheduler scheduler, JobCommon jobCommon) {
try {
String sJobID = jobCommon.getsJobID();
String sCronExpression = jobCommon.getsCronExpression();
Date dRunTime = jobCommon.getdRunTime();
Integer nRunFlg = jobCommon.getnRunFlg();
TriggerKey triggerKey = getTriggerKey(sJobID);
Trigger trigger = getTrigger(scheduler, jobCommon.getsJobID());
if(StringUtil.isNotBlank(sCronExpression)) {
ScheduleBuilder<CronTrigger> scheduleBuilder = CronScheduleBuilder.cronSchedule(sCronExpression).withMisfireHandlingInstructionDoNothing();
trigger = ((CronTrigger)trigger).getTriggerBuilder().withIdentity(triggerKey).withSchedule(scheduleBuilder).build();
} else if(dRunTime != null) {
ScheduleBuilder<SimpleTrigger> scheduleBuilder = SimpleScheduleBuilder.simpleSchedule().withIntervalInSeconds(3).withRepeatCount(0);
trigger = ((SimpleTrigger)trigger).getTriggerBuilder().withIdentity(triggerKey).withSchedule(scheduleBuilder).build();
} else {
throw new XScheduleException("创建触发器缺少必要条件(sCronExpression或dRunTime)");
}
trigger.getJobDataMap().put(ScheduleConfig.JOB_PARAM_KEY, jobCommon);
scheduler.rescheduleJob(triggerKey, trigger);
if (nRunFlg == RunFlag.PAUSE.getValue()) {
pauseJob(scheduler, sJobID);
}
} catch (SchedulerException e) {
throw new XScheduleException("更新定时任务失败", e);
}
}
/**
* 立即执行任务
* @param scheduler scheduler
* @param jobCommon scheduleJob
*/
public static void run(Scheduler scheduler, JobCommon jobCommon) {
try {
JobDataMap dataMap = new JobDataMap();
dataMap.put(ScheduleConfig.JOB_PARAM_KEY, jobCommon);
scheduler.triggerJob(getJobKey(jobCommon.getsJobID()), dataMap);
} catch (SchedulerException e) {
throw new XScheduleException("立即执行定时任务失败", e);
}
}
/**
* 暂停任务
* @param scheduler scheduler
* @param jobId jobId
*/
public static void pauseJob(Scheduler scheduler, String jobId) {
try {
scheduler.pauseJob(getJobKey(jobId));
} catch (SchedulerException e) {
throw new XScheduleException("暂停定时任务失败", e);
}
}
/**
* 恢复任务
* @param scheduler scheduler
* @param jobId jobId
*/
public static void resumeJob(Scheduler scheduler, String jobId) {
try {
scheduler.resumeJob(getJobKey(jobId));
} catch (SchedulerException e) {
throw new XScheduleException("暂停定时任务失败", e);
}
}
/**
* 删除定时任务
* @param scheduler scheduler
* @param jobId jobId
*/
public static void deleteScheduleJob(Scheduler scheduler, String jobId) {
try {
scheduler.deleteJob(getJobKey(jobId));
} catch (SchedulerException e) {
throw new XScheduleException("删除定时任务失败", e);
}
}
}
package cn.ossip.jobs.config.schedule;
import cn.ossip.jobs.config.XException;
public class XScheduleException extends XException {
private static final long serialVersionUID = 1L;
public XScheduleException(String msg, Throwable e) {
super(msg, 500, e);
}
public XScheduleException(String msg) {
super(msg, 500);
}
}
server.tomcat.max-threads=1000
server.tomcat.min-spare-threads=30
server.port=8088
server.context-path=/
server.session.timeout=90000
server.tomcat.uri-encoding=utf-8
spring.http.multipart.maxFileSize=5MB
spring.http.multipart.maxRequestSize=5MB
spring.http.encoding.force=true
spring.http.encoding.enabled=true
spring.http.encoding.charset=utf-8
spring.datasource.schedule.url=jdbc:mysql://10.10.0.20:3306/msgcenter?useSSL=false
spring.datasource.schedule.username=root
spring.datasource.schedule.password=egolm2018
spring.datasource.schedule.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.schedule.testWhileIdle=true
spring.datasource.schedule.validationQuery=SELECT 1
spring.datasource.schedule.timeBetweenEvictionRunsMillis=3600000
spring.datasource.shop.username=sa
spring.datasource.shop.password=qiyang
spring.datasource.shop.url=jdbc:sqlserver://10.10.0.51:56443;instanceName=SQLSERVER;DatabaseName=EGOLMSAAS
spring.datasource.shop.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.datasource.shop.testWhileIdle=true
spring.datasource.shop.validationQuery=SELECT 1
spring.datasource.shop.timeBetweenEvictionRunsMillis=3600000
\ No newline at end of file
server.tomcat.max-threads=1000
server.tomcat.min-spare-threads=30
server.port=8088
server.context-path=/
server.session.timeout=90000
server.tomcat.uri-encoding=utf-8
spring.http.multipart.maxFileSize=5MB
spring.http.multipart.maxRequestSize=5MB
spring.http.encoding.force=true
spring.http.encoding.enabled=true
spring.http.encoding.charset=utf-8
spring.datasource.schedule.url=jdbc:mysql://10.10.0.20:3306/msgcenter?useSSL=false
spring.datasource.schedule.username=root
spring.datasource.schedule.password=egolm2018
spring.datasource.schedule.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.schedule.testWhileIdle=true
spring.datasource.schedule.validationQuery=SELECT 1
spring.datasource.schedule.timeBetweenEvictionRunsMillis=3600000
spring.datasource.shop.username=sa
spring.datasource.shop.password=qiyang
spring.datasource.shop.url=jdbc:sqlserver://10.10.0.51:56443;instanceName=SQLSERVER;DatabaseName=EGOLMSAAS
spring.datasource.shop.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.datasource.shop.testWhileIdle=true
spring.datasource.shop.validationQuery=SELECT 1
spring.datasource.shop.timeBetweenEvictionRunsMillis=3600000
\ No newline at end of file
server.tomcat.max-threads=1000
server.tomcat.min-spare-threads=30
server.port=8088
server.context-path=/
server.session.timeout=90000
server.tomcat.uri-encoding=utf-8
spring.http.multipart.maxFileSize=5MB
spring.http.multipart.maxRequestSize=5MB
spring.http.encoding.force=true
spring.http.encoding.enabled=true
spring.http.encoding.charset=utf-8
spring.datasource.schedule.url=jdbc:mysql://10.10.0.20:3306/msgcenter?useSSL=false
spring.datasource.schedule.username=root
spring.datasource.schedule.password=egolm2018
spring.datasource.schedule.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.schedule.testWhileIdle=true
spring.datasource.schedule.validationQuery=SELECT 1
spring.datasource.schedule.timeBetweenEvictionRunsMillis=3600000
spring.datasource.shop.username=sa
spring.datasource.shop.password=qiyang
spring.datasource.shop.url=jdbc:sqlserver://10.10.0.51:56443;instanceName=SQLSERVER;DatabaseName=EGOLMSAAS
spring.datasource.shop.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.datasource.shop.testWhileIdle=true
spring.datasource.shop.validationQuery=SELECT 1
spring.datasource.shop.timeBetweenEvictionRunsMillis=3600000
\ No newline at end of file
spring.profiles.active=dev
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd"
updateCheck="false">
<defaultCache
eternal="false"
maxElementsInMemory="1000"
overflowToDisk="false"
diskPersistent="false"
timeToIdleSeconds="0"
timeToLiveSeconds="600"
memoryStoreEvictionPolicy="LRU" />
</ehcache>
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<property name="LOG_BASE_PATH" value="/data/logs/jobs" />
<include resource="org/springframework/boot/logging/logback/base.xml" />
<logger name="org" level="INFO" />
<logger name="com" level="INFO" />
<logger name="com.egolm" level="DEBUG" />
<appender name="siftingAppender" class="ch.qos.logback.classic.sift.SiftingAppender">
<discriminator>
<key>CTX_PATH</key>
<DefaultValue>jobs</DefaultValue>
</discriminator>
<sift>
<appender name="rollingFileAppender"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<FileNamePattern>${LOG_BASE_PATH}/${CTX_PATH}-%d{yyyy-MM-dd}.log</FileNamePattern>
<MaxHistory>30</MaxHistory>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
</encoder>
</appender>
</sift>
</appender>
<root level="INFO">
<appender-ref ref="siftingAppender" />
</root>
</configuration>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment