├── .gitattributes
├── .github
├── FUNDING.yml
├── ISSUE_TEMPLATE.md
└── workflows
│ └── codeql-analysis.yml
├── .gitignore
├── .travis.yml
├── LICENSE
├── Readme.md
├── SECURITY.md
├── _config.yml
├── async
├── .gitignore
├── README.md
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── info
│ │ └── xiaomo
│ │ └── anysc
│ │ ├── AsyncMain.java
│ │ ├── controller
│ │ └── TestController.java
│ │ └── task
│ │ └── AsyncTask.java
│ └── resources
│ └── config
│ ├── application.properties
│ └── logback-dev.xml
├── changeLog.md
├── core
├── .gitignore
├── README.md
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── info
│ │ └── xiaomo
│ │ └── core
│ │ ├── base
│ │ ├── AuthOperate.java
│ │ ├── BaseController.java
│ │ ├── BaseDao.java
│ │ ├── BaseModel.java
│ │ ├── BaseService.java
│ │ └── Result.java
│ │ ├── constant
│ │ ├── CodeConst.java
│ │ ├── FileConst.java
│ │ ├── GenderConst.java
│ │ └── SymbolConst.java
│ │ ├── exception
│ │ └── UserNotFoundException.java
│ │ ├── field
│ │ └── LoginField.java
│ │ ├── filter
│ │ ├── CorsFilter.java
│ │ └── CustomDateSerializerFilter.java
│ │ └── untils
│ │ ├── AuthUtil.java
│ │ ├── CastUtil.java
│ │ ├── CharUtil.java
│ │ ├── DownUtil.java
│ │ ├── ExcelUtil.java
│ │ ├── FileUtil.java
│ │ ├── HtmlUtil.java
│ │ ├── HttpUtil.java
│ │ ├── IDUtil.java
│ │ ├── LunarCalendarUtil.java
│ │ ├── MailUtil.java
│ │ ├── Md5Util.java
│ │ ├── PropsUtil.java
│ │ ├── RandomUtil.java
│ │ ├── RegExUtil.java
│ │ ├── SerializeUtil.java
│ │ ├── SqlUtil.java
│ │ ├── StringUtil.java
│ │ ├── TimeUtil.java
│ │ ├── TokenUtil.java
│ │ └── XmlUtil.java
│ └── resources
│ └── config
│ └── oauth.properties
├── crawler
├── .gitignore
├── README.md
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── info
│ │ └── xiaomo
│ │ └── crawler
│ │ ├── CrawlerMain.java
│ │ ├── dao
│ │ └── ShikigamaDao.java
│ │ ├── model
│ │ ├── MitamaModel.java
│ │ └── ShikigamiModel.java
│ │ ├── schedule
│ │ └── ScheduledTasks.java
│ │ ├── service
│ │ ├── ShikigamaService.java
│ │ └── impl
│ │ │ └── ShikigamaServiceImpl.java
│ │ └── spider
│ │ ├── Crawler.java
│ │ └── OnnmyoujiSpider.java
│ └── resources
│ └── config
│ ├── application.properties
│ └── logback-dev.xml
├── freemarker
├── .gitignore
├── README.md
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── info
│ │ └── xiaomo
│ │ └── freemarker
│ │ ├── FreemarkerMain.java
│ │ └── controller
│ │ └── FreemarkerController.java
│ └── resources
│ ├── config
│ ├── application.properties
│ ├── banner-girl.txt
│ └── logback-dev.xml
│ └── templates
│ └── index.ftl
├── javase
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── info
│ │ └── xiaomo
│ │ └── javase
│ │ ├── QuestionMain.java
│ │ ├── controller
│ │ └── QuestionController.java
│ │ ├── dao
│ │ └── QuestionDao.java
│ │ ├── model
│ │ └── QuestionModel.java
│ │ └── service
│ │ ├── QuestionService.java
│ │ └── impl
│ │ └── QuestionServiceImpl.java
│ └── resources
│ └── config
│ ├── application.properties
│ ├── banner-girl.txt
│ └── logback-dev.xml
├── mongodb
├── .gitignore
├── README.md
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── info
│ │ └── xiaomo
│ │ └── mongodb
│ │ ├── MongodbMain.java
│ │ ├── controller
│ │ └── MongoUserController.java
│ │ ├── dao
│ │ └── MongoUserDao.java
│ │ ├── model
│ │ └── MongoUser.java
│ │ └── service
│ │ ├── MongoUserService.java
│ │ └── impl
│ │ └── MongoUserServiceImpl.java
│ └── resources
│ └── config
│ ├── application.properties
│ └── logback-dev.xml
├── multipleSource
├── .gitignore
├── README.md
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── info
│ │ └── xiaomo
│ │ └── multiplesource
│ │ ├── MultipleSourceMain.java
│ │ ├── controller
│ │ └── MultipleSourceController.java
│ │ ├── domain
│ │ └── User.java
│ │ └── sql
│ │ └── Sql.java
│ └── resources
│ └── config
│ ├── application.properties
│ ├── banner-girl.txt
│ └── logback-dev.xml
├── mybatis
├── .gitignore
├── README.md
├── USER.sql
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── info
│ │ └── xiaomo
│ │ └── mybatis
│ │ ├── MybatisMain.java
│ │ ├── controller
│ │ └── MybatisUserController.java
│ │ ├── domain
│ │ └── User.java
│ │ └── mapper
│ │ └── UserMapper.java
│ └── resources
│ └── config
│ ├── application.properties
│ ├── banner-girl.txt
│ └── logback-dev.xml
├── order
├── pom.xml
└── src
│ └── main
│ └── java
│ └── info
│ └── xiaomo
│ └── order
│ ├── OrderMain.java
│ ├── controller
│ └── OrderController.java
│ ├── model
│ └── OrderModel.java
│ └── service
│ ├── OrderService.java
│ └── impl
│ └── OrderServiceImpl.java
├── pom.xml
├── rabbitmq
├── .gitignore
├── README.md
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── info
│ │ │ └── xiaomo
│ │ │ └── rabbitmq
│ │ │ ├── RabbitMqMain.java
│ │ │ └── config
│ │ │ ├── Receiver.java
│ │ │ └── Sender.java
│ └── resources
│ │ └── config
│ │ ├── application.properties
│ │ └── logback-dev.xml
│ └── test
│ └── java
│ └── test
│ └── RabbitMqTests.java
├── redis
├── .gitignore
├── README.md
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── info
│ │ └── xiaomo
│ │ └── redis
│ │ ├── RedisMain.java
│ │ ├── controller
│ │ └── TestController.java
│ │ ├── dao
│ │ ├── CommonRedisDao.java
│ │ └── impl
│ │ │ └── CommonRedisDaoImpl.java
│ │ ├── job
│ │ └── TaskJob.java
│ │ ├── model
│ │ └── CityInfo.java
│ │ └── service
│ │ └── CityService.java
│ └── resources
│ └── config
│ ├── application.properties
│ └── logback-dev.xml
├── scheduled
├── .gitignore
├── README.md
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── info
│ │ └── xiaomo
│ │ └── scheduled
│ │ ├── ScheduledMain.java
│ │ └── task
│ │ └── ScheduledTasks.java
│ └── resources
│ └── config
│ ├── application.properties
│ └── logback-dev.xml
├── screenshot
├── SpringBootUnity.png
├── api.png
├── bootstrap.png
├── crawler.png
├── interface.png
├── lombok.png
├── run.png
├── spring.png
├── support.png
├── swagger-ui.png
└── yys.png
├── security
├── .gitignore
├── README.md
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── info
│ │ └── xiaomo
│ │ └── security
│ │ ├── SecurityMain.java
│ │ └── controller
│ │ └── HelloController.java
│ └── resources
│ ├── config
│ ├── application.properties
│ └── logback-dev.xml
│ └── templates
│ ├── hello.html
│ ├── index.html
│ └── login.html
├── socket
├── .gitignore
├── README.md
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── info
│ │ └── xiaomo
│ │ └── chat
│ │ ├── ChatMain.java
│ │ └── socket
│ │ └── MyWebSocket.java
│ └── resources
│ ├── config
│ ├── application.properties
│ └── logback-dev.xml
│ └── public
│ ├── chat.html
│ ├── image
│ └── avatar.png
│ └── index.html
├── thymeleaf
├── .gitignore
├── README.md
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── info
│ │ └── xiaomo
│ │ └── thymeleaf
│ │ ├── ThymeleafMain.java
│ │ └── controller
│ │ └── ThymeleafController.java
│ └── resources
│ ├── config
│ ├── application.properties
│ ├── banner-girl.txt
│ └── logback-dev.xml
│ └── templates
│ └── index.html
└── website
├── .gitignore
├── README.md
├── pom.xml
├── src
└── main
│ ├── java
│ └── info
│ │ └── xiaomo
│ │ └── website
│ │ ├── XiaomoMain.java
│ │ ├── controller
│ │ ├── AdminUserController.java
│ │ ├── ChangeLogController.java
│ │ ├── LinkController.java
│ │ ├── MailController.java
│ │ ├── TechnologyController.java
│ │ ├── UserController.java
│ │ └── WorksController.java
│ │ ├── dao
│ │ ├── AdminUserDao.java
│ │ ├── ChangeLogDao.java
│ │ ├── LinkDao.java
│ │ ├── TechnologyDao.java
│ │ ├── UserDao.java
│ │ ├── WorksDao.java
│ │ └── base
│ │ │ └── CommonDao.java
│ │ ├── interceptor
│ │ └── LoginInterceptor.java
│ │ ├── model
│ │ ├── AdminModel.java
│ │ ├── ChangeLogModel.java
│ │ ├── LinkModel.java
│ │ ├── TechnologyModel.java
│ │ ├── UserModel.java
│ │ └── WorksModel.java
│ │ ├── service
│ │ ├── AdminUserService.java
│ │ ├── ChangeLogService.java
│ │ ├── LinkService.java
│ │ ├── TechnologyService.java
│ │ ├── UserService.java
│ │ ├── WorksService.java
│ │ └── impl
│ │ │ ├── AdminUserServiceImpl.java
│ │ │ ├── ChangeLogServiceImpl.java
│ │ │ ├── LinkServiceImpl.java
│ │ │ ├── TechnologyServiceImpl.java
│ │ │ ├── UserServiceImpl.java
│ │ │ └── WorksServiceImpl.java
│ │ ├── util
│ │ └── MailUtil.java
│ │ └── view
│ │ ├── AdminUserView.java
│ │ ├── ChangeLogView.java
│ │ ├── LinkView.java
│ │ ├── TechnologyView.java
│ │ ├── UserView.java
│ │ └── WorksView.java
│ └── resources
│ ├── config
│ ├── application.properties
│ ├── banner-girl.txt
│ └── logback-dev.xml
│ ├── public
│ ├── css
│ │ └── style.css
│ └── images
│ │ ├── collapse.gif
│ │ ├── expand.gif
│ │ ├── favicon-16x16.png
│ │ ├── favicon-32x32.png
│ │ ├── favicon.ico
│ │ ├── index.jpg
│ │ ├── landing.png
│ │ ├── logo_small.png
│ │ ├── pet_store_api.png
│ │ └── throbber.gif
│ ├── templates
│ ├── email.ftl
│ ├── index.ftl
│ ├── info.ftl
│ ├── login.ftl
│ └── register.ftl
│ └── 项目文档
│ └── 重点记录
│ ├── markdown语法.markdown
│ ├── maven使用相关.markdown
│ ├── spring boot 相关.markdown
│ ├── 前后分离与传统javaweb项目的区别.markdown
│ ├── 文件上传.markdown
│ ├── 服务器部署.markdown
│ └── 跨域.markdown
└── web.sql
/.gitattributes:
--------------------------------------------------------------------------------
1 | # *.js linguist-language=java
2 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: houko
4 | patreon: #hupeng
5 | open_collective: SpringBootUnity
6 | ko_fi: #hupeng
7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9 | liberapay: # Replace with a single Liberapay username
10 | issuehunt: #houko/SpringBootUnity
11 | otechie: # Replace with a single Otechie username
12 | custom: #https:blog.xiaomo.info
13 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | *.iml
3 | node_modules
4 | target
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: java
2 | jdk:
3 | - oraclejdk11
4 | dist: trusty
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Peng Hu
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/SECURITY.md:
--------------------------------------------------------------------------------
1 | # Security Policy
2 |
3 | ## Supported Versions
4 |
5 | Use this section to tell people about which versions of your project are
6 | currently being supported with security updates.
7 |
8 | | Version | Supported |
9 | | ------- | ------------------ |
10 | | 5.1.x | :white_check_mark: |
11 | | 5.0.x | :x: |
12 | | 4.0.x | :white_check_mark: |
13 | | < 4.0 | :x: |
14 |
15 | ## Reporting a Vulnerability
16 |
17 | Use this section to tell people how to report a vulnerability.
18 |
19 | Tell them where to go, how often they can expect to get an update on a
20 | reported vulnerability, what to expect if the vulnerability is accepted or
21 | declined, etc.
22 |
--------------------------------------------------------------------------------
/_config.yml:
--------------------------------------------------------------------------------
1 | theme: jekyll-theme-cayman
--------------------------------------------------------------------------------
/async/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | *.iml
3 | node_modules
4 | target
--------------------------------------------------------------------------------
/async/README.md:
--------------------------------------------------------------------------------
1 | 异步任务
--------------------------------------------------------------------------------
/async/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
22 | * Date: 2016/4/1 15:38
23 | * Description: RabbitMq启动器
24 | * Copyright(©) 2015 by xiaomo.
25 | **/
26 | @Configuration
27 | @EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class})
28 | @ComponentScan("info.xiaomo")
29 | @EntityScan("info.xiaomo.*.model")
30 | public class AsyncMain {
31 | public static void main(String[] args) throws Exception {
32 | SpringApplication.run(AsyncMain.class, args);
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/async/src/main/java/info/xiaomo/anysc/task/AsyncTask.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.anysc.task;
2 |
3 | import org.springframework.scheduling.annotation.Async;
4 | import org.springframework.scheduling.annotation.AsyncResult;
5 | import org.springframework.stereotype.Component;
6 |
7 | import java.util.Random;
8 | import java.util.concurrent.Future;
9 |
10 | /**
11 | * @author : xiaomo
12 | */
13 | @Component
14 | public class AsyncTask {
15 |
16 | private static Random random = new Random();
17 |
18 | @Async
19 | public Future
19 | * Date: 2016/4/1 20:37
20 | * Copyright(©) 2015 by xiaomo.
21 | **/
22 |
23 | @MappedSuperclass
24 | @Data
25 | public abstract class BaseModel implements Serializable {
26 |
27 | @Id
28 | @GeneratedValue(strategy = GenerationType.AUTO)
29 | @Column(name = "Id")
30 | private Long id;
31 |
32 | @Column(name = "Name")
33 | private String name;
34 |
35 | @Column(name = "CreateTime")
36 | private Date createTime;
37 |
38 | @Column(name = "UpdateTime")
39 | private Date updateTime;
40 | }
41 |
--------------------------------------------------------------------------------
/core/src/main/java/info/xiaomo/core/base/BaseService.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.core.base;
2 |
3 | import org.springframework.data.domain.Page;
4 | import org.springframework.stereotype.Service;
5 |
6 | import java.util.List;
7 |
8 | /**
9 | * @author : xiaomo (https://xiaomo.info) (https://github.com/houko)
10 | * @version : 2017/1/11 16:42
11 | */
12 | @Service
13 | public interface BaseService
15 | * Date: 2016/10/31 15:25
16 | * Description: 返回结果
17 | * Copyright(©) 2015 by xiaomo.
18 | */
19 | @Data
20 | public class Result
13 | * Date: 2016/10/29 10:59
14 | * Description: 错误码
15 | * Copyright(©) 2015 by xiaomo.
16 | */
17 | public enum CodeConst {
18 | /**
19 | * success
20 | */
21 | SUCCESS(200, "成功"),
22 | NOT_FOUNT(404, "找不到"),
23 | REPEAT(992, "数据重复"),
24 | CodeOR(993, "系统错误"),
25 | ADMIN_USER_REPEAT(994, "后台用户名重复"),
26 | NULL_DATA(995, "没有数据"),
27 | TIME_PASSED(996, "时间己过期"),
28 | USER_NOT_FOUND(997, "找不到用户"),
29 | USER_REPEAT(998, "用户重复"),
30 | AUTH_FAILED(999, "用户名或密码错误");
31 |
32 |
33 | private int resultCode;
34 | private String message;
35 |
36 | CodeConst(int resultCode) {
37 | this.resultCode = resultCode;
38 | }
39 |
40 | CodeConst(String message) {
41 | this.message = message;
42 | }
43 |
44 | CodeConst(int resultCode, String message) {
45 | this.resultCode = resultCode;
46 | this.message = message;
47 | }
48 |
49 | public int getResultCode() {
50 | return resultCode;
51 | }
52 |
53 | public void setResultCode(int resultCode) {
54 | this.resultCode = resultCode;
55 | }
56 |
57 | public String getMessage() {
58 | return message;
59 | }
60 |
61 | public void setMessage(String message) {
62 | this.message = message;
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/core/src/main/java/info/xiaomo/core/constant/GenderConst.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.core.constant;
2 |
3 | /**
4 | * 把今天最好的表现当作明天最新的起点..~
5 | * いま 最高の表現 として 明日最新の始発..~
6 | * Today the best performance as tomorrow newest starter!
7 |
8 | *
9 | * @author : xiaomo
10 | * github: https://github.com/houko
11 | * email: xiaomo@xiaomo.info
12 | *
13 | * Date: 2016/1/12 16:37
14 | * Description: 性别
15 | * Copyright(©) 2015 by xiaomo.
16 | **/
17 | public interface GenderConst {
18 |
19 | int SECRET = 0;
20 |
21 | int MAN = 1;
22 |
23 | int WOMAN = 2;
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/core/src/main/java/info/xiaomo/core/constant/SymbolConst.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.core.constant;
2 |
3 | /**
4 | * @author : xiaomo
5 | */
6 | public class SymbolConst {
7 | public static final String JINHAO = "#";
8 | public static final String AND = "&";
9 | public static final String SHUXIAN = "\\|";
10 | public static final String JINHAO_TWO = "##";
11 | public static final String GANTANHAO = "!";
12 | public static final String FENHAO = ";";
13 | public static final String HENGXIAN = "-";
14 | public static final String JINHAO__AND_GANTANHAO = "#!";
15 | public static final String JINHAO_AND_BAIFENHAO = "#%";
16 | public static final String DOUHAO = ",";
17 | public static final String DIAN = ".";
18 | public static final String ZHENGXIEXIAN = "/";
19 | public static final String DENGHAO = "=";
20 | public static final String SPACE = " ";
21 | public static final String AT = "@";
22 | }
23 |
--------------------------------------------------------------------------------
/core/src/main/java/info/xiaomo/core/exception/UserNotFoundException.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.core.exception;
2 |
3 | /**
4 | * │\__╭╭╭╭╭__/│
5 | * │ │
6 | * │ │
7 | * │ - -│
8 | * │≡ o ≡ │
9 | * │ │
10 | * ╰——┬O◤▽◥O┬——╯
11 | * | o |
12 | * |╭---╮把今天最好的表现当作明天最新的起点..~
13 | * いま 最高の表現 として 明日最新の始発..~
14 | * Today the best performance as tomorrow newest starter!
15 |
16 | *
17 | * @author : xiaomo
18 | * github: https://github.com/houko
19 | * email: xiaomo@xiaomo.info
20 | *
21 | * Date: 16/4/3 11:08
22 | * Description: 找不到用户异常
23 | * Copyright(©) 2015 by xiaomo.
24 | */
25 | public class UserNotFoundException extends Exception {
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/core/src/main/java/info/xiaomo/core/field/LoginField.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.core.field;
2 |
3 | /**
4 | * 把今天最好的表现当作明天最新的起点..~
5 | * いま 最高の表現 として 明日最新の始発..~
6 | * Today the best performance as tomorrow newest starter!
7 |
8 | *
9 | * @author : xiaomo
10 | * github: https://github.com/houko
11 | * email: xiaomo@xiaomo.info(83387856)
12 | * Date: 2016/1/8 13:16
13 | * Description: QQ登录常量类
14 | * Copyright(©) 2015 by xiaomo.
15 | */
16 | public interface LoginField {
17 |
18 | String Q_Q_OPEN_ID = "openid";
19 | String Q_Q_NICKNAME = "nickname";
20 | String Q_Q_PHOTOURL = "figureurl_qq_2";
21 | String Q_Q_GENDER = "gender";
22 | String SINA_NICK_NAME = "screen_name";
23 | String SINA_OPEN_ID = "id";
24 | String SINA_HEAD_PHOTO = "avatar_large";
25 | String GITHUB_NICK_NAME = "name";
26 | String GITHUB_OPEN_ID = "id";
27 | String GITHUB_HEAD_PHOTO = "avatar_url";
28 | String GITHUB_EMAIL = "email";
29 | String BAIDU_NICK_NAME = "name";
30 | String BAIDU_OPEN_ID = "id";
31 | String BAIDU_HEAD_PHOTO = "avatar_url";
32 | String BAIDU_GENDER = "";
33 |
34 | String OSC_NICK_NAME = "name";
35 | String OSC_OPEN_ID = "id";
36 | String OSC_HEAD_PHOTO = "avatar";
37 | String OSC_EMAIL = "email";
38 | String OSC_GENDER = "gender";
39 |
40 | String RENREN_NICK_NAME = "name";
41 | String RENREN_OPEN_ID = "id";
42 | String RENREN_HEAD_PHOTO = "url";
43 | String RENREN_EMAIL = "email";
44 | String RENREN_GENDER = "gender";
45 | String RENREN_PHOTO = "avatar";
46 |
47 | String ID = "id";
48 | String PASSWORD = "password";
49 | String EMAIL = "email";
50 | String EMAILVERIFY = "emailVerify";
51 | String SEX = "gender";
52 | String BIRTHDAY = "birthday";
53 | String STATUS = "status";
54 | String LAST_LOGIN_TIME = "lastLoginTime";
55 |
56 | String TYPE = "type";
57 | String CONTRIBUTION = "contribution";
58 | String AUTHORITY = "authority";
59 | String UPDATETIME = "updateTime";
60 | String CREATETIME = "createTime";
61 | String INDEX = "/index.html";
62 | }
63 |
--------------------------------------------------------------------------------
/core/src/main/java/info/xiaomo/core/filter/CorsFilter.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.core.filter;
2 |
3 | import org.springframework.stereotype.Component;
4 |
5 | import javax.servlet.*;
6 | import javax.servlet.http.HttpServletResponse;
7 | import java.io.IOException;
8 |
9 | /**
10 | * 把今天最好的表现当作明天最新的起点..~
11 | * いま 最高の表現 として 明日最新の始発..~
12 | * Today the best performance as tomorrow newest starter!
13 |
14 | *
15 | * @author : xiaomo
16 | * github: https://github.com/houko
17 | * email: xiaomo@xiaomo.info
18 | *
19 | * Date: 2016/4/1516:25
20 | * Description:
21 | * Copyright(©) 2015 by xiaomo.
22 | **/
23 | @Component
24 | public class CorsFilter implements Filter {
25 |
26 |
27 | /**
28 | * 初始化
29 | *
30 | * @param filterConfig filterConfig
31 | * @throws ServletException ServletException
32 | */
33 | @Override
34 | public void init(FilterConfig filterConfig) throws ServletException {
35 |
36 | }
37 |
38 | /**
39 | * CORS 过滤器
40 | *
41 | * @param req rq
42 | * @param res res
43 | * @param chain chin
44 | * @throws IOException IOException
45 | * @throws ServletException ServletException
46 | */
47 | @Override
48 | public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
49 | HttpServletResponse response = (HttpServletResponse) res;
50 | response.setHeader("Access-Control-Allow-Origin", "*");
51 | response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
52 | response.setHeader("Access-Control-Max-Age", "3600");
53 | response.setHeader("Access-Control-Allow-Headers", "Origin, Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers, If-Modified-Since");
54 | chain.doFilter(req, res);
55 | }
56 |
57 |
58 | /**
59 | * 销毁对象
60 | */
61 | @Override
62 | public void destroy() {
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/core/src/main/java/info/xiaomo/core/filter/CustomDateSerializerFilter.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.core.filter;
2 |
3 | import com.fasterxml.jackson.core.JsonGenerator;
4 | import com.fasterxml.jackson.databind.JsonSerializer;
5 | import com.fasterxml.jackson.databind.SerializerProvider;
6 | import info.xiaomo.core.untils.TimeUtil;
7 |
8 | import java.io.IOException;
9 | import java.text.SimpleDateFormat;
10 | import java.util.Date;
11 |
12 | /**
13 | * @author : xiaomo
14 | */
15 | public class CustomDateSerializerFilter extends JsonSerializer
15 | * Date: 2016/11/31 9:50
16 | * Copyright(©) 2015 by xiaomo.
17 | **/
18 |
19 | public class AuthUtil {
20 | public static boolean isAuthorized(HttpSession session) {
21 | String currentUser = (String) session.getAttribute("currentUser");
22 | return !(currentUser == null || currentUser.isEmpty());
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/core/src/main/java/info/xiaomo/core/untils/DownUtil.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.core.untils;
2 |
3 | import lombok.extern.slf4j.Slf4j;
4 |
5 | import java.io.File;
6 | import java.io.FileOutputStream;
7 | import java.io.InputStream;
8 | import java.io.OutputStream;
9 | import java.net.URL;
10 | import java.net.URLConnection;
11 |
12 | /**
13 | * @author : xiaomo (https://xiaomo.info) (https://github.com/houko)
14 | * @created : 2016/12/26 13:25
15 | */
16 | @Slf4j
17 | public class DownUtil {
18 |
19 | public static void download(String urlString) throws Exception {
20 | File file = new File(urlString);
21 | String filename = file.getName();
22 | // 构造URL
23 | URL url = new URL(urlString);
24 | // 打开连接
25 | URLConnection con = url.openConnection();
26 | // 输入流
27 | InputStream is = con.getInputStream();
28 | // 1K的数据缓冲
29 | byte[] bs = new byte[1024];
30 | // 读取到的数据长度
31 | int len;
32 | // 输出的文件流
33 | OutputStream os = new FileOutputStream(filename);
34 | // 开始读取
35 | while ((len = is.read(bs)) != -1) {
36 | os.write(bs, 0, len);
37 | }
38 | // 完毕,关闭所有链接
39 | os.close();
40 | is.close();
41 | }
42 |
43 |
44 | /**
45 | * 下载图片
46 | *
47 | * @param urlString url
48 | * @param filePath 存储路径 D:\MIR\config\data\
49 | */
50 | public static void download(String urlString, String filePath) throws Exception {
51 | File file = new File(urlString);
52 | String filename = file.getName();
53 | // 构造URL
54 | URL url = new URL(urlString);
55 | // 打开连接
56 | URLConnection con = url.openConnection();
57 | // 输入流
58 | InputStream is = con.getInputStream();
59 | // 1K的数据缓冲
60 | byte[] bs = new byte[1024];
61 | // 读取到的数据长度
62 | int len;
63 | // 输出的文件流
64 |
65 | File output = new File(filePath);
66 | if (!output.exists()) {
67 | boolean res = output.mkdir();
68 | if (res) {
69 | log.debug("{} 目录创建成功", filePath);
70 | }
71 | }
72 |
73 | OutputStream os = new FileOutputStream(filePath + filename);
74 | // 开始读取
75 | while ((len = is.read(bs)) != -1) {
76 | os.write(bs, 0, len);
77 | }
78 | // 完毕,关闭所有链接
79 | os.close();
80 | is.close();
81 | }
82 |
83 | }
84 |
--------------------------------------------------------------------------------
/core/src/main/java/info/xiaomo/core/untils/IDUtil.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.core.untils;
2 |
3 | import org.slf4j.Logger;
4 | import org.slf4j.LoggerFactory;
5 |
6 |
7 | /**
8 | * @author : xiaomo
9 | */
10 | public class IDUtil {
11 | private static final Logger LOGGER = LoggerFactory.getLogger(IDUtil.class);
12 | /**
13 | * 锁
14 | */
15 | private static final Object ID_LOCK = new Object();
16 | /**
17 | * 当前秒数
18 | */
19 | private static long CURRENT_SECOND = System.currentTimeMillis() / 1000L;
20 | private static int ID = 0;
21 |
22 | public static void main(String[] args) {
23 | LOGGER.info(String.valueOf(Integer.MAX_VALUE / (365 * 24 * 60 * 60)));
24 | LOGGER.info(Integer.toBinaryString((int) (System.currentTimeMillis() / 1000)));
25 | }
26 |
27 | /**
28 | * 获取唯一一个id
29 | *
30 | * @return long
31 | */
32 | public static long getId() {
33 | int tempId;
34 | long tempCurSec = System.currentTimeMillis() / 1000L;
35 | synchronized (ID_LOCK) {
36 | ID += 1;
37 | tempId = ID;
38 | int i = 65000;
39 | if (ID > i) {
40 | ID = 0;
41 | CURRENT_SECOND += 1L;
42 | }
43 | if (tempCurSec > CURRENT_SECOND) {
44 | CURRENT_SECOND = tempCurSec;
45 | } else {
46 | tempCurSec = CURRENT_SECOND;
47 | }
48 | }
49 | return ((tempCurSec) << 16 | tempId & 0xFFFF);
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/core/src/main/java/info/xiaomo/core/untils/Md5Util.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.core.untils;
2 |
3 | import java.security.MessageDigest;
4 |
5 | /**
6 | * │\__╭╭╭╭╭__/│
7 | * │ │
8 | * │ │
9 | * │ - -│
10 | * │≡ o ≡ │
11 | * │ │
12 | * ╰——┬O◤▽◥O┬——╯
13 | * | o |
14 | * |╭---╮把今天最好的表现当作明天最新的起点..~
15 | * いま 最高の表現 として 明日最新の始発..~
16 | * Today the best performance as tomorrow newest starter!
17 |
18 | *
19 | * @author : xiaomo
20 | * github: https://github.com/houko
21 | * email: xiaomo@xiaomo.info
22 | *
23 | * Date: 16/4/3 10:03
24 | * Description: md5加密解密
25 | * Copyright(©) 2015 by xiaomo.
26 | */
27 | public class Md5Util {
28 |
29 | private final static String[] HEX_DIGITS = {
30 | "0", "1", "2", "3", "4", "5", "6", "7",
31 | "8", "9", "a", "b", "c", "d", "e", "f"};
32 |
33 | /**
34 | * 转换字节数组为16进制字串
35 | *
36 | * @param b 字节数组
37 | * @return 16进制字串
38 | */
39 | public static String byteArrayToString(byte[] b) {
40 | StringBuilder resultSb = new StringBuilder();
41 | for (byte aB : b) {
42 | //若使用本函数转换则可得到加密结果的16进制表示,即数字字母混合的形式
43 | resultSb.append(byteToHexString(aB));
44 | }
45 | return resultSb.toString();
46 | }
47 |
48 | private static String byteToNumString(byte b) {
49 |
50 | int tempB = b;
51 | if (tempB < 0) {
52 | tempB = 256 + tempB;
53 | }
54 |
55 | return String.valueOf(tempB);
56 | }
57 |
58 | private static String byteToHexString(byte b) {
59 | int n = b;
60 | if (n < 0) {
61 | n = 256 + n;
62 | }
63 | int d1 = n / 16;
64 | int d2 = n % 16;
65 | return HEX_DIGITS[d1] + HEX_DIGITS[d2];
66 | }
67 |
68 | public static String encode(String password, String salt) {
69 | String resultString = null;
70 | try {
71 | resultString = password + salt;
72 | MessageDigest md = MessageDigest.getInstance("md5");
73 | resultString = byteArrayToString(md.digest(resultString.getBytes()));
74 | } catch (Exception ex) {
75 | ex.printStackTrace();
76 | }
77 | return resultString;
78 | }
79 |
80 | public static void main(String[] args) {
81 | String password = "xiaomo";
82 | String salt = RandomUtil.createSalt();
83 | System.out.println("原数据:" + password);
84 | System.out.println("盐值:" + salt);
85 | System.out.println("MD5后:" + encode(password, salt));
86 | }
87 |
88 | }
89 |
--------------------------------------------------------------------------------
/core/src/main/java/info/xiaomo/core/untils/PropsUtil.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.core.untils;
2 |
3 | import java.io.FileInputStream;
4 | import java.io.InputStream;
5 | import java.util.Properties;
6 |
7 | /**
8 | * @author : xiaomo
9 | */
10 | public class PropsUtil {
11 |
12 | /**
13 | * 构造函数
14 | * 找到数据源,并用这个数据源创建连接
15 | */
16 | private PropsUtil() {
17 |
18 | }
19 |
20 | public static Properties getProperties(String url) {
21 | Properties properties = null;
22 | try {
23 | InputStream fs = new FileInputStream(url);
24 | properties = new Properties();
25 | properties.load(fs);
26 | } catch (Exception e) {
27 | e.printStackTrace();
28 | }
29 | return properties;
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/core/src/main/java/info/xiaomo/core/untils/SerializeUtil.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.core.untils;
2 |
3 | import java.io.*;
4 | import java.nio.charset.StandardCharsets;
5 |
6 | /**
7 | * │\__╭╭╭╭╭__/│
8 | * │ │
9 | * │ │
10 | * │ - -│
11 | * │≡ o ≡ │
12 | * │ │
13 | * ╰——┬O◤▽◥O┬——╯
14 | * | o |
15 | * |╭---╮把今天最好的表现当作明天最新的起点..~
16 | * いま 最高の表現 として 明日最新の始発..~
17 | * Today the best performance as tomorrow newest starter!
18 |
19 | *
20 | * @author : xiaomo
21 | * github: https://github.com/houko
22 | * email: xiaomo@xiaomo.info
23 | *
24 | * Date: 15/9/6 16:05
25 | * Description: 序列化通用方法
26 | * Copyright(©) 2015 by xiaomo.
27 | */
28 | public class SerializeUtil {
29 |
30 | /**
31 | * 序列化
32 | */
33 | public static String serialize(Object object) {
34 | if (object == null) {
35 | return null;
36 | }
37 | ObjectOutputStream oos;
38 | ByteArrayOutputStream baos;
39 | try {
40 | baos = new ByteArrayOutputStream();
41 | oos = new ObjectOutputStream(baos);
42 | oos.writeObject(object);
43 | byte[] bytes = baos.toByteArray();
44 | return new String(bytes, StandardCharsets.UTF_8);
45 | } catch (Exception e) {
46 | e.printStackTrace();
47 | }
48 | return null;
49 | }
50 |
51 | /**
52 | * 反序列化
53 | */
54 | public static Object unserialize(String s) throws UnsupportedEncodingException {
55 | byte[] bytes = s.getBytes(StandardCharsets.UTF_8);
56 | ByteArrayInputStream bais;
57 | try {
58 | //反序列化
59 | bais = new ByteArrayInputStream(bytes);
60 | ObjectInputStream ois = new ObjectInputStream(bais);
61 | return ois.readObject();
62 | } catch (Exception e) {
63 | e.printStackTrace();
64 | }
65 | return null;
66 | }
67 | }
--------------------------------------------------------------------------------
/core/src/main/java/info/xiaomo/core/untils/SqlUtil.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.core.untils;
2 |
3 | import org.apache.commons.lang3.StringUtils;
4 |
5 | import java.util.Arrays;
6 | import java.util.StringTokenizer;
7 |
8 | /**
9 | * 把今天最好的表现当作明天最新的起点..~
10 | * いま 最高の表現 として 明日最新の始発..~
11 | * Today the best performance as tomorrow newest starter!
12 | *
13 | *
14 | * @author : xiaomo
15 | * github: https://github.com/syoubaku
16 | * email: xiaomo@xiamoo.info
17 | * QQ_NO: 83387856
18 | * Date: 17/5/11 17:56
19 | * Description:
20 | * Copyright(©) 2017 by xiaomo.
21 | */
22 | public class SqlUtil {
23 |
24 |
25 | /**
26 | * 功能描述: 生成sql占位符 ?,?,?
27 | *
28 | * @return String 返回类型
29 | */
30 | public static String sqlHolder(int size) {
31 | String[] paras = new String[size];
32 | Arrays.fill(paras, "?");
33 | return StringUtils.join(paras, ',');
34 | }
35 |
36 | /**
37 | * sql语句 处理
38 | *
39 | * @param sql 要进行处理的sql语句
40 | * @param dbtype 数据库类型
41 | * @return 处理后的sql语句
42 | */
43 | public static String sql4DB(String sql, String dbtype) {
44 | String oracle = "oracle";
45 | if (!oracle.equalsIgnoreCase(dbtype)) {
46 | sql = StringUtil.toISO(sql);
47 | }
48 | return sql;
49 | }
50 |
51 | private String delNewSQlString(String sql) {
52 | return "in (" + sql.replace('|', ',') + ")";
53 | }
54 |
55 | private String delSQlString(String sql) {
56 | StringBuilder delSql = new StringBuilder("in(");
57 | StringTokenizer tokenizer = new StringTokenizer(sql, "|");
58 |
59 | // 标记本身等于分隔符的特殊情况
60 | delSql.append(tokenizer.nextToken());
61 | while (tokenizer.hasMoreTokens()) {
62 | delSql.append(tokenizer.nextToken()).append(",");
63 | }
64 | delSql = new StringBuilder(delSql.substring(0, delSql.length() - 1) + ")");
65 | return delSql.toString();
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/core/src/main/java/info/xiaomo/core/untils/TokenUtil.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.core.untils;
2 |
3 | import com.alibaba.fastjson.JSONObject;
4 | import info.xiaomo.core.constant.SymbolConst;
5 |
6 | import java.util.regex.Matcher;
7 | import java.util.regex.Pattern;
8 |
9 | /**
10 | * Token 帮助类
11 | *
12 | * @author : xiaomo
13 | */
14 | public class TokenUtil {
15 |
16 | private static final String STR_S = "abcdefghijklmnopqrstuvwxyz0123456789";
17 |
18 | /**
19 | * 参考自 qq sdk
20 | *
21 | * @param string string
22 | * @return String 返回类型
23 | */
24 | public static String getAccessToken(String string) {
25 | String accessToken = "";
26 | try {
27 | JSONObject json = JSONObject.parseObject(string);
28 | if (null != json) {
29 | accessToken = json.getString("access_token");
30 | }
31 | } catch (Exception e) {
32 | String regex = "^access_token=(\\w+)&expires_in=(\\w+)&refresh_token=(\\w+)$";
33 | Matcher m = Pattern.compile(regex).matcher(string);
34 | if (m.find()) {
35 | accessToken = m.group(1);
36 | } else {
37 | String regex1 = "^access_token=(\\w+)&expires_in=(\\w+)$";
38 | Matcher m2 = Pattern.compile(regex1).matcher(string);
39 | if (m2.find()) {
40 | accessToken = m2.group(1);
41 | } else {
42 | String temp = string.split(SymbolConst.DENGHAO)[1];
43 | accessToken = temp.split(SymbolConst.AND)[0];
44 | }
45 | }
46 | }
47 | return accessToken;
48 | }
49 |
50 | /**
51 | * 匹配openid
52 | *
53 | * @return String 返回类型
54 | */
55 | public static String getOpenId(String string) {
56 | String openid = null;
57 | String regex = "\"openid\"\\s*:\\s*\"(\\w+)\"";
58 | Matcher m = Pattern.compile(regex).matcher(string);
59 | if (m.find()) {
60 | openid = m.group(1);
61 | }
62 | return openid;
63 | }
64 |
65 | /**
66 | * sina uid于qq分离
67 | *
68 | * @return String 返回类型
69 | */
70 | public static String getUid(String string) {
71 | JSONObject json = JSONObject.parseObject(string);
72 | return json.getString("uid");
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/core/src/main/resources/config/oauth.properties:
--------------------------------------------------------------------------------
1 | ## qq openid
2 | openid_qq=101292993
3 | openkey_qq=e1bee0c32c149b66a295f295646ad092
4 | redirect_qq=http://static.xiaomo.info/qq/callback
5 | ## sina openid
6 | openid_sina=4193705357
7 | openkey_sina=bc7bbdfe92be06b42b38206f8bca3645
8 | redirect_sina=http://static.xiaomo.info/sina/callback
9 | ## baidu openid
10 | openid_baidu=xwKOgtKjbbrn9dOb7ZkGrAo5
11 | openkey_baidu=dNlKN4vVqgZvROrWW8twc4wESGWkSfF8
12 | redirect_baidu=http://static.xiaomo.info/baidu/callback
13 | ## renren openid
14 | openid_renren=80cd6ab8bc924c97b78e06568196456e
15 | openkey_renren=51aab0e2633f43a2aeda89f299a7b4f8
16 | redirect_renren=http://static.xiaomo.info/renren/callback
17 | ## osc openid
18 | openid_osc=R6XS1Qnhist6jy5UABer
19 | openkey_osc=llvILNi5ThQj2YwgbM6qx7BOEKIfJjjM
20 | redirect_osc=http://static.xiaomo.info/osc/callback
21 | ## douban openid
22 | openid_douban=04e962ea4e22c5980ebc28beea6850c8
23 | openkey_douban=d7ae6ac47ddf75e2
24 | redirect_douban=http://static.xiaomo.info/douban/callback
25 | ## github openid `no tested`
26 | openid_github=
27 | openkey_github=
28 | redirect_github=
--------------------------------------------------------------------------------
/crawler/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | *.iml
3 | node_modules
4 | target
--------------------------------------------------------------------------------
/crawler/README.md:
--------------------------------------------------------------------------------
1 | 网络爬虫
--------------------------------------------------------------------------------
/crawler/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 | *
18 | * @author : xiaomo
19 | * github: https://github.com/houko
20 | * email: xiaomo@xiaomo.info
21 | *
22 | * Date: 2016/4/1 15:38
23 | * Copyright(©) 2015 by xiaomo.
24 | **/
25 | @Configuration
26 | @EnableAutoConfiguration
27 | @EnableScheduling
28 | @Configurable
29 | @EnableJpaRepositories("info.xiaomo.*.dao")
30 | @ComponentScan("info.xiaomo")
31 | public class CrawlerMain {
32 | public static void main(String[] args) throws Exception {
33 | SpringApplication.run(CrawlerMain.class, args);
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/crawler/src/main/java/info/xiaomo/crawler/dao/ShikigamaDao.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.crawler.dao;
2 |
3 | import info.xiaomo.crawler.model.ShikigamiModel;
4 | import org.springframework.data.jpa.repository.JpaRepository;
5 | import org.springframework.stereotype.Repository;
6 |
7 | /**
8 | * @author : xiaomo (https://xiaomo.info) (https://github.com/houko)
9 | * @created : 2016/12/24 15:55
10 | */
11 | @Repository
12 | public interface ShikigamaDao extends JpaRepository
21 | * Date: 2016/4/1 15:38
22 | * Copyright(©) 2015 by xiaomo.
23 | **/
24 | @Configuration
25 | @ComponentScan("info.xiaomo")
26 | @EntityScan("info.xiaomo.*.model")
27 | @EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class})
28 | public class FreemarkerMain {
29 |
30 | public static void main(String[] args) throws Exception {
31 | SpringApplication.run(FreemarkerMain.class, args);
32 | }
33 |
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/freemarker/src/main/java/info/xiaomo/freemarker/controller/FreemarkerController.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.freemarker.controller;
2 |
3 | import org.springframework.stereotype.Controller;
4 | import org.springframework.ui.ModelMap;
5 | import org.springframework.web.bind.annotation.RequestMapping;
6 |
7 | /**
8 | * 把今天最好的表现当作明天最新的起点..~
9 | * いま 最高の表現 として 明日最新の始発..~
10 | * Today the best performance as tomorrow newest starter!
11 |
12 | *
13 | * @author : xiaomo
14 | * github: https://github.com/houko
15 | * email: xiaomo@xiaomo.info
16 | *
17 | * Date: 2016/11/16 10:19
18 | * Copyright(©) 2015 by xiaomo.
19 | **/
20 |
21 | @Controller
22 | public class FreemarkerController {
23 |
24 | @RequestMapping("hello")
25 | public String hello(ModelMap map) {
26 | map.put("host", "使用freemarker!");
27 | return "index";
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/freemarker/src/main/resources/config/application.properties:
--------------------------------------------------------------------------------
1 | logging.config=classpath:config/logback-dev.xml
2 | server.port=8080
3 |
4 | server.max-http-header-size=20971520
5 |
6 | spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
7 | spring.jackson.time-zone=GMT+8
8 |
9 | spring.freemarker.charset=utf-8
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/freemarker/src/main/resources/config/banner-girl.txt:
--------------------------------------------------------------------------------
1 | .::::.
2 | .::::::::.
3 | :::::::::::
4 | ..:::::::::::'
5 | '::::::::::::'
6 | .::::::::::
7 | '::::::::::::::..
8 | ..::::::::::::.
9 | ``::::::::::::::::
10 | ::::``:::::::::' .:::.
11 | ::::' ':::::' .::::::::.
12 | .::::' :::: .:::::::'::::.
13 | .:::' ::::: .:::::::::' ':::::.
14 | .::' :::::.:::::::::' ':::::.
15 | .::' ::::::::::::::' ``::::.
16 | ...::: ::::::::::::' ``::.
17 | ```` ':. ':::::::::' ::::..
18 | '.:::::' ':'````..
19 | :: Spring Boot :: (v2.0.0.RELEASE)
--------------------------------------------------------------------------------
/freemarker/src/main/resources/config/logback-dev.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
21 | * Date: 2016/11/15 15:49
22 | * Copyright(©) 2015 by xiaomo.
23 | **/
24 |
25 | @RestController
26 | @RequestMapping("mongodb")
27 | @Api("mongodb測試")
28 | public class MongoUserController {
29 |
30 | private final MongoUserService service;
31 |
32 | @Autowired
33 | public MongoUserController(MongoUserService service) {
34 | this.service = service;
35 | }
36 |
37 | @RequestMapping(value = "get/{id}", method = RequestMethod.GET)
38 | public Result get(@PathVariable("id") Long id) {
39 | MongoUser mongoUser = service.findById(id);
40 | return new Result<>(mongoUser);
41 | }
42 |
43 | @RequestMapping(value = "findAll", method = RequestMethod.GET)
44 | public Result findAll() {
45 | return new Result<>(service.findAll());
46 | }
47 |
48 |
49 | @RequestMapping(value = "add", method = RequestMethod.POST)
50 | public Result add(@RequestBody MongoUser user) {
51 | return new Result<>(service.add(user));
52 | }
53 |
54 | @RequestMapping(value = "delete/{id}", method = RequestMethod.GET)
55 | public Result delete(@PathVariable("id") Long id) {
56 | service.delete(id);
57 | return new Result<>(CodeConst.SUCCESS.getResultCode(), CodeConst.SUCCESS.getMessage());
58 | }
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/mongodb/src/main/java/info/xiaomo/mongodb/dao/MongoUserDao.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.mongodb.dao;
2 |
3 | import info.xiaomo.mongodb.model.MongoUser;
4 | import org.springframework.data.mongodb.repository.MongoRepository;
5 | import org.springframework.stereotype.Repository;
6 |
7 | /**
8 | * 把今天最好的表现当作明天最新的起点..~
9 | * いま 最高の表現 として 明日最新の始発..~
10 | * Today the best performance as tomorrow newest starter!
11 |
12 | *
13 | * @author : xiaomo
14 | * github: https://github.com/houko
15 | * email: xiaomo@xiaomo.info
16 | *
17 | * Date: 2016/11/15 15:42
18 | * Description: 用户实体类
19 | * Copyright(©) 2015 by xiaomo.
20 | **/
21 |
22 | @Repository
23 | public interface MongoUserDao extends MongoRepository
21 | * Date: 2016/11/15 15:39
22 | * Description: 用户实体类
23 | * Copyright(©) 2015 by xiaomo.
24 | **/
25 |
26 | @Data
27 | @ToString(callSuper = false)
28 | @NoArgsConstructor
29 | @AllArgsConstructor
30 | public class MongoUser {
31 |
32 | @Id
33 | private int id;
34 |
35 | @ApiModelProperty(value = "登录用户")
36 | private String email;
37 |
38 | @ApiModelProperty(value = "昵称")
39 | private String userName;
40 |
41 | @ApiModelProperty(value = "密码")
42 | private String password;
43 |
44 | @ApiModelProperty(value = "盐值")
45 | private String salt;
46 |
47 | @ApiModelProperty(value = "激活码")
48 | private String validateCode;
49 |
50 | @ApiModelProperty(value = "性别:1男2女0保密")
51 | private int gender = 0;
52 |
53 | @ApiModelProperty(value = "电话")
54 | private Long phone = 0L;
55 |
56 | @ApiModelProperty(value = "图片地址")
57 | private String imgUrl = "";
58 |
59 | @ApiModelProperty(value = "地址")
60 | private String address = "";
61 |
62 | @ApiModelProperty(value = "注册时间(时间戳)")
63 | private Long registerTime = 0L;
64 | }
65 |
--------------------------------------------------------------------------------
/mongodb/src/main/java/info/xiaomo/mongodb/service/MongoUserService.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.mongodb.service;
2 |
3 | import info.xiaomo.mongodb.model.MongoUser;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * 把今天最好的表现当作明天最新的起点..~
9 | * いま 最高の表現 として 明日最新の始発..~
10 | * Today the best performance as tomorrow newest starter!
11 |
12 | *
13 | * @author : xiaomo
14 | * github: https://github.com/houko
15 | * email: xiaomo@xiaomo.info
16 | *
17 | * Date: 2016/11/15 15:45
18 | * Copyright(©) 2015 by xiaomo.
19 | **/
20 |
21 |
22 | public interface MongoUserService {
23 |
24 | /**
25 | * 查所有
26 | *
27 | * @return
28 | */
29 | List
22 | * Date: 2016/11/15 15:45
23 | * Copyright(©) 2015 by xiaomo.
24 | **/
25 |
26 | @Service
27 | public class MongoUserServiceImpl implements MongoUserService {
28 | private final MongoUserDao dao;
29 |
30 | @Autowired
31 | public MongoUserServiceImpl(MongoUserDao dao) {
32 | this.dao = dao;
33 | }
34 |
35 | @Override
36 | public List
21 | * Date: 2016/11/16 10:45
22 | * Description: 用户实体类
23 | * Copyright(©) 2015 by xiaomo.
24 | **/
25 |
26 | @RestController
27 | public class MultipleSourceController {
28 | private final JdbcTemplate jdbcTemplate1;
29 |
30 | private final JdbcTemplate jdbcTemplate2;
31 |
32 | @Autowired
33 | public MultipleSourceController(@Qualifier("primaryJdbcTemplate") JdbcTemplate jdbcTemplate1, @Qualifier("secondaryJdbcTemplate") JdbcTemplate jdbcTemplate2) {
34 | this.jdbcTemplate1 = jdbcTemplate1;
35 | this.jdbcTemplate2 = jdbcTemplate2;
36 | this.jdbcTemplate1.update(Sql.dropUser);
37 | this.jdbcTemplate2.update(Sql.dropUser);
38 | }
39 |
40 |
41 | @RequestMapping("/")
42 | public Result index() {
43 | // 往第一个数据源中插入两条数据
44 | jdbcTemplate1.update(Sql.addUser, "xiaomo", 20);
45 | jdbcTemplate2.update(Sql.addUser, "xiaoming", 30);
46 |
47 | int count1 = jdbcTemplate1.queryForObject(Sql.selectUser, Integer.class);
48 | int count2 = jdbcTemplate2.queryForObject(Sql.selectUser, Integer.class);
49 | return new Result<>(new Object[]{count1, count2});
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/multipleSource/src/main/java/info/xiaomo/multiplesource/domain/User.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.multiplesource.domain;
2 |
3 |
4 | import lombok.Data;
5 | import lombok.NoArgsConstructor;
6 | import lombok.ToString;
7 |
8 | /**
9 | * @author : xiaomo
10 | */
11 | @Data
12 | @ToString(callSuper = false)
13 | @NoArgsConstructor
14 | public class User {
15 |
16 | private Long id;
17 |
18 | private String name;
19 |
20 | private Integer age;
21 |
22 | public User(Long id, String name, Integer age) {
23 | this.id = id;
24 | this.name = name;
25 | this.age = age;
26 | }
27 |
28 | public User(String name, Integer age) {
29 | this.name = name;
30 | this.age = age;
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/multipleSource/src/main/java/info/xiaomo/multiplesource/sql/Sql.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.multiplesource.sql;
2 |
3 | /**
4 | * 把今天最好的表现当作明天最新的起点..~
5 | * いま 最高の表現 として 明日最新の始発..~
6 | * Today the best performance as tomorrow newest starter!
7 | *
8 | * @author : xiaomo
9 | * github: https://github.com/houko
10 | * email: xiaomo@xiaomo.info
11 | *
12 | * Date: 2016/11/16 11:29
13 | * Description: 用户实体类
14 | * Copyright(©) 2015 by xiaomo.
15 | **/
16 |
17 | public class Sql {
18 |
19 | public static String dropUser = "DELETE FROM user";
20 | public static String addUser = "insert into user(name,age) values(?, ?)";
21 | public static String selectUser = "select count(1) from user";
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/multipleSource/src/main/resources/config/application.properties:
--------------------------------------------------------------------------------
1 | logging.config=classpath:config/logback-dev.xml
2 | server.port=8080
3 |
4 | server.max-http-header-size=20971520
5 |
6 | spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
7 | spring.jackson.time-zone=GMT+8
8 |
9 | #database1
10 | spring.datasource.primary.url=jdbc:mysql://ip:3306/test1?characterEncoding=utf8&useSSL=true
11 | spring.datasource.primary.username=\u4F60\u7684\u5E10\u53F7
12 | spring.datasource.primary.password=\u4F60\u7684\u5BC6\u7801
13 | spring.datasource.primary.driver-class-name=com.mysql.cj.jdbc.Driver
14 |
15 | #database2
16 | spring.datasource.secondary.url=jdbc:mysql://ip:3306/test2?characterEncoding=utf8&useSSL=true
17 | spring.datasource.secondary.username=\u5E10\u53F7
18 | spring.datasource.secondary.password=\u4F60\u7684\u5BC6\u7801
19 | spring.datasource.secondary.driver-class-name=com.mysql.cj.jdbc.Driver
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/multipleSource/src/main/resources/config/banner-girl.txt:
--------------------------------------------------------------------------------
1 | .::::.
2 | .::::::::.
3 | :::::::::::
4 | ..:::::::::::'
5 | '::::::::::::'
6 | .::::::::::
7 | '::::::::::::::..
8 | ..::::::::::::.
9 | ``::::::::::::::::
10 | ::::``:::::::::' .:::.
11 | ::::' ':::::' .::::::::.
12 | .::::' :::: .:::::::'::::.
13 | .:::' ::::: .:::::::::' ':::::.
14 | .::' :::::.:::::::::' ':::::.
15 | .::' ::::::::::::::' ``::::.
16 | ...::: ::::::::::::' ``::.
17 | ```` ':. ':::::::::' ::::..
18 | '.:::::' ':'````..
19 | :: Spring Boot :: (v2.0.0.RELEASE)
--------------------------------------------------------------------------------
/multipleSource/src/main/resources/config/logback-dev.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
19 | * Date: 2016/4/1 15:38
20 | * Copyright(©) 2015 by xiaomo.
21 | **/
22 | @Configuration
23 | @EnableAutoConfiguration
24 | @ComponentScan("info.xiaomo")
25 | @EntityScan("info.xiaomo.*.model")
26 | public class MybatisMain {
27 |
28 | public static void main(String[] args) throws Exception {
29 | SpringApplication.run(MybatisMain.class, args);
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/mybatis/src/main/java/info/xiaomo/mybatis/controller/MybatisUserController.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.mybatis.controller;
2 |
3 | import info.xiaomo.core.base.Result;
4 | import info.xiaomo.mybatis.domain.User;
5 | import info.xiaomo.mybatis.mapper.UserMapper;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.web.bind.annotation.RequestMapping;
8 | import org.springframework.web.bind.annotation.RestController;
9 |
10 | import java.util.List;
11 |
12 | /**
13 | * 把今天最好的表现当作明天最新的起点..~
14 | * いま 最高の表現 として 明日最新の始発..~
15 | * Today the best performance as tomorrow newest starter!
16 |
17 | *
18 | * @author : xiaomo
19 | * github: https://github.com/houko
20 | * email: xiaomo@xiaomo.info
21 | *
22 | * Date: 2016/11/16 9:41
23 | * Description: 用户实体类
24 | * Copyright(©) 2015 by xiaomo.
25 | **/
26 |
27 | @RestController
28 | public class MybatisUserController {
29 |
30 | private final UserMapper userMapper;
31 |
32 | @Autowired
33 | public MybatisUserController(UserMapper userMapper) {
34 | this.userMapper = userMapper;
35 | }
36 |
37 |
38 | @RequestMapping("/")
39 | public Result
30 | * Date: 16/4/2 12:39
31 | * Copyright(©) 2015 by xiaomo.
32 | */
33 | @Entity
34 | @Table(name = "adminUser")
35 | @Data
36 | @ToString(callSuper = true)
37 | @EqualsAndHashCode(callSuper = false)
38 | @AllArgsConstructor
39 | @NoArgsConstructor
40 | public class OrderModel extends BaseModel implements Serializable {
41 |
42 | @Column(name = "UserName")
43 | private String userName;
44 |
45 | @Column(name = "Password")
46 | private String password;
47 |
48 | @Column(name = "Status")
49 | private int status = 1;
50 |
51 | @Column(name = "Salt")
52 | private String salt;
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/order/src/main/java/info/xiaomo/order/service/OrderService.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.order.service;
2 |
3 | /**
4 | * @author xiaomo
5 | */
6 | public interface OrderService {
7 |
8 |
9 | }
10 |
--------------------------------------------------------------------------------
/order/src/main/java/info/xiaomo/order/service/impl/OrderServiceImpl.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.order.service.impl;
2 |
3 | import info.xiaomo.order.service.OrderService;
4 | import org.springframework.stereotype.Service;
5 |
6 | /**
7 | * @author xiaomo
8 | */
9 | @Service
10 | public class OrderServiceImpl implements OrderService {
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/rabbitmq/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | *.iml
3 | node_modules
4 | target
--------------------------------------------------------------------------------
/rabbitmq/README.md:
--------------------------------------------------------------------------------
1 | 消息队列
--------------------------------------------------------------------------------
/rabbitmq/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
19 | *
20 | * @author : xiaomo
21 | * github: https://github.com/houko
22 | * email: xiaomo@xiaomo.info
23 | *
24 | * Date: 2016/4/1 15:38
25 | * Description: RabbitMq启动器
26 | * Copyright(©) 2015 by xiaomo.
27 | **/
28 | @Configuration
29 | @ComponentScan("info.xiaomo")
30 | @EnableScheduling
31 | @EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class})
32 | public class RabbitMqMain {
33 | public static void main(String[] args) throws Exception {
34 | SpringApplication.run(RabbitMqMain.class, args);
35 | }
36 |
37 | @Bean
38 | public Queue helloQueue() {
39 | return new Queue("hello");
40 | }
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/rabbitmq/src/main/java/info/xiaomo/rabbitmq/config/Receiver.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.rabbitmq.config;
2 |
3 | import org.springframework.amqp.rabbit.annotation.RabbitHandler;
4 | import org.springframework.amqp.rabbit.annotation.RabbitListener;
5 | import org.springframework.stereotype.Component;
6 |
7 | /**
8 | * @author : xiaomo
9 | */
10 | @Component
11 | @RabbitListener(queues = "hello")
12 | public class Receiver {
13 |
14 | @RabbitHandler
15 | public void process(String hello) {
16 | System.out.println("Receiver : " + hello);
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/rabbitmq/src/main/java/info/xiaomo/rabbitmq/config/Sender.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.rabbitmq.config;
2 |
3 | import org.springframework.amqp.core.AmqpTemplate;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.stereotype.Component;
6 |
7 | import java.util.Date;
8 |
9 | /**
10 | * @author : xiaomo
11 | */
12 | @Component
13 | public class Sender {
14 |
15 | private final AmqpTemplate rabbitTemplate;
16 |
17 | @Autowired
18 | public Sender(AmqpTemplate rabbitTemplate) {
19 | this.rabbitTemplate = rabbitTemplate;
20 | }
21 |
22 | public void send() {
23 | String context = "hello " + new Date();
24 | System.out.println("Sender : " + context);
25 | this.rabbitTemplate.convertAndSend("hello", context);
26 | }
27 |
28 | }
--------------------------------------------------------------------------------
/rabbitmq/src/main/resources/config/application.properties:
--------------------------------------------------------------------------------
1 | logging.config=classpath:config/logback-dev.xml
2 | server.port=8080
3 |
4 | server.max-http-header-size=20971520
5 |
6 | # \u914D\u7F6E\u8FD9\u4E2A\u503C\u5C31\u53EF\u4EE5\u683C\u5F0F\u5316\u65F6\u95F4
7 | spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
8 | spring.jackson.time-zone=GMT+8
9 |
10 | # rabbitmq
11 | spring.application.name=rabbitmq-\u4F60\u7684\u5BC6\u7801
12 | spring.rabbitmq.host=ip
13 | spring.rabbitmq.port=5672
14 | spring.rabbitmq.username=\u4F60\u7684\u5BC6\u7801
15 | spring.rabbitmq.password=\u4F60\u7684\u5BC6\u7801
--------------------------------------------------------------------------------
/rabbitmq/src/main/resources/config/logback-dev.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
22 | * Date: 2016/4/1 15:38
23 | * Description: Redis启动器
24 | * Copyright(©) 2015 by xiaomo.
25 | **/
26 | @Configuration
27 | @EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class})
28 | @ComponentScan("info.xiaomo")
29 | @EnableCaching
30 | @EnableScheduling
31 | public class RedisMain {
32 | public static void main(String[] args) throws Exception {
33 | SpringApplication.run(RedisMain.class, args);
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/redis/src/main/java/info/xiaomo/redis/controller/TestController.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.redis.controller;
2 |
3 | import info.xiaomo.core.base.Result;
4 | import info.xiaomo.redis.dao.CommonRedisDao;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.web.bind.annotation.PathVariable;
7 | import org.springframework.web.bind.annotation.RequestMapping;
8 | import org.springframework.web.bind.annotation.RequestMethod;
9 | import org.springframework.web.bind.annotation.RestController;
10 |
11 | /**
12 | * 把今天最好的表现当作明天最新的起点..~
13 | * いま 最高の表現 として 明日最新の始発..~
14 | * Today the best performance as tomorrow newest starter!
15 |
16 | *
17 | * @author : xiaomo
18 | * github: https://github.com/houko
19 | * email: xiaomo@xiaomo.info
20 | *
21 | * Date: 2016/11/14 17:25
22 | * Copyright(©) 2015 by xiaomo.
23 | **/
24 |
25 | @RestController
26 | @RequestMapping("/redis")
27 | public class TestController {
28 |
29 | private final CommonRedisDao dao;
30 |
31 | @Autowired
32 | public TestController(CommonRedisDao dao) {
33 | this.dao = dao;
34 | }
35 |
36 | @RequestMapping(value = "get/{key}", method = RequestMethod.GET)
37 | public Result
22 | * Date: 2016/4/1 15:31
23 | * Description: 任务启动器
24 | * Copyright(©) 2015 by xiaomo.
25 | **/
26 | @Configuration
27 | @EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class})
28 | @ComponentScan("info.xiaomo")
29 | @EnableScheduling
30 | @EnableAsync
31 | public class ScheduledMain {
32 | public static void main(String[] args) {
33 | SpringApplication.run(ScheduledMain.class, args);
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/scheduled/src/main/java/info/xiaomo/scheduled/task/ScheduledTasks.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.scheduled.task;
2 |
3 | import lombok.extern.slf4j.Slf4j;
4 | import org.springframework.scheduling.annotation.Scheduled;
5 | import org.springframework.stereotype.Component;
6 |
7 | import java.text.SimpleDateFormat;
8 |
9 | /**
10 | * @author : xiaomo
11 | */
12 | @Component
13 | @Slf4j
14 | public class ScheduledTasks {
15 |
16 | private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("HH:mm:ss");
17 |
18 | // 定义某个定时任务
19 | @Scheduled(fixedRate = 5000)
20 | public void reportCurrentTime() {
21 | log.debug("每5秒钟执行一次,注意观察日志时间");
22 | }
23 |
24 |
25 | /**
26 | * 字段 允许值 允许的特殊字符
27 | * 秒 0-59 , - * /
28 | * 分 0-59 , - * /
29 | * 小时 0-23 , - * /
30 | * 日期 1-31 , - * / L W C
31 | * 月份 1-12 或者 JAN-DEC , - * /
32 | * 星期 1-7 或者 SUN-SAT , - * / L C #
33 | * 年(可选) 留空, 1970-2099 , - * /
34 | *
35 | * “*”字符被用来指定所有的值。如:”*“在分钟的字段域里表示“每分钟”。
36 | * “-”字符被用来指定一个范围。如:“10-12”在小时域意味着“10点、11点、12点”。
37 | * “,”字符被用来指定另外的值。如:“MON,WED,FRI”在星期域里表示”星期一、星期三、星期五”.
38 | * “?”字符只在日期域和星期域中使用。它被用来指定“非明确的值”。当你需要通过在这两个域中的一个来指定一些东西的时候,它是有用的。看下面的例子你就会明白。
39 | * “L”字符指定在月或者星期中的某天(最后一天)。即“Last ”的缩写。但是在星期和月中“L”表示不同的意思,如:在月子段中“L”指月份的最后一天-1月31日,2月28日,如果在星期字段中则简单的表示为“7”或者“SAT”。如果在星期字段中在某个value值得后面,则表示“某月的最后一个星期value”,如“6L”表示某月的最后一个星期五。
40 | * “W”字符只能用在月份字段中,该字段指定了离指定日期最近的那个星期日。
41 | * “#”字符只能用在星期字段,该字段指定了第几个星期value在某月中
42 | **/
43 | //每1分钟执行一次
44 | @Scheduled(cron = "0 */1 * * * * ")
45 | public void reportCurrentByCron() {
46 | log.debug("每分钟执行一次,注意观察日志时间");
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/scheduled/src/main/resources/config/application.properties:
--------------------------------------------------------------------------------
1 | logging.config=classpath:config/logback-dev.xml
2 | server.port=8080
3 |
4 | server.max-http-header-size=20971520
5 |
6 | # \u914D\u7F6E\u8FD9\u4E2A\u503C\u5C31\u53EF\u4EE5\u683C\u5F0F\u5316\u65F6\u95F4
7 | spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
8 | spring.jackson.time-zone=GMT+8
9 |
--------------------------------------------------------------------------------
/scheduled/src/main/resources/config/logback-dev.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
27 | * Date: 2016/4/1 15:38
28 | * Description: RabbitMq启动器
29 | * Copyright(©) 2015 by xiaomo.
30 | **/
31 | @Configuration
32 | @EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class})
33 | @ComponentScan("info.xiaomo")
34 | @EntityScan("info.xiaomo.*.model")
35 | @EnableWebSecurity
36 | public class SecurityMain extends WebSecurityConfigurerAdapter {
37 | public static void main(String[] args) throws Exception {
38 | SpringApplication.run(SecurityMain.class, args);
39 | }
40 |
41 | @Override
42 | protected void configure(HttpSecurity http) throws Exception {
43 | http.authorizeRequests()
44 | .antMatchers("/", "/home").permitAll()
45 | .anyRequest().authenticated()
46 | .and()
47 | .formLogin()
48 | .loginPage("/login")
49 | .permitAll()
50 | .and()
51 | .logout()
52 | .permitAll();
53 | }
54 |
55 | @Autowired
56 | public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
57 | auth.inMemoryAuthentication()
58 | .withUser("test").password("test").roles("USER");
59 | }
60 |
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/security/src/main/java/info/xiaomo/security/controller/HelloController.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.security.controller;
2 |
3 | import org.springframework.stereotype.Controller;
4 | import org.springframework.web.bind.annotation.RequestMapping;
5 | import org.springframework.web.bind.annotation.RequestMethod;
6 |
7 | /**
8 | * @author : xiaomo
9 | */
10 | @Controller
11 | public class HelloController {
12 |
13 | @RequestMapping("/")
14 | public String index() {
15 | return "index";
16 | }
17 |
18 | @RequestMapping("/hello")
19 | public String hello() {
20 | return "hello";
21 | }
22 |
23 | @RequestMapping(value = "/login", method = RequestMethod.GET)
24 | public String login() {
25 | return "login";
26 | }
27 |
28 | }
--------------------------------------------------------------------------------
/security/src/main/resources/config/application.properties:
--------------------------------------------------------------------------------
1 | logging.config=classpath:config/logback-dev.xml
2 | server.port=8080
3 |
4 | server.max-http-header-size=20971520
5 | # \u914D\u7F6E\u8FD9\u4E2A\u503C\u5C31\u53EF\u4EE5\u683C\u5F0F\u5316\u65F6\u95F4
6 | spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
7 | spring.jackson.time-zone=GMT+8
8 |
--------------------------------------------------------------------------------
/security/src/main/resources/config/logback-dev.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 点击 这里 打个招呼吧
23 | * Date: 2016/4/1 15:38
24 | * Description: 后台管理启动器
25 | * Copyright(©) 2015 by xiaomo.
26 | **/
27 | @Configuration
28 | @EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class})
29 | @ComponentScan("info.xiaomo")
30 | @EntityScan("info.xiaomo.*.model")
31 | public class ChatMain {
32 |
33 | public static void main(String[] args) throws Exception {
34 | SpringApplication.run(ChatMain.class, args);
35 | }
36 |
37 |
38 | @Bean
39 | public ServerEndpointExporter serverEndpointExporter() {
40 | return new ServerEndpointExporter();
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/socket/src/main/resources/config/application.properties:
--------------------------------------------------------------------------------
1 | logging.config=classpath:config/logback-dev.xml
2 | server.port=8081
3 |
4 | server.max-http-header-size=20971520
5 |
6 |
7 |
--------------------------------------------------------------------------------
/socket/src/main/resources/config/logback-dev.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
21 | * Date: 2016/12/1 15:38
22 | * Copyright(©) 2015 by xiaomo.
23 | **/
24 | @Configuration
25 | @EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class})
26 | @ComponentScan("info.xiaomo")
27 | @EntityScan("info.xiaomo.*.model")
28 | public class ThymeleafMain {
29 |
30 | public static void main(String[] args) throws Exception {
31 | SpringApplication.run(ThymeleafMain.class, args);
32 | }
33 |
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/thymeleaf/src/main/java/info/xiaomo/thymeleaf/controller/ThymeleafController.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.thymeleaf.controller;
2 |
3 | import org.springframework.stereotype.Controller;
4 | import org.springframework.ui.ModelMap;
5 | import org.springframework.web.bind.annotation.RequestMapping;
6 |
7 | /**
8 | * 把今天最好的表现当作明天最新的起点..~
9 | * いま 最高の表現 として 明日最新の始発..~
10 | * Today the best performance as tomorrow newest starter!
11 |
12 | *
13 | * @author : xiaomo
14 | * github: https://github.com/houko
15 | * email: xiaomo@xiaomo.info
16 | *
17 | * Date: 2016/11/16 10:19
18 | * Copyright(©) 2015 by xiaomo.
19 | **/
20 |
21 | @Controller
22 | public class ThymeleafController {
23 |
24 | @RequestMapping("/")
25 | public String hello(ModelMap map) {
26 | map.put("hello", "使用thymeleaf!");
27 | return "index";
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/thymeleaf/src/main/resources/config/application.properties:
--------------------------------------------------------------------------------
1 | logging.config=classpath:config/logback-dev.xml
2 | server.port=8080
3 |
4 | server.max-http-header-size=20971520
5 |
6 | spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
7 | spring.jackson.time-zone=GMT+8
8 |
9 |
--------------------------------------------------------------------------------
/thymeleaf/src/main/resources/config/banner-girl.txt:
--------------------------------------------------------------------------------
1 | .::::.
2 | .::::::::.
3 | :::::::::::
4 | ..:::::::::::'
5 | '::::::::::::'
6 | .::::::::::
7 | '::::::::::::::..
8 | ..::::::::::::.
9 | ``::::::::::::::::
10 | ::::``:::::::::' .:::.
11 | ::::' ':::::' .::::::::.
12 | .::::' :::: .:::::::'::::.
13 | .:::' ::::: .:::::::::' ':::::.
14 | .::' :::::.:::::::::' ':::::.
15 | .::' ::::::::::::::' ``::::.
16 | ...::: ::::::::::::' ``::.
17 | ```` ':. ':::::::::' ::::..
18 | '.:::::' ':'````..
19 | :: Spring Boot :: (v2.0.0.RELEASE)
--------------------------------------------------------------------------------
/thymeleaf/src/main/resources/config/logback-dev.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
18 | * Date: 2016/11/14 11:06
19 | * Description: 用户实体类
20 | * Copyright(©) 2015 by xiaomo.
21 | **/
22 |
23 | @RestController
24 | @RequestMapping("/mail")
25 | public class MailController {
26 |
27 | @RequestMapping(value = "/send", method = RequestMethod.GET)
28 | public boolean sendMail() {
29 | return MailUtil.send("hupengbest@163.com", "测试邮件是否正常", "测试");
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/website/src/main/java/info/xiaomo/website/dao/AdminUserDao.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.website.dao;
2 |
3 | import info.xiaomo.website.model.AdminModel;
4 | import org.springframework.data.jpa.repository.JpaRepository;
5 | import org.springframework.stereotype.Repository;
6 |
7 | /**
8 | * │\__╭╭╭╭╭__/│
9 | * │ │
10 | * │ │
11 | * │ - -│
12 | * │≡ o ≡ │
13 | * │ │
14 | * ╰——┬O◤▽◥O┬——╯
15 | * | o |
16 | * |╭---╮把今天最好的表现当作明天最新的起点..~
17 | * いま 最高の表現 として 明日最新の始発..~
18 | * Today the best performance as tomorrow newest starter!
19 |
20 | *
21 | * @author : xiaomo
22 | * github: https://github.com/houko
23 | * email: xiaomo@xiaomo.info
24 | *
25 | * Date: 16/4/2 13:08
26 | * Copyright(©) 2015 by xiaomo.
27 | */
28 | @Repository
29 | public interface AdminUserDao extends JpaRepository
17 | * Date: 2016/4/1119:52
18 | * Copyright(©) 2015 by xiaomo.
19 | **/
20 | @Repository
21 | public interface ChangeLogDao extends JpaRepository
17 | * Date: 2016/4/1119:52
18 | * Copyright(©) 2015 by xiaomo.
19 | **/
20 | @Repository
21 | public interface LinkDao extends JpaRepository
25 | * Date: 16/4/2 13:08
26 | * Copyright(©) 2015 by xiaomo.
27 | */
28 | @Repository
29 | public interface TechnologyDao extends JpaRepository
25 | * Date: 16/4/3 10:53
26 | * Copyright(©) 2015 by xiaomo.
27 | */
28 |
29 | @Repository
30 | public interface UserDao extends JpaRepository
25 | * Date: 16/4/2 13:08
26 | * Copyright(©) 2015 by xiaomo.
27 | */
28 | @Repository
29 | public interface WorksDao extends JpaRepository
22 | * Date: 2016/4/1 20:46
23 | * Description: 公共dao层
24 | * Copyright(©) 2015 by xiaomo.
25 | **/
26 | @Repository
27 | @Transactional(rollbackFor = {})
28 | public class CommonDao {
29 |
30 | @PersistenceContext
31 | private EntityManager entityManager;
32 |
33 | public
20 | * Date: 2016/11/21 10:42
21 | * Copyright(©) 2015 by xiaomo.
22 | **/
23 |
24 | public class LoginInterceptor implements HandlerInterceptor {
25 | @Override
26 | public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o) throws Exception {
27 | UserModel user = (UserModel) httpServletRequest.getSession().getAttribute("currentUser");
28 | if (user == null) {
29 | //用户没有登录
30 | httpServletResponse.sendRedirect(httpServletRequest.getContextPath() + "/user/toLogin");
31 | return false;
32 | }
33 | //用户已经登录
34 | return true;
35 |
36 | }
37 |
38 | @Override
39 | public void postHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, ModelAndView modelAndView) throws Exception {
40 |
41 | }
42 |
43 | @Override
44 | public void afterCompletion(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) throws Exception {
45 |
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/website/src/main/java/info/xiaomo/website/model/AdminModel.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.website.model;
2 |
3 |
4 | import info.xiaomo.core.base.BaseModel;
5 | import lombok.*;
6 |
7 | import javax.persistence.Column;
8 | import javax.persistence.Entity;
9 | import javax.persistence.Table;
10 | import java.io.Serializable;
11 |
12 | /**
13 | * │\__╭╭╭╭╭__/│
14 | * │ │
15 | * │ │
16 | * │ - -│
17 | * │≡ o ≡ │
18 | * │ │
19 | * ╰——┬O◤▽◥O┬——╯
20 | * | o |
21 | * |╭---╮把今天最好的表现当作明天最新的起点..~
22 | * いま 最高の表現 として 明日最新の始発..~
23 | * Today the best performance as tomorrow newest starter!
24 |
25 | *
26 | * @author : xiaomo
27 | * github: https://github.com/houko
28 | * email: xiaomo@xiaomo.info
29 | *
30 | * Date: 16/4/2 12:39
31 | * Copyright(©) 2015 by xiaomo.
32 | */
33 | @Entity
34 | @Table(name = "adminUser")
35 | @Data
36 | @ToString(callSuper = true)
37 | @EqualsAndHashCode(callSuper = false)
38 | @AllArgsConstructor
39 | @NoArgsConstructor
40 | public class AdminModel extends BaseModel implements Serializable {
41 |
42 | @Column(name = "UserName")
43 | private String userName;
44 |
45 | @Column(name = "Password")
46 | private String password;
47 |
48 | @Column(name = "Status")
49 | private int status = 1;
50 |
51 | @Column(name = "Salt")
52 | private String salt;
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/website/src/main/java/info/xiaomo/website/model/ChangeLogModel.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.website.model;
2 |
3 |
4 | import info.xiaomo.core.base.BaseModel;
5 | import lombok.*;
6 |
7 | import javax.persistence.Column;
8 | import javax.persistence.Entity;
9 | import javax.persistence.Table;
10 | import java.io.Serializable;
11 |
12 | /**
13 | * 把今天最好的表现当作明天最新的起点..~
14 | * いま 最高の表現 として 明日最新の始発..~
15 | * Today the best performance as tomorrow newest starter!
16 |
17 | *
18 | * @author : xiaomo
19 | * github: https://github.com/houko
20 | * email: xiaomo@xiaomo.info
21 | *
22 | * Date: 2016/4/517:17
23 | * Copyright(©) 2015 by xiaomo.
24 | **/
25 | @Entity
26 | @Table(name = "changeLog")
27 | @Data
28 | @ToString(callSuper = true)
29 | @EqualsAndHashCode(callSuper = false)
30 | @AllArgsConstructor
31 | @NoArgsConstructor
32 | public class ChangeLogModel extends BaseModel implements Serializable {
33 |
34 | @Column(name = "Name")
35 | private String name;
36 |
37 | @Column(name = "OnlineTime")
38 | private String onlineTime;
39 | }
40 |
--------------------------------------------------------------------------------
/website/src/main/java/info/xiaomo/website/model/LinkModel.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.website.model;
2 |
3 |
4 | import info.xiaomo.core.base.BaseModel;
5 | import lombok.*;
6 |
7 | import javax.persistence.Column;
8 | import javax.persistence.Entity;
9 | import javax.persistence.Table;
10 | import java.io.Serializable;
11 |
12 | /**
13 | * 把今天最好的表现当作明天最新的起点..~
14 | * いま 最高の表現 として 明日最新の始発..~
15 | * Today the best performance as tomorrow newest starter!
16 |
17 | *
18 | * @author : xiaomo
19 | * github: https://github.com/houko
20 | * email: xiaomo@xiaomo.info
21 | *
22 | * Date: 2016/4/1119:47
23 | * Copyright(©) 2015 by xiaomo.
24 | **/
25 | @Entity
26 | @Table(name = "link")
27 | // lomlok
28 | @Data
29 | @ToString(callSuper = true)
30 | @EqualsAndHashCode(callSuper = false)
31 | @AllArgsConstructor
32 | @NoArgsConstructor
33 | public class LinkModel extends BaseModel implements Serializable {
34 |
35 | @Column(name = "Name")
36 | private String name;
37 |
38 | @Column(name = "Url")
39 | private String url;
40 | }
41 |
--------------------------------------------------------------------------------
/website/src/main/java/info/xiaomo/website/model/TechnologyModel.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.website.model;
2 |
3 |
4 | import info.xiaomo.core.base.BaseModel;
5 | import lombok.*;
6 |
7 | import javax.persistence.Column;
8 | import javax.persistence.Entity;
9 | import javax.persistence.Table;
10 |
11 | /**
12 | * 把今天最好的表现当作明天最新的起点..~
13 | * いま 最高の表現 として 明日最新の始発..~
14 | * Today the best performance as tomorrow newest starter!
15 |
16 | *
17 | * @author : xiaomo
18 | * github: https://github.com/houko
19 | * email: xiaomo@xiaomo.info
20 | *
21 | * Date: 2016/11/3 14:27
22 | * Copyright(©) 2015 by xiaomo.
23 | **/
24 |
25 | @Entity
26 | @Table(name = "technology")
27 | // lomlok
28 | @Data
29 | @ToString(callSuper = true)
30 | @EqualsAndHashCode(callSuper = false)
31 | @AllArgsConstructor
32 | @NoArgsConstructor
33 | public class TechnologyModel extends BaseModel {
34 |
35 | @Column(name = "Name")
36 | private String name;
37 |
38 | @Column(name = "Url")
39 | private String url;
40 |
41 | @Column(name = "Summary")
42 | private String summary;
43 |
44 | @Column(name = "ImgUrl")
45 | private String imgUrl;
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/website/src/main/java/info/xiaomo/website/model/UserModel.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.website.model;
2 |
3 |
4 | import info.xiaomo.core.base.BaseModel;
5 | import lombok.*;
6 |
7 | import javax.persistence.Column;
8 | import javax.persistence.Entity;
9 | import javax.persistence.Table;
10 | import java.io.Serializable;
11 |
12 | /**
13 | * 把今天最好的表现当作明天最新的起点..~
14 | * いま 最高の表現 として 明日最新の始発..~
15 | * Today the best performance as tomorrow newest starter!
16 |
17 | *
18 | * @author : xiaomo
19 | * github: https://github.com/houko
20 | * email: xiaomo@xiaomo.info
21 | *
22 | * Date: 2016/4/1 17:36
23 | * Copyright(©) 2015 by xiaomo.
24 | **/
25 | @Entity
26 | @Table(name = "user")
27 | // lomlok
28 | @Data
29 | @ToString(callSuper = true)
30 | @EqualsAndHashCode(callSuper = false)
31 | @AllArgsConstructor
32 | @NoArgsConstructor
33 | public class UserModel extends BaseModel implements Serializable {
34 |
35 | @Column(name = "Email")
36 | private String email;
37 |
38 | @Column(name = "NickName")
39 | private String nickName;
40 |
41 | @Column(name = "Password")
42 | private String password;
43 |
44 | @Column(name = "Salt")
45 | private String salt;
46 |
47 | @Column(name = "Gender")
48 | private int gender = 0;
49 |
50 | @Column(name = "Phone")
51 | private Long phone = 0L;
52 |
53 | @Column(name = "ValidateCode")
54 | private String validateCode = "";
55 |
56 | @Column(name = "ImgUrl")
57 | private String imgUrl = "";
58 |
59 | @Column(name = "Address")
60 | private String address = "";
61 |
62 | @Column(name = "RegisterTime")
63 | private Long registerTime = 0L;
64 |
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/website/src/main/java/info/xiaomo/website/model/WorksModel.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.website.model;
2 |
3 |
4 | import info.xiaomo.core.base.BaseModel;
5 | import lombok.*;
6 |
7 | import javax.persistence.Column;
8 | import javax.persistence.Entity;
9 | import javax.persistence.Table;
10 |
11 | /**
12 | * 把今天最好的表现当作明天最新的起点..~
13 | * いま 最高の表現 として 明日最新の始発..~
14 | * Today the best performance as tomorrow newest starter!
15 |
16 | *
17 | * @author : xiaomo
18 | * github: https://github.com/houko
19 | * email: xiaomo@xiaomo.info
20 | *
21 | * Date: 2016/11/3 14:15
22 | * Copyright(©) 2015 by xiaomo.
23 | **/
24 |
25 | // hibernate
26 | @Entity
27 | @Table(name = "works")
28 | // lomlok
29 | @Data
30 | @ToString(callSuper = true)
31 | @EqualsAndHashCode(callSuper = false)
32 | @AllArgsConstructor
33 | @NoArgsConstructor
34 | public class WorksModel extends BaseModel {
35 |
36 | @Column(name = "Name")
37 | private String name;
38 |
39 | @Column(name = "Url")
40 | private String url;
41 |
42 | @Column(name = "Summary")
43 | private String summary;
44 |
45 | @Column(name = "CompleteTime")
46 | private String completeTime;
47 |
48 | @Column(name = "ImgUrl")
49 | private String imgUrl;
50 | }
51 |
--------------------------------------------------------------------------------
/website/src/main/java/info/xiaomo/website/service/AdminUserService.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.website.service;
2 |
3 | import info.xiaomo.core.exception.UserNotFoundException;
4 | import info.xiaomo.website.model.AdminModel;
5 | import org.springframework.data.domain.Page;
6 |
7 | import java.util.List;
8 |
9 | /**
10 | * │\__╭╭╭╭╭__/│
11 | * │ │
12 | * │ │
13 | * │ - -│
14 | * │≡ o ≡ │
15 | * │ │
16 | * ╰——┬O◤▽◥O┬——╯
17 | * | o |
18 | * |╭---╮把今天最好的表现当作明天最新的起点..~
19 | * いま 最高の表現 として 明日最新の始発..~
20 | * Today the best performance as tomorrow newest starter!
21 |
22 | *
23 | * @author : xiaomo
24 | * github: https://github.com/houko
25 | * email: xiaomo@xiaomo.info
26 | *
27 | * Date: 16/4/2 13:04
28 | * Copyright(©) 2015 by xiaomo.
29 | */
30 | public interface AdminUserService {
31 |
32 | /**
33 | * 根据用户名查用户
34 | *
35 | * @param userName
36 | * @return
37 | */
38 | AdminModel findAdminUserByUserName(String userName);
39 |
40 | /**
41 | * 根据id查用户
42 | *
43 | * @param id
44 | * @return
45 | */
46 | AdminModel findAdminUserById(Long id);
47 |
48 | /**
49 | * 添加用户
50 | *
51 | * @param model
52 | * @return
53 | */
54 | AdminModel addAdminUser(AdminModel model);
55 |
56 | /**
57 | * 更新用户
58 | *
59 | * @param model
60 | * @return
61 | * @throws UserNotFoundException
62 | */
63 | AdminModel updateAdminUser(AdminModel model) throws UserNotFoundException;
64 |
65 | /**
66 | * 获取分页
67 | *
68 | * @param start
69 | * @param pageSize
70 | * @return
71 | */
72 | Page
18 | * Date: 2016/4/1119:49
19 | * Copyright(©) 2015 by xiaomo.
20 | **/
21 | public interface ChangeLogService {
22 |
23 | /**
24 | * 根据id查
25 | *
26 | * @param id
27 | * @return
28 | */
29 | ChangeLogModel findById(Long id);
30 |
31 | /**
32 | * 根据名字查
33 | *
34 | * @param name
35 | * @return
36 | */
37 | ChangeLogModel findByName(String name);
38 |
39 | /**
40 | * find all
41 | *
42 | * @param start
43 | * @param pageSize
44 | * @return
45 | */
46 | Page
19 | * Date: 2016/4/1119:49
20 | * Copyright(©) 2015 by xiaomo.
21 | **/
22 | public interface LinkService {
23 |
24 | /**
25 | * 根据id查友链
26 | *
27 | * @param id
28 | * @return
29 | */
30 | LinkModel findById(Long id);
31 |
32 | /**
33 | * 根据名字查友链
34 | *
35 | * @param name
36 | * @return
37 | */
38 | LinkModel findByName(String name);
39 |
40 | /**
41 | * 分页查
42 | *
43 | * @param start
44 | * @param pageSize
45 | * @return
46 | */
47 | Page
19 | * Date: 2016/11/3 14:33
20 | * Copyright(©) 2015 by xiaomo.
21 | **/
22 |
23 | public interface TechnologyService {
24 |
25 | /**
26 | * find all
27 | *
28 | * @return
29 | */
30 | List
21 | * Date: 2016/4/1 17:45
22 | * Copyright(©) 2015 by xiaomo.
23 | **/
24 | public interface UserService {
25 | /**
26 | * 根据id查用户
27 | *
28 | * @param id id
29 | * @return UserModel
30 | */
31 | Optional
19 | * Date: 2016/11/3 14:33
20 | * Copyright(©) 2015 by xiaomo.
21 | **/
22 |
23 | public interface WorksService {
24 |
25 | /**
26 | * find all
27 | *
28 | * @return
29 | */
30 | List
13 | * Date: 2016/11/21 11:12
14 | * Copyright(©) 2015 by xiaomo.
15 | **/
16 |
17 | public enum AdminUserView {
18 |
19 | /**
20 | * login
21 | */
22 | LOGIN("login"),
23 | REGISTER("register"),
24 | REGISTER_INFO("info"),
25 | INDEX("/web/index");
26 |
27 | private String name;
28 |
29 | AdminUserView(String name) {
30 | this.name = name;
31 | }
32 |
33 | public String getName() {
34 | return name;
35 | }
36 |
37 | public void setName(String name) {
38 | this.name = name;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/website/src/main/java/info/xiaomo/website/view/ChangeLogView.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.website.view;
2 |
3 | /**
4 | * 把今天最好的表现当作明天最新的起点..~
5 | * いま 最高の表現 として 明日最新の始発..~
6 | * Today the best performance as tomorrow newest starter!
7 |
8 | *
9 | * @author : xiaomo
10 | * github: https://github.com/houko
11 | * email: xiaomo@xiaomo.info
12 | *
13 | * Date: 2016/11/21 11:12
14 | * Copyright(©) 2015 by xiaomo.
15 | **/
16 |
17 | public enum ChangeLogView {
18 | /**
19 | * Login
20 | */
21 | LOGIN("login"),
22 | REGISTER("register"),
23 | REGISTER_INFO("info"),
24 | INDEX("/web/index");
25 |
26 | private String name;
27 |
28 | ChangeLogView(String name) {
29 | this.name = name;
30 | }
31 |
32 | public String getName() {
33 | return name;
34 | }
35 |
36 | public void setName(String name) {
37 | this.name = name;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/website/src/main/java/info/xiaomo/website/view/LinkView.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.website.view;
2 |
3 | /**
4 | * 把今天最好的表现当作明天最新的起点..~
5 | * いま 最高の表現 として 明日最新の始発..~
6 | * Today the best performance as tomorrow newest starter!
7 |
8 | *
9 | * @author : xiaomo
10 | * github: https://github.com/houko
11 | * email: xiaomo@xiaomo.info
12 | *
13 | * Date: 2016/11/21 11:12
14 | * Copyright(©) 2015 by xiaomo.
15 | **/
16 |
17 | public enum LinkView {
18 | /**
19 | * login
20 | */
21 | LOGIN("login"),
22 | REGISTER("register"),
23 | REGISTER_INFO("info"),
24 | INDEX("/web/index");
25 |
26 | private String name;
27 |
28 | LinkView(String name) {
29 | this.name = name;
30 | }
31 |
32 | public String getName() {
33 | return name;
34 | }
35 |
36 | public void setName(String name) {
37 | this.name = name;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/website/src/main/java/info/xiaomo/website/view/TechnologyView.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.website.view;
2 |
3 | /**
4 | * 把今天最好的表现当作明天最新的起点..~
5 | * いま 最高の表現 として 明日最新の始発..~
6 | * Today the best performance as tomorrow newest starter!
7 |
8 | *
9 | * @author : xiaomo
10 | * github: https://github.com/houko
11 | * email: xiaomo@xiaomo.info
12 | *
13 | * Date: 2016/11/21 11:12
14 | * Copyright(©) 2015 by xiaomo.
15 | **/
16 |
17 | public enum TechnologyView {
18 | /**
19 | * login
20 | */
21 | LOGIN("login"),
22 | REGISTER("register"),
23 | REGISTER_INFO("info"),
24 | INDEX("/web/index");
25 |
26 | private String name;
27 |
28 | TechnologyView(String name) {
29 | this.name = name;
30 | }
31 |
32 | public String getName() {
33 | return name;
34 | }
35 |
36 | public void setName(String name) {
37 | this.name = name;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/website/src/main/java/info/xiaomo/website/view/UserView.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.website.view;
2 |
3 | /**
4 | * 把今天最好的表现当作明天最新的起点..~
5 | * いま 最高の表現 として 明日最新の始発..~
6 | * Today the best performance as tomorrow newest starter!
7 |
8 | *
9 | * @author : xiaomo
10 | * github: https://github.com/houko
11 | * email: xiaomo@xiaomo.info
12 | *
13 | * Date: 2016/11/21 11:12
14 | * Copyright(©) 2015 by xiaomo.
15 | **/
16 |
17 | public enum UserView {
18 | /**
19 | * login
20 | */
21 | LOGIN("login"),
22 | REGISTER("register"),
23 | REGISTER_INFO("info"),
24 | INDEX("index"),
25 | API("swagger-ui.html");
26 |
27 | private String name;
28 |
29 | UserView(String name) {
30 | this.name = name;
31 | }
32 |
33 | public String getName() {
34 | return name;
35 | }
36 |
37 | public void setName(String name) {
38 | this.name = name;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/website/src/main/java/info/xiaomo/website/view/WorksView.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.website.view;
2 |
3 | /**
4 | * 把今天最好的表现当作明天最新的起点..~
5 | * いま 最高の表現 として 明日最新の始発..~
6 | * Today the best performance as tomorrow newest starter!
7 |
8 | *
9 | * @author : xiaomo
10 | * github: https://github.com/houko
11 | * email: xiaomo@xiaomo.info
12 | *
13 | * Date: 2016/11/21 11:12
14 | * Copyright(©) 2015 by xiaomo.
15 | **/
16 |
17 | public enum WorksView {
18 |
19 | /**
20 | * login
21 | */
22 | LOGIN("login"),
23 | REGISTER("register"),
24 | REGISTER_INFO("info"),
25 | INDEX("/web/index");
26 |
27 | private String name;
28 |
29 | WorksView(String name) {
30 | this.name = name;
31 | }
32 |
33 | public String getName() {
34 | return name;
35 | }
36 |
37 | public void setName(String name) {
38 | this.name = name;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/website/src/main/resources/config/application.properties:
--------------------------------------------------------------------------------
1 | logging.config=classpath:config/logback-dev.xml
2 | server.port=8080
3 |
4 | server.max-http-header-size=20971520
5 |
6 | #datasource
7 | spring.datasource.url=jdbc:mysql://ip/db?characterEncoding=utf8&useSSL=true
8 | # ?useUnicode=true&characterEncoding=UTF-8
9 | spring.datasource.username=username
10 | spring.datasource.password=password
11 | spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
12 | # \u914D\u7F6E\u8FD9\u4E2A\u503C\u5C31\u53EF\u4EE5\u683C\u5F0F\u5316\u65F6\u95F4
13 | #spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
14 | #spring.jackson.time-zone=GMT+8
15 |
16 | #jpa
17 | spring.jpa.database-platform=org.hibernate.dialect.MySQL5Dialect
18 | spring.jpa.hibernate.ddl-auto=update
19 | spring.jpa.show-sql=true
20 | spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
21 |
22 |
23 | # redis
24 | # Redis\u6570\u636E\u5E93\u7D22\u5F15\uFF08\u9ED8\u8BA4\u4E3A0\uFF09
25 | spring.redis.database=0
26 | spring.redis.host=ip
27 | spring.redis.port=6379
28 | spring.redis.password=
29 | # \u8FDE\u63A5\u6C60\u6700\u5927\u8FDE\u63A5\u6570\uFF08\u4F7F\u7528\u8D1F\u503C\u8868\u793A\u6CA1\u6709\u9650\u5236\uFF09
30 | spring.redis.pool.max-active=8
31 | # \u8FDE\u63A5\u6C60\u6700\u5927\u963B\u585E\u7B49\u5F85\u65F6\u95F4\uFF08\u4F7F\u7528\u8D1F\u503C\u8868\u793A\u6CA1\u6709\u9650\u5236\uFF09
32 | spring.redis.pool.max-wait=-1
33 | # \u8FDE\u63A5\u6C60\u4E2D\u7684\u6700\u5927\u7A7A\u95F2\u8FDE\u63A5
34 | spring.redis.pool.max-idle=8
35 | # \u8FDE\u63A5\u6C60\u4E2D\u7684\u6700\u5C0F\u7A7A\u95F2\u8FDE\u63A5
36 | spring.redis.pool.min-idle=0
37 | # \u8FDE\u63A5\u8D85\u65F6\u65F6\u95F4\uFF08\u6BEB\u79D2\uFF09
38 | spring.redis.timeout=0
39 |
40 | #\u90AE\u4EF6
41 | mail.host=smtp.163.com
42 | mail.username=\u4F60\u7684\u5BC6\u7801test@163.com
43 | mail.password=\u4F60\u7684\u5BC6\u7801\u4F60\u7684\u5BC6\u7801
44 | mail.smtp.auth=true
45 | mail.port=25
46 | mail.protocol=smtp
47 |
48 | # DEVTOOLS (DevToolsProperties)
49 | spring.devtools.restart.additional-exclude=/**
50 | spring.devtools.restart.enabled=true
51 | spring.devtools.restart.poll-interval=1000
52 | spring.devtools.restart.quiet-period=400
--------------------------------------------------------------------------------
/website/src/main/resources/config/banner-girl.txt:
--------------------------------------------------------------------------------
1 | .::::.
2 | .::::::::.
3 | :::::::::::
4 | ..:::::::::::'
5 | '::::::::::::'
6 | .::::::::::
7 | '::::::::::::::..
8 | ..:::::::::::::.
9 | ..:::::::::::::::.
10 | ``:::::::::::::::::::
11 | ::::``::::::::::::' .:::.
12 | ::::' ':::::' .::::::::.
13 | .::::' :::: .:::::::'::::.
14 | .:::' ::::: .:::::::::' ':::::.
15 | .::' :::::.:::::::::' ':::::.
16 | .::' ::::::::::::::' ``::::.
17 | ...::: ::::::::::::' ``::.
18 | ```` ':. ':::::::::' ::::..
19 | '.:::::' ':'````..
20 | :: Spring Boot :: (v2.0.0.RELEASE)
--------------------------------------------------------------------------------
/website/src/main/resources/config/logback-dev.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | > findAll();
27 |
28 | /**
29 | * 带分页
30 | *
31 | * @param start 起始页
32 | * @param pageSize 页码数
33 | * @return result
34 | */
35 | public abstract Result
${host}
10 |
11 |
--------------------------------------------------------------------------------
/javase/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | > findAll() {
40 | List
Hello [[${#httpServletRequest.remoteUser}]]!
9 |
12 |
13 |
--------------------------------------------------------------------------------
/security/src/main/resources/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 | 欢迎使用Spring Security!
9 |
10 | Hello.v.2
9 |
10 |
11 |
--------------------------------------------------------------------------------
/website/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | *.iml
3 | node_modules
4 | target
--------------------------------------------------------------------------------
/website/README.md:
--------------------------------------------------------------------------------
1 | 我的网站
--------------------------------------------------------------------------------
/website/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 亲爱的${email!}
12 |
13 | 欢迎加入xiaomo.info!
14 |
15 |
16 | 请点击链接验证:${url!}
17 |
18 |
19 | 如果您的email程序不支持链接点击,请将上面的地址拷贝至您的浏览器(如Chrome)的地址栏进入。
20 |
21 |
22 | 我们对您产生的不便,深表歉意。
23 |
24 |
25 | 希望您在xiaomo.info度过快乐的时光!
26 |
27 |
28 | -----------------------
29 |
30 | (这是一封自动产生的email,请勿回复。)
31 |
32 |
34 |
35 |
--------------------------------------------------------------------------------
/website/src/main/resources/templates/info.ftl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
7 |
8 |