Skip to content

Commit

Permalink
update jfinal and beetl version
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangbiao committed Oct 30, 2019
1 parent 2bd2906 commit f128a0d
Show file tree
Hide file tree
Showing 6 changed files with 328 additions and 224 deletions.
6 changes: 6 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
Change Log 更新说明
------------------------------
## 2019-06-15 jfinal cms5.1.0
1. jfinal升级为最新版本4.7
2. beetl升级为最新版本2.9.6
3. mysql驱动升级为8.0
4. 将c3p0连接池改为druid

## 2019-06-15 jfinal cms5.0.1
1. 修复新版本启动兼容问题
2. 加入idea启动文档
Expand Down
64 changes: 37 additions & 27 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,43 @@
<groupId>com.jflyfox</groupId>
<artifactId>jfinal_cms</artifactId>
<packaging>war</packaging>
<version>5.0.1</version>
<version>5.1.0</version>

<properties>
<!-- 文件拷贝时的编码 -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<!-- 编译时的编码 -->
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
<!-- 阿里连接池 -->
<druid.version>1.1.20</druid.version>
<!-- jfinal -->
<jfinal.version>4.7</jfinal.version>
<!-- mysql -->
<mysql.version>8.0.18</mysql.version>
<!-- beetl -->
<beetl.version>3.0.13.RELEASE</beetl.version>
<!-- fastjson -->
<fastjson.version>1.2.62</fastjson.version>
</properties>

<dependencies>
<dependency>
<groupId>com.jfinal</groupId>
<artifactId>jfinal</artifactId>
<version>4.2</version>
<version>${jfinal.version}</version>
</dependency>
<dependency>
<groupId>com.jfinal</groupId>
<artifactId>jfinal</artifactId>
<version>4.2</version>
<version>${jfinal.version}</version>
<classifier>sources</classifier>
</dependency>
<dependency>
<!-- <dependency>
<groupId>c3p0</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.1.2</version>
</dependency>
</dependency>-->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
Expand Down Expand Up @@ -69,11 +79,6 @@
<artifactId>jedis</artifactId>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>com.ibeetl</groupId>
<artifactId>beetl</artifactId>
<version>2.7.11</version>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
Expand All @@ -88,7 +93,7 @@
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.28</version>
<version>${fastjson.version}</version>
</dependency>
<dependency>
<groupId>de.ruedigermoeller</groupId>
Expand All @@ -101,17 +106,7 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.ibeetl</groupId>
<artifactId>beetl</artifactId>
<version>2.7.11</version>
</dependency>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
<version>4.2</version>
</dependency>


<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
Expand All @@ -134,12 +129,27 @@
<artifactId>aliyun-sdk-oss</artifactId>
<version>2.0.6</version>
</dependency>


<dependency>
<groupId>com.ibeetl</groupId>
<artifactId>beetl</artifactId>
<version>${beetl.version}</version>
</dependency>
<!-- <dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
<version>4.2</version>
</dependency>-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>${druid.version}</version>
</dependency>
<!-- 数据库 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.35</version>
<version>${mysql.version}</version>
</dependency>
</dependencies>

Expand Down Expand Up @@ -199,8 +209,8 @@
<webAppConfig>
<contextPath>/${project.artifactId}</contextPath>
</webAppConfig>
<classesDirectory>${basedir}/target/${artifactId}/classes</classesDirectory>
<webAppSourceDirectory>${basedir}/target/${artifactId}</webAppSourceDirectory>
<classesDirectory>${basedir}/target/${project.artifactId}/classes</classesDirectory>
<webAppSourceDirectory>${basedir}/target/${project.artifactId}</webAppSourceDirectory>
</configuration>
</plugin>
<plugin>
Expand All @@ -210,7 +220,7 @@
<configuration>
<port>80</port>
<path>/${project.artifactId}</path>
<warSourceDirectory>${basedir}/target/${artifactId}</warSourceDirectory>
<!-- <warSourceDirectory>${basedir}/target/${project.artifactId}</warSourceDirectory>-->
</configuration>
</plugin>
</plugins>
Expand Down
27 changes: 27 additions & 0 deletions src/main/java/com/jflyfox/component/beelt/JFinalBeetlRender.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.jflyfox.component.beelt;

import com.jfinal.render.Render;
import org.beetl.core.GroupTemplate;
import org.beetl.ext.web.WebRender;

/**
* beetl render
*
* @author jflyfox
* @date 2019/10/30
*/
public class JFinalBeetlRender extends Render {
GroupTemplate groupTemplate;

public JFinalBeetlRender(GroupTemplate groupTemplate, String view) {
super.setView(view);
this.groupTemplate = groupTemplate;
}

@Override
public void render() {
this.response.setContentType("text/html; charset=" + getEncoding());
WebRender web = new WebRender(this.groupTemplate);
web.render(this.view, this.request, this.response, (Object[])null);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package com.jflyfox.component.beelt;

import com.jfinal.kit.PathKit;
import com.jfinal.render.Render;
import com.jfinal.render.RenderFactory;
import org.beetl.core.Configuration;
import org.beetl.core.GroupTemplate;
import org.beetl.core.ResourceLoader;
import org.beetl.core.resource.WebAppResourceLoader;

import java.io.IOException;

/**
* beetl render factory
*
* @author jflyfox
* @date 2019/10/30
*/
public class JFinalBeetlRenderFactory extends RenderFactory {
public GroupTemplate groupTemplate = null;

public JFinalBeetlRenderFactory() {
}

@Override
public Render getRender(String view) {
return new JFinalBeetlRender(this.groupTemplate, view);
}

public void config() {
String root = PathKit.getWebRootPath();
WebAppResourceLoader resourceLoader = new WebAppResourceLoader(root);
this.config(resourceLoader);
}

public void config(String root) {
WebAppResourceLoader resourceLoader = new WebAppResourceLoader(root);
this.config(resourceLoader);
}

public void config(ResourceLoader rs) {
if (this.groupTemplate != null) {
this.groupTemplate.close();
}

try {
Configuration cfg = Configuration.defaultConfiguration();
this.groupTemplate = new GroupTemplate(rs, cfg);
} catch (IOException var3) {
throw new RuntimeException("加载GroupTemplate失败", var3);
}
}
}
Loading

0 comments on commit f128a0d

Please sign in to comment.