diff --git a/spring-boot/spring-boot-druid-mybatis/README.md b/spring-boot/spring-boot-druid-mybatis/README.md index 8409d1a..a42747f 100644 --- a/spring-boot/spring-boot-druid-mybatis/README.md +++ b/spring-boot/spring-boot-druid-mybatis/README.md @@ -12,7 +12,7 @@ #### 1.2 项目主要依赖 -需要说明的是按照spring 官方对应自定义的starter 命名规范的推荐: +需要说明的是按照spring 官方对于自定义的starter 命名规范的推荐: - 官方的starter命名:spring-boot-starter-XXXX - 其他第三方starter命名:XXXX-spring-boot-starte @@ -54,7 +54,7 @@ spring boot 与 mybatis 版本的对应关系: #### 2.1 在application.yml 中配置数据源 -本用例采用druid作为数据库连接池,虽然druid性能略逊于Hikari,但是提供了更为全面的监控管理,可以按照实际需求选用druid或者Hikari。(关于Hikari数据源的配置可以参考[spring-boot-mbatis项目](https://github.com/heibaiying/spring-samples-for-all/tree/master/spring-boot/spring-boot-mybatis)) +本用例采用druid作为数据库连接池,虽然druid性能略逊于Hikari,但是提供了更为全面的监控管理,可以按照实际需求选用druid或者Hikari。(关于Hikari数据源的配置可以参考[spring-boot-mybatis项目](https://github.com/heibaiying/spring-samples-for-all/tree/master/spring-boot/spring-boot-mybatis)) ```yaml spring: @@ -193,4 +193,4 @@ public class DruidStatController { #### 2.4 druid 控制台的使用,默认访问地址 http://localhost:8080/druid/login.html -![spring-boot-druid 控制台](D:\spring-samples-for-all\pictures\spring-boot-druid 控制台.png) \ No newline at end of file +
diff --git a/spring-boot/spring-boot-yml-profile/README.md b/spring-boot/spring-boot-yml-profile/README.md index 4b479d4..f7b4416 100644 --- a/spring-boot/spring-boot-yml-profile/README.md +++ b/spring-boot/spring-boot-yml-profile/README.md @@ -244,4 +244,4 @@ freemarker:提供了完善的中文文档,地址 http://freemarker.foofun.cn thymeleaf:官方英文文档地址:[thymeleaf 3.0.11RELEASE](https://www.thymeleaf.org/doc/tutorials/3.0/usingthymeleaf.pdf) -注:我在本仓库中也上传了一份[thymeleaf中文文档(gangzi828(刘明刚 译)](https://github.com/heibaiying/spring-samples-for-all/tree/master/referenced%20documents),翻译的版本为3.0.5RELEASE \ No newline at end of file +注:我在本仓库中也上传了一份[thymeleaf中文文档(gangzi828(刘明刚 译))](https://github.com/heibaiying/spring-samples-for-all/tree/master/referenced%20documents),翻译的版本为3.0.5RELEASE diff --git a/spring/spring-aop-annotation/README.md b/spring/spring-aop-annotation/README.md index 6b045a7..26df9b0 100644 --- a/spring/spring-aop-annotation/README.md +++ b/spring/spring-aop-annotation/README.md @@ -166,4 +166,71 @@ public class AopTest { - 优先级高的切面在切入方法前执行的通知(before)会优先执行,但是位于方法后执行的通知(after,afterReturning)反而会延后执行,类似于同心圆原理。 -
\ No newline at end of file +
+ + + +## 附: 关于切面表达式的说明 + +切面表达式遵循以下格式: + +```shell +execution(modifiers-pattern? ret-type-pattern declaring-type-pattern?name-pattern(param-pattern) + throws-pattern?) +``` + +- 除了返回类型模式,名字模式和参数模式以外,所有的部分都是可选的; +- `*`,它代表了匹配任意的返回类型; +- `()` 匹配了一个不接受任何参数的方法, 而 `(..)` 匹配了一个接受任意数量参数的方法(零或者更多)。 模式 `(*)` 匹配了一个接受一个任何类型的参数的方法。 模式 `(*,String)` 匹配了一个接受两个参数的方法,第一个可以是任意类型,第二个则必须是String类型。 + +下面给出一些常见切入点表达式的例子。 + +- 任意公共方法的执行: + + ```java + execution(public * *(..)) + ``` + +- 任何一个以“set”开始的方法的执行: + + ```java + execution(* set*(..)) + ``` + +- `AccountService` 接口的任意方法的执行: + + ```java + execution(* com.xyz.service.AccountService.*(..)) + ``` + +- 定义在service包里的任意方法的执行: + + ```java + execution(* com.xyz.service.*.*(..)) + ``` + +- 定义在service包或者子包里的任意方法的执行: + + ```java + execution(* com.xyz.service..*.*(..)) + ``` + +- 在service包里的任意连接点(在Spring AOP中只是方法执行) : + + ```java + within(com.xyz.service.*) + ``` + +- 在service包或者子包里的任意连接点(在Spring AOP中只是方法执行) : + + ``` + within(com.xyz.service..*) + ``` + +- 实现了 `AccountService` 接口的代理对象的任意连接点(在Spring AOP中只是方法执行) : + + ``` + this(com.xyz.service.AccountService) + ``` + +更多表达式可以参考官方文档:[Declaring a Pointcut](https://docs.spring.io/spring/docs/5.1.3.RELEASE/spring-framework-reference/core.html#aop-pointcuts) \ No newline at end of file diff --git a/spring/spring-aop/README.md b/spring/spring-aop/README.md index b3e2364..e5acbdc 100644 --- a/spring/spring-aop/README.md +++ b/spring/spring-aop/README.md @@ -160,3 +160,68 @@ public class AopTest { ``` + +## 附: 关于切面表达式的说明 + +切面表达式遵循以下格式: + +```shell +execution(modifiers-pattern? ret-type-pattern declaring-type-pattern?name-pattern(param-pattern) + throws-pattern?) +``` + +- 除了返回类型模式,名字模式和参数模式以外,所有的部分都是可选的; +- `*`,它代表了匹配任意的返回类型; +- `()` 匹配了一个不接受任何参数的方法, 而 `(..)` 匹配了一个接受任意数量参数的方法(零或者更多)。 模式 `(*)` 匹配了一个接受一个任何类型的参数的方法。 模式 `(*,String)` 匹配了一个接受两个参数的方法,第一个可以是任意类型,第二个则必须是String类型。 + +下面给出一些常见切入点表达式的例子。 + +- 任意公共方法的执行: + + ```java + execution(public * *(..)) + ``` + +- 任何一个以“set”开始的方法的执行: + + ```java + execution(* set*(..)) + ``` + +- `AccountService` 接口的任意方法的执行: + + ```java + execution(* com.xyz.service.AccountService.*(..)) + ``` + +- 定义在service包里的任意方法的执行: + + ```java + execution(* com.xyz.service.*.*(..)) + ``` + +- 定义在service包或者子包里的任意方法的执行: + + ```java + execution(* com.xyz.service..*.*(..)) + ``` + +- 在service包里的任意连接点(在Spring AOP中只是方法执行) : + + ```java + within(com.xyz.service.*) + ``` + +- 在service包或者子包里的任意连接点(在Spring AOP中只是方法执行) : + + ``` + within(com.xyz.service..*) + ``` + +- 实现了 `AccountService` 接口的代理对象的任意连接点(在Spring AOP中只是方法执行) : + + ``` + this(com.xyz.service.AccountService) + ``` + +更多表达式可以参考官方文档:[Declaring a Pointcut](https://docs.spring.io/spring/docs/5.1.3.RELEASE/spring-framework-reference/core.html#aop-pointcuts) \ No newline at end of file diff --git a/spring/springmvc-base-annotation/README.md b/spring/springmvc-base-annotation/README.md index e508751..a9111ad 100644 --- a/spring/springmvc-base-annotation/README.md +++ b/spring/springmvc-base-annotation/README.md @@ -1,10 +1,6 @@ # springmvc基础(基于注解) -**开发环境:IDEA** -**spring版本:5.1.3.RELEASE** - -**本部分内容官方文档链接:[Web Servlet](https://docs.spring.io/spring/docs/5.1.3.RELEASE/spring-framework-reference/web.html#spring-web)** ## 一、搭建hello spring工程 diff --git a/spring/springmvc-base/README.md b/spring/springmvc-base/README.md index a3929f0..16c0fb3 100644 --- a/spring/springmvc-base/README.md +++ b/spring/springmvc-base/README.md @@ -1,10 +1,6 @@ # springmvc基础(基于xml配置) -**开发环境:IDEA** -**spring版本:5.1.3.RELEASE** - -**本部分内容官方文档链接:[Web Servlet](https://docs.spring.io/spring/docs/5.1.3.RELEASE/spring-framework-reference/web.html#spring-web)** ## 一、搭建hello spring工程