From e1c2edb92b63d6812b7b562e57584a27fa471e0d Mon Sep 17 00:00:00 2001 From: xieYj Date: Wed, 12 May 2021 17:16:03 +0800 Subject: [PATCH] init demo-restful --- .gitignore | 18 ++-- README.md | 48 +++++---- pom.xml | 59 ----------- .../community/MxCommunityApplication.java | 17 ---- .../community/domain/model/post/Post.java | 99 ------------------- .../domain/model/post/PostAuthor.java | 52 ---------- .../community/domain/model/topic/Topic.java | 36 ------- .../domain/model/topic/TopicPost.java | 17 ---- .../service/contentfilter/ContentFilter.java | 25 ----- .../contentfilter/ImageContentFilter.java | 14 --- .../contentfilter/LocalTextContentFilter.java | 35 ------- .../PostMainBodyContentFilterChain.java | 46 --------- .../PostTitleContentFilterChain.java | 44 --------- .../RemoteTextContentFilter.java | 14 --- .../contentfilter/TextContentFilter.java | 16 --- .../constant/CommonConstants.java | 10 -- .../constant/ExceptionCodeConstant.java | 12 --- .../exception/BusinessException.java | 84 ---------------- src/main/resources/application-dev.yml | 19 +++- src/main/resources/application-release.yml | 4 - .../MxCommunityApplicationTests.java | 13 --- 21 files changed, 52 insertions(+), 630 deletions(-) delete mode 100644 pom.xml delete mode 100644 src/main/java/cn/allms/community/MxCommunityApplication.java delete mode 100644 src/main/java/cn/allms/community/domain/model/post/Post.java delete mode 100644 src/main/java/cn/allms/community/domain/model/post/PostAuthor.java delete mode 100644 src/main/java/cn/allms/community/domain/model/topic/Topic.java delete mode 100644 src/main/java/cn/allms/community/domain/model/topic/TopicPost.java delete mode 100644 src/main/java/cn/allms/community/domain/service/contentfilter/ContentFilter.java delete mode 100644 src/main/java/cn/allms/community/domain/service/contentfilter/ImageContentFilter.java delete mode 100644 src/main/java/cn/allms/community/domain/service/contentfilter/LocalTextContentFilter.java delete mode 100644 src/main/java/cn/allms/community/domain/service/contentfilter/PostMainBodyContentFilterChain.java delete mode 100644 src/main/java/cn/allms/community/domain/service/contentfilter/PostTitleContentFilterChain.java delete mode 100644 src/main/java/cn/allms/community/domain/service/contentfilter/RemoteTextContentFilter.java delete mode 100644 src/main/java/cn/allms/community/domain/service/contentfilter/TextContentFilter.java delete mode 100644 src/main/java/cn/allms/community/infrastructure/constant/CommonConstants.java delete mode 100644 src/main/java/cn/allms/community/infrastructure/constant/ExceptionCodeConstant.java delete mode 100644 src/main/java/cn/allms/community/infrastructure/exception/BusinessException.java delete mode 100644 src/main/resources/application-release.yml delete mode 100644 src/test/java/cn/allms/community/MxCommunityApplicationTests.java diff --git a/.gitignore b/.gitignore index 549e00a..c2065bc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,9 @@ HELP.md -target/ -!.mvn/wrapper/maven-wrapper.jar -!**/src/main/**/target/ -!**/src/test/**/target/ +.gradle +build/ +!gradle/wrapper/gradle-wrapper.jar +!**/src/main/**/build/ +!**/src/test/**/build/ ### STS ### .apt_generated @@ -12,12 +13,18 @@ target/ .settings .springBeans .sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ ### IntelliJ IDEA ### .idea *.iws *.iml *.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ ### NetBeans ### /nbproject/private/ @@ -25,9 +32,6 @@ target/ /dist/ /nbdist/ /.nb-gradle/ -build/ -!**/src/main/**/build/ -!**/src/test/**/build/ ### VS Code ### .vscode/ diff --git a/README.md b/README.md index 676b4c5..a67c01b 100644 --- a/README.md +++ b/README.md @@ -1,34 +1,32 @@ +# Getting Started RestFul +### Reference Documentation -**项目名称:** 沐雪博客DDD版本 +For further reference, please consider the following sections: -**项目描述:** +* [Official Gradle documentation](https://docs.gradle.org) +* [Spring Boot Gradle Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.4.5/gradle-plugin/reference/html/) +* [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.4.5/gradle-plugin/reference/html/#build-image) +* [Rest Repositories](https://docs.spring.io/spring-boot/docs/2.4.5/reference/htmlsingle/#howto-use-exposing-spring-data-repositories-rest-endpoint) +* [Spring Web](https://docs.spring.io/spring-boot/docs/2.4.5/reference/htmlsingle/#boot-features-developing-web-applications) +* [Spring Data JPA](https://docs.spring.io/spring-boot/docs/2.4.5/reference/htmlsingle/#boot-features-jpa-and-spring-data) +* [Spring Boot DevTools](https://docs.spring.io/spring-boot/docs/2.4.5/reference/htmlsingle/#using-boot-devtools) -主要用于博主分享学习经验,书写 技术文章,笔记以及日常生活的记录。 +### Guides -**涉及技术:** +The following guides illustrate how to use some features concretely: -```java -前端: Semantic-UI框架 -后端: JDK1.8+SpringBoot2.4.5 -``` +* [Accessing JPA Data with REST](https://spring.io/guides/gs/accessing-data-rest/) +* [Accessing Neo4j Data with REST](https://spring.io/guides/gs/accessing-neo4j-data-rest/) +* [Accessing MongoDB Data with REST](https://spring.io/guides/gs/accessing-mongodb-data-rest/) +* [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/) +* [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/) +* [Building REST services with Spring](https://spring.io/guides/tutorials/bookmarks/) +* [Accessing Data with JPA](https://spring.io/guides/gs/accessing-data-jpa/) +* [Accessing data with MySQL](https://spring.io/guides/gs/accessing-data-mysql/) -**项目介绍:** +### See Links -整个项目前端采用 Semantic-UI,后端基于 SpringBoot,分为: +* https://zyue.wiki/articles/2019/01/05/1546684795983.htmlhttps://scans.gradle.com#gradle) +* https://github.com/lizhongyue248/spring-boot-restful-api -- 前台展示 - - 首页、分类、标签、 归档、站长信息、搜索详情页、博客详情页 - -- 后台管理 - - 登录、欢迎页、博客管理、新增/编辑博客、 分类管理、分类编辑/新增、标签管理 - -2、密码加密采用 MD5 进行加密,使得项目安全性有所提高。 - -3、博客编辑页面采用 Markdown 放行进行书写,集成了 Markdown 编辑器插件。期间使用 MarkdownUtil 工具将 Markdown 转化成 HTML 格式。 - -4、使用 CommentUtil 工具类以及 Semantic-UI 中自带的留言组件实现评论功能,让评论显示为层级 - -5、采用 SpringData JAP 连接数据库,简化 SQL 编写方式。 \ No newline at end of file diff --git a/pom.xml b/pom.xml deleted file mode 100644 index 394338c..0000000 --- a/pom.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - 4.0.0 - - org.springframework.boot - spring-boot-starter-parent - 2.4.5 - - - cn.allms.community - mx-community - 0.0.1-SNAPSHOT - mx-community - Demo project for Spring Boot - - 1.8 - - - - org.springframework.boot - spring-boot-starter-web - - - - org.springframework.boot - spring-boot-configuration-processor - true - - - org.projectlombok - lombok - true - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - org.projectlombok - lombok - - - - - - - - diff --git a/src/main/java/cn/allms/community/MxCommunityApplication.java b/src/main/java/cn/allms/community/MxCommunityApplication.java deleted file mode 100644 index 98f096a..0000000 --- a/src/main/java/cn/allms/community/MxCommunityApplication.java +++ /dev/null @@ -1,17 +0,0 @@ -package cn.allms.community; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -/** - * 啓動入口 - * @author josxy - */ -@SpringBootApplication -public class MxCommunityApplication { - - public static void main(String[] args) { - SpringApplication.run(MxCommunityApplication.class, args); - } - -} diff --git a/src/main/java/cn/allms/community/domain/model/post/Post.java b/src/main/java/cn/allms/community/domain/model/post/Post.java deleted file mode 100644 index e62697d..0000000 --- a/src/main/java/cn/allms/community/domain/model/post/Post.java +++ /dev/null @@ -1,99 +0,0 @@ -package cn.allms.community.domain.model.post; - -import cn.allms.community.domain.model.topic.TopicPost; -import cn.allms.community.infrastructure.constant.CommonConstants; -import cn.allms.community.infrastructure.constant.ExceptionCodeConstant; -import cn.allms.community.infrastructure.exception.BusinessException; -import lombok.Data; -import org.springframework.util.Assert; -import org.springframework.util.StringUtils; - -import java.util.HashSet; -import java.util.Objects; -import java.util.Set; - -/** - * 帖子对象 - * @author xieYj - * @date 2021/5/11 11:50 - */ -@Data -public class Post { - /** - * 帖子ID - */ - private Long id; - - /** - * 帖子作者ID - */ - private Long authorId; - - /** - * 帖子标题 - */ - private String title; - - /** - * 帖子内容 - */ - private String sourceContent; - - /** - * 发帖时间戳 - */ - private Long postingTime; - - /** - * 最后修改时间 - */ - private Long lastModifyTime; - - /** - * 加入的话题 - */ - private Set topics = new HashSet<>(); - - /** - * 最多加入的主题数 - */ - public static final Integer MAX_JOINED_TOPICS_NUM = 5; - - /** - * 自定义的setter,优先会调用此set方法,而不是lombok自带的 - * @param authorId 作者Id - */ - public void setAuthorId(Long authorId) { - Assert.isTrue(authorId > 0, "帖子作者Id必须大于0"); - this.authorId = authorId; - } - - public void setSourceContent(String sourceContent) { - Assert.isTrue(Objects.nonNull(sourceContent), "帖子内容不能为空"); - Assert.isTrue(sourceContent.length() >= 16, "帖子内容必须大于16"); - this.sourceContent = sourceContent; - } - - /** - * 将帖子关联话题 | 加入话题 - * - * @param topicIds 话题集合 - */ - public void joinTopics(String topicIds) throws BusinessException { - if (Objects.isNull(topicIds)) { - return; - } - String[] topicIdArray = topicIds.split(CommonConstants.TOPIC_SPLIT_COMMA); - for (String s : topicIdArray) { - TopicPost topicPost = new TopicPost(Long.valueOf(s), this.getId()); - this.topics.add(topicPost); - if (topicSize() > MAX_JOINED_TOPICS_NUM) { - throw new BusinessException(ExceptionCodeConstant.ONE_POST_MOST_JOIN_INTO_FIVE_TOPICS); - } - } - } - - public int topicSize(){ - return this.topics.size(); - } -} diff --git a/src/main/java/cn/allms/community/domain/model/post/PostAuthor.java b/src/main/java/cn/allms/community/domain/model/post/PostAuthor.java deleted file mode 100644 index 4f02bbe..0000000 --- a/src/main/java/cn/allms/community/domain/model/post/PostAuthor.java +++ /dev/null @@ -1,52 +0,0 @@ -package cn.allms.community.domain.model.post; - -import cn.allms.community.infrastructure.constant.ExceptionCodeConstant; -import cn.allms.community.infrastructure.exception.BusinessException; -import lombok.Data; - -/** - * 帖子作者对象 - * @author xieYj - * @date 2021/5/11 11:51 - */ -@Data -public class PostAuthor { - /** - * 帖子内容最小长度 - */ - private final static int MIN_LENGTH_POST_SOURCE_CONTENT = 16; - - /** - * 作者ID - */ - private Long id; - /** - * 作者账号 - */ - private String account; - /** - * 作者昵称 - */ - private String nickname; - - /** - * 发布帖子 - * - * @param title 帖子标题 - * @param sourceContent 帖子内容 - * @return - */ - public Post posting(String title, String sourceContent) throws BusinessException { - long currentTimeMillis = System.currentTimeMillis(); - if (sourceContent.length() < MIN_LENGTH_POST_SOURCE_CONTENT) { - throw new BusinessException(ExceptionCodeConstant.POST_SOURCE_CONTENT_AT_LEAST_SIXTEEN_WORDS); - } - Post post = new Post(); - post.setAuthorId(this.id); - post.setSourceContent(sourceContent); - post.setTitle(title); - post.setPostingTime(currentTimeMillis); - post.setLastModifyTime(currentTimeMillis); - return post; - } -} diff --git a/src/main/java/cn/allms/community/domain/model/topic/Topic.java b/src/main/java/cn/allms/community/domain/model/topic/Topic.java deleted file mode 100644 index a912500..0000000 --- a/src/main/java/cn/allms/community/domain/model/topic/Topic.java +++ /dev/null @@ -1,36 +0,0 @@ -package cn.allms.community.domain.model.topic; - -import lombok.Data; - -import java.sql.Timestamp; -import java.util.Set; - -/** - * 话题对象 - * - * @author xieYj - * @date 2021/5/11 14:31 - */ -@Data -public class Topic { - /** - * 话题id - */ - private Long id; - /** - * 话题标题 - */ - private String title; - /** - * 话题描述 - */ - private String description; - /** - * 话题创建时间 - */ - private Timestamp createTime; - /** - * 话题下的帖子列表 - */ - private Set posts; -} diff --git a/src/main/java/cn/allms/community/domain/model/topic/TopicPost.java b/src/main/java/cn/allms/community/domain/model/topic/TopicPost.java deleted file mode 100644 index aed723b..0000000 --- a/src/main/java/cn/allms/community/domain/model/topic/TopicPost.java +++ /dev/null @@ -1,17 +0,0 @@ -package cn.allms.community.domain.model.topic; - -import lombok.AllArgsConstructor; -import lombok.Data; - -/** - * 话题文章对象 - * - * @author xieYj - * @date 2021/5/11 14:31 - */ -@Data -@AllArgsConstructor -public class TopicPost { - private Long topicId; - private Long postId; -} diff --git a/src/main/java/cn/allms/community/domain/service/contentfilter/ContentFilter.java b/src/main/java/cn/allms/community/domain/service/contentfilter/ContentFilter.java deleted file mode 100644 index a9550a6..0000000 --- a/src/main/java/cn/allms/community/domain/service/contentfilter/ContentFilter.java +++ /dev/null @@ -1,25 +0,0 @@ -package cn.allms.community.domain.service.contentfilter; - -import lombok.Getter; -import lombok.Setter; - -/** - * 内容过滤器 - * @author xieYj - * @date 2021/5/11 15:09 - */ -@Setter -@Getter -public abstract class ContentFilter { - /** - * 下一个内容过滤器 - */ - private ContentFilter nextContentFilter; - - /** - * 过滤内容 - * @param object 过滤对象 - * @return - */ - public abstract boolean filterContent(Object object); -} diff --git a/src/main/java/cn/allms/community/domain/service/contentfilter/ImageContentFilter.java b/src/main/java/cn/allms/community/domain/service/contentfilter/ImageContentFilter.java deleted file mode 100644 index b78309f..0000000 --- a/src/main/java/cn/allms/community/domain/service/contentfilter/ImageContentFilter.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.allms.community.domain.service.contentfilter; - -/** - * 图片过滤器 - * @author xieYj - * @date 2021/5/11 15:17 - */ -public class ImageContentFilter extends ContentFilter{ - @Override - public boolean filterContent(Object object) { - // TODO 调用第三方接口实现图片过滤 - return false; - } -} diff --git a/src/main/java/cn/allms/community/domain/service/contentfilter/LocalTextContentFilter.java b/src/main/java/cn/allms/community/domain/service/contentfilter/LocalTextContentFilter.java deleted file mode 100644 index d718371..0000000 --- a/src/main/java/cn/allms/community/domain/service/contentfilter/LocalTextContentFilter.java +++ /dev/null @@ -1,35 +0,0 @@ -package cn.allms.community.domain.service.contentfilter; - -import org.springframework.util.Assert; - -import java.util.HashSet; -import java.util.Set; - -/** - * 本地文本内容过滤器 - * @author xieYj - * @date 2021/5/11 15:24 - */ -public class LocalTextContentFilter extends TextContentFilter { - /** - * 本地敏感词 - */ - private Set sensitiveWords = new HashSet<>(); - - public LocalTextContentFilter() { - sensitiveWords.add("NND"); - sensitiveWords.add("奶奶个熊"); - } - - - @Override - public boolean filterContent(Object content) { - Assert.isTrue(content instanceof String, "本地文本过滤对象必须为 String 类型"); - for (String sensitiveWord : sensitiveWords) { - if (((String) content).contains(sensitiveWord)) { - return false; - } - } - return true; - } -} diff --git a/src/main/java/cn/allms/community/domain/service/contentfilter/PostMainBodyContentFilterChain.java b/src/main/java/cn/allms/community/domain/service/contentfilter/PostMainBodyContentFilterChain.java deleted file mode 100644 index d643551..0000000 --- a/src/main/java/cn/allms/community/domain/service/contentfilter/PostMainBodyContentFilterChain.java +++ /dev/null @@ -1,46 +0,0 @@ -package cn.allms.community.domain.service.contentfilter; - -import cn.allms.community.domain.model.post.Post; - -import java.util.Set; - -/** - * 帖子内容过滤:包含文本过滤,图片过滤 - * 责任链模式 - * - * @author xieYj - * @date 2021/5/11 15:33 - */ -public class PostMainBodyContentFilterChain { - /** - * 内容过滤器 - */ - private Set contentFilters; - - public PostMainBodyContentFilterChain() { - TextContentFilter localTextContentFilter = new LocalTextContentFilter(); - TextContentFilter remoteTextContentFilter = new RemoteTextContentFilter(); - ImageContentFilter imageContentFilter = new ImageContentFilter(); - // 优先校验本地的敏感词 - contentFilters.add(localTextContentFilter); - // 第三方文本敏感词过滤 - contentFilters.add(remoteTextContentFilter); - // 第三方图片过滤 - contentFilters.add(imageContentFilter); - } - - /** - * 过滤标题 - * - * @param post 帖子信息 - * @return true —— 通过, false —— 未通过 - */ - public boolean filterMainBody(Post post) { - for (ContentFilter contentFilter : contentFilters) { - if (!contentFilter.filterContent(post.getSourceContent())) { - return false; - } - } - return true; - } -} diff --git a/src/main/java/cn/allms/community/domain/service/contentfilter/PostTitleContentFilterChain.java b/src/main/java/cn/allms/community/domain/service/contentfilter/PostTitleContentFilterChain.java deleted file mode 100644 index cff9e4e..0000000 --- a/src/main/java/cn/allms/community/domain/service/contentfilter/PostTitleContentFilterChain.java +++ /dev/null @@ -1,44 +0,0 @@ -package cn.allms.community.domain.service.contentfilter; - -import cn.allms.community.domain.model.post.Post; - -import java.util.Iterator; -import java.util.Set; - -/** - * 帖子标题过滤:文本过滤 - * 责任链模式 - * - * @author xieYj - * @date 2021/5/11 15:40 - */ -public class PostTitleContentFilterChain { - /** - * 内容过滤器 - */ - private Set contentFilters; - - public PostTitleContentFilterChain() { - LocalTextContentFilter localTextContentFilter = new LocalTextContentFilter(); - RemoteTextContentFilter remoteTextContentFilter = new RemoteTextContentFilter(); - // 本地文本敏感词校验 - contentFilters.add(localTextContentFilter); - // 第三方文本敏感词校验 - contentFilters.add(remoteTextContentFilter); - } - - /** - * 过滤标题 - * - * @param post 帖子信息 - * @return true —— 通过,false —— 未通过 - */ - public boolean filterTitle(Post post) { - for (ContentFilter contentFilter : contentFilters) { - if (!contentFilter.filterContent(post.getTitle())) { - return false; - } - } - return true; - } -} diff --git a/src/main/java/cn/allms/community/domain/service/contentfilter/RemoteTextContentFilter.java b/src/main/java/cn/allms/community/domain/service/contentfilter/RemoteTextContentFilter.java deleted file mode 100644 index 7acf6eb..0000000 --- a/src/main/java/cn/allms/community/domain/service/contentfilter/RemoteTextContentFilter.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.allms.community.domain.service.contentfilter; - -/** - * 远程文本内容过滤器 - * @author xieYj - * @date 2021/5/11 15:22 - */ -public class RemoteTextContentFilter extends TextContentFilter{ - @Override - public boolean filterContent(Object object) { - // TODO 需要调用第三方服务才能实现 - return false; - } -} diff --git a/src/main/java/cn/allms/community/domain/service/contentfilter/TextContentFilter.java b/src/main/java/cn/allms/community/domain/service/contentfilter/TextContentFilter.java deleted file mode 100644 index 83d7293..0000000 --- a/src/main/java/cn/allms/community/domain/service/contentfilter/TextContentFilter.java +++ /dev/null @@ -1,16 +0,0 @@ -package cn.allms.community.domain.service.contentfilter; - -/** - * 文本过滤器 - * @author xieYj - * @date 2021/5/11 15:18 - */ -public abstract class TextContentFilter extends ContentFilter{ - /** - * 文本过滤器,抽象 - * @param object 过滤对象 - * @return - */ - @Override - public abstract boolean filterContent(Object object); -} diff --git a/src/main/java/cn/allms/community/infrastructure/constant/CommonConstants.java b/src/main/java/cn/allms/community/infrastructure/constant/CommonConstants.java deleted file mode 100644 index 4332c68..0000000 --- a/src/main/java/cn/allms/community/infrastructure/constant/CommonConstants.java +++ /dev/null @@ -1,10 +0,0 @@ -package cn.allms.community.infrastructure.constant; - -/** - * 公共常量 - * @author xieYj - * @date 2021/5/11 14:56 - */ -public interface CommonConstants { - String TOPIC_SPLIT_COMMA = ","; -} diff --git a/src/main/java/cn/allms/community/infrastructure/constant/ExceptionCodeConstant.java b/src/main/java/cn/allms/community/infrastructure/constant/ExceptionCodeConstant.java deleted file mode 100644 index 6b0abad..0000000 --- a/src/main/java/cn/allms/community/infrastructure/constant/ExceptionCodeConstant.java +++ /dev/null @@ -1,12 +0,0 @@ -package cn.allms.community.infrastructure.constant; - -/** - * 异常码状态常量 - * - * @author xieYj - * @date 2021/5/11 14:17 - */ -public interface ExceptionCodeConstant { - String POST_SOURCE_CONTENT_AT_LEAST_SIXTEEN_WORDS = "2001"; - String ONE_POST_MOST_JOIN_INTO_FIVE_TOPICS = "2002"; -} diff --git a/src/main/java/cn/allms/community/infrastructure/exception/BusinessException.java b/src/main/java/cn/allms/community/infrastructure/exception/BusinessException.java deleted file mode 100644 index 4c41736..0000000 --- a/src/main/java/cn/allms/community/infrastructure/exception/BusinessException.java +++ /dev/null @@ -1,84 +0,0 @@ -package cn.allms.community.infrastructure.exception; - -/** - * @author xieYj - * @date 2021/5/11 13:59 - */ -public class BusinessException extends Exception { - /** - * 业务异常码 - */ - private String code; - /** - * 业务异常参数 - */ - private Object[] arguments; - - public BusinessException() { - super(); - } - - public BusinessException(Throwable cause) { - super(cause); - } - - public BusinessException(String message) { - super(message); - } - - public BusinessException(String code, String message) { - super(message); - this.code = code; - } - - public BusinessException(String message, Object[] arguments) { - super(message); - this.arguments = arguments; - } - - public BusinessException(String code, String message, Object[] arguments) { - super(message); - this.code = code; - this.arguments = arguments; - } - - public BusinessException(String message, Object[] arguments, Throwable cause) { - super(message, cause); - this.arguments = arguments; - } - - public BusinessException(String code, String message, Object[] arguments, Throwable cause) { - super(message, cause); - this.code = code; - this.arguments = arguments; - } - - public BusinessException(String message, Throwable cause) { - super(message, cause); - } - - - public BusinessException(String code, String message, Throwable cause) { - super(message, cause); - this.code = code; - } - - - public BusinessException(String message, - Throwable cause, - boolean enableSuppression, - boolean writableStackTrace) { - super(message, cause, enableSuppression, writableStackTrace); - } - - - public BusinessException(String code, - String message, - Throwable cause, - boolean enableSuppression, - boolean writableStackTrace) { - super(message, cause, enableSuppression, writableStackTrace); - this.code = code; - } - -} diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index e558821..dc3d7b8 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -1,4 +1,21 @@ +spring: + application: + name: restful-api + datasource: + url: jdbc:p6spy:mysql://localhost:3306/spring?useUnicode=true&characterEncoding=utf-8&useSSL=false + username: root + password: 123456 + platform: mysql + driver-class-name: com.p6spy.engine.spy.P6SpyDriver + jpa: + # 关闭jpa自带的show sql + show-sql: false + open-in-view: false + #加上这句会执行import.sql + generate-ddl: true + hibernate: + ddl-auto: create server: - port: 9420 servlet: context-path: /api + port: 8001 diff --git a/src/main/resources/application-release.yml b/src/main/resources/application-release.yml deleted file mode 100644 index 256cb23..0000000 --- a/src/main/resources/application-release.yml +++ /dev/null @@ -1,4 +0,0 @@ -server: - port: 9420 - servlet: - context-path: /server diff --git a/src/test/java/cn/allms/community/MxCommunityApplicationTests.java b/src/test/java/cn/allms/community/MxCommunityApplicationTests.java deleted file mode 100644 index 0a1e495..0000000 --- a/src/test/java/cn/allms/community/MxCommunityApplicationTests.java +++ /dev/null @@ -1,13 +0,0 @@ -package cn.allms.community; - -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; - -@SpringBootTest -class MxCommunityApplicationTests { - - @Test - void contextLoads() { - } - -}