springBoot整合Quarzt2.3
首先,你要配置好springboot的配置(在resources下)
我把其改为application.yml
# Tomcat
server:
tomcat:
uri-encoding: UTF-8
max-threads: 1000
min-spare-threads: 30
port: 8080
servlet:
context-path: /xiaobo spring:
profiles:
active: dev
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.jdbc.Driver
filters: stat
maxActive: 20
initialSize: 1
maxWait: 60000
minIdle: 1
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
validationQuery: select 'x'
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
maxOpenPreparedStatements: 20
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
servlet:
multipart:
max-file-size: 100MB
max-request-size: 100MB
enabled: true
freemarker:
suffix: .html
request-context-attribute: request blgg:
redis:
open: false
shiro:
redis: false #mybatis
mybatis-plus:
mapper-locations: classpath:com/blgg/permission/**/**.xml
#实体扫描,多个package用逗号或者分号分隔
typeAliasesPackage: com.blgg.permission.modules.*.entity
global-config:
#主键类型 0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
id-type: 0
#字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断"
field-strategy: 2
#驼峰下划线转换
db-column-underline: true
#刷新mapper 调试神器
refresh-mapper: true
#逻辑删除配置
logic-delete-value: -1
logic-not-delete-value: 0
#自定义填充策略接口实现
#meta-object-handler: com.baomidou.springboot.xxx
#自定义SQL注入器
sql-injector: com.baomidou.mybatisplus.mapper.LogicSqlInjector
configuration:
map-underscore-to-camel-case: true
cache-enabled: false
call-setters-on-nulls: true logging:
config: classpath:logback-spring.xml
application.yml
数据源配置在
spring:
datasource:
name: dev
url: jdbc:mysql://localhost:3306/blgg_permission?useUnicode=true&characterEncoding=utf8
username: root
password: root
application-dev.yml
这里我们先写一个任务类
package com.blgg.permission.modules.job.task; import com.blgg.permission.modules.sys.entity.User;
import com.blgg.permission.modules.sys.service.UserService;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; /**
* ┏┓ ┏┓
* ┏┛┻━━━┛┻┓
* ┃ ┃
* ┃ ━ ┃
* ┃ ┳┛ ┗┳ ┃
* ┃ ┃
* ┃ ┻ ┃
* ┃ ┃
* ┗━┓ ┏━┛
* ┃ ┃神兽保佑
* ┃ ┃代码无BUG!
* ┃ ┗━━━┓
* ┃ ┣┓
* ┃ ┏┛
* ┗┓┓┏━┳┓┏┛
* ┃┫┫ ┃┫┫
* ┗┻┛ ┗┻┛
*
*
* @ClassName TestTask
* @Description
* @Author xiaobo
* @Date 2018/10/16/016 1:18
*/
@Component("testTask")
public class TestTask {
private Logger logger=LoggerFactory.getLogger(getClass()); @Autowired
private UserService userService; public void test1(String params){
logger.info("我是带参数的test方法,正在被执行,参数为:"+params); try{
Thread.sleep(1000L);
}catch (InterruptedException e){
e.printStackTrace();
} User user=userService.selectById(1L);
System.out.println(ToStringBuilder.reflectionToString(user));
} public void test2(){
logger.info("我是不带参数的test1方法,正在被执行!");
} }
TestTask
springBoot整合Quarzt2.3的更多相关文章
- spring-boot整合mybatis(1)
sprig-boot是一个微服务架构,加快了spring工程快速开发,以及简便了配置.接下来开始spring-boot与mybatis的整合. 1.创建一个maven工程命名为spring-boot- ...
- SpringBoot整合Mybatis之项目结构、数据源
已经有好些日子没有总结了,不是变懒了,而是我一直在奋力学习springboot的路上,现在也算是完成了第一阶段的学习,今天给各位总结总结. 之前在网上找过不少关于springboot的教程,都是一些比 ...
- springboot整合mq接收消息队列
继上篇springboot整合mq发送消息队列 本篇主要在上篇基础上进行activiemq消息队列的接收springboot整合mq发送消息队列 第一步:新建marven项目,配置pom文件 < ...
- springboot整合mybaits注解开发
springboot整合mybaits注解开发时,返回json或者map对象时,如果一个字段的value为空,需要更改springboot的配置文件 mybatis: configuration: c ...
- SpringBoot整合Redis、ApachSolr和SpringSession
SpringBoot整合Redis.ApachSolr和SpringSession 一.简介 SpringBoot自从问世以来,以其方便的配置受到了广大开发者的青睐.它提供了各种starter简化很多 ...
- SpringBoot整合ElasticSearch实现多版本的兼容
前言 在上一篇学习SpringBoot中,整合了Mybatis.Druid和PageHelper并实现了多数据源的操作.本篇主要是介绍和使用目前最火的搜索引擎ElastiSearch,并和Spring ...
- SpringBoot整合Kafka和Storm
前言 本篇文章主要介绍的是SpringBoot整合kafka和storm以及在这过程遇到的一些问题和解决方案. kafka和storm的相关知识 如果你对kafka和storm熟悉的话,这一段可以直接 ...
- SpringBoot整合SpringCloud搭建分布式应用
什么是SpringCloud? SpringCloud是一个分布式的整体解决方案.SpringCloud为开发者提供了在分布式系统中快速构建的工具,使用SpringCloud可以快速的启动服务或构建应 ...
- SpringBoot整合RabbitMQ-整合演示
本系列是学习SpringBoot整合RabbitMQ的练手,包含服务安装,RabbitMQ整合SpringBoot2.x,消息可靠性投递实现等三篇博客. 学习路径:https://www.imooc. ...
随机推荐
- [Shell]Bash基本功能:多命令顺序执行与管道符
/*----------------------------------------------------------------------------------------------- @黑 ...
- HTML框架、列表、表格
本章内容一.列表1.有序列表ol <ol> <li></li> </ol>type的值有3个 默认为1(阿拉伯数字), 还有A/a(大小写字母),I/i ...
- (转)JS之——解决IE6、7、8使用JSON.stringify报JSON未定义错误的问题
https://blog.csdn.net/l1028386804/article/details/53439755 在通过JavaScript将对象类型的参数通过JSON.stringify转换成字 ...
- 利用monkey测试android,入门级用户可能遇见的错误及解决办法 【转】
转自[http://blog.csdn.net/zm2714/article/details/7977930] 一.D:\android\android-sdk-windows\tools目录中没有a ...
- 利用ant脚本 自动构建svn增量/全量 系统程序升级包【转】
引文:我们公司是做自己使用产品,迭代更新周期短,每次都花费较多时间和精力打包做增量更新,发现了一篇文章用于 自动构建svn增量/全量 系统程序升级包,收藏之,希望可以通过学习,更加简化我们的工作. 文 ...
- 学JS的心路历程 - JS的Class
没错,你没有看错,虽然前面说JS是原型继承,但在ES6以后新增了class关键字!!! 不过底层实作仍然是以原型继承方式进行,所以基本上算是一个语法糖. 今天我们就来看一下如何使用吧! class 首 ...
- SAP 使用
SAP 提供多种方法查找系统内的事务代码 1. 使用SE11查看存储事物代码的表:TSTC 或者TSTCT TSTC: 存有事务代码,程序名称,屏幕号码等字段 TSTCT: 存有语言代码,事务代码,事 ...
- redis异常Redis:java.util.NoSuchElementException: Unable to validate object at
前两天项目上线的时候遇到了redis的一个问题,在测试环境的时候项目运行正常,项目一上线redis便开始抛异常. redis.clients.jedis.exceptions.JedisConnect ...
- Java NIO Overview
Java NIO Overview Channels and Buffers Selectors Jakob JenkovLast update: 2014-06-23
- 动态代理 JDK动态代理 CGLIB代理
代理模式:代理类和被代理类实现共同的接口(或继承),代理类中存有指向被代理类的索引,实际执行时通过调用代理类的方法.实际执行的是被代理类的方法. 而AOP,是通过动态代理实现的. 一.简单来说: JD ...