feat: add five more example modules (aop, httpinterface, i18n, ratelimit, graphql) - #45
Merged
Conversation
…mit, graphql) - aop: @loggable annotation + @aspect to log invocation cost/count (note: Spring Boot 4 renamed the starter to spring-boot-starter-aspectj) - httpinterface: @HttpExchange + HttpServiceProxyFactory declarative HTTP client, tested with MockRestServiceServer - i18n: MessageSource + AcceptHeaderLocaleResolver multi-language messages - ratelimit: HandlerInterceptor + fixed time window; Clock is a bean so the test injects a @primary mutable clock and never relies on sleep - graphql: @QueryMapping + .graphqls schema exposing /graphql, tested via MockMvc POST All five modules need no external service and ship with runnable tests. Also updates Readme.md (21 -> 26 modules) and changeLog.md.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
在上一轮示例模块(#43)之外,再补 5 个不依赖外部服务、自带可运行测试的模块:
aop@Loggable+@Aspect记录耗时与调用次数httpinterface@HttpExchange+HttpServiceProxyFactory,MockRestServiceServer测试i18nMessageSource+AcceptHeaderLocaleResolver,按Accept-Language返回文案ratelimitHandlerInterceptor+ 固定时间窗口;Clock抽成 bean,测试注入可拨动时钟graphql@QueryMapping+.graphqlsschema,提供/graphql端点测试
全部通过:
命令:
mvn -pl aop,httpinterface,i18n,ratelimit,graphql -am testSpring Boot 4 注意点
spring-boot-starter-aop改名为spring-boot-starter-aspectjObjectMapper在tools.jackson.databind包下(注解仍在com.fasterxml.jackson.annotation)@HttpExchange,无需引入 OpenFeign文档
Readme.md:模块数 21 → 26,更新模块表、技术栈、可测试模块列表changeLog.md:新增条目