基於spring-boot 2.x + quartz 的CRUD任務管理系統,適用於中小項目。html
基於spring-boot +quartz 的CRUD任務管理系統:vue
https://gitee.com/52itstyle/spring-boot-quartzjava
JDK1.八、Maven、Eclipsemysql
SpringBoot2.0.一、thymeleaf3.0.九、quartz2.3.0、iview、vue、layer、AdminLTE、bootstrapgit
項目源碼: https://gitee.com/52itstyle/spring-boot-taskspring
這裏只是針對這兩個項目異同作比較,固然spring-boot 2.x版本升級還有很多須要注意的地方。sql
項目名稱配置:數據庫
# spring boot 1.x
server.context-path=/quartz
# spring boot 2.x
server.servlet.context-path=/quartz
複製代碼
thymeleaf配置:bootstrap
#spring boot 1.x
spring.thymeleaf.mode=LEGACYHTML5
#spring boot 2.x
spring.thymeleaf.mode=HTML
複製代碼
Hibernate配置:bash
# spring boot 2.x JPA 依賴 Hibernate 5
# Hibernate 4 naming strategy fully qualified name. Not supported with Hibernate 5.
spring.jpa.hibernate.naming.strategy = org.hibernate.cfg.ImprovedNamingStrategy
# stripped before adding them to the entity manager)
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
# Hibernate 5
spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
複製代碼
quartz配置:
# spring boot 2.x 已集成Quartz,無需本身配置
spring.quartz.job-store-type=jdbc
spring.quartz.properties.org.quartz.scheduler.instanceName=clusteredScheduler
spring.quartz.properties.org.quartz.scheduler.instanceId=AUTO
spring.quartz.properties.org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX
spring.quartz.properties.org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.StdJDBCDelegate
spring.quartz.properties.org.quartz.jobStore.tablePrefix=QRTZ_
spring.quartz.properties.org.quartz.jobStore.isClustered=true
spring.quartz.properties.org.quartz.jobStore.clusterCheckinInterval=10000
spring.quartz.properties.org.quartz.jobStore.useProperties=false
spring.quartz.properties.org.quartz.threadPool.class=org.quartz.simpl.SimpleThreadPool
spring.quartz.properties.org.quartz.threadPool.threadCount=10
spring.quartz.properties.org.quartz.threadPool.threadPriority=5
spring.quartz.properties.org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread=true
複製代碼
默認首頁配置:
/** * 配置首頁 spring boot 1.x * 建立者 小柒2012 * 建立時間 2017年9月7日 */
@Configuration
public class MyAdapter extends WebMvcConfigurerAdapter{
@Override
public void addViewControllers( ViewControllerRegistry registry ) {
registry.addViewController( "/" ).setViewName( "forward:/login.shtml" );
registry.setOrder( Ordered.HIGHEST_PRECEDENCE );
super.addViewControllers( registry );
}
}
複製代碼
/** * 配置首頁(在SpringBoot2.0及Spring 5.0 WebMvcConfigurerAdapter以被廢棄 * 建議實現WebMvcConfigurer接口) * 建立者 小柒2012 * 建立時間 2018年4月10日 */
@Configuration
public class MyAdapter implements WebMvcConfigurer{
@Override
public void addViewControllers( ViewControllerRegistry registry ) {
registry.addViewController( "/" ).setViewName( "forward:/login.shtml" );
registry.setOrder( Ordered.HIGHEST_PRECEDENCE );
}
}
複製代碼
待解決問題:
/** * Set a strategy for handling the query results. This can be used to change * "shape" of the query result. * * @param transformer The transformer to apply * * @return this (for method chaining) * * @deprecated (since 5.2) * @todo develop a new approach to result transformers */
@Deprecated
Query<R> setResultTransformer(ResultTransformer transformer);
複製代碼
hibernate 5.2 廢棄了 setResultTransformer,說是要開發一種新的獲取集合方法,顯然目前還沒實現,處於TODO狀態。
項目源碼: https://gitee.com/52itstyle/spring-boot-task