forked from dyc87112/SpringBoot-Learning
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
215 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>com.didispace</groupId> | ||
<artifactId>demo</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
|
||
<name>demo</name> | ||
<description>Demo project for Spring Boot</description> | ||
|
||
<parent> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>1.5.1.RELEASE</version> | ||
<relativePath/> <!-- lookup parent from repository --> | ||
</parent> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | ||
<java.version>1.8</java.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-actuator</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
|
||
</project> |
28 changes: 28 additions & 0 deletions
28
Chapter4-2-6/src/main/java/com/didispace/DemoApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.didispace; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@SpringBootApplication | ||
public class DemoApplication { | ||
|
||
private Logger logger = LoggerFactory.getLogger(getClass()); | ||
|
||
@RequestMapping(value = "/test", method = RequestMethod.GET) | ||
public String testLogLevel() { | ||
logger.debug("Logger Level :DEBUG"); | ||
logger.info("Logger Level :INFO"); | ||
logger.error("Logger Level :ERROR"); | ||
return ""; | ||
} | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(DemoApplication.class, args); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
management.security.enabled=false |
16 changes: 16 additions & 0 deletions
16
Chapter4-2-6/src/test/java/com/didispace/DemoApplicationTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.didispace; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.test.context.junit4.SpringRunner; | ||
|
||
@RunWith(SpringRunner.class) | ||
@SpringBootTest | ||
public class DemoApplicationTests { | ||
|
||
@Test | ||
public void contextLoads() { | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,110 +1,116 @@ | ||
#SpringBoot-Learning | ||
|
||
本项目内容为Spring Boot教程程序样例。 | ||
|
||
作者博客:http://blog.didispace.com | ||
|
||
- Spring Boot系列博文:http://blog.didispace.com/categories/Spring-Boot/ | ||
- Spring Cloud系列博文:http://blog.didispace.com/tag/spring-cloud/ | ||
- Spring Cloud中文社区:http://bbs.springcloud.com.cn/ | ||
|
||
如您觉得该项目对您有用,欢迎点击右上方的**Star**按钮,给予支持!! | ||
|
||
如有问题,可联系:[email protected] | ||
|
||
##样例列表 | ||
|
||
### 快速入门 | ||
|
||
- chapter1:[基本项目构建(可作为工程脚手架),引入web模块,完成一个简单的RESTful API](http://blog.didispace.com/spring-boot-learning-1/) | ||
|
||
### 工程配置 | ||
|
||
- chapter2-1-1:[配置文件详解:自定义属性、随机数、多环境配置等](http://blog.didispace.com/springbootproperties/) | ||
|
||
### Web开发 | ||
|
||
- chapter3-1-1:[构建一个较为复杂的RESTful API以及单元测试](http://blog.didispace.com/springbootrestfulapi/) | ||
- chapter3-1-2:[使用Thymeleaf模板引擎渲染web视图](http://blog.didispace.com/springbootweb/) | ||
- chapter3-1-3:[使用Freemarker模板引擎渲染web视图](http://blog.didispace.com/springbootweb/) | ||
- chapter3-1-4:[使用Velocity模板引擎渲染web视图](http://blog.didispace.com/springbootweb/) | ||
- chapter3-1-5:[使用Swagger2构建RESTful API](http://blog.didispace.com/springbootswagger2/) | ||
- chapter3-1-6:[统一异常处理](http://blog.didispace.com/springbootexception/) | ||
|
||
### 数据访问 | ||
|
||
- chapter3-2-1:[使用JdbcTemplate](http://blog.didispace.com/springbootdata1/) | ||
- chapter3-2-2:[使用Spring-data-jpa简化数据访问层(推荐)](http://blog.didispace.com/springbootdata2/) | ||
- chapter3-2-3:[多数据源配置(一):JdbcTemplate](http://blog.didispace.com/springbootmultidatasource/) | ||
- chapter3-2-4:[多数据源配置(二):Spring-data-jpa](http://blog.didispace.com/springbootmultidatasource/) | ||
- chapter3-2-5:[使用NoSQL数据库(一):Redis](http://blog.didispace.com/springbootredis/) | ||
- chapter3-2-6:[使用NoSQL数据库(二):MongoDB](http://blog.didispace.com/springbootmongodb/) | ||
- chapter3-2-7:[整合MyBatis](http://blog.didispace.com/springbootmybatis/) | ||
- chapter3-2-8:[MyBatis注解配置详解](http://blog.didispace.com/mybatisinfo/) | ||
|
||
### 事务管理 | ||
|
||
- chapter3-3-1:[使用事务管理](http://blog.didispace.com/springboottransactional/) | ||
- chapter3-3-2:[分布式事务(未完成)] | ||
|
||
### 其他内容 | ||
- chapter4-1-1:[使用@Scheduled创建定时任务](http://blog.didispace.com/springbootscheduled/) | ||
- chapter4-1-2:[使用@Async实现异步调用](http://blog.didispace.com/springbootasync/) | ||
|
||
#### 日志管理 | ||
|
||
- chapter4-2-1:[默认日志的配置](http://blog.didispace.com/springbootlog/) | ||
- chapter4-2-2:[使用log4j记录日志](http://blog.didispace.com/springbootlog4j/) | ||
- chapter4-2-3:[对log4j进行多环境不同日志级别的控制](http://blog.didispace.com/springbootlog4jmuilt/) | ||
- chapter4-2-4:[使用AOP统一处理Web请求日志](http://blog.didispace.com/springbootaoplog/) | ||
- chapter4-2-5:[使用log4j记录日志到MongoDB](http://blog.didispace.com/springbootlog4jmongodb/) | ||
|
||
#### 安全管理 | ||
|
||
- chapter4-3-1:[使用Spring Security](http://blog.didispace.com/springbootsecurity/) | ||
- chapter4-3-2:[使用Spring Session(未完成)] | ||
|
||
#### 缓存支持 | ||
|
||
- chapter4-4-1:[注解配置与EhCache使用](http://blog.didispace.com/springbootcache1/) | ||
- chapter4-4-2:[使用Redis做集中式缓存](http://blog.didispace.com/springbootcache2/) | ||
|
||
#### 邮件发送 | ||
|
||
- chapter4-5-1:[实现邮件发送:简单邮件、附件邮件、嵌入资源的邮件、模板邮件](http://blog.didispace.com/springbootmailsender/) | ||
|
||
### 消息服务 | ||
|
||
- chapter5-1-1:[JMS(未完成)] | ||
- chapter5-2-1:[Spring Boot中使用RabbitMQ](http://blog.didispace.com/spring-boot-rabbitmq/) | ||
|
||
### 其他功能 | ||
|
||
- chapter6-1-1:[使用Spring StateMachine框架实现状态机](http://blog.didispace.com/spring-statemachine/) | ||
|
||
### Dubbo进行服务治理 | ||
|
||
- chapter9-2-1:[Spring Boot中使用Dubbo进行服务治理] | ||
- chapter9-2-2:[Spring Boot与Dubbo中管理服务依赖] | ||
|
||
### Spring Cloud构建微服务架构 | ||
|
||
由于Spring Cloud偏宏观架构,Spring Boot偏微观细节,内容上越来越多,为了两部分内容不互相干扰,所以迁移Spring Cloud内容到:[SpringCloud-Learning项目](http://git.oschina.net/didispace/SpringCloud-Learning),该项目将不再更新Spring Cloud内容,关注Spring Cloud内容的请移步至[SpringCloud-Learning项目](http://git.oschina.net/didispace/SpringCloud-Learning) | ||
|
||
- chapter9-1-1:[Spring Cloud构建微服务架构(一)服务注册与发现](http://blog.didispace.com/springcloud1/) | ||
- chapter9-1-2:[Spring Cloud构建微服务架构(二)服务消费者](http://blog.didispace.com/springcloud2/) | ||
- chapter9-1-3:[Spring Cloud构建微服务架构(三)断路器](http://blog.didispace.com/springcloud3/) | ||
- chapter9-1-4:[Spring Cloud构建微服务架构(四)分布式配置中心](http://blog.didispace.com/springcloud4/) | ||
- chapter9-1-5:[Spring Cloud构建微服务架构(五)服务网关](http://blog.didispace.com/springcloud5/) | ||
- chapter9-1-6:[Spring Cloud构建微服务架构(六)集群监控] | ||
|
||
|
||
## 教程整理地址(时间不足,暂缓更新) | ||
|
||
http://blog.didispace.com/book/springboot/ | ||
|
||
## 打赏支持 | ||
|
||
<img src="http://git.oschina.net/uploads/images/2016/0717/085831_64f0a21e_437188.png" width="200px" height="200px;" /> <img src="http://git.oschina.net/uploads/images/2016/0717/085620_78f6b3cb_437188.png" width="200px" height="200px;" /> | ||
|
||
|
||
#SpringBoot-Learning | ||
|
||
本项目内容为Spring Boot教程程序样例。 | ||
|
||
作者博客:http://blog.didispace.com | ||
|
||
- Spring Boot系列博文:http://blog.didispace.com/categories/Spring-Boot/ | ||
- Spring Cloud系列博文:http://blog.didispace.com/tag/spring-cloud/ | ||
- Spring Cloud中文社区:http://bbs.springcloud.com.cn/ | ||
|
||
如您觉得该项目对您有用,欢迎点击右上方的**Star**按钮,给予支持!! | ||
|
||
如有问题,可联系:[email protected] | ||
|
||
##样例列表 | ||
|
||
### 快速入门 | ||
|
||
- chapter1:[基本项目构建(可作为工程脚手架),引入web模块,完成一个简单的RESTful API](http://blog.didispace.com/spring-boot-learning-1/) | ||
|
||
### 工程配置 | ||
|
||
- chapter2-1-1:[配置文件详解:自定义属性、随机数、多环境配置等](http://blog.didispace.com/springbootproperties/) | ||
|
||
### Web开发 | ||
|
||
- chapter3-1-1:[构建一个较为复杂的RESTful API以及单元测试](http://blog.didispace.com/springbootrestfulapi/) | ||
- chapter3-1-2:[使用Thymeleaf模板引擎渲染web视图](http://blog.didispace.com/springbootweb/) | ||
- chapter3-1-3:[使用Freemarker模板引擎渲染web视图](http://blog.didispace.com/springbootweb/) | ||
- chapter3-1-4:[使用Velocity模板引擎渲染web视图](http://blog.didispace.com/springbootweb/) | ||
- chapter3-1-5:[使用Swagger2构建RESTful API](http://blog.didispace.com/springbootswagger2/) | ||
- chapter3-1-6:[统一异常处理](http://blog.didispace.com/springbootexception/) | ||
|
||
### 数据访问 | ||
|
||
- chapter3-2-1:[使用JdbcTemplate](http://blog.didispace.com/springbootdata1/) | ||
- chapter3-2-2:[使用Spring-data-jpa简化数据访问层(推荐)](http://blog.didispace.com/springbootdata2/) | ||
- chapter3-2-3:[多数据源配置(一):JdbcTemplate](http://blog.didispace.com/springbootmultidatasource/) | ||
- chapter3-2-4:[多数据源配置(二):Spring-data-jpa](http://blog.didispace.com/springbootmultidatasource/) | ||
- chapter3-2-5:[使用NoSQL数据库(一):Redis](http://blog.didispace.com/springbootredis/) | ||
- chapter3-2-6:[使用NoSQL数据库(二):MongoDB](http://blog.didispace.com/springbootmongodb/) | ||
- chapter3-2-7:[整合MyBatis](http://blog.didispace.com/springbootmybatis/) | ||
- chapter3-2-8:[MyBatis注解配置详解](http://blog.didispace.com/mybatisinfo/) | ||
|
||
### 事务管理 | ||
|
||
- chapter3-3-1:[使用事务管理](http://blog.didispace.com/springboottransactional/) | ||
- chapter3-3-2:[分布式事务(未完成)] | ||
|
||
### 其他内容 | ||
- chapter4-1-1:[使用@Scheduled创建定时任务](http://blog.didispace.com/springbootscheduled/) | ||
- chapter4-1-2:[使用@Async实现异步调用](http://blog.didispace.com/springbootasync/) | ||
|
||
#### 日志管理 | ||
|
||
- chapter4-2-1:[默认日志的配置](http://blog.didispace.com/springbootlog/) | ||
|
||
- chapter4-2-2:[使用log4j记录日志](http://blog.didispace.com/springbootlog4j/) | ||
|
||
- chapter4-2-3:[对log4j进行多环境不同日志级别的控制](http://blog.didispace.com/springbootlog4jmuilt/) | ||
|
||
- chapter4-2-4:[使用AOP统一处理Web请求日志](http://blog.didispace.com/springbootaoplog/) | ||
|
||
- chapter4-2-5:[使用log4j记录日志到MongoDB](http://blog.didispace.com/springbootlog4jmongodb/) | ||
|
||
- chapter4-2-6:[Spring Boot 1.5.x新特性:动态修改日志级别](http://blog.didispace.com/spring-boot-1-5-x-feature-1/) | ||
|
||
#### 安全管理 | ||
|
||
- chapter4-3-1:[使用Spring Security](http://blog.didispace.com/springbootsecurity/) | ||
- chapter4-3-2:[使用Spring Session(未完成)] | ||
|
||
#### 缓存支持 | ||
|
||
- chapter4-4-1:[注解配置与EhCache使用](http://blog.didispace.com/springbootcache1/) | ||
- chapter4-4-2:[使用Redis做集中式缓存](http://blog.didispace.com/springbootcache2/) | ||
|
||
#### 邮件发送 | ||
|
||
- chapter4-5-1:[实现邮件发送:简单邮件、附件邮件、嵌入资源的邮件、模板邮件](http://blog.didispace.com/springbootmailsender/) | ||
|
||
### 消息服务 | ||
|
||
- chapter5-1-1:[JMS(未完成)] | ||
- chapter5-2-1:[Spring Boot中使用RabbitMQ](http://blog.didispace.com/spring-boot-rabbitmq/) | ||
|
||
### 其他功能 | ||
|
||
- chapter6-1-1:[使用Spring StateMachine框架实现状态机](http://blog.didispace.com/spring-statemachine/) | ||
|
||
### Dubbo进行服务治理 | ||
|
||
- chapter9-2-1:[Spring Boot中使用Dubbo进行服务治理] | ||
- chapter9-2-2:[Spring Boot与Dubbo中管理服务依赖] | ||
|
||
### Spring Cloud构建微服务架构 | ||
|
||
由于Spring Cloud偏宏观架构,Spring Boot偏微观细节,内容上越来越多,为了两部分内容不互相干扰,所以迁移Spring Cloud内容到:[SpringCloud-Learning项目](http://git.oschina.net/didispace/SpringCloud-Learning),该项目将不再更新Spring Cloud内容,关注Spring Cloud内容的请移步至[SpringCloud-Learning项目](http://git.oschina.net/didispace/SpringCloud-Learning) | ||
|
||
- chapter9-1-1:[Spring Cloud构建微服务架构(一)服务注册与发现](http://blog.didispace.com/springcloud1/) | ||
- chapter9-1-2:[Spring Cloud构建微服务架构(二)服务消费者](http://blog.didispace.com/springcloud2/) | ||
- chapter9-1-3:[Spring Cloud构建微服务架构(三)断路器](http://blog.didispace.com/springcloud3/) | ||
- chapter9-1-4:[Spring Cloud构建微服务架构(四)分布式配置中心](http://blog.didispace.com/springcloud4/) | ||
- chapter9-1-5:[Spring Cloud构建微服务架构(五)服务网关](http://blog.didispace.com/springcloud5/) | ||
- chapter9-1-6:[Spring Cloud构建微服务架构(六)集群监控] | ||
|
||
|
||
## 教程整理地址(时间不足,暂缓更新) | ||
|
||
http://blog.didispace.com/book/springboot/ | ||
|
||
## 打赏支持 | ||
|
||
<img src="http://git.oschina.net/uploads/images/2016/0717/085831_64f0a21e_437188.png" width="200px" height="200px;" /> <img src="http://git.oschina.net/uploads/images/2016/0717/085620_78f6b3cb_437188.png" width="200px" height="200px;" /> | ||
|
||
|