Spring Boot整合UEditor不修改源码

 1.创建Springboot项目,目录结构如下(在resources中static/ueditor/jsp/config.json)

          

        2.pom文件引入

<dependency>
    <groupId>cn.jasonone.ueditor</groupId>
	<artifactId>ueditor-spring-boot-starter</artifactId>
	<version>1.1.4</version>
</dependency>

  

3. Springboot application.yml配置(可选配置)

ue:
  root-path: classpath:/static #文件存储根目录(可选配置),默认为[classpath:/static]
  server-url: /ueditor/jsp/controller #服务器统一请求接口路径(可选配置),默认为[/ueditor/jsp/controller]
  upload: cn.jasonone.ueditor.upload.LocationFileStorage #文件持久化处理类(可选配置),默认为[cn.jasonone.ueditor.upload.LocationFileStorage]

  

 4.UEditor配置(必选)

  • static/ueditor/ueditor.config.js 将serverUrl 改为application.yml 中ue.server-url 的值
//...
//服务器统一请求接口路径
, serverUrl: URL + "jsp/controller"
//...

  

 5.HTML代码(index.html)

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<script type="text/plain" id="editor"></script>
	<script th:src="@{/ueditor/ueditor.config.js}"></script>
	<script th:src="@{/ueditor/ueditor.all.js}"></script>
	<script th:src="@{/ueditor/lang/zh-cn/zh-cn.js}"></script>
	<script>
		UE.getEditor('editor');
	</script>
</body>
</html>

  


项目地址:https://gitee.com/hmjasonone/ueditor-spring-boot-stater

错误:Unable to read meta-data for class com.jason.ueditor.UeditorAutoConfiguration

 出错版本: 1.1.0

 解决办法: 将Jar包更新到1.1.3版本

  

posted @ 2019-08-23 11:34  zhuzhipeng  阅读(716)  评论(0编辑  收藏  举报