parent
b1e15c6adb
commit
3e6851a2d4
@ -0,0 +1,16 @@
|
|||||||
|
package com.xxl.controller;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/")
|
||||||
|
public class IndexController {
|
||||||
|
|
||||||
|
@RequestMapping("")
|
||||||
|
@ResponseBody
|
||||||
|
private String index() {
|
||||||
|
return "hehe";
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.xxl.service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trigger Service
|
||||||
|
* @author xuxueli
|
||||||
|
*/
|
||||||
|
public interface ITriggerService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全站静态化
|
||||||
|
*/
|
||||||
|
public void generateNetHtml();
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
package com.xxl.service.impl;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.xxl.service.ITriggerService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trigger Service
|
||||||
|
* @author xuxueli
|
||||||
|
*/
|
||||||
|
@Service("triggerService")
|
||||||
|
public class TriggerServiceImpl implements ITriggerService {
|
||||||
|
private static transient Logger logger = LoggerFactory.getLogger(TriggerServiceImpl.class);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全站静态化
|
||||||
|
*/
|
||||||
|
public void generateNetHtml() {
|
||||||
|
long start = System.currentTimeMillis();
|
||||||
|
logger.info("全站静态化... start:{}", start);
|
||||||
|
|
||||||
|
|
||||||
|
long end = System.currentTimeMillis();
|
||||||
|
logger.info("全站静态化... end:{}, cost:{}", end, end - start);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
|
||||||
|
xmlns:util="http://www.springframework.org/schema/util"
|
||||||
|
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||||
|
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||||
|
http://www.springframework.org/schema/context
|
||||||
|
http://www.springframework.org/schema/context/spring-context-3.0.xsd
|
||||||
|
http://www.springframework.org/schema/util
|
||||||
|
http://www.springframework.org/schema/util/spring-util.xsd">
|
||||||
|
|
||||||
|
<context:annotation-config />
|
||||||
|
<context:component-scan base-package="com.xxl.service.impl, com.xxl.dao.impl" />
|
||||||
|
|
||||||
|
<bean id="freemarkerConfig" class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
|
||||||
|
<property name="templateLoaderPath" value="/WEB-INF/template/" />
|
||||||
|
<property name="freemarkerSettings">
|
||||||
|
<bean class="org.springframework.beans.factory.config.PropertiesFactoryBean">
|
||||||
|
<property name="location" value="classpath:freemarker.properties" />
|
||||||
|
</bean>
|
||||||
|
</property>
|
||||||
|
<property name="freemarkerVariables">
|
||||||
|
<bean class="org.springframework.beans.factory.config.PropertiesFactoryBean">
|
||||||
|
<property name="location" value="classpath:freemarker.variables.properties" />
|
||||||
|
</bean>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
|
||||||
|
<property name="fileEncoding" value="utf-8" />
|
||||||
|
<property name="locations">
|
||||||
|
<list>
|
||||||
|
<value>classpath*:jdbc.properties</value>
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
</beans>
|
@ -0,0 +1,34 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
|
||||||
|
xmlns:util="http://www.springframework.org/schema/util"
|
||||||
|
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||||
|
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||||
|
http://www.springframework.org/schema/context
|
||||||
|
http://www.springframework.org/schema/context/spring-context-3.0.xsd
|
||||||
|
http://www.springframework.org/schema/util
|
||||||
|
http://www.springframework.org/schema/util/spring-util.xsd">
|
||||||
|
|
||||||
|
<!-- 全站静态化:Job Detail -->
|
||||||
|
<bean id="generateNetHtmlJobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
|
||||||
|
<property name="targetObject" ref="triggerService" />
|
||||||
|
<property name="targetMethod" value="generateNetHtml" />
|
||||||
|
<property name="concurrent" value="false" />
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<!-- 全站静态化:Cron Trigger (quartz-2.x的配置) -->
|
||||||
|
<bean id="generateNetHtmlTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
|
||||||
|
<property name="jobDetail" ref="generateNetHtmlJobDetail" />
|
||||||
|
<property name="cronExpression" value="0 0/5 * * * ? *" />
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<!-- 启动触发器的配置开始 -->
|
||||||
|
<bean name="startQuertz" lazy-init="false" autowire="no" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
|
||||||
|
<property name="triggers">
|
||||||
|
<list>
|
||||||
|
<ref bean="generateNetHtmlTrigger" />
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
</beans>
|
@ -0,0 +1,10 @@
|
|||||||
|
template_update_delay=0
|
||||||
|
default_encoding=UTF-8
|
||||||
|
output_encoding=UTF-8
|
||||||
|
locale=zh_CN
|
||||||
|
number_format=0.##########
|
||||||
|
date_format=yyyy-MM-dd
|
||||||
|
time_format=HH:mm:ss
|
||||||
|
datetime_format=yyyy-MM-dd HH:mm:s
|
||||||
|
classic_compatible=true
|
||||||
|
template_exception_handler=ignore
|
@ -0,0 +1,2 @@
|
|||||||
|
# 静态文件地址
|
||||||
|
static_url=https://www.baidu.com/
|
@ -0,0 +1,4 @@
|
|||||||
|
c3p0.driverClass=com.mysql.jdbc.Driver
|
||||||
|
c3p0.url=jdbc:mysql://localhost:3306/test?Unicode=true&characterEncoding=UTF-8
|
||||||
|
c3p0.user=root
|
||||||
|
c3p0.password=root_pwd
|
@ -0,0 +1,10 @@
|
|||||||
|
log4j.rootLogger=info,console
|
||||||
|
|
||||||
|
log4j.appender.console=org.apache.log4j.ConsoleAppender
|
||||||
|
log4j.appender.console.layout=org.apache.log4j.PatternLayout
|
||||||
|
log4j.appender.console.layout.ConversionPattern=%d - xxl-job-admin - %p [%c] - <%m>%n
|
||||||
|
|
||||||
|
log4j.appender.logFile=org.apache.log4j.DailyRollingFileAppender
|
||||||
|
log4j.appender.logFile.File=${catalina.base}/logs/xxl-job-admin.log
|
||||||
|
log4j.appender.logFile.layout=org.apache.log4j.PatternLayout
|
||||||
|
log4j.appender.logFile.layout.ConversionPattern=%d - xxl-job-admin - %p [%c] - <%m>%n
|
@ -0,0 +1,55 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
|
||||||
|
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
|
||||||
|
id="WebApp_ID" version="2.5">
|
||||||
|
<display-name>xxl-job-admin</display-name>
|
||||||
|
|
||||||
|
<context-param>
|
||||||
|
<param-name>contextConfigLocation</param-name>
|
||||||
|
<param-value>classpath*:applicationcontext-*.xml</param-value>
|
||||||
|
</context-param>
|
||||||
|
|
||||||
|
<listener>
|
||||||
|
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
|
||||||
|
</listener>
|
||||||
|
<listener>
|
||||||
|
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
|
||||||
|
</listener>
|
||||||
|
|
||||||
|
<filter>
|
||||||
|
<filter-name>encodingFilter</filter-name>
|
||||||
|
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
|
||||||
|
<init-param>
|
||||||
|
<param-name>encoding</param-name>
|
||||||
|
<param-value>UTF-8</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>forceEncoding</param-name>
|
||||||
|
<param-value>true</param-value>
|
||||||
|
</init-param>
|
||||||
|
</filter>
|
||||||
|
<filter-mapping>
|
||||||
|
<filter-name>encodingFilter</filter-name>
|
||||||
|
<url-pattern>/*</url-pattern>
|
||||||
|
</filter-mapping>
|
||||||
|
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>springmvc</servlet-name>
|
||||||
|
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
|
||||||
|
<init-param>
|
||||||
|
<param-name>contextConfigLocation</param-name>
|
||||||
|
<param-value>classpath*:springmvc-context.xml</param-value>
|
||||||
|
</init-param>
|
||||||
|
<load-on-startup>1</load-on-startup>
|
||||||
|
</servlet>
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>springmvc</servlet-name>
|
||||||
|
<url-pattern>/</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
|
||||||
|
<welcome-file-list>
|
||||||
|
<welcome-file>index.html</welcome-file>
|
||||||
|
</welcome-file-list>
|
||||||
|
|
||||||
|
</web-app>
|
@ -0,0 +1,16 @@
|
|||||||
|
package com.xxl.controller;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/")
|
||||||
|
public class IndexController {
|
||||||
|
|
||||||
|
@RequestMapping("")
|
||||||
|
@ResponseBody
|
||||||
|
private String index() {
|
||||||
|
return "hehe";
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.xxl.service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trigger Service
|
||||||
|
* @author xuxueli
|
||||||
|
*/
|
||||||
|
public interface ITriggerService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全站静态化
|
||||||
|
*/
|
||||||
|
public void generateNetHtml();
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
package com.xxl.service.impl;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.xxl.service.ITriggerService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trigger Service
|
||||||
|
* @author xuxueli
|
||||||
|
*/
|
||||||
|
@Service("triggerService")
|
||||||
|
public class TriggerServiceImpl implements ITriggerService {
|
||||||
|
private static transient Logger logger = LoggerFactory.getLogger(TriggerServiceImpl.class);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全站静态化
|
||||||
|
*/
|
||||||
|
public void generateNetHtml() {
|
||||||
|
long start = System.currentTimeMillis();
|
||||||
|
logger.info("全站静态化... start:{}", start);
|
||||||
|
|
||||||
|
|
||||||
|
long end = System.currentTimeMillis();
|
||||||
|
logger.info("全站静态化... end:{}, cost:{}", end, end - start);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
|
||||||
|
xmlns:util="http://www.springframework.org/schema/util"
|
||||||
|
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||||
|
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||||
|
http://www.springframework.org/schema/context
|
||||||
|
http://www.springframework.org/schema/context/spring-context-3.0.xsd
|
||||||
|
http://www.springframework.org/schema/util
|
||||||
|
http://www.springframework.org/schema/util/spring-util.xsd">
|
||||||
|
|
||||||
|
<context:annotation-config />
|
||||||
|
<context:component-scan base-package="com.xxl.service.impl, com.xxl.dao.impl" />
|
||||||
|
|
||||||
|
<bean id="freemarkerConfig" class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
|
||||||
|
<property name="templateLoaderPath" value="/WEB-INF/template/" />
|
||||||
|
<property name="freemarkerSettings">
|
||||||
|
<bean class="org.springframework.beans.factory.config.PropertiesFactoryBean">
|
||||||
|
<property name="location" value="classpath:freemarker.properties" />
|
||||||
|
</bean>
|
||||||
|
</property>
|
||||||
|
<property name="freemarkerVariables">
|
||||||
|
<bean class="org.springframework.beans.factory.config.PropertiesFactoryBean">
|
||||||
|
<property name="location" value="classpath:freemarker.variables.properties" />
|
||||||
|
</bean>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
|
||||||
|
<property name="fileEncoding" value="utf-8" />
|
||||||
|
<property name="locations">
|
||||||
|
<list>
|
||||||
|
<value>classpath*:jdbc.properties</value>
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
</beans>
|
@ -0,0 +1,34 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
|
||||||
|
xmlns:util="http://www.springframework.org/schema/util"
|
||||||
|
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||||
|
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||||
|
http://www.springframework.org/schema/context
|
||||||
|
http://www.springframework.org/schema/context/spring-context-3.0.xsd
|
||||||
|
http://www.springframework.org/schema/util
|
||||||
|
http://www.springframework.org/schema/util/spring-util.xsd">
|
||||||
|
|
||||||
|
<!-- 全站静态化:Job Detail -->
|
||||||
|
<bean id="generateNetHtmlJobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
|
||||||
|
<property name="targetObject" ref="triggerService" />
|
||||||
|
<property name="targetMethod" value="generateNetHtml" />
|
||||||
|
<property name="concurrent" value="false" />
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<!-- 全站静态化:Cron Trigger (quartz-2.x的配置) -->
|
||||||
|
<bean id="generateNetHtmlTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
|
||||||
|
<property name="jobDetail" ref="generateNetHtmlJobDetail" />
|
||||||
|
<property name="cronExpression" value="0/3 * * * * ? *" />
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<!-- 启动触发器的配置开始 -->
|
||||||
|
<bean name="startQuertz" lazy-init="false" autowire="no" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
|
||||||
|
<property name="triggers">
|
||||||
|
<list>
|
||||||
|
<ref bean="generateNetHtmlTrigger" />
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
</beans>
|
@ -0,0 +1,10 @@
|
|||||||
|
template_update_delay=0
|
||||||
|
default_encoding=UTF-8
|
||||||
|
output_encoding=UTF-8
|
||||||
|
locale=zh_CN
|
||||||
|
number_format=0.##########
|
||||||
|
date_format=yyyy-MM-dd
|
||||||
|
time_format=HH:mm:ss
|
||||||
|
datetime_format=yyyy-MM-dd HH:mm:s
|
||||||
|
classic_compatible=true
|
||||||
|
template_exception_handler=ignore
|
@ -0,0 +1,2 @@
|
|||||||
|
# 静态文件地址
|
||||||
|
static_url=https://www.baidu.com/
|
@ -0,0 +1,4 @@
|
|||||||
|
c3p0.driverClass=com.mysql.jdbc.Driver
|
||||||
|
c3p0.url=jdbc:mysql://localhost:3306/test?Unicode=true&characterEncoding=UTF-8
|
||||||
|
c3p0.user=root
|
||||||
|
c3p0.password=root_pwd
|
@ -0,0 +1,10 @@
|
|||||||
|
log4j.rootLogger=info,console
|
||||||
|
|
||||||
|
log4j.appender.console=org.apache.log4j.ConsoleAppender
|
||||||
|
log4j.appender.console.layout=org.apache.log4j.PatternLayout
|
||||||
|
log4j.appender.console.layout.ConversionPattern=%d - xxl-job-demo - %p [%c] - <%m>%n
|
||||||
|
|
||||||
|
log4j.appender.logFile=org.apache.log4j.DailyRollingFileAppender
|
||||||
|
log4j.appender.logFile.File=${catalina.base}/logs/xxl-job-demo.log
|
||||||
|
log4j.appender.logFile.layout=org.apache.log4j.PatternLayout
|
||||||
|
log4j.appender.logFile.layout.ConversionPattern=%d - xxl-job-demo - %p [%c] - <%m>%n
|
@ -0,0 +1,55 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
|
||||||
|
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
|
||||||
|
id="WebApp_ID" version="2.5">
|
||||||
|
<display-name>xxl-job-demo</display-name>
|
||||||
|
|
||||||
|
<context-param>
|
||||||
|
<param-name>contextConfigLocation</param-name>
|
||||||
|
<param-value>classpath*:applicationcontext-*.xml</param-value>
|
||||||
|
</context-param>
|
||||||
|
|
||||||
|
<listener>
|
||||||
|
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
|
||||||
|
</listener>
|
||||||
|
<listener>
|
||||||
|
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
|
||||||
|
</listener>
|
||||||
|
|
||||||
|
<filter>
|
||||||
|
<filter-name>encodingFilter</filter-name>
|
||||||
|
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
|
||||||
|
<init-param>
|
||||||
|
<param-name>encoding</param-name>
|
||||||
|
<param-value>UTF-8</param-value>
|
||||||
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>forceEncoding</param-name>
|
||||||
|
<param-value>true</param-value>
|
||||||
|
</init-param>
|
||||||
|
</filter>
|
||||||
|
<filter-mapping>
|
||||||
|
<filter-name>encodingFilter</filter-name>
|
||||||
|
<url-pattern>/*</url-pattern>
|
||||||
|
</filter-mapping>
|
||||||
|
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>springmvc</servlet-name>
|
||||||
|
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
|
||||||
|
<init-param>
|
||||||
|
<param-name>contextConfigLocation</param-name>
|
||||||
|
<param-value>classpath*:springmvc-context.xml</param-value>
|
||||||
|
</init-param>
|
||||||
|
<load-on-startup>1</load-on-startup>
|
||||||
|
</servlet>
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>springmvc</servlet-name>
|
||||||
|
<url-pattern>/</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
|
||||||
|
<welcome-file-list>
|
||||||
|
<welcome-file>index.html</welcome-file>
|
||||||
|
</welcome-file-list>
|
||||||
|
|
||||||
|
</web-app>
|
Loading…
Reference in new issue