Skip to content

Commit e271b27

Browse files
committed
init
1 parent 13fae6e commit e271b27

File tree

11 files changed

+348
-0
lines changed

11 files changed

+348
-0
lines changed

javase/pom.xml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xmlns="http://maven.apache.org/POM/4.0.0"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<parent>
6+
<artifactId>xiaomo</artifactId>
7+
<groupId>info.xiaomo</groupId>
8+
<version>2017.2</version>
9+
</parent>
10+
<modelVersion>4.0.0</modelVersion>
11+
12+
<artifactId>javase</artifactId>
13+
14+
<dependencies>
15+
<dependency>
16+
<groupId>info.xiaomo</groupId>
17+
<artifactId>core</artifactId>
18+
<version>2017.2</version>
19+
</dependency>
20+
<dependency>
21+
<groupId>org.springframework.boot</groupId>
22+
<artifactId>spring-boot-starter-data-jpa</artifactId>
23+
</dependency>
24+
<dependency>
25+
<groupId>org.springframework.boot</groupId>
26+
<artifactId>spring-boot-starter-freemarker</artifactId>
27+
</dependency>
28+
<dependency>
29+
<groupId>org.springframework.boot</groupId>
30+
<artifactId>spring-boot-devtools</artifactId>
31+
<optional>true</optional>
32+
</dependency>
33+
<dependency>
34+
<groupId>io.springfox</groupId>
35+
<artifactId>springfox-swagger2</artifactId>
36+
</dependency>
37+
<dependency>
38+
<groupId>io.springfox</groupId>
39+
<artifactId>springfox-swagger-ui</artifactId>
40+
</dependency>
41+
<dependency>
42+
<groupId>com.github.xiaoymin</groupId>
43+
<artifactId>swagger-bootstrap-ui</artifactId>
44+
<version>1.5</version>
45+
</dependency>
46+
</dependencies>
47+
48+
<build>
49+
<plugins>
50+
<plugin>
51+
<groupId>org.springframework.boot</groupId>
52+
<artifactId>spring-boot-maven-plugin</artifactId>
53+
<executions>
54+
<execution>
55+
<goals>
56+
<goal>repackage</goal>
57+
</goals>
58+
</execution>
59+
</executions>
60+
</plugin>
61+
</plugins>
62+
</build>
63+
</project>
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
package info.xiaomo.javase;
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.cache.annotation.EnableCaching;
8+
import org.springframework.context.annotation.Bean;
9+
import org.springframework.context.annotation.ComponentScan;
10+
import org.springframework.context.annotation.Configuration;
11+
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
12+
import org.springframework.stereotype.Controller;
13+
import org.springframework.transaction.annotation.EnableTransactionManagement;
14+
import org.springframework.web.bind.annotation.RequestMapping;
15+
import org.springframework.web.bind.annotation.RequestMethod;
16+
import org.springframework.web.servlet.ModelAndView;
17+
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
18+
import springfox.documentation.annotations.ApiIgnore;
19+
import springfox.documentation.builders.ApiInfoBuilder;
20+
import springfox.documentation.builders.PathSelectors;
21+
import springfox.documentation.builders.RequestHandlerSelectors;
22+
import springfox.documentation.service.ApiInfo;
23+
import springfox.documentation.spi.DocumentationType;
24+
import springfox.documentation.spring.web.plugins.Docket;
25+
import springfox.documentation.swagger2.annotations.EnableSwagger2;
26+
27+
/**
28+
* 把今天最好的表现当作明天最新的起点..~
29+
* いま 最高の表現 として 明日最新の始発..~
30+
* Today the best performance as tomorrow newest starter!
31+
* Created by IntelliJ IDEA.
32+
*
33+
* @author : xiaomo
34+
* github: https://github.com/xiaomoinfo
35+
36+
* <p>
37+
* Date: 2016/4/1 15:38
38+
* Description: 后台管理启动器
39+
* Copyright(©) 2015 by xiaomo.
40+
**/
41+
@Configuration
42+
@EnableAutoConfiguration
43+
@ComponentScan("info.xiaomo")
44+
@EntityScan("info.xiaomo.*.model")
45+
@EnableTransactionManagement
46+
@EnableJpaRepositories("info.xiaomo.*.dao")
47+
@EnableCaching
48+
@EnableSwagger2
49+
@Controller
50+
public class XiaomoMain extends WebMvcConfigurerAdapter {
51+
52+
public static void main(String[] args) throws Exception {
53+
SpringApplication.run(XiaomoMain.class, args);
54+
}
55+
56+
/**
57+
* 接口
58+
*
59+
* @return 接口
60+
*/
61+
@RequestMapping(value = "/", method = RequestMethod.GET)
62+
@ApiIgnore()
63+
@ApiOperation(value = "重定向到api首页")
64+
public ModelAndView api() {
65+
return new ModelAndView("redirect:/swagger-ui.html");
66+
}
67+
68+
69+
@Bean
70+
public Docket createRestApi() {
71+
return new Docket(DocumentationType.SWAGGER_2)
72+
.apiInfo(apiInfo())
73+
.select()
74+
.apis(RequestHandlerSelectors.basePackage("info.xiaomo.website"))
75+
.paths(PathSelectors.any())
76+
.build();
77+
}
78+
79+
private ApiInfo apiInfo() {
80+
return new ApiInfoBuilder()
81+
.title("Spring Boot中使用Swagger2构建RESTful APIs")
82+
.description("api根地址:http://api.xiaomo.info:8080/")
83+
.termsOfServiceUrl("https://xiaomo.info/")
84+
.contact("小莫")
85+
.version("1.0")
86+
.build();
87+
}
88+
89+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package info.xiaomo.javase.bean;
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+
import java.util.List;
11+
12+
/**
13+
* 把今天最好的表现当作明天最新的起点..~
14+
* いま 最高の表現 として 明日最新の始発..~
15+
* Today the best performance as tomorrow newest starter!
16+
*
17+
* @author : xiaomo
18+
* github : https://github.com/xiaomoinfo
19+
20+
* QQ : 83387856
21+
* Date : 2017/11/20 18:57
22+
* desc :
23+
* Copyright(©) 2017 by xiaomo.
24+
*/
25+
@EqualsAndHashCode(callSuper = true)
26+
@Entity
27+
@Table(name = "adminUser")
28+
@Data
29+
public class Question extends BaseModel implements Serializable {
30+
/**
31+
* 问题
32+
*/
33+
private String question;
34+
/**
35+
* 选项
36+
*/
37+
private List<String> choice;
38+
/**
39+
* 答案
40+
*/
41+
private List<Integer> answer;
42+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package info.xiaomo.javase.controller;
2+
3+
import org.springframework.web.bind.annotation.RestController;
4+
5+
/**
6+
* 把今天最好的表现当作明天最新的起点..~
7+
* いま 最高の表現 として 明日最新の始発..~
8+
* Today the best performance as tomorrow newest starter!
9+
*
10+
* @author : xiaomo
11+
* github : https://github.com/xiaomoinfo
12+
13+
* QQ : 83387856
14+
* Date : 2017/11/20 19:00
15+
* desc :
16+
* Copyright(©) 2017 by xiaomo.
17+
*/
18+
@RestController
19+
public class QuestionController {
20+
21+
22+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package info.xiaomo.javase.dao;
2+
3+
import info.xiaomo.javase.bean.Question;
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+
* @author : xiaomo
13+
* github : https://github.com/xiaomoinfo
14+
15+
* QQ : 83387856
16+
* Date : 2017/11/20 19:00
17+
* desc :
18+
* Copyright(©) 2017 by xiaomo.
19+
*/
20+
@Repository
21+
public interface QuestionDao extends JpaRepository<Question, Long> {
22+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package info.xiaomo.javase.service;
2+
3+
/**
4+
* 把今天最好的表现当作明天最新的起点..~
5+
* いま 最高の表現 として 明日最新の始発..~
6+
* Today the best performance as tomorrow newest starter!
7+
*
8+
* @author : xiaomo
9+
* github : https://github.com/xiaomoinfo
10+
11+
* QQ : 83387856
12+
* Date : 2017/11/20 19:00
13+
* desc :
14+
* Copyright(©) 2017 by xiaomo.
15+
*/
16+
public interface QuestionService {
17+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package info.xiaomo.javase.service.impl;
2+
3+
import info.xiaomo.javase.service.QuestionService;
4+
import org.springframework.stereotype.Service;
5+
6+
/**
7+
* 把今天最好的表现当作明天最新的起点..~
8+
* いま 最高の表現 として 明日最新の始発..~
9+
* Today the best performance as tomorrow newest starter!
10+
*
11+
* @author : xiaomo
12+
* github : https://github.com/xiaomoinfo
13+
14+
* QQ : 83387856
15+
* Date : 2017/11/20 19:01
16+
* desc :
17+
* Copyright(©) 2017 by xiaomo.
18+
*/
19+
@Service
20+
public class QuestionServiceImpl implements QuestionService {
21+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
logging.config=classpath:config/logback-dev.xml
2+
server.port=8080
3+
server.session.timeout=1800
4+
server.max-http-header-size=20971520
5+
#datasource
6+
spring.datasource.url=jdbc:mysql://ip/db?characterEncoding=utf8&useSSL=true
7+
# ?useUnicode=true&amp;characterEncoding=UTF-8
8+
spring.datasource.username=xiaomo
9+
spring.datasource.password=password
10+
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
11+
# \u914D\u7F6E\u8FD9\u4E2A\u503C\u5C31\u53EF\u4EE5\u683C\u5F0F\u5316\u65F6\u95F4
12+
#spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
13+
#spring.jackson.time-zone=GMT+8
14+
#jpa
15+
spring.jpa.database-platform=org.hibernate.dialect.MySQL5Dialect
16+
spring.jpa.hibernate.ddl-auto=update
17+
spring.jpa.show-sql=true
18+
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
19+
# redis
20+
# Redis\u6570\u636E\u5E93\u7D22\u5F15\uFF08\u9ED8\u8BA4\u4E3A0\uFF09
21+
spring.redis.database=0
22+
spring.redis.host=ip
23+
spring.redis.port=6379
24+
spring.redis.password=
25+
# \u8FDE\u63A5\u6C60\u6700\u5927\u8FDE\u63A5\u6570\uFF08\u4F7F\u7528\u8D1F\u503C\u8868\u793A\u6CA1\u6709\u9650\u5236\uFF09
26+
spring.redis.pool.max-active=8
27+
# \u8FDE\u63A5\u6C60\u6700\u5927\u963B\u585E\u7B49\u5F85\u65F6\u95F4\uFF08\u4F7F\u7528\u8D1F\u503C\u8868\u793A\u6CA1\u6709\u9650\u5236\uFF09
28+
spring.redis.pool.max-wait=-1
29+
# \u8FDE\u63A5\u6C60\u4E2D\u7684\u6700\u5927\u7A7A\u95F2\u8FDE\u63A5
30+
spring.redis.pool.max-idle=8
31+
# \u8FDE\u63A5\u6C60\u4E2D\u7684\u6700\u5C0F\u7A7A\u95F2\u8FDE\u63A5
32+
spring.redis.pool.min-idle=0
33+
# \u8FDE\u63A5\u8D85\u65F6\u65F6\u95F4\uFF08\u6BEB\u79D2\uFF09
34+
spring.redis.timeout=0
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
.::::.
2+
.::::::::.
3+
:::::::::::
4+
..:::::::::::'
5+
'::::::::::::'
6+
.::::::::::
7+
'::::::::::::::..
8+
..:::::::::::::.
9+
..:::::::::::::::.
10+
``:::::::::::::::::::
11+
::::``::::::::::::' .:::.
12+
::::' ':::::' .::::::::.
13+
.::::' :::: .:::::::'::::.
14+
.:::' ::::: .:::::::::' ':::::.
15+
.::' :::::.:::::::::' ':::::.
16+
.::' ::::::::::::::' ``::::.
17+
...::: ::::::::::::' ``::.
18+
```` ':. ':::::::::' ::::..
19+
'.:::::' ':'````..
20+
:: Spring Boot :: (v1.5.8.RELEASE)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<configuration scan="true">
4+
5+
<appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
6+
<encoder charset="UTF-8">
7+
<pattern>[%d{yyyy-MM-dd HH:mm:ss} [%thread] %highlight(%-5level) %cyan(%logger{15}) - %highlight(%msg) %n</pattern>
8+
</encoder>
9+
</appender>
10+
11+
<root level="INFO">
12+
<appender-ref ref="stdout"/>
13+
</root>
14+
15+
<logger name="info.xiaomo" level="DEBUG"/>
16+
17+
</configuration>

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
<module>multipleSource</module>
3737
<!-- 爬虫 -->
3838
<module>crawler</module>
39+
<module>javase</module>
3940
</modules>
4041
<packaging>pom</packaging>
4142

0 commit comments

Comments
 (0)