├── core ├── README.md ├── .gitignore └── src │ └── main │ ├── java │ └── info │ │ └── xiaomo │ │ └── core │ │ ├── constant │ │ ├── GenderConst.java │ │ ├── SymbolConst.java │ │ └── CodeConst.java │ │ ├── exception │ │ └── UserNotFoundException.java │ │ ├── base │ │ ├── BaseDao.java │ │ ├── BaseModel.java │ │ ├── AuthOperate.java │ │ ├── Result.java │ │ ├── BaseService.java │ │ └── BaseController.java │ │ ├── untils │ │ ├── AuthUtil.java │ │ ├── PropsUtil.java │ │ ├── IDUtil.java │ │ ├── SerializeUtil.java │ │ ├── SqlUtil.java │ │ ├── TokenUtil.java │ │ ├── DownUtil.java │ │ └── Md5Util.java │ │ ├── filter │ │ ├── CustomDateSerializerFilter.java │ │ └── CorsFilter.java │ │ └── field │ │ └── LoginField.java │ └── resources │ └── config │ └── oauth.properties ├── async ├── README.md ├── .gitignore ├── src │ └── main │ │ ├── resources │ │ └── config │ │ │ ├── application.properties │ │ │ └── logback-dev.xml │ │ └── java │ │ └── info │ │ └── xiaomo │ │ └── anysc │ │ ├── AsyncMain.java │ │ └── task │ │ └── AsyncTask.java └── pom.xml ├── crawler ├── README.md ├── .gitignore ├── src │ └── main │ │ ├── resources │ │ └── config │ │ │ ├── logback-dev.xml │ │ │ └── application.properties │ │ └── java │ │ └── info │ │ └── xiaomo │ │ └── crawler │ │ ├── dao │ │ └── ShikigamaDao.java │ │ ├── service │ │ ├── ShikigamaService.java │ │ └── impl │ │ │ └── ShikigamaServiceImpl.java │ │ ├── model │ │ ├── MitamaModel.java │ │ └── ShikigamiModel.java │ │ ├── CrawlerMain.java │ │ └── schedule │ │ └── ScheduledTasks.java └── pom.xml ├── rabbitmq ├── README.md ├── .gitignore ├── src │ ├── test │ │ └── java │ │ │ └── test │ │ │ └── RabbitMqTests.java │ └── main │ │ ├── java │ │ └── info │ │ │ └── xiaomo │ │ │ └── rabbitmq │ │ │ ├── config │ │ │ ├── Receiver.java │ │ │ └── Sender.java │ │ │ └── RabbitMqMain.java │ │ └── resources │ │ └── config │ │ ├── application.properties │ │ └── logback-dev.xml └── pom.xml ├── redis ├── README.md ├── .gitignore ├── src │ └── main │ │ ├── resources │ │ └── config │ │ │ ├── logback-dev.xml │ │ │ └── application.properties │ │ └── java │ │ └── info │ │ └── xiaomo │ │ └── redis │ │ ├── service │ │ └── CityService.java │ │ ├── model │ │ └── CityInfo.java │ │ ├── RedisMain.java │ │ ├── job │ │ └── TaskJob.java │ │ └── controller │ │ └── TestController.java └── pom.xml ├── scheduled ├── README.md ├── .gitignore ├── src │ └── main │ │ ├── resources │ │ └── config │ │ │ ├── application.properties │ │ │ └── logback-dev.xml │ │ └── java │ │ └── info │ │ └── xiaomo │ │ └── scheduled │ │ ├── ScheduledMain.java │ │ └── task │ │ └── ScheduledTasks.java └── pom.xml ├── security ├── README.md ├── .gitignore ├── src │ └── main │ │ ├── resources │ │ ├── config │ │ │ ├── application.properties │ │ │ └── logback-dev.xml │ │ └── templates │ │ │ ├── index.html │ │ │ ├── hello.html │ │ │ └── login.html │ │ └── java │ │ └── info │ │ └── xiaomo │ │ └── security │ │ ├── controller │ │ └── HelloController.java │ │ └── SecurityMain.java └── pom.xml ├── socket ├── README.md ├── .gitignore ├── src │ └── main │ │ ├── resources │ │ ├── public │ │ │ ├── image │ │ │ │ └── avatar.png │ │ │ └── index.html │ │ └── config │ │ │ ├── application.properties │ │ │ └── logback-dev.xml │ │ └── java │ │ └── info │ │ └── xiaomo │ │ └── chat │ │ └── ChatMain.java └── pom.xml ├── website ├── README.md ├── src │ └── main │ │ ├── resources │ │ ├── 项目文档 │ │ │ └── 重点记录 │ │ │ │ ├── 跨域.markdown │ │ │ │ ├── 文件上传.markdown │ │ │ │ ├── 服务器部署.markdown │ │ │ │ ├── maven使用相关.markdown │ │ │ │ ├── spring boot 相关.markdown │ │ │ │ ├── 前后分离与传统javaweb项目的区别.markdown │ │ │ │ └── markdown语法.markdown │ │ ├── public │ │ │ └── images │ │ │ │ ├── index.jpg │ │ │ │ ├── collapse.gif │ │ │ │ ├── expand.gif │ │ │ │ ├── favicon.ico │ │ │ │ ├── landing.png │ │ │ │ ├── throbber.gif │ │ │ │ ├── logo_small.png │ │ │ │ ├── favicon-16x16.png │ │ │ │ ├── favicon-32x32.png │ │ │ │ └── pet_store_api.png │ │ ├── templates │ │ │ ├── info.ftl │ │ │ ├── register.ftl │ │ │ ├── login.ftl │ │ │ └── email.ftl │ │ └── config │ │ │ ├── logback-dev.xml │ │ │ ├── banner-girl.txt │ │ │ └── application.properties │ │ └── java │ │ └── info │ │ └── xiaomo │ │ └── website │ │ ├── dao │ │ ├── LinkDao.java │ │ ├── ChangeLogDao.java │ │ ├── UserDao.java │ │ ├── WorksDao.java │ │ ├── AdminUserDao.java │ │ ├── TechnologyDao.java │ │ └── base │ │ │ └── CommonDao.java │ │ ├── view │ │ ├── LinkView.java │ │ ├── WorksView.java │ │ ├── ChangeLogView.java │ │ ├── TechnologyView.java │ │ ├── AdminUserView.java │ │ └── UserView.java │ │ ├── controller │ │ └── MailController.java │ │ ├── model │ │ ├── LinkModel.java │ │ ├── ChangeLogModel.java │ │ ├── TechnologyModel.java │ │ ├── WorksModel.java │ │ ├── AdminModel.java │ │ └── UserModel.java │ │ ├── service │ │ ├── LinkService.java │ │ ├── WorksService.java │ │ ├── TechnologyService.java │ │ ├── ChangeLogService.java │ │ ├── UserService.java │ │ ├── AdminUserService.java │ │ └── impl │ │ │ └── LinkServiceImpl.java │ │ └── interceptor │ │ └── LoginInterceptor.java ├── .gitignore └── pom.xml ├── mongodb ├── README.md ├── .gitignore ├── src │ └── main │ │ ├── resources │ │ └── config │ │ │ ├── application.properties │ │ │ └── logback-dev.xml │ │ └── java │ │ └── info │ │ └── xiaomo │ │ └── mongodb │ │ ├── dao │ │ └── MongoUserDao.java │ │ ├── service │ │ ├── MongoUserService.java │ │ └── impl │ │ │ └── MongoUserServiceImpl.java │ │ ├── model │ │ └── MongoUser.java │ │ └── controller │ │ └── MongoUserController.java └── pom.xml ├── multipleSource ├── README.md ├── .gitignore ├── src │ └── main │ │ ├── resources │ │ └── config │ │ │ ├── logback-dev.xml │ │ │ ├── banner-girl.txt │ │ │ └── application.properties │ │ └── java │ │ └── info │ │ └── xiaomo │ │ └── multiplesource │ │ ├── sql │ │ └── Sql.java │ │ ├── domain │ │ └── User.java │ │ ├── controller │ │ └── MultipleSourceController.java │ │ └── MultipleSourceMain.java └── pom.xml ├── mybatis ├── README.md ├── .gitignore ├── src │ └── main │ │ ├── resources │ │ └── config │ │ │ ├── application.properties │ │ │ ├── logback-dev.xml │ │ │ └── banner-girl.txt │ │ └── java │ │ └── info │ │ └── xiaomo │ │ └── mybatis │ │ ├── domain │ │ └── User.java │ │ ├── MybatisMain.java │ │ ├── controller │ │ └── MybatisUserController.java │ │ └── mapper │ │ └── UserMapper.java ├── USER.sql └── pom.xml ├── thymeleaf ├── README.md ├── .gitignore ├── src │ └── main │ │ ├── resources │ │ ├── config │ │ │ ├── application.properties │ │ │ ├── logback-dev.xml │ │ │ └── banner-girl.txt │ │ └── templates │ │ │ └── index.html │ │ └── java │ │ └── info │ │ └── xiaomo │ │ └── thymeleaf │ │ ├── controller │ │ └── ThymeleafController.java │ │ └── ThymeleafMain.java └── pom.xml ├── freemarker ├── README.md ├── .gitignore ├── src │ └── main │ │ ├── resources │ │ ├── templates │ │ │ └── index.ftl │ │ └── config │ │ │ ├── application.properties │ │ │ ├── logback-dev.xml │ │ │ └── banner-girl.txt │ │ └── java │ │ └── info │ │ └── xiaomo │ │ └── freemarker │ │ ├── controller │ │ └── FreemarkerController.java │ │ └── FreemarkerMain.java └── pom.xml ├── _config.yml ├── .gitattributes ├── .gitignore ├── .travis.yml ├── screenshot ├── api.png ├── run.png ├── yys.png ├── crawler.png ├── lombok.png ├── spring.png ├── support.png ├── bootstrap.png ├── interface.png ├── swagger-ui.png └── SpringBootUnity.png ├── .github ├── ISSUE_TEMPLATE.md └── FUNDING.yml ├── order ├── src │ └── main │ │ └── java │ │ └── info │ │ └── xiaomo │ │ └── order │ │ ├── service │ │ ├── OrderService.java │ │ └── impl │ │ │ └── OrderServiceImpl.java │ │ ├── model │ │ └── OrderModel.java │ │ ├── controller │ │ └── OrderController.java │ │ └── OrderMain.java └── pom.xml ├── javase ├── src │ └── main │ │ ├── resources │ │ └── config │ │ │ ├── logback-dev.xml │ │ │ ├── banner-girl.txt │ │ │ └── application.properties │ │ └── java │ │ └── info │ │ └── xiaomo │ │ └── javase │ │ ├── dao │ │ └── QuestionDao.java │ │ ├── service │ │ ├── QuestionService.java │ │ └── impl │ │ │ └── QuestionServiceImpl.java │ │ ├── model │ │ └── QuestionModel.java │ │ └── controller │ │ └── QuestionController.java └── pom.xml ├── SECURITY.md ├── changeLog.md └── LICENSE /core/README.md: -------------------------------------------------------------------------------- 1 | 核心包 -------------------------------------------------------------------------------- /async/README.md: -------------------------------------------------------------------------------- 1 | 异步任务 -------------------------------------------------------------------------------- /crawler/README.md: -------------------------------------------------------------------------------- 1 | 网络爬虫 -------------------------------------------------------------------------------- /rabbitmq/README.md: -------------------------------------------------------------------------------- 1 | 消息队列 -------------------------------------------------------------------------------- /redis/README.md: -------------------------------------------------------------------------------- 1 | redis -------------------------------------------------------------------------------- /scheduled/README.md: -------------------------------------------------------------------------------- 1 | 定时任务 -------------------------------------------------------------------------------- /security/README.md: -------------------------------------------------------------------------------- 1 | 安全 -------------------------------------------------------------------------------- /socket/README.md: -------------------------------------------------------------------------------- 1 | socket -------------------------------------------------------------------------------- /website/README.md: -------------------------------------------------------------------------------- 1 | 我的网站 -------------------------------------------------------------------------------- /mongodb/README.md: -------------------------------------------------------------------------------- 1 | mongodb -------------------------------------------------------------------------------- /multipleSource/README.md: -------------------------------------------------------------------------------- 1 | 多数据源 -------------------------------------------------------------------------------- /mybatis/README.md: -------------------------------------------------------------------------------- 1 | mybatis -------------------------------------------------------------------------------- /thymeleaf/README.md: -------------------------------------------------------------------------------- 1 | velocity -------------------------------------------------------------------------------- /freemarker/README.md: -------------------------------------------------------------------------------- 1 | freemarker -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # *.js linguist-language=java 2 | -------------------------------------------------------------------------------- /website/src/main/resources/项目文档/重点记录/跨域.markdown: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | node_modules 4 | target -------------------------------------------------------------------------------- /website/src/main/resources/项目文档/重点记录/文件上传.markdown: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /website/src/main/resources/项目文档/重点记录/服务器部署.markdown: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /core/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | node_modules 4 | target -------------------------------------------------------------------------------- /website/src/main/resources/项目文档/重点记录/maven使用相关.markdown: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /async/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | node_modules 4 | target -------------------------------------------------------------------------------- /crawler/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | node_modules 4 | target -------------------------------------------------------------------------------- /mongodb/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | node_modules 4 | target -------------------------------------------------------------------------------- /mybatis/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | node_modules 4 | target -------------------------------------------------------------------------------- /rabbitmq/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | node_modules 4 | target -------------------------------------------------------------------------------- /redis/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | node_modules 4 | target -------------------------------------------------------------------------------- /scheduled/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | node_modules 4 | target -------------------------------------------------------------------------------- /security/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | node_modules 4 | target -------------------------------------------------------------------------------- /socket/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | node_modules 4 | target -------------------------------------------------------------------------------- /thymeleaf/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | node_modules 4 | target -------------------------------------------------------------------------------- /website/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | node_modules 4 | target -------------------------------------------------------------------------------- /website/src/main/resources/项目文档/重点记录/spring boot 相关.markdown: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /freemarker/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | node_modules 4 | target -------------------------------------------------------------------------------- /multipleSource/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | node_modules 4 | target -------------------------------------------------------------------------------- /website/src/main/resources/项目文档/重点记录/前后分离与传统javaweb项目的区别.markdown: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | jdk: 3 | - oraclejdk11 4 | dist: trusty -------------------------------------------------------------------------------- /screenshot/api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/HEAD/screenshot/api.png -------------------------------------------------------------------------------- /screenshot/run.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/HEAD/screenshot/run.png -------------------------------------------------------------------------------- /screenshot/yys.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/HEAD/screenshot/yys.png -------------------------------------------------------------------------------- /screenshot/crawler.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/HEAD/screenshot/crawler.png -------------------------------------------------------------------------------- /screenshot/lombok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/HEAD/screenshot/lombok.png -------------------------------------------------------------------------------- /screenshot/spring.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/HEAD/screenshot/spring.png -------------------------------------------------------------------------------- /screenshot/support.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/HEAD/screenshot/support.png -------------------------------------------------------------------------------- /screenshot/bootstrap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/HEAD/screenshot/bootstrap.png -------------------------------------------------------------------------------- /screenshot/interface.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/HEAD/screenshot/interface.png -------------------------------------------------------------------------------- /screenshot/swagger-ui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/HEAD/screenshot/swagger-ui.png -------------------------------------------------------------------------------- /screenshot/SpringBootUnity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/HEAD/screenshot/SpringBootUnity.png -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /socket/src/main/resources/public/image/avatar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/HEAD/socket/src/main/resources/public/image/avatar.png -------------------------------------------------------------------------------- /website/src/main/resources/public/images/index.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/HEAD/website/src/main/resources/public/images/index.jpg -------------------------------------------------------------------------------- /website/src/main/resources/public/images/collapse.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/HEAD/website/src/main/resources/public/images/collapse.gif -------------------------------------------------------------------------------- /website/src/main/resources/public/images/expand.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/HEAD/website/src/main/resources/public/images/expand.gif -------------------------------------------------------------------------------- /website/src/main/resources/public/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/HEAD/website/src/main/resources/public/images/favicon.ico -------------------------------------------------------------------------------- /website/src/main/resources/public/images/landing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/HEAD/website/src/main/resources/public/images/landing.png -------------------------------------------------------------------------------- /website/src/main/resources/public/images/throbber.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/HEAD/website/src/main/resources/public/images/throbber.gif -------------------------------------------------------------------------------- /website/src/main/resources/public/images/logo_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/HEAD/website/src/main/resources/public/images/logo_small.png -------------------------------------------------------------------------------- /website/src/main/resources/public/images/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/HEAD/website/src/main/resources/public/images/favicon-16x16.png -------------------------------------------------------------------------------- /website/src/main/resources/public/images/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/HEAD/website/src/main/resources/public/images/favicon-32x32.png -------------------------------------------------------------------------------- /website/src/main/resources/public/images/pet_store_api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/houko/SpringBootUnity/HEAD/website/src/main/resources/public/images/pet_store_api.png -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /freemarker/src/main/resources/templates/index.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |点击 这里 打个招呼吧
11 | 12 | -------------------------------------------------------------------------------- /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/src/test/java/test/RabbitMqTests.java: -------------------------------------------------------------------------------- 1 | package test; 2 | 3 | import info.xiaomo.rabbitmq.config.Sender; 4 | import org.junit.Test; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | 7 | public class RabbitMqTests { 8 | 9 | @Autowired() 10 | private Sender sender; 11 | 12 | @Test 13 | public void hello() throws Exception { 14 | sender.send(); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /security/src/main/resources/templates/hello.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 |
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 |
--------------------------------------------------------------------------------
/crawler/src/main/resources/config/logback-dev.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
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/base/BaseDao.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.core.base;
2 |
3 | import org.springframework.data.jpa.repository.JpaRepository;
4 | import org.springframework.stereotype.Repository;
5 |
6 | /**
7 | * @author : xiaomo (https://xiaomo.info) (https://github.com/houko)
8 | * @version : 2017/1/13 11:23
9 | */
10 | @Repository
11 | public interface BaseDao
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 |
--------------------------------------------------------------------------------
/mybatis/src/main/java/info/xiaomo/mybatis/domain/User.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.mybatis.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 |
--------------------------------------------------------------------------------
/website/src/main/resources/templates/register.ftl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/crawler/src/main/java/info/xiaomo/crawler/service/ShikigamaService.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.crawler.service;
2 |
3 | import info.xiaomo.crawler.model.ShikigamiModel;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * @author : xiaomo (https://xiaomo.info) (https://github.com/houko)
9 | * @created : 2016/12/24 15:54
10 | */
11 | public interface ShikigamaService {
12 |
13 | /**
14 | * 根据名字查式神
15 | *
16 | * @param name
17 | * @return
18 | */
19 | ShikigamiModel findByName(String name);
20 |
21 | /**
22 | * 保存
23 | *
24 | * @param model
25 | */
26 | void save(ShikigamiModel model);
27 |
28 | /**
29 | * 查所有
30 | *
31 | * @return
32 | */
33 | List
17 | * Date: 2016/4/1119:52
18 | * Copyright(©) 2015 by xiaomo.
19 | **/
20 | @Repository
21 | public interface LinkDao extends JpaRepository
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 |
--------------------------------------------------------------------------------
/website/src/main/java/info/xiaomo/website/dao/ChangeLogDao.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.website.dao;
2 |
3 | import info.xiaomo.website.model.ChangeLogModel;
4 | import org.springframework.data.jpa.repository.JpaRepository;
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/4/1119:52
18 | * Copyright(©) 2015 by xiaomo.
19 | **/
20 | @Repository
21 | public interface ChangeLogDao extends JpaRepository
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 |
--------------------------------------------------------------------------------
/redis/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 | # redis
7 | # Redis\u6570\u636E\u5E93\u7D22\u5F15\uFF08\u9ED8\u8BA4\u4E3A0\uFF09
8 | spring.redis.database=0
9 | spring.redis.host=ip
10 | spring.redis.port=6379
11 | # Redis\u670D\u52A1\u5668\u8FDE\u63A5\u5BC6\u7801\uFF08\u9ED8\u8BA4\u4E3A\u7A7A\uFF09
12 | spring.redis.password=
13 | # \u8FDE\u63A5\u6C60\u6700\u5927\u8FDE\u63A5\u6570\uFF08\u4F7F\u7528\u8D1F\u503C\u8868\u793A\u6CA1\u6709\u9650\u5236\uFF09
14 | spring.redis.pool.max-active=8
15 | # \u8FDE\u63A5\u6C60\u6700\u5927\u963B\u585E\u7B49\u5F85\u65F6\u95F4\uFF08\u4F7F\u7528\u8D1F\u503C\u8868\u793A\u6CA1\u6709\u9650\u5236\uFF09
16 | spring.redis.pool.max-wait=-1
17 | spring.redis.pool.max-idle=8
18 | spring.redis.pool.min-idle=0
19 | spring.redis.timeout=0
--------------------------------------------------------------------------------
/javase/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/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)
--------------------------------------------------------------------------------
/mybatis/USER.sql:
--------------------------------------------------------------------------------
1 | /*
2 | Navicat MySQL Data Transfer
3 |
4 | Source Server : xiaomo2017(106.15.188.160)
5 | Source Server Version : 50717
6 | Source Host : 106.15.188.160:3306
7 | Source Database : xiaomo
8 |
9 | Target Server Type : MYSQL
10 | Target Server Version : 50717
11 | File Encoding : 65001
12 |
13 | Date: 2017-09-06 17:45:51
14 | */
15 |
16 | SET FOREIGN_KEY_CHECKS=0;
17 |
18 | -- ----------------------------
19 | -- Table structure for USER
20 | -- ----------------------------
21 | DROP TABLE IF EXISTS `USER`;
22 | CREATE TABLE `USER` (
23 | `id` bigint(20) DEFAULT NULL,
24 | `name` varchar(255) DEFAULT NULL,
25 | `age` int(11) DEFAULT NULL
26 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
27 |
28 | -- ----------------------------
29 | -- Records of USER
30 | -- ----------------------------
31 | INSERT INTO `USER` VALUES ('1', 'xiaomo', '25');
32 |
--------------------------------------------------------------------------------
/website/src/main/resources/项目文档/重点记录/markdown语法.markdown:
--------------------------------------------------------------------------------
1 | # 1.标题(h标签)
2 | h1-h6对应1-6个#
3 | # 2.列表(li>li)
4 | #### 有序列表
5 | * 1
6 | * 2
7 | * 3
8 | #### 无序列表
9 | 1. 1
10 | 2. 2
11 | 3. 3
12 | # 3.引用(blockquote)
13 | >这个是引用的内容
14 | # 4.图片与链接
15 | #### 图片:名字、url
16 | 
17 | #### 链接
18 | [小莫的主页](http://www.xiaomo.info)
19 | # 5.粗体与斜体
20 | #### 说明:用两个 * 包含一段文本就是粗体的语法,用一个 * 包含一段文本就是斜体的语法。
21 | **这里是粗体**
22 |
23 | *这里是斜体*
24 |
25 | # 6.表格
26 | | Tables | Are | Cool |
27 | | ----------- |:-----------:| -----:|
28 | | col 3 is | right-aligned | $1600 |
29 | | col 2 is | centered | $12 |
30 | | zebra stripes | are neat | $1 |
31 | # 7.代码框(一个tab即可)
32 |
33 | function Hello(){
34 | console.log("hello");
35 | }
36 | # 8.分割线(hr)
37 | 三个或三个以上的星号、减号或者下划线
38 | ***
39 |
40 | # 9.换行、分段
41 | 行末加两个或以上个空格
42 | 分段:两个回车
--------------------------------------------------------------------------------
/javase/src/main/java/info/xiaomo/javase/service/QuestionService.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.javase.service;
2 |
3 | import info.xiaomo.javase.model.QuestionModel;
4 |
5 | /**
6 | * 把今天最好的表现当作明天最新的起点..~
7 | * いま 最高の表現 として 明日最新の始発..~
8 | * Today the best performance as tomorrow newest starter!
9 | *
10 | * @author : xiaomo
11 | * github : https://github.com/houko
12 | * email : xiaomo@xiaomo.info
13 | * QQ : 83387856
14 | * Date : 2017/11/20 19:00
15 | * desc :
16 | * Copyright(©) 2017 by xiaomo.
17 | */
18 | public interface QuestionService {
19 |
20 | /**
21 | * 根据id查找
22 | *
23 | * @param id id
24 | * @return QuestionModel
25 | */
26 | QuestionModel findById(Long id);
27 |
28 | /**
29 | * 添加
30 | *
31 | * @param questionModel questionModel
32 | * @return
33 | */
34 | boolean add(QuestionModel questionModel);
35 | }
36 |
--------------------------------------------------------------------------------
/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
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/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/website/src/main/resources/templates/login.ftl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
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/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/AdminUserView.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 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/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 |
--------------------------------------------------------------------------------
/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/base/BaseModel.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.core.base;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.*;
6 | import java.io.Serializable;
7 | import java.util.Date;
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/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 |
--------------------------------------------------------------------------------
/website/src/main/java/info/xiaomo/website/dao/UserDao.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.website.dao;
2 |
3 | import info.xiaomo.website.model.UserModel;
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/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
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
25 | * Date: 16/4/2 13:08
26 | * Copyright(©) 2015 by xiaomo.
27 | */
28 | @Repository
29 | public interface TechnologyDao extends JpaRepository
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 |
--------------------------------------------------------------------------------
/mybatis/src/main/java/info/xiaomo/mybatis/MybatisMain.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.mybatis;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
5 | import org.springframework.boot.autoconfigure.domain.EntityScan;
6 | import org.springframework.context.annotation.ComponentScan;
7 | import org.springframework.context.annotation.Configuration;
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/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/changeLog.md:
--------------------------------------------------------------------------------
1 | - 2017-09-02 api模块: 添加swagger-bootstrap-ui,和原有ui并行存在。
2 | http://localhost:8080 默认UI
3 | http://localhost:808/doc.html bootstrap-ui
4 |
5 | ```
6 | 1. spring boot版本从1.4.3更新到1.5.6
7 | 2. 修复不配置数据库信息无法启动的bug
8 | 3. 版本号更新到2017.1
9 | 4. api模块(swagger)添加开源库swagger-bootstrap-ui,和swagger默认UI同时存在。
10 | 5. web模块添加数据库sql文件,导入后一键启动可直接访问到web界面。
11 | ```
12 |
13 |
14 |
15 | 
16 |
17 | #### swagger
18 | 
19 |
20 |
21 | #### bootstrap-ui
22 | 
23 |
24 | 
25 |
26 | 
27 |
28 |
29 |
30 | - 2017-09-06 更新记录
31 |
32 | ```
33 | 1. mybatis模块:添加USER.sql,启动后访问:http://localhost:8080 即可看到接口数据
34 | 2. 所有模块: 添加 characterEncoding=utf8&useSSL=true 解决高版本mysql的sll警告
35 | 3. 添加代码贡献者列表和支持者,赞助商链接。
36 | ```
37 |
38 | - 2017-09-08 更新记录
39 |
40 | ```
41 | 1. crawler模块(网络爬虫):修复本地文件目录不存在会报错的bug。处理方式为:不存在则自动创建
42 | ```
43 |
44 | 
45 | 
--------------------------------------------------------------------------------
/javase/src/main/java/info/xiaomo/javase/model/QuestionModel.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.javase.model;
2 |
3 | import info.xiaomo.core.base.BaseModel;
4 | import lombok.Data;
5 | import lombok.EqualsAndHashCode;
6 |
7 | import javax.persistence.Entity;
8 | import javax.persistence.Table;
9 | import java.io.Serializable;
10 |
11 | /**
12 | * 把今天最好的表现当作明天最新的起点..~
13 | * いま 最高の表現 として 明日最新の始発..~
14 | * Today the best performance as tomorrow newest starter!
15 | *
16 | * @author : xiaomo
17 | * github : https://github.com/houko
18 | * email : xiaomo@xiaomo.info
19 | * QQ : 83387856
20 | * Date : 2017/11/20 18:57
21 | * desc :
22 | * Copyright(©) 2017 by xiaomo.
23 | */
24 | @EqualsAndHashCode(callSuper = true)
25 | @Entity
26 | @Table(name = "question")
27 | @Data
28 | public class QuestionModel extends BaseModel implements Serializable {
29 | /**
30 | * 问题
31 | */
32 | private String question;
33 | // /**
34 | // * 选项
35 | // */
36 | // private List
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/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 |
--------------------------------------------------------------------------------
/crawler/src/main/java/info/xiaomo/crawler/CrawlerMain.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.crawler;
2 |
3 | import org.springframework.beans.factory.annotation.Configurable;
4 | import org.springframework.boot.SpringApplication;
5 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
6 | import org.springframework.context.annotation.ComponentScan;
7 | import org.springframework.context.annotation.Configuration;
8 | import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
9 | import org.springframework.scheduling.annotation.EnableScheduling;
10 |
11 | /**
12 | * 把今天最好的表现当作明天最新的起点..~
13 | * いま 最高の表現 として 明日最新の始発..~
14 | * Today the best performance as tomorrow newest starter!
15 |
16 | *
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/model/ShikigamiModel.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.crawler.model;
2 |
3 | import info.xiaomo.core.base.BaseModel;
4 | import lombok.*;
5 |
6 | import javax.persistence.Entity;
7 | import javax.persistence.Table;
8 |
9 | /**
10 | * @author : xiaomo (https://xiaomo.info) (https://github.com/houko)
11 | * @created : 2016/12/24 15:09
12 | */
13 |
14 | @Entity
15 | @Table(name = "shikigame")
16 | // lomlok
17 | @Data
18 | @ToString(callSuper = true)
19 | @EqualsAndHashCode(callSuper = false)
20 | @AllArgsConstructor
21 | @NoArgsConstructor
22 | public class ShikigamiModel extends BaseModel {
23 |
24 | /**
25 | * 名字
26 | */
27 | private String name;
28 |
29 | /**
30 | * 图片
31 | */
32 | private String image;
33 |
34 | /**
35 | * 声优
36 | */
37 | private String seiyou;
38 |
39 |
40 | /**
41 | * 性别
42 | */
43 | private String sex;
44 |
45 | /**
46 | * 星级
47 | */
48 | private String star;
49 |
50 | /**
51 | * 获取方式
52 | */
53 | private String getWay;
54 |
55 |
56 | /**
57 | * N/R/SR/SSR
58 | */
59 | private String level;
60 |
61 |
62 | /**
63 | * 描述
64 | */
65 | private String des;
66 |
67 |
68 | }
69 |
--------------------------------------------------------------------------------
/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
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 |
--------------------------------------------------------------------------------
/async/src/main/java/info/xiaomo/anysc/AsyncMain.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.anysc;
2 |
3 |
4 | import org.springframework.boot.SpringApplication;
5 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
6 | import org.springframework.boot.autoconfigure.domain.EntityScan;
7 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
8 | import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
9 | import org.springframework.context.annotation.ComponentScan;
10 | import org.springframework.context.annotation.Configuration;
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 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 |
--------------------------------------------------------------------------------
/freemarker/src/main/java/info/xiaomo/freemarker/FreemarkerMain.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.freemarker;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
5 | import org.springframework.boot.autoconfigure.domain.EntityScan;
6 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
7 | import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
8 | import org.springframework.context.annotation.ComponentScan;
9 | import org.springframework.context.annotation.Configuration;
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/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 |
--------------------------------------------------------------------------------
/scheduled/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/redis/src/main/java/info/xiaomo/redis/RedisMain.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.redis;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
5 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
6 | import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
7 | import org.springframework.cache.annotation.EnableCaching;
8 | import org.springframework.context.annotation.ComponentScan;
9 | import org.springframework.context.annotation.Configuration;
10 | import org.springframework.scheduling.annotation.EnableScheduling;
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 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 |
--------------------------------------------------------------------------------
/scheduled/src/main/java/info/xiaomo/scheduled/ScheduledMain.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.scheduled;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
5 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
6 | import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
7 | import org.springframework.context.annotation.ComponentScan;
8 | import org.springframework.context.annotation.Configuration;
9 | import org.springframework.scheduling.annotation.EnableAsync;
10 | import org.springframework.scheduling.annotation.EnableScheduling;
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 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 |
--------------------------------------------------------------------------------
/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
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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/crawler/src/main/java/info/xiaomo/crawler/service/impl/ShikigamaServiceImpl.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.crawler.service.impl;
2 |
3 | import com.alibaba.fastjson.JSON;
4 | import info.xiaomo.crawler.dao.ShikigamaDao;
5 | import info.xiaomo.crawler.model.ShikigamiModel;
6 | import info.xiaomo.crawler.service.ShikigamaService;
7 | import org.slf4j.Logger;
8 | import org.springframework.beans.factory.annotation.Autowired;
9 | import org.springframework.stereotype.Service;
10 |
11 | import java.util.List;
12 |
13 | /**
14 | * @author : xiaomo (https://xiaomo.info) (https://github.com/houko)
15 | * @created : 2016/12/24 15:54
16 | */
17 | @Service
18 | public class ShikigamaServiceImpl implements ShikigamaService {
19 |
20 |
21 | private static final Logger LOGGER = org.slf4j.LoggerFactory.getLogger(ShikigamaServiceImpl.class);
22 |
23 | private final ShikigamaDao dao;
24 |
25 |
26 | @Autowired
27 | public ShikigamaServiceImpl(ShikigamaDao dao) {
28 | this.dao = dao;
29 | }
30 |
31 | @Override
32 | public ShikigamiModel findByName(String name) {
33 | return dao.findByName(name);
34 | }
35 |
36 | @Override
37 | public void save(ShikigamiModel model) {
38 | ShikigamiModel shikigamiModel = dao.findByName(model.getName());
39 | if (shikigamiModel == null) {
40 | dao.save(model);
41 | LOGGER.debug("插入数据:{}", JSON.toJSONString(model));
42 | }
43 | }
44 |
45 | @Override
46 | public List
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 |
--------------------------------------------------------------------------------
/website/src/main/java/info/xiaomo/website/service/LinkService.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.website.service;
2 |
3 |
4 | import info.xiaomo.website.model.LinkModel;
5 | import org.springframework.data.domain.Page;
6 |
7 | import java.util.List;
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/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 WorksService {
24 |
25 | /**
26 | * find all
27 | *
28 | * @return
29 | */
30 | List
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 |
--------------------------------------------------------------------------------
/crawler/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
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
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 |
--------------------------------------------------------------------------------
/security/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
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/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 |
--------------------------------------------------------------------------------
/website/src/main/java/info/xiaomo/website/service/ChangeLogService.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.website.service;
2 |
3 | import info.xiaomo.website.model.ChangeLogModel;
4 | import org.springframework.data.domain.Page;
5 |
6 | import java.util.List;
7 |
8 | /**
9 | * 把今天最好的表现当作明天最新的起点..~
10 | * いま 最高の表現 として 明日最新の始発..~
11 | * Today the best performance as tomorrow newest starter!
12 |
13 | *
14 | * @author : xiaomo
15 | * github: https://github.com/houko
16 | * email: xiaomo@xiaomo.info
17 | *
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
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 |
--------------------------------------------------------------------------------
/website/src/main/java/info/xiaomo/website/interceptor/LoginInterceptor.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.website.interceptor;
2 |
3 | import info.xiaomo.website.model.UserModel;
4 | import org.springframework.web.servlet.HandlerInterceptor;
5 | import org.springframework.web.servlet.ModelAndView;
6 |
7 | import javax.servlet.http.HttpServletRequest;
8 | import javax.servlet.http.HttpServletResponse;
9 |
10 |
11 | /**
12 | * 把今天最好的表现当作明天最新的起点..~
13 | * いま 最高の表現 として 明日最新の始発..~
14 | * Today the best performance as tomorrow newest starter!
15 | *
16 | * @author : xiaomo
17 | * github: https://github.com/houko
18 | * email: xiaomo@xiaomo.info
19 | *
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 |
--------------------------------------------------------------------------------
/mongodb/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
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 | }
--------------------------------------------------------------------------------
/multipleSource/src/main/java/info/xiaomo/multiplesource/controller/MultipleSourceController.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.multiplesource.controller;
2 |
3 | import info.xiaomo.core.base.Result;
4 | import info.xiaomo.multiplesource.sql.Sql;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.beans.factory.annotation.Qualifier;
7 | import org.springframework.jdbc.core.JdbcTemplate;
8 | import org.springframework.web.bind.annotation.RequestMapping;
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/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/mongodb/src/main/java/info/xiaomo/mongodb/service/impl/MongoUserServiceImpl.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.mongodb.service.impl;
2 |
3 | import info.xiaomo.mongodb.dao.MongoUserDao;
4 | import info.xiaomo.mongodb.model.MongoUser;
5 | import info.xiaomo.mongodb.service.MongoUserService;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.stereotype.Service;
8 |
9 | import java.util.List;
10 | import java.util.Optional;
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/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
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 |
--------------------------------------------------------------------------------
/mybatis/src/main/java/info/xiaomo/mybatis/mapper/UserMapper.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.mybatis.mapper;
2 |
3 |
4 | import info.xiaomo.mybatis.domain.User;
5 | import org.apache.ibatis.annotations.*;
6 | import org.springframework.stereotype.Repository;
7 |
8 | import java.util.List;
9 | import java.util.Map;
10 |
11 | /**
12 | * @author : xiaomo
13 | */
14 | @Mapper
15 | @Repository
16 | public interface UserMapper {
17 |
18 | @Results({
19 | @Result(property = "name", column = "name"),
20 | @Result(property = "age", column = "age")
21 | })
22 |
23 | /**
24 | * 根据名字查
25 | * @param name
26 | * @return user
27 | */
28 | @Select("SELECT * FROM USER WHERE NAME = #{name}")
29 | User findByName(@Param("name") String name);
30 |
31 | /**
32 | * 插入
33 | *
34 | * @param name
35 | * @param age
36 | * @return
37 | */
38 | @Insert("INSERT INTO USER(NAME, AGE) VALUES(#{name}, #{age})")
39 | int insert(@Param("name") String name, @Param("age") Integer age);
40 |
41 | /**
42 | * 查所有
43 | *
44 | * @return
45 | */
46 | @Select("SELECT * FROM USER WHERE 1=1")
47 | List
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 |
--------------------------------------------------------------------------------
/website/src/main/java/info/xiaomo/website/service/UserService.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.website.service;
2 |
3 |
4 | import info.xiaomo.core.exception.UserNotFoundException;
5 | import info.xiaomo.website.model.UserModel;
6 | import org.springframework.data.domain.Page;
7 |
8 | import java.util.List;
9 | import java.util.Optional;
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/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
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
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
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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/multipleSource/src/main/java/info/xiaomo/multiplesource/MultipleSourceMain.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.multiplesource;
2 |
3 | import org.springframework.beans.factory.annotation.Qualifier;
4 | import org.springframework.boot.SpringApplication;
5 | import org.springframework.boot.autoconfigure.SpringBootApplication;
6 | import org.springframework.boot.context.properties.ConfigurationProperties;
7 | import org.springframework.boot.jdbc.DataSourceBuilder;
8 | import org.springframework.context.annotation.Bean;
9 | import org.springframework.context.annotation.Primary;
10 | import org.springframework.jdbc.core.JdbcTemplate;
11 |
12 | import javax.sql.DataSource;
13 |
14 | /**
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: 2016/11/16 10:34
25 | * Description: 多数据源(在配置文件中自定义字段,在这里取出并创建不同的数据源)
26 | * Copyright(©) 2015 by xiaomo.
27 | **/
28 |
29 | @SpringBootApplication
30 | public class MultipleSourceMain {
31 |
32 | public static void main(String[] args) {
33 | SpringApplication.run(MultipleSourceMain.class, args);
34 | }
35 |
36 |
37 | /**
38 | * 第一个数据源
39 | * @return 数据源实例
40 | */
41 | @Bean(name = "primaryDataSource")
42 | @Qualifier("primaryDataSource")
43 | @ConfigurationProperties(prefix = "spring.datasource.primary")
44 | public DataSource primaryDataSource() {
45 | return DataSourceBuilder.create().build();
46 | }
47 |
48 | /**
49 | * 第二个数据源
50 | * @return 数据源实例
51 | */
52 | @Bean(name = "secondaryDataSource")
53 | @Qualifier("secondaryDataSource")
54 | @Primary
55 | @ConfigurationProperties(prefix = "spring.datasource.secondary")
56 | public DataSource secondaryDataSource() {
57 | return DataSourceBuilder.create().build();
58 | }
59 |
60 | /**
61 | * 第一个JDBC模板
62 | * @param dataSource dataSource
63 | * @return JDBC模板
64 | */
65 | @Bean(name = "primaryJdbcTemplate")
66 | public JdbcTemplate primaryJdbcTemplate(
67 | @Qualifier("primaryDataSource") DataSource dataSource) {
68 | return new JdbcTemplate(dataSource);
69 | }
70 |
71 | /**
72 | * 第二个JDBC模板
73 | * @param dataSource dataSource
74 | * @return JDBC模板
75 | */
76 | @Bean(name = "secondaryJdbcTemplate")
77 | public JdbcTemplate secondaryJdbcTemplate(
78 | @Qualifier("secondaryDataSource") DataSource dataSource) {
79 | return new JdbcTemplate(dataSource);
80 | }
81 |
82 | }
83 |
--------------------------------------------------------------------------------
/order/src/main/java/info/xiaomo/order/OrderMain.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.order;
2 |
3 | import io.swagger.annotations.ApiOperation;
4 | import org.springframework.boot.SpringApplication;
5 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
6 | import org.springframework.boot.autoconfigure.domain.EntityScan;
7 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
8 | import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
9 | import org.springframework.context.annotation.Bean;
10 | import org.springframework.context.annotation.ComponentScan;
11 | import org.springframework.context.annotation.Configuration;
12 | import org.springframework.stereotype.Controller;
13 | import org.springframework.web.bind.annotation.RequestMapping;
14 | import org.springframework.web.bind.annotation.RequestMethod;
15 | import org.springframework.web.servlet.ModelAndView;
16 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
17 | import springfox.documentation.annotations.ApiIgnore;
18 | import springfox.documentation.builders.ApiInfoBuilder;
19 | import springfox.documentation.builders.PathSelectors;
20 | import springfox.documentation.builders.RequestHandlerSelectors;
21 | import springfox.documentation.service.ApiInfo;
22 | import springfox.documentation.spi.DocumentationType;
23 | import springfox.documentation.spring.web.plugins.Docket;
24 | import springfox.documentation.swagger2.annotations.EnableSwagger2;
25 |
26 |
27 | /**
28 | * @author xiaomo
29 | */
30 | @Configuration
31 | @ComponentScan("info.xiaomo")
32 | @EntityScan("info.xiaomo.*.model")
33 | @EnableSwagger2
34 | @Controller
35 | @EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class})
36 | public class OrderMain implements WebMvcConfigurer {
37 |
38 | public static void main(String[] args) {
39 | SpringApplication.run(OrderMain.class, args);
40 | }
41 |
42 | /**
43 | * 接口
44 | *
45 | * @return 接口
46 | */
47 | @RequestMapping(value = "/", method = RequestMethod.GET)
48 | @ApiIgnore()
49 | @ApiOperation(value = "重定向到api首页")
50 | public ModelAndView api() {
51 | return new ModelAndView("redirect:/swagger-ui.html");
52 | }
53 |
54 |
55 | @Bean
56 | public Docket createRestApi() {
57 | return new Docket(DocumentationType.SWAGGER_2)
58 | .apiInfo(apiInfo())
59 | .select()
60 | .apis(RequestHandlerSelectors.basePackage("info.xiaomo.order"))
61 | .paths(PathSelectors.any())
62 | .build();
63 | }
64 |
65 | private ApiInfo apiInfo() {
66 | return new ApiInfoBuilder()
67 | .title("Spring Boot中使用Swagger2构建RESTful APIs")
68 | .contact("小莫")
69 | .version("1.0")
70 | .build();
71 | }
72 |
73 | }
74 |
--------------------------------------------------------------------------------
/website/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
25 | * Date: 2016/4/11 19:50
26 | * Copyright(©) 2015 by xiaomo.
27 | **/
28 | @Service
29 | public class LinkServiceImpl implements LinkService {
30 |
31 | private final LinkDao dao;
32 |
33 | @Autowired
34 | public LinkServiceImpl(LinkDao dao) {
35 | this.dao = dao;
36 | }
37 |
38 | @Override
39 | public LinkModel findById(Long id) {
40 | Optional亲爱的${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/java/info/xiaomo/website/dao/TechnologyDao.java:
--------------------------------------------------------------------------------
1 | package info.xiaomo.website.dao;
2 |
3 | import info.xiaomo.website.model.TechnologyModel;
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 | * > findAll() {
40 | List
> findAll();
27 |
28 | /**
29 | * 带分页
30 | *
31 | * @param start 起始页
32 | * @param pageSize 页码数
33 | * @return result
34 | */
35 | public abstract Result