├── springboot-hot-patch ├── temp │ └── 1.txt ├── src │ └── main │ │ ├── resources │ │ └── application.properties │ │ └── java │ │ └── com │ │ └── example │ │ └── hotpatch │ │ ├── example │ │ ├── MathHelper.java │ │ └── StringUtils.java │ │ ├── HotPatchApplication.java │ │ ├── annotation │ │ └── PatchType.java │ │ ├── instrumentation │ │ └── InstrumentationHolder.java │ │ ├── agent │ │ └── HotPatchAgent.java │ │ ├── patches │ │ ├── MathHelperDividePatch.java │ │ └── StringUtilsPatch.java │ │ └── model │ │ └── PatchResult.java └── .gitignore ├── spring-ai-demo ├── README.md ├── src │ └── main │ │ ├── java │ │ └── org │ │ │ └── example │ │ │ └── QuestionRequest.java │ │ └── resources │ │ └── application.yaml └── .gitignore ├── springboot-proxy ├── src │ └── main │ │ ├── resources │ │ ├── application.yaml │ │ └── application-a.yaml │ │ └── java │ │ └── com │ │ └── example │ │ ├── Application.java │ │ └── controller │ │ └── UserController.java ├── README.md └── .gitignore ├── springboot-package-segment ├── config │ ├── application-dev.yaml │ ├── application-test.yaml │ └── application.yaml └── demo │ └── src │ └── main │ ├── resources │ ├── application-test.yaml │ ├── application.yaml │ └── application-dev.yaml │ └── java │ └── cn │ └── test │ ├── DemoApplication.java │ └── DemoController.java ├── springboot-rest-chain ├── src │ └── main │ │ ├── resources │ │ └── application.yaml │ │ └── java │ │ └── com │ │ └── example │ │ └── rest │ │ ├── RestApplication.java │ │ └── TestController.java └── .gitignore ├── springboot-htmx ├── src │ └── main │ │ └── resources │ │ └── application.yaml └── .gitignore ├── springboot-api-gray ├── src │ └── main │ │ ├── resources │ │ └── application.yaml │ │ └── java │ │ └── com │ │ └── example │ │ ├── version │ │ ├── UserInfo.java │ │ ├── ApiVersion.java │ │ └── GrayRelease.java │ │ ├── Application.java │ │ └── model │ │ └── User.java └── .gitignore ├── springboot-dynamic-controller ├── src │ └── main │ │ ├── resources │ │ └── application.yaml │ │ └── java │ │ └── com │ │ └── example │ │ ├── DynamicControllerApplication.java │ │ └── controller │ │ ├── DynamicController.java │ │ └── DemoController.java ├── README.md └── .gitignore ├── springboot-shamir ├── .gitignore └── src │ └── main │ ├── resources │ └── application.properties │ └── java │ └── com │ └── demo │ └── shamir │ ├── ShamirApplication.java │ ├── dto │ ├── CombineRequest.java │ ├── CombineResponse.java │ ├── SplitResponse.java │ └── SplitRequest.java │ └── config │ └── CorsConfig.java ├── doc └── images │ └── qrcode.jpg ├── springboot-static-permit ├── src │ └── main │ │ ├── resources │ │ ├── static │ │ │ ├── images │ │ │ │ └── logo.png │ │ │ ├── uploads │ │ │ │ ├── admin-document.pdf │ │ │ │ └── user-contract.pdf │ │ │ └── js │ │ │ │ └── app.js │ │ └── application.properties │ │ └── java │ │ └── com │ │ └── example │ │ └── staticpermit │ │ ├── StaticPermitApplication.java │ │ └── repository │ │ └── FileInfoRepository.java └── private-uploads │ ├── user-avatar.jpg │ ├── private-data.xlsx │ ├── admin-document.pdf │ └── user-contract.pdf ├── springboot-cmd ├── src │ └── main │ │ ├── resources │ │ └── application.yaml │ │ └── java │ │ └── com │ │ └── example │ │ └── cmd │ │ ├── shell │ │ ├── FileCommands.java │ │ ├── AdvancedCommands.java │ │ └── MyCommands.java │ │ └── ShellToolApplication.java └── .gitignore ├── springboot-undertow-proxy ├── src │ └── main │ │ ├── resources │ │ ├── application-a.yaml │ │ ├── application-b.yaml │ │ └── application.yaml │ │ └── java │ │ └── com │ │ └── example │ │ └── controller │ │ └── HealthController.java ├── README.md └── .gitignore ├── springboot-unified-call ├── src │ └── main │ │ ├── resources │ │ ├── META-INF │ │ │ └── dubbo │ │ │ │ └── org.apache.dubbo.rpc.Filter │ │ └── application.yaml │ │ └── java │ │ └── com │ │ └── example │ │ └── unified │ │ ├── service │ │ ├── OrderService.java │ │ ├── UserService.java │ │ └── OrderServiceImpl.java │ │ ├── invoker │ │ └── ServiceInvoker.java │ │ ├── dto │ │ ├── UserDTO.java │ │ └── OrderDTO.java │ │ ├── controller │ │ └── UserController.java │ │ ├── exception │ │ └── BusinessException.java │ │ ├── GlobalExceptionHandler.java │ │ └── UnifiedApplication.java └── .gitignore ├── springboot-gencode ├── doc │ ├── image │ │ └── qrcode.jpg │ └── sys_user.sql ├── src │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── yuboon │ │ │ │ └── springboot │ │ │ │ └── gencode │ │ │ │ ├── template │ │ │ │ ├── VoCodeTemplate.java │ │ │ │ ├── EntityCodeTemplate.java │ │ │ │ └── ControllerCodeTemplate.java │ │ │ │ ├── command │ │ │ │ ├── GenControllerAndEntityCommand.java │ │ │ │ ├── GenVoCommand.java │ │ │ │ ├── GenControllerCommand.java │ │ │ │ └── GenEntityCommand.java │ │ │ │ ├── exception │ │ │ │ └── GenCodeException.java │ │ │ │ └── output │ │ │ │ ├── CodeOutput.java │ │ │ │ └── ConsoleOutput.java │ │ └── resources │ │ │ ├── templates │ │ │ ├── Entity.tpl │ │ │ ├── Controller.tpl │ │ │ └── Vo.tpl │ │ │ ├── logback.xml │ │ │ └── application.yaml │ └── test │ │ └── java │ │ └── com │ │ └── yuboon │ │ └── gencode │ │ └── test │ │ └── GenCodeTest.java └── README.md ├── springboot-config-hot-reload ├── src │ └── main │ │ ├── resources │ │ └── application.yaml │ │ └── java │ │ └── com │ │ └── example │ │ ├── Application.java │ │ ├── AppConfig.java │ │ ├── config │ │ ├── HotRefreshConfig.java │ │ └── ConfigRefreshedEvent.java │ │ └── controller │ │ └── ConfigController.java └── .gitignore ├── java-exception ├── src │ └── main │ │ ├── resources │ │ ├── META-INF │ │ │ └── spring.factories │ │ └── application.yaml │ │ └── java │ │ └── com │ │ └── yuboon │ │ └── learning │ │ └── exception │ │ ├── ExceptionApplicatioin.java │ │ └── DemoAutoConfigure.java └── .gitignore ├── springboot-serverless ├── functions │ ├── demo-function.jar │ └── user-function.jar ├── serverless-core │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── example │ │ │ └── model │ │ │ └── ServerlessFunction.java │ └── pom.xml └── .gitignore ├── springboot-danmaku ├── src │ └── main │ │ ├── resources │ │ ├── static │ │ │ └── code.mp4 │ │ ├── application.properties │ │ └── schema.sql │ │ └── java │ │ └── com │ │ └── example │ │ └── danmaku │ │ ├── dto │ │ └── DanmakuDTO.java │ │ └── DanmakuApplication.java └── .gitignore ├── springboot-mutual-cert └── src │ └── main │ ├── resources │ ├── client.jks │ ├── server.jks │ ├── truststore.jks │ └── application.yml │ └── java │ └── com │ └── example │ └── mutualcert │ └── MutualCertApplication.java ├── springboot-db-cfg └── src │ └── main │ ├── resources │ └── META-INF │ │ └── spring.factories │ └── java │ └── com │ └── example │ └── entity │ ├── ConfigHistory.java │ └── ApplicationConfig.java ├── springboot-agent ├── README.md ├── app │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── example │ │ └── app │ │ ├── Application.java │ │ └── controller │ │ └── UserController.java ├── .gitignore └── pom.xml ├── springboot-object-version └── src │ └── main │ ├── resources │ └── application.yml │ └── java │ └── com │ └── example │ └── objectversion │ ├── model │ ├── Product.java │ └── AuditLog.java │ ├── SpringbootObjectVersionApplication.java │ ├── config │ ├── JaversConfig.java │ └── WebConfig.java │ └── dto │ └── ProductRequest.java ├── springboot-permission └── src │ └── main │ ├── resources │ ├── casbin │ │ ├── policy.csv │ │ └── model.conf │ └── application.yml │ └── java │ └── com │ └── example │ └── permission │ ├── common │ ├── AccessDeniedException.java │ └── Result.java │ ├── PermissionApplication.java │ └── annotation │ └── CheckPermission.java ├── springboot-rpc ├── src │ └── main │ │ ├── resources │ │ └── application.yaml │ │ └── java │ │ └── com │ │ └── example │ │ └── rpc │ │ ├── demo │ │ ├── UserService.java │ │ └── UserController.java │ │ ├── core │ │ ├── RpcReference.java │ │ └── RpcService.java │ │ └── RpcDemoApplication.java └── .gitignore ├── README.md ├── springboot-mybatis-interceptor ├── src │ └── main │ │ ├── java │ │ └── com │ │ │ └── example │ │ │ ├── interceptor │ │ │ ├── SensitiveType.java │ │ │ └── Sensitive.java │ │ │ ├── Application.java │ │ │ ├── model │ │ │ └── User.java │ │ │ ├── service │ │ │ └── UserService.java │ │ │ ├── util │ │ │ └── SensitiveUtils.java │ │ │ ├── controller │ │ │ └── UserController.java │ │ │ └── mapper │ │ │ └── UserMapper.java │ │ └── resources │ │ ├── schema.sql │ │ └── application.yaml └── .gitignore ├── springboot-dynamic-rule └── src │ └── main │ ├── resources │ └── application.yml │ └── java │ └── com │ └── example │ └── dynamicrule │ ├── entity │ ├── RuleExecuteRequest.java │ ├── RuleExecuteResponse.java │ └── RuleScript.java │ └── DynamicRuleApplication.java ├── springboot-live-call ├── src │ └── main │ │ ├── resources │ │ ├── application.yaml │ │ └── static │ │ │ └── login.html │ │ └── java │ │ └── com │ │ └── example │ │ └── livestream │ │ ├── LiveCallApplication.java │ │ ├── model │ │ ├── User.java │ │ └── ChatMessage.java │ │ └── config │ │ └── WebConfig.java └── .gitignore ├── springboot-qrcode-login ├── README.md ├── src │ └── main │ │ ├── resources │ │ └── application.yml │ │ └── java │ │ └── com │ │ └── example │ │ └── qrcodelogin │ │ ├── QrcodeLoginApplication.java │ │ └── model │ │ └── UserInfo.java └── .gitignore ├── springboot-single-login ├── src │ └── main │ │ ├── java │ │ └── com │ │ │ └── example │ │ │ └── login │ │ │ ├── model │ │ │ ├── LoginRequest.java │ │ │ ├── TokenInfo.java │ │ │ ├── LoginInfo.java │ │ │ └── ApiResponse.java │ │ │ ├── LoginApplication.java │ │ │ └── controller │ │ │ └── PageController.java │ │ └── resources │ │ └── application.yml └── .gitignore ├── springboot-memviz ├── .claude │ └── settings.local.json └── src │ └── main │ └── java │ └── com │ └── example │ └── memviz │ ├── model │ ├── TestUserStorage.java │ └── User.java │ └── util │ └── SafeExecs.java ├── springboot-lic └── src │ └── main │ ├── resources │ └── application.yml │ └── java │ └── com │ └── license │ ├── LicenseApplication.java │ ├── exception │ └── LicenseException.java │ ├── annotation │ └── RequireFeature.java │ └── config │ └── AppConfig.java ├── springboot-scheduler ├── src │ └── main │ │ ├── resources │ │ ├── application.yaml │ │ └── schema.sql │ │ └── java │ │ └── com │ │ └── example │ │ ├── scheduler │ │ └── ScheduledTasks.java │ │ └── Application.java └── .gitignore ├── springboot-dfa ├── src │ └── main │ │ ├── resources │ │ └── application.properties │ │ └── java │ │ └── com │ │ └── example │ │ └── dfa │ │ ├── controller │ │ └── IndexController.java │ │ └── entity │ │ └── SensitiveWordResult.java └── README.md ├── .gitignore ├── springboot-form ├── src │ └── main │ │ ├── resources │ │ └── application.yml │ │ └── java │ │ └── com │ │ └── example │ │ └── dynamicform │ │ ├── model │ │ ├── ValidationError.java │ │ ├── FormConfig.java │ │ ├── FormSubmission.java │ │ ├── FormSchema.java │ │ └── FormField.java │ │ ├── DynamicFormApplication.java │ │ └── config │ │ └── CorsConfig.java └── .gitignore ├── springboot-report └── src │ └── main │ ├── resources │ └── application.yml │ └── java │ └── com │ └── example │ └── report │ ├── ReportApplication.java │ └── config │ └── CorsConfig.java ├── springboot-face2face-chat ├── src │ └── main │ │ ├── resources │ │ └── application.properties │ │ └── java │ │ └── com │ │ └── example │ │ └── face2face │ │ ├── dto │ │ └── request │ │ │ ├── JoinGroupRequest.java │ │ │ ├── LoginRequest.java │ │ │ └── LocationRequest.java │ │ ├── exception │ │ └── AppException.java │ │ ├── Face2FaceApplication.java │ │ └── config │ │ └── WebConfig.java └── .gitignore ├── springboot-live ├── src │ └── main │ │ └── java │ │ └── com │ │ └── example │ │ └── livestream │ │ ├── mapper │ │ ├── LiveStreamMapper.java │ │ ├── LiveRecordingMapper.java │ │ └── LiveRoomMapper.java │ │ ├── LiveApplication.java │ │ ├── dto │ │ └── SrsCallbackDto.java │ │ ├── config │ │ └── MinioConfig.java │ │ └── entity │ │ └── LiveStream.java └── .gitignore ├── springboot-online-debug └── src │ └── main │ ├── resources │ └── application.yml │ └── java │ └── com │ └── example │ └── onlinedebug │ └── OnlineDebugApplication.java ├── dist ├── SysUser.java └── SysUserController.java ├── springboot-exception-group └── src │ └── main │ ├── resources │ └── application.properties │ └── java │ └── com │ └── example │ └── exceptiongroup │ └── ExceptionGroupApplication.java ├── springboot-net-capture └── src │ └── main │ └── java │ └── com │ └── example │ └── netcapture │ ├── dto │ ├── CaptureControlDto.java │ └── PacketInfoDto.java │ ├── NetCaptureApplication.java │ └── config │ ├── JacksonConfig.java │ ├── NetworkCaptureProperties.java │ ├── MyBatisPlusConfig.java │ └── WebMvcConfig.java ├── springboot-web-ssh └── src │ └── main │ ├── java │ └── com │ │ └── example │ │ └── webssh │ │ ├── WebSshApplication.java │ │ └── config │ │ └── WebSocketConfig.java │ └── resources │ └── db │ └── schema.sql ├── springboot-cli ├── cli-client │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── example │ │ │ └── cli │ │ │ └── CliClientApplication.java │ │ └── resources │ │ └── application.yml ├── cli-server │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── example │ │ │ └── cli │ │ │ └── CliServerApplication.java │ │ └── resources │ │ └── application.yml ├── cli-common │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── example │ │ │ └── cli │ │ │ ├── CommandHandler.java │ │ │ └── dto │ │ │ └── CommandRequest.java │ └── pom.xml └── README.md ├── springboot-multi-port └── src │ └── main │ ├── java │ └── com │ │ └── example │ │ └── multiport │ │ ├── annotation │ │ ├── UserApi.java │ │ └── AdminApi.java │ │ ├── MultiPortApplication.java │ │ ├── config │ │ └── DualPortProperties.java │ │ └── model │ │ ├── CartItem.java │ │ ├── Product.java │ │ └── ErrorResponse.java │ └── resources │ └── application.yml ├── springboot-api-doc └── src │ └── main │ ├── java │ └── com │ │ └── apidoc │ │ ├── controller │ │ └── HomeController.java │ │ ├── ApiDocApplication.java │ │ └── annotation │ │ ├── ApiEnvironment.java │ │ ├── ApiOperation.java │ │ ├── ApiGroup.java │ │ ├── ApiParam.java │ │ ├── ApiField.java │ │ └── ApiExample.java │ └── resources │ └── application.properties ├── springboot-sql-tree └── src │ └── main │ └── java │ └── com │ └── example │ └── sqltree │ ├── SqlTreeApplication.java │ └── SqlTreeProperties.java ├── springboot-gencode-training └── src │ └── main │ ├── java │ └── com │ │ └── yuboon │ │ └── springboot │ │ └── gencode │ │ ├── template │ │ ├── EntityCodeTemplate.java │ │ └── ControllerCodeTemplate.java │ │ ├── exception │ │ └── GenCodeException.java │ │ ├── output │ │ ├── ConsoleOutput.java │ │ └── CodeOutput.java │ │ └── command │ │ └── EntityCommand.java │ └── resources │ ├── template │ ├── Entity.tpl │ └── Controller.tpl │ ├── logback.xml │ └── application.yaml ├── springboot-jwt-rotation └── src │ └── main │ ├── resources │ └── application.yml │ └── java │ └── com │ └── example │ └── jwt │ └── JwtRotationApplication.java ├── springboot-asn1 ├── src │ └── main │ │ └── java │ │ └── com │ │ └── example │ │ └── asn1 │ │ ├── Asn1ParserApplication.java │ │ ├── controller │ │ └── HomeController.java │ │ └── dto │ │ └── Asn1ParseRequest.java └── README.md ├── dependency-scanner └── src │ └── main │ └── java │ └── com │ └── example │ └── dependencyscanner │ └── DependencyScannerApplication.java ├── springboot-timingwheel └── src │ └── main │ ├── resources │ └── application.yml │ └── java │ └── com │ └── example │ └── timingwheel │ ├── model │ └── TimerTask.java │ ├── config │ ├── MetricsConfig.java │ ├── WebConfig.java │ └── TimingWheelConfig.java │ └── SpringbootTimingwheelApplication.java ├── springboot-api-dashboard └── src │ └── main │ ├── java │ └── com │ │ └── example │ │ └── dashboard │ │ └── DashboardApplication.java │ └── resources │ └── application.yml ├── springboot-jar-conflict └── src │ └── main │ └── java │ └── com │ └── example │ └── jarconflict │ └── JarConflictDetectorApplication.java ├── springboot-column-encryption └── src │ └── main │ ├── java │ └── com │ │ └── example │ │ └── encryption │ │ ├── ColumnEncryptionApplication.java │ │ └── annotation │ │ └── Encrypted.java │ └── resources │ └── sql │ └── schema.sql ├── springboot-hot-cpu └── src │ └── main │ └── resources │ └── application.yml ├── springboot-logview └── src │ └── main │ └── java │ └── com │ └── example │ └── logviewer │ └── dto │ └── LogQueryResponse.java └── springboot-api-signature └── src └── main └── java └── com └── example └── sign └── ApiSignatureApplication.java /springboot-hot-patch/temp/1.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spring-ai-demo/README.md: -------------------------------------------------------------------------------- 1 | # spring-ai-demo -------------------------------------------------------------------------------- /springboot-proxy/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 -------------------------------------------------------------------------------- /springboot-package-segment/config/application-dev.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8085 -------------------------------------------------------------------------------- /springboot-proxy/src/main/resources/application-a.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8081 3 | -------------------------------------------------------------------------------- /springboot-rest-chain/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 -------------------------------------------------------------------------------- /springboot-htmx/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | 4 | -------------------------------------------------------------------------------- /springboot-package-segment/config/application-test.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8085 3 | -------------------------------------------------------------------------------- /springboot-api-gray/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | 4 | -------------------------------------------------------------------------------- /springboot-dynamic-controller/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 -------------------------------------------------------------------------------- /springboot-shamir/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | target/ 3 | *.iml 4 | .DS_Store 5 | .vscode/ 6 | *.log -------------------------------------------------------------------------------- /doc/images/qrcode.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuboon/java-examples/HEAD/doc/images/qrcode.jpg -------------------------------------------------------------------------------- /springboot-package-segment/config/application.yaml: -------------------------------------------------------------------------------- 1 | spring: 2 | profiles: 3 | active: dev -------------------------------------------------------------------------------- /springboot-package-segment/demo/src/main/resources/application-test.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8081 3 | -------------------------------------------------------------------------------- /springboot-package-segment/demo/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | spring: 2 | profiles: 3 | active: dev -------------------------------------------------------------------------------- /springboot-static-permit/src/main/resources/static/images/logo.png: -------------------------------------------------------------------------------- 1 | 这是一个公开的Logo图片占位符文件。 2 | 在实际项目中,这里应该是一个PNG图片文件。 -------------------------------------------------------------------------------- /springboot-cmd/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | spring: 2 | shell: 3 | interactive: 4 | enabled: true -------------------------------------------------------------------------------- /springboot-package-segment/demo/src/main/resources/application-dev.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | 4 | 5 | -------------------------------------------------------------------------------- /springboot-undertow-proxy/src/main/resources/application-a.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8081 3 | 4 | user: 5 | enabled: true 6 | -------------------------------------------------------------------------------- /springboot-undertow-proxy/src/main/resources/application-b.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8082 3 | 4 | user: 5 | enabled: true 6 | -------------------------------------------------------------------------------- /springboot-unified-call/src/main/resources/META-INF/dubbo/org.apache.dubbo.rpc.Filter: -------------------------------------------------------------------------------- 1 | com.example.unified.DubboExceptionFilter -------------------------------------------------------------------------------- /springboot-gencode/doc/image/qrcode.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuboon/java-examples/HEAD/springboot-gencode/doc/image/qrcode.jpg -------------------------------------------------------------------------------- /springboot-config-hot-reload/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | 4 | app: 5 | timeout: 3000 6 | maxRetries: 5 7 | -------------------------------------------------------------------------------- /java-exception/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=com.yuboon.learning.exception.Demo -------------------------------------------------------------------------------- /springboot-serverless/functions/demo-function.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuboon/java-examples/HEAD/springboot-serverless/functions/demo-function.jar -------------------------------------------------------------------------------- /springboot-serverless/functions/user-function.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuboon/java-examples/HEAD/springboot-serverless/functions/user-function.jar -------------------------------------------------------------------------------- /springboot-danmaku/src/main/resources/static/code.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuboon/java-examples/HEAD/springboot-danmaku/src/main/resources/static/code.mp4 -------------------------------------------------------------------------------- /springboot-mutual-cert/src/main/resources/client.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuboon/java-examples/HEAD/springboot-mutual-cert/src/main/resources/client.jks -------------------------------------------------------------------------------- /springboot-mutual-cert/src/main/resources/server.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuboon/java-examples/HEAD/springboot-mutual-cert/src/main/resources/server.jks -------------------------------------------------------------------------------- /springboot-mutual-cert/src/main/resources/truststore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuboon/java-examples/HEAD/springboot-mutual-cert/src/main/resources/truststore.jks -------------------------------------------------------------------------------- /springboot-db-cfg/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.context.ApplicationContextInitializer=\ 2 | com.example.config.EarlyDatabaseConfigInitializer -------------------------------------------------------------------------------- /springboot-agent/README.md: -------------------------------------------------------------------------------- 1 | ## 测试流程 2 | 1. maven package 打包agent 3 | 2. 设置app启动参数 `-javaagent:agent/target/agent-0.0.1-SNAPSHOT.jar` 4 | 3. 启动app, 访问 `http://localhost:8080/user/query` 5 | 4. 查看监控数据 -------------------------------------------------------------------------------- /springboot-static-permit/private-uploads/user-avatar.jpg: -------------------------------------------------------------------------------- 1 | 这是用户头像文件 (user-avatar.jpg) 2 | 3 | 用户头像信息: 4 | 用户:user 5 | 上传时间:2024-09-23 6 | 文件类型:个人头像 7 | 权限:仅用户本人可访问 8 | 9 | 注:在实际项目中,这里应该是一个JPG图片文件。 -------------------------------------------------------------------------------- /springboot-object-version/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | jackson: 3 | serialization: 4 | write-dates-as-timestamps: false 5 | 6 | app: 7 | audit: 8 | enabled: true 9 | -------------------------------------------------------------------------------- /springboot-static-permit/private-uploads/private-data.xlsx: -------------------------------------------------------------------------------- 1 | 这是一个私密数据表格文件 (private-data.xlsx) 2 | 3 | 数据表格内容: 4 | - 财务数据汇总 5 | - 用户隐私信息统计 6 | - 商业机密分析报告 7 | 8 | 所有者:admin 9 | 安全级别:机密 10 | 访问权限:仅管理员 -------------------------------------------------------------------------------- /springboot-permission/src/main/resources/casbin/policy.csv: -------------------------------------------------------------------------------- 1 | p, r.sub.dept == r.obj.dept && r.sub.id == r.obj.ownerId, true, edit 2 | p, r.sub.dept == r.obj.dept, true, read 3 | p, true, r.obj.type == "public", read -------------------------------------------------------------------------------- /springboot-rpc/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | 4 | rpc: 5 | server: 6 | url: http://localhost:8080 7 | 8 | logging: 9 | level: 10 | com.example.rpc: DEBUG -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### java-examples 2 | 3 | 配合博客或技术文章的一些demo代码 4 | 5 | ### 关注我 6 | 7 | 公众号「风象南」,持续输出优质内容 8 | 9 | 10 | ![](https://raw.githubusercontent.com/yuboon/java-examples/master/doc/images/qrcode.jpg) 11 | 12 | -------------------------------------------------------------------------------- /springboot-hot-patch/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=springboot-hot-patch 2 | server.port=8080 3 | 4 | # Hot Patch Configuration 5 | hotpatch.enabled=true 6 | hotpatch.path=./patches 7 | -------------------------------------------------------------------------------- /springboot-static-permit/src/main/resources/static/uploads/admin-document.pdf: -------------------------------------------------------------------------------- 1 | 这是一个受保护的管理员文档 (admin-document.pdf) 2 | 3 | 内容:这是一份只有管理员才能访问的机密文档。 4 | 包含公司的核心业务数据和策略信息。 5 | 6 | 创建者:admin 7 | 创建时间:2024-09-23 8 | 权限级别:仅管理员可访问 -------------------------------------------------------------------------------- /springboot-mybatis-interceptor/src/main/java/com/example/interceptor/SensitiveType.java: -------------------------------------------------------------------------------- 1 | package com.example.interceptor; 2 | 3 | // 脱敏类型枚举 4 | public enum SensitiveType { 5 | PHONE, // 手机号 6 | ID_CARD // 身份证号 7 | } -------------------------------------------------------------------------------- /spring-ai-demo/src/main/java/org/example/QuestionRequest.java: -------------------------------------------------------------------------------- 1 | package org.example; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class QuestionRequest { 7 | private String question; 8 | private String sessionId; 9 | } -------------------------------------------------------------------------------- /springboot-shamir/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=8080 2 | spring.application.name=shamir-secret-sharing 3 | 4 | logging.level.com.demo.shamir=INFO 5 | logging.pattern.console=%d{yyyy-MM-dd HH:mm:ss} - %msg%n -------------------------------------------------------------------------------- /springboot-static-permit/src/main/resources/static/uploads/user-contract.pdf: -------------------------------------------------------------------------------- 1 | 这是一个受保护的用户合同文件 (user-contract.pdf) 2 | 3 | 合同内容: 4 | 合同编号:CONTRACT-2024-001 5 | 签署方:用户 (user) 6 | 合同类型:服务协议 7 | 签署日期:2024-09-23 8 | 9 | 这是一份个人合同文件,只有合同拥有者才能查看。 -------------------------------------------------------------------------------- /springboot-proxy/README.md: -------------------------------------------------------------------------------- 1 | ## 说明 2 | 1. 测试代理功能需要启动两个独立的服务,一个是代理服务,一个是目标服务 3 | 2. 先默认启动Application 4 | 3. 再添加一个启动类TargetApplication,指定配置文件 -Dspring.config.name=application-a ,然后启动即可测试 5 | 4. 访问 http://localhost:8080/proxy/user/save 查看代理服务返回结果 -------------------------------------------------------------------------------- /springboot-undertow-proxy/README.md: -------------------------------------------------------------------------------- 1 | ## 说明 2 | 1. 测试代理功能需要启动两个独立的服务,一个是代理服务,一个是目标服务 3 | 2. 先默认启动Application 4 | 3. 再添加一个启动类TargetApplication,指定配置文件 -Dspring.config.name=application-a ,然后启动即可测试 5 | 4. 访问 http://localhost:8080/user/users1 查看代理服务返回结果 -------------------------------------------------------------------------------- /springboot-dynamic-rule/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | 4 | spring: 5 | application: 6 | name: springboot-dynamic-rule 7 | 8 | logging: 9 | level: 10 | com.example.dynamicrule: INFO 11 | root: INFO -------------------------------------------------------------------------------- /springboot-live-call/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | 4 | spring: 5 | application: 6 | name: livestream-system 7 | 8 | jwt: 9 | secret: livestreamSecretKey123456789012345678901234567890 10 | expiration: 86400000 -------------------------------------------------------------------------------- /springboot-permission/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | 4 | spring: 5 | application: 6 | name: springboot-permission 7 | 8 | logging: 9 | level: 10 | com.example.permission: DEBUG 11 | org.casbin: DEBUG 12 | -------------------------------------------------------------------------------- /springboot-static-permit/private-uploads/admin-document.pdf: -------------------------------------------------------------------------------- 1 | 这是一个管理员文档副本 (admin-document.pdf) 2 | 3 | 内容:这是一份只有管理员才能访问的机密文档。 4 | 包含公司的核心业务数据和策略信息。 5 | 6 | 创建者:admin 7 | 创建时间:2024-09-23 8 | 权限级别:仅管理员可访问 9 | 10 | 注:此文件存储在private-uploads目录,通过Controller代理访问。 -------------------------------------------------------------------------------- /springboot-static-permit/private-uploads/user-contract.pdf: -------------------------------------------------------------------------------- 1 | 这是一个用户合同副本 (user-contract.pdf) 2 | 3 | 合同内容: 4 | 合同编号:CONTRACT-2024-001 5 | 签署方:用户 (user) 6 | 合同类型:服务协议 7 | 签署日期:2024-09-23 8 | 9 | 这是一份个人合同文件,只有合同拥有者才能查看。 10 | 11 | 注:此文件存储在private-uploads目录,通过Controller代理访问。 -------------------------------------------------------------------------------- /springboot-unified-call/src/main/java/com/example/unified/service/OrderService.java: -------------------------------------------------------------------------------- 1 | package com.example.unified.service; 2 | 3 | import com.example.unified.dto.OrderDTO; 4 | 5 | public interface OrderService { 6 | 7 | public OrderDTO getOrder(OrderDTO orderDTO); 8 | 9 | } -------------------------------------------------------------------------------- /springboot-qrcode-login/README.md: -------------------------------------------------------------------------------- 1 | ### 二维码登录 2 | 3 | 技术文章详见: 4 | 5 | [SpringBoot扫码登录实现](https://mp.weixin.qq.com/s/_W0X7wRPjzXLn7OwZlS-Fg) 6 | 7 | ### 关注我 8 | 9 | 公众号「风象南」,持续输出优质内容 10 | 11 | ![](https://raw.githubusercontent.com/yuboon/java-examples/master/doc/images/qrcode.jpg) 12 | 13 | -------------------------------------------------------------------------------- /springboot-single-login/src/main/java/com/example/login/model/LoginRequest.java: -------------------------------------------------------------------------------- 1 | package com.example.login.model; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * 登录请求 7 | */ 8 | @Data 9 | public class LoginRequest { 10 | private String username; 11 | private String password; 12 | } -------------------------------------------------------------------------------- /springboot-rpc/src/main/java/com/example/rpc/demo/UserService.java: -------------------------------------------------------------------------------- 1 | package com.example.rpc.demo; 2 | 3 | import java.util.List; 4 | 5 | public interface UserService { 6 | String getUserName(Long userId); 7 | boolean updateUser(Long userId, String name); 8 | List getUserList(); 9 | } -------------------------------------------------------------------------------- /springboot-permission/src/main/resources/casbin/model.conf: -------------------------------------------------------------------------------- 1 | [request_definition] 2 | r = sub, obj, act 3 | 4 | [policy_definition] 5 | p = sub_rule, obj_rule, act 6 | 7 | [policy_effect] 8 | e = some(where (p.eft == allow)) 9 | 10 | [matchers] 11 | m = eval(p.sub_rule) && eval(p.obj_rule) && r.act == p.act -------------------------------------------------------------------------------- /springboot-memviz/.claude/settings.local.json: -------------------------------------------------------------------------------- 1 | { 2 | "permissions": { 3 | "allow": [ 4 | "Bash(mvn:*)", 5 | "WebFetch(domain:javadoc.io)", 6 | "WebFetch(domain:github.com)", 7 | "Bash(timeout:*)", 8 | "Bash(ping:*)", 9 | "Bash(curl:*)" 10 | ], 11 | "deny": [] 12 | } 13 | } -------------------------------------------------------------------------------- /springboot-memviz/src/main/java/com/example/memviz/model/TestUserStorage.java: -------------------------------------------------------------------------------- 1 | package com.example.memviz.model; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | /** 7 | * 存储测试User对象的静态容器 8 | */ 9 | public class TestUserStorage { 10 | public static final List users = new ArrayList<>(); 11 | } -------------------------------------------------------------------------------- /springboot-object-version/src/main/java/com/example/objectversion/model/Product.java: -------------------------------------------------------------------------------- 1 | package com.example.objectversion.model; 2 | 3 | import java.math.BigDecimal; 4 | 5 | public record Product( 6 | String id, 7 | String name, 8 | BigDecimal price, 9 | String description 10 | ) { 11 | } 12 | -------------------------------------------------------------------------------- /springboot-lic/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | 4 | spring: 5 | application: 6 | name: license-control-system 7 | 8 | license: 9 | keys: 10 | private-key: classpath:keys/private.pem 11 | public-key: classpath:keys/public.pem 12 | 13 | logging: 14 | level: 15 | com.license: DEBUG -------------------------------------------------------------------------------- /springboot-scheduler/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | 4 | # mysql数据源连接 5 | spring: 6 | datasource: 7 | driver-class-name: com.mysql.cj.jdbc.Driver 8 | url: jdbc:mysql://localhost:3306/task?useUnicode=true&characterEncoding=utf8&serverTimezone=UTC 9 | username: root 10 | password: root -------------------------------------------------------------------------------- /springboot-api-gray/src/main/java/com/example/version/UserInfo.java: -------------------------------------------------------------------------------- 1 | package com.example.version; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * 用户信息类,用于灰度发布决策 7 | */ 8 | @Data 9 | public class UserInfo { 10 | private String userId; 11 | private String[] groups; 12 | private String region; 13 | } -------------------------------------------------------------------------------- /springboot-mybatis-interceptor/src/main/resources/schema.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE user ( 2 | id BIGINT PRIMARY KEY AUTO_INCREMENT COMMENT '主键ID', 3 | username VARCHAR(255) NOT NULL COMMENT '用户名', 4 | phone VARCHAR(11) COMMENT '手机号', 5 | id_card VARCHAR(18) COMMENT '身份证号' 6 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='用户表'; -------------------------------------------------------------------------------- /springboot-dfa/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=8080 2 | 3 | spring.application.name=dfa-sensitive-word-filter 4 | 5 | logging.level.com.example.dfa=INFO 6 | logging.pattern.console=%d{yyyy-MM-dd HH:mm:ss} - %msg%n 7 | 8 | server.servlet.encoding.charset=UTF-8 9 | server.servlet.encoding.enabled=true 10 | server.servlet.encoding.force=true -------------------------------------------------------------------------------- /springboot-mybatis-interceptor/src/main/java/com/example/interceptor/Sensitive.java: -------------------------------------------------------------------------------- 1 | package com.example.interceptor; 2 | 3 | import java.lang.annotation.*; 4 | 5 | // 作用在字段上 6 | @Target(ElementType.FIELD) 7 | // 运行时生效 8 | @Retention(RetentionPolicy.RUNTIME) 9 | public @interface Sensitive { 10 | // 脱敏类型(手机号、身份证号等) 11 | SensitiveType type(); 12 | } 13 | -------------------------------------------------------------------------------- /springboot-mybatis-interceptor/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | 4 | spring: 5 | datasource: 6 | url: jdbc:mysql://localhost:3306/test 7 | username: root 8 | password: root 9 | driver-class-name: com.mysql.cj.jdbc.Driver 10 | # 连接池配置 11 | hikari: 12 | maximum-pool-size: 10 13 | minimum-idle: 5 -------------------------------------------------------------------------------- /spring-ai-demo/.gitignore: -------------------------------------------------------------------------------- 1 | # maven # 2 | target/ 3 | 4 | logs 5 | 6 | # eclipse # 7 | .settings 8 | .project 9 | .classpath 10 | .log 11 | 12 | # Package Files # 13 | *.war 14 | *.ear 15 | 16 | # idea # 17 | .idea/ 18 | *.iml 19 | *.lck 20 | *.tmp 21 | *.class 22 | vcx.xml 23 | 24 | # Package Files # 25 | *.jar 26 | *.bak 27 | *.tmp 28 | *.log 29 | *.gz 30 | 31 | 32 | -------------------------------------------------------------------------------- /springboot-scheduler/src/main/resources/schema.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE scheduled_tasks ( 2 | id BIGINT AUTO_INCREMENT PRIMARY KEY, 3 | task_name VARCHAR(100) NOT NULL UNIQUE, 4 | cron VARCHAR(100) NOT NULL, 5 | description VARCHAR(255), 6 | created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, 7 | updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP 8 | ); -------------------------------------------------------------------------------- /springboot-unified-call/src/main/java/com/example/unified/invoker/ServiceInvoker.java: -------------------------------------------------------------------------------- 1 | package com.example.unified.invoker; 2 | 3 | import cn.hutool.core.lang.TypeReference; 4 | import com.example.unified.ApiResponse; 5 | 6 | public interface ServiceInvoker { 7 | ApiResponse invoke(String serviceName, String method, Object param, TypeReference> resultType); 8 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # maven # 2 | target/ 3 | logs 4 | 5 | # eclipse # 6 | .settings 7 | .project 8 | .classpath 9 | .log 10 | 11 | # Package Files # 12 | *.war 13 | *.ear 14 | 15 | # idea # 16 | .idea/ 17 | *.iml 18 | *.lck 19 | *.tmp 20 | *.class 21 | vcx.xml 22 | 23 | # Package Files # 24 | *.jar 25 | *.bak 26 | *.tmp 27 | *.log 28 | *.gz 29 | 30 | 31 | -------------------------------------------------------------------------------- /spring-ai-demo/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 5555 3 | 4 | spring: 5 | ai: 6 | openai: 7 | # 替换为自己的硅基流动API密钥,否则启动报错 8 | api-key: sk-xxx 9 | base-url: https://api.siliconflow.cn/ 10 | embedding: 11 | options: 12 | model: BAAI/bge-m3 13 | chat: 14 | options: 15 | model: deepseek-ai/DeepSeek-V3 -------------------------------------------------------------------------------- /springboot-form/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | servlet: 4 | context-path: / 5 | 6 | spring: 7 | application: 8 | name: dynamic-form-system 9 | 10 | # 自定义配置 11 | form: 12 | cache: 13 | max-size: 1000 14 | expire-minutes: 30 15 | 16 | logging: 17 | level: 18 | com.example.dynamicform: DEBUG 19 | org.springframework.web: DEBUG -------------------------------------------------------------------------------- /springboot-dfa/README.md: -------------------------------------------------------------------------------- 1 | # DFA 敏感词过滤系统 2 | 3 | 基于 DFA (Deterministic Finite Automaton) 算法和 Trie 树数据结构实现的敏感词过滤示例。 4 | 5 | ## 🚀 项目特性 6 | 7 | - **高效算法**: 基于 DFA 算法,时间复杂度 O(n) 8 | - **前缀共享**: 使用 Trie 树优化内存使用 9 | - **RESTful API**: 标准化的 API 接口 10 | 11 | ## 📋 功能列表 12 | 13 | ### 核心功能 14 | - ✅ 敏感词检测 15 | - ✅ 文本过滤 16 | - ✅ 批量敏感词管理 17 | 18 | ### 管理功能 19 | - ✅ 添加单个敏感词 20 | - ✅ 批量添加敏感词 21 | - ✅ 动态词库更新 -------------------------------------------------------------------------------- /springboot-report/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | 4 | spring: 5 | application: 6 | name: report-platform 7 | 8 | datasource: 9 | driver-class-name: com.mysql.cj.jdbc.Driver 10 | url: jdbc:mysql://localhost:3306/test_db?useSSL=false 11 | username: root 12 | password: root 13 | 14 | logging: 15 | level: 16 | com.example.report: INFO -------------------------------------------------------------------------------- /java-exception/.gitignore: -------------------------------------------------------------------------------- 1 | # maven # 2 | target/ 3 | logs 4 | 5 | # eclipse # 6 | .settings 7 | .project 8 | .classpath 9 | .log 10 | 11 | # Package Files # 12 | *.war 13 | *.ear 14 | 15 | # idea # 16 | .idea/ 17 | *.iml 18 | *.lck 19 | *.tmp 20 | *.class 21 | vcx.xml 22 | 23 | # Package Files # 24 | *.jar 25 | *.bak 26 | *.tmp 27 | *.log 28 | *.gz 29 | 30 | 31 | -------------------------------------------------------------------------------- /springboot-qrcode-login/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | redis: 3 | host: localhost 4 | port: 6379 5 | password: 6 | database: 0 7 | timeout: 5000ms 8 | lettuce: 9 | pool: 10 | max-active: 20 11 | max-idle: 10 12 | min-idle: 5 13 | qrcode: 14 | # 二维码有效期(秒) 15 | expire: 16 | seconds: 300 17 | width: 100 18 | height: 100 -------------------------------------------------------------------------------- /springboot-face2face-chat/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | # Server configuration 2 | server.port=8080 3 | 4 | # Redis configuration 5 | spring.redis.host=localhost 6 | spring.redis.port=6379 7 | 8 | face2face.distanceThresholdMeters: 500 9 | 10 | # JWT configuration 11 | jwt.secret=MTIzNDU2NzgxMjM0NTY3ODEyMzQ1Njc4MTIzNDU2NzgxMjM0NTY3ODEyMzQ1Njc4MTIzNDU2NzgxMjM0NTY3OA== 12 | jwt.expiration=86400 -------------------------------------------------------------------------------- /springboot-live/src/main/java/com/example/livestream/mapper/LiveStreamMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.livestream.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.example.livestream.entity.LiveStream; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | @Mapper 8 | public interface LiveStreamMapper extends BaseMapper { 9 | // 基础CRUD方法由BaseMapper提供 10 | } -------------------------------------------------------------------------------- /springboot-object-version/src/main/java/com/example/objectversion/model/AuditLog.java: -------------------------------------------------------------------------------- 1 | package com.example.objectversion.model; 2 | 3 | import java.time.Instant; 4 | 5 | public record AuditLog( 6 | String id, 7 | String entityType, 8 | String entityId, 9 | String action, 10 | String actor, 11 | Instant occurredAt, 12 | String diffJson 13 | ) { 14 | } 15 | -------------------------------------------------------------------------------- /springboot-api-gray/src/main/java/com/example/Application.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Application { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Application.class, args); 11 | } 12 | 13 | } -------------------------------------------------------------------------------- /springboot-online-debug/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | 4 | spring: 5 | application: 6 | name: online-debug-tool 7 | 8 | # 开发环境配置 9 | profiles: 10 | active: dev 11 | 12 | logging: 13 | level: 14 | com.example.onlinedebug: DEBUG 15 | net.bytebuddy: WARN 16 | pattern: 17 | console: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n" 18 | -------------------------------------------------------------------------------- /springboot-dynamic-controller/README.md: -------------------------------------------------------------------------------- 1 | ## 说明 2 | 1. 启动服务 3 | 2. 访问 http://localhost:8080/demo/hello ,此时应该是404,因为没有注册控制器 4 | 3. POST http://localhost:8080/controller/register?methodName=hello&controllerBeanName=demoController 注册控制器 5 | 4. 再次访问 http://localhost:8080/demo/hello 6 | 5. POST http://localhost:8080/controller/unregister?methodName=hello&controllerBeanName=demoController 卸载控制器 7 | 6. 再次访问 http://localhost:8080/demo/hello -------------------------------------------------------------------------------- /springboot-dynamic-rule/src/main/java/com/example/dynamicrule/entity/RuleExecuteRequest.java: -------------------------------------------------------------------------------- 1 | package com.example.dynamicrule.entity; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @NoArgsConstructor 9 | @AllArgsConstructor 10 | public class RuleExecuteRequest { 11 | 12 | private String ruleName; 13 | 14 | private Object params; 15 | } -------------------------------------------------------------------------------- /springboot-lic/src/main/java/com/license/LicenseApplication.java: -------------------------------------------------------------------------------- 1 | package com.license; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class LicenseApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(LicenseApplication.class, args); 11 | } 12 | } -------------------------------------------------------------------------------- /springboot-live/src/main/java/com/example/livestream/mapper/LiveRecordingMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.livestream.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.example.livestream.entity.LiveRecording; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | @Mapper 8 | public interface LiveRecordingMapper extends BaseMapper { 9 | // 基础CRUD方法由BaseMapper提供 10 | } -------------------------------------------------------------------------------- /springboot-shamir/src/main/java/com/demo/shamir/ShamirApplication.java: -------------------------------------------------------------------------------- 1 | package com.demo.shamir; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class ShamirApplication { 8 | public static void main(String[] args) { 9 | SpringApplication.run(ShamirApplication.class, args); 10 | } 11 | } -------------------------------------------------------------------------------- /springboot-shamir/src/main/java/com/demo/shamir/dto/CombineRequest.java: -------------------------------------------------------------------------------- 1 | package com.demo.shamir.dto; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * 恢复请求 DTO 11 | */ 12 | @Data 13 | @NoArgsConstructor 14 | @AllArgsConstructor 15 | public class CombineRequest { 16 | private List shares; // 密钥份额列表 17 | } -------------------------------------------------------------------------------- /dist/SysUser.java: -------------------------------------------------------------------------------- 1 | import lombok.Data; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * 用户信息-实体 7 | * 8 | * @author yuboon 9 | * @version v1.0 10 | * @date 2020-01-08 11 | */ 12 | @Data 13 | public class SysUser implements Serializable { 14 | 15 | /** 主键 */ 16 | @Column("id") 17 | private int id; 18 | 19 | /** 姓名 */ 20 | @Column("name") 21 | private String name; 22 | 23 | 24 | } 25 | -------------------------------------------------------------------------------- /springboot-config-hot-reload/src/main/java/com/example/Application.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Application { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Application.class,args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springboot-exception-group/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=8080 2 | server.servlet.context-path=/ 3 | 4 | logging.level.com.example.exceptiongroup=DEBUG 5 | logging.level.org.springframework.web=INFO 6 | 7 | error-fingerprint.cache-size=1000 8 | error-fingerprint.log-threshold=10 9 | error-fingerprint.stack-depth=5 10 | error-fingerprint.enable-call-chain-hash=true 11 | 12 | spring.web.cors.enabled=true -------------------------------------------------------------------------------- /springboot-mybatis-interceptor/src/main/java/com/example/Application.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Application { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Application.class,args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springboot-undertow-proxy/src/main/java/com/example/controller/HealthController.java: -------------------------------------------------------------------------------- 1 | package com.example.controller; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class HealthController { 8 | @GetMapping("/health") 9 | public String health() { 10 | return "OK"; 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springboot-net-capture/src/main/java/com/example/netcapture/dto/CaptureControlDto.java: -------------------------------------------------------------------------------- 1 | package com.example.netcapture.dto; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class CaptureControlDto { 7 | 8 | private String action; 9 | 10 | private String networkInterface; 11 | 12 | private String filter; 13 | 14 | private Boolean promiscuous; 15 | 16 | private Integer maxPackets; 17 | } -------------------------------------------------------------------------------- /springboot-report/src/main/java/com/example/report/ReportApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.report; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class ReportApplication { 8 | public static void main(String[] args) { 9 | SpringApplication.run(ReportApplication.class, args); 10 | } 11 | } -------------------------------------------------------------------------------- /springboot-single-login/src/main/java/com/example/login/LoginApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.login; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class LoginApplication { 8 | public static void main(String[] args) { 9 | SpringApplication.run(LoginApplication.class, args); 10 | } 11 | } -------------------------------------------------------------------------------- /springboot-web-ssh/src/main/java/com/example/webssh/WebSshApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.webssh; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class WebSshApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(WebSshApplication.class, args); 11 | } 12 | } -------------------------------------------------------------------------------- /springboot-danmaku/src/main/java/com/example/danmaku/dto/DanmakuDTO.java: -------------------------------------------------------------------------------- 1 | package com.example.danmaku.dto; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class DanmakuDTO { 7 | private String content; 8 | private String color = "#ffffff"; // 默认白色 9 | private Integer fontSize = 24; // 默认字体大小 10 | private Double time; 11 | private String videoId; 12 | private String userId; 13 | private String username; 14 | } -------------------------------------------------------------------------------- /springboot-hot-patch/src/main/java/com/example/hotpatch/example/MathHelper.java: -------------------------------------------------------------------------------- 1 | package com.example.hotpatch.example; 2 | 3 | /** 4 | * 示例数学辅助类 - 用于演示静态方法替换 5 | */ 6 | public class MathHelper { 7 | 8 | public static int divide(int a, int b) { 9 | // 原始版本有bug:没有处理除零异常 10 | return a / b; 11 | } 12 | 13 | public static int multiply(int a, int b) { 14 | return a * b; // 这个方法没问题,不需要修复 15 | } 16 | } -------------------------------------------------------------------------------- /springboot-lic/src/main/java/com/license/exception/LicenseException.java: -------------------------------------------------------------------------------- 1 | package com.license.exception; 2 | 3 | /** 4 | * 许可证异常类 5 | * 用于处理许可证相关的业务异常 6 | */ 7 | public class LicenseException extends RuntimeException { 8 | 9 | public LicenseException(String message) { 10 | super(message); 11 | } 12 | 13 | public LicenseException(String message, Throwable cause) { 14 | super(message, cause); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /springboot-package-segment/demo/src/main/java/cn/test/DemoApplication.java: -------------------------------------------------------------------------------- 1 | package cn.test; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class DemoApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(DemoApplication.class); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springboot-live-call/src/main/java/com/example/livestream/LiveCallApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.livestream; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class LiveCallApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(LiveCallApplication.class, args); 11 | } 12 | 13 | } -------------------------------------------------------------------------------- /springboot-mutual-cert/src/main/java/com/example/mutualcert/MutualCertApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.mutualcert; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class MutualCertApplication { 8 | public static void main(String[] args) { 9 | SpringApplication.run(MutualCertApplication.class, args); 10 | } 11 | } -------------------------------------------------------------------------------- /springboot-permission/src/main/java/com/example/permission/common/AccessDeniedException.java: -------------------------------------------------------------------------------- 1 | package com.example.permission.common; 2 | 3 | /** 4 | * 权限拒绝异常 5 | */ 6 | public class AccessDeniedException extends RuntimeException { 7 | 8 | public AccessDeniedException(String message) { 9 | super(message); 10 | } 11 | 12 | public AccessDeniedException(String message, Throwable cause) { 13 | super(message, cause); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /springboot-single-login/src/main/java/com/example/login/model/TokenInfo.java: -------------------------------------------------------------------------------- 1 | package com.example.login.model; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | 6 | /** 7 | * Token信息 8 | */ 9 | @Data 10 | @AllArgsConstructor 11 | public class TokenInfo { 12 | private String token; // Token值 13 | private String username; // 用户名 14 | private LoginInfo loginInfo; // 登录信息 15 | private long expireTime; // 过期时间 16 | } -------------------------------------------------------------------------------- /springboot-dynamic-controller/src/main/java/com/example/DynamicControllerApplication.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class DynamicControllerApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(DynamicControllerApplication.class, args); 11 | } 12 | } -------------------------------------------------------------------------------- /springboot-dynamic-rule/src/main/java/com/example/dynamicrule/DynamicRuleApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.dynamicrule; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class DynamicRuleApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(DynamicRuleApplication.class, args); 11 | } 12 | } -------------------------------------------------------------------------------- /springboot-static-permit/src/main/java/com/example/staticpermit/StaticPermitApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.staticpermit; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class StaticPermitApplication { 8 | public static void main(String[] args) { 9 | SpringApplication.run(StaticPermitApplication.class, args); 10 | } 11 | } -------------------------------------------------------------------------------- /dist/SysUserController.java: -------------------------------------------------------------------------------- 1 | import org.springframework.web.bind.annotation.RestController; 2 | import org.springframework.web.bind.annotation.RequestMapping; 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | 5 | /** 6 | * 用户信息-控制层 7 | * 8 | * @author yuboon 9 | * @version v1.0 10 | * @date 2020-01-08 11 | */ 12 | @RestController 13 | public class SysUserController { 14 | 15 | @Autowired 16 | private SysUserService SysUserService; 17 | 18 | } -------------------------------------------------------------------------------- /springboot-rest-chain/src/main/java/com/example/rest/RestApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.rest; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | import javax.swing.*; 7 | 8 | @SpringBootApplication 9 | public class RestApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(RestApplication.class,args); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /springboot-rpc/src/main/java/com/example/rpc/core/RpcReference.java: -------------------------------------------------------------------------------- 1 | package com.example.rpc.core; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Target(ElementType.FIELD) 9 | @Retention(RetentionPolicy.RUNTIME) 10 | public @interface RpcReference { 11 | String version() default "1.0"; 12 | long timeout() default 5000; 13 | } -------------------------------------------------------------------------------- /springboot-cli/cli-client/src/main/java/com/example/cli/CliClientApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.cli; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * CLI客户端主程序 8 | */ 9 | @SpringBootApplication 10 | public class CliClientApplication { 11 | public static void main(String[] args) { 12 | SpringApplication.run(CliClientApplication.class, args); 13 | } 14 | } -------------------------------------------------------------------------------- /springboot-cli/cli-server/src/main/java/com/example/cli/CliServerApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.cli; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * CLI服务端主程序 8 | */ 9 | @SpringBootApplication 10 | public class CliServerApplication { 11 | public static void main(String[] args) { 12 | SpringApplication.run(CliServerApplication.class, args); 13 | } 14 | } -------------------------------------------------------------------------------- /springboot-config-hot-reload/src/main/java/com/example/AppConfig.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import lombok.Data; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | import org.springframework.stereotype.Component; 6 | 7 | @Data 8 | @Component 9 | @ConfigurationProperties(prefix = "app") // 绑定配置前缀 10 | public class AppConfig { 11 | 12 | private int timeout = 3000; // 默认超时时间3秒 13 | private int maxRetries = 2; // 默认重试次数2次 14 | 15 | } -------------------------------------------------------------------------------- /springboot-face2face-chat/src/main/java/com/example/face2face/dto/request/JoinGroupRequest.java: -------------------------------------------------------------------------------- 1 | package com.example.face2face.dto.request; 2 | 3 | public class JoinGroupRequest { 4 | private String invitationCode; 5 | 6 | // Getters and Setters 7 | public String getInvitationCode() { 8 | return invitationCode; 9 | } 10 | 11 | public void setInvitationCode(String invitationCode) { 12 | this.invitationCode = invitationCode; 13 | } 14 | } -------------------------------------------------------------------------------- /springboot-hot-patch/src/main/java/com/example/hotpatch/example/StringUtils.java: -------------------------------------------------------------------------------- 1 | package com.example.hotpatch.example; 2 | 3 | /** 4 | * 示例工具类 - 用于演示静态方法替换 5 | */ 6 | public class StringUtils { 7 | 8 | public static boolean isEmpty(String str) { 9 | // 原始版本有bug:没有考虑空白字符 10 | return str == null || str.length() == 0; 11 | } 12 | 13 | public static String trim(String str) { 14 | return str == null ? null : str.trim(); 15 | } 16 | } -------------------------------------------------------------------------------- /springboot-multi-port/src/main/java/com/example/multiport/annotation/UserApi.java: -------------------------------------------------------------------------------- 1 | package com.example.multiport.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * 用户端API注解 10 | * 标记该Controller为用户端API 11 | */ 12 | @Target(ElementType.TYPE) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | public @interface UserApi { 15 | } -------------------------------------------------------------------------------- /springboot-qrcode-login/src/main/java/com/example/qrcodelogin/QrcodeLoginApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.qrcodelogin; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class QrcodeLoginApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(QrcodeLoginApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springboot-qrcode-login/src/main/java/com/example/qrcodelogin/model/UserInfo.java: -------------------------------------------------------------------------------- 1 | package com.example.qrcodelogin.model; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @NoArgsConstructor 9 | @AllArgsConstructor 10 | public class UserInfo { 11 | private String userId; 12 | private String username; 13 | private String avatar; 14 | private String email; 15 | private String token; 16 | } -------------------------------------------------------------------------------- /springboot-api-doc/src/main/java/com/apidoc/controller/HomeController.java: -------------------------------------------------------------------------------- 1 | package com.apidoc.controller; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.GetMapping; 5 | 6 | /** 7 | * 首页控制器 8 | */ 9 | @Controller 10 | public class HomeController { 11 | 12 | /** 13 | * 首页重定向到API文档界面 14 | */ 15 | @GetMapping("/") 16 | public String home() { 17 | return "redirect:/index.html"; 18 | } 19 | } -------------------------------------------------------------------------------- /springboot-dfa/src/main/java/com/example/dfa/controller/IndexController.java: -------------------------------------------------------------------------------- 1 | package com.example.dfa.controller; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.GetMapping; 5 | 6 | /** 7 | * 首页控制器 8 | */ 9 | @Controller 10 | public class IndexController { 11 | 12 | /** 13 | * 首页 14 | */ 15 | @GetMapping("/") 16 | public String index() { 17 | return "forward:/index.html"; 18 | } 19 | } -------------------------------------------------------------------------------- /springboot-multi-port/src/main/java/com/example/multiport/annotation/AdminApi.java: -------------------------------------------------------------------------------- 1 | package com.example.multiport.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * 管理端API注解 10 | * 标记该Controller为管理端API 11 | */ 12 | @Target(ElementType.TYPE) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | public @interface AdminApi { 15 | } -------------------------------------------------------------------------------- /springboot-package-segment/demo/src/main/java/cn/test/DemoController.java: -------------------------------------------------------------------------------- 1 | package cn.test; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | import org.springframework.web.bind.annotation.RestController; 6 | 7 | @RestController 8 | public class DemoController { 9 | 10 | @RequestMapping("/hello") 11 | public String hello(){ 12 | return "hello"; 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /springboot-agent/app/src/main/java/com/example/app/Application.java: -------------------------------------------------------------------------------- 1 | package com.example.app; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.scheduling.annotation.EnableScheduling; 6 | 7 | @SpringBootApplication 8 | public class Application { 9 | 10 | public static void main(String[] args) { 11 | SpringApplication.run(Application.class, args); 12 | } 13 | } -------------------------------------------------------------------------------- /springboot-exception-group/src/main/java/com/example/exceptiongroup/ExceptionGroupApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.exceptiongroup; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class ExceptionGroupApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(ExceptionGroupApplication.class, args); 11 | } 12 | } -------------------------------------------------------------------------------- /springboot-shamir/src/main/java/com/demo/shamir/dto/CombineResponse.java: -------------------------------------------------------------------------------- 1 | package com.demo.shamir.dto; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * 恢复响应 DTO 9 | */ 10 | @Data 11 | @NoArgsConstructor 12 | @AllArgsConstructor 13 | public class CombineResponse { 14 | private String secret; // 恢复的密钥 15 | private String message; // 提示信息 16 | private boolean success; // 是否成功 17 | } -------------------------------------------------------------------------------- /springboot-form/src/main/java/com/example/dynamicform/model/ValidationError.java: -------------------------------------------------------------------------------- 1 | package com.example.dynamicform.model; 2 | 3 | import lombok.Data; 4 | import lombok.Builder; 5 | import lombok.AllArgsConstructor; 6 | import lombok.NoArgsConstructor; 7 | 8 | /** 9 | * 验证错误信息 10 | */ 11 | @Data 12 | @Builder 13 | @AllArgsConstructor 14 | @NoArgsConstructor 15 | public class ValidationError { 16 | private String field; 17 | private String message; 18 | private String code; 19 | } -------------------------------------------------------------------------------- /springboot-scheduler/src/main/java/com/example/scheduler/ScheduledTasks.java: -------------------------------------------------------------------------------- 1 | package com.example.scheduler; 2 | 3 | import org.springframework.scheduling.annotation.Scheduled; 4 | import org.springframework.stereotype.Component; 5 | 6 | import java.util.Date; 7 | 8 | @Component 9 | public class ScheduledTasks { 10 | 11 | @Scheduled(cron = "0/5 * * * * ?") // 每5分钟执行一次 12 | public void executeTask() { 13 | System.out.println("定时任务执行,时间:" + new Date()); 14 | } 15 | } -------------------------------------------------------------------------------- /springboot-permission/src/main/java/com/example/permission/PermissionApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.permission; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * 应用启动类 8 | */ 9 | @SpringBootApplication 10 | public class PermissionApplication { 11 | 12 | public static void main(String[] args) { 13 | SpringApplication.run(PermissionApplication.class, args); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /springboot-proxy/src/main/java/com/example/Application.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.scheduling.annotation.EnableScheduling; 6 | 7 | @SpringBootApplication 8 | @EnableScheduling 9 | public class Application { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(Application.class, args); 13 | } 14 | } -------------------------------------------------------------------------------- /springboot-hot-patch/src/main/java/com/example/hotpatch/HotPatchApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.hotpatch; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * Spring Boot 热补丁加载器主应用 8 | */ 9 | @SpringBootApplication 10 | public class HotPatchApplication { 11 | 12 | public static void main(String[] args) { 13 | SpringApplication.run(HotPatchApplication.class, args); 14 | } 15 | } -------------------------------------------------------------------------------- /springboot-hot-patch/src/main/java/com/example/hotpatch/annotation/PatchType.java: -------------------------------------------------------------------------------- 1 | package com.example.hotpatch.annotation; 2 | 3 | /** 4 | * 补丁类型枚举 5 | */ 6 | public enum PatchType { 7 | /** 8 | * Spring Bean 替换 9 | */ 10 | SPRING_BEAN, 11 | 12 | /** 13 | * 普通Java类替换(整个类) 14 | */ 15 | JAVA_CLASS, 16 | 17 | /** 18 | * 静态方法替换 19 | */ 20 | STATIC_METHOD, 21 | 22 | /** 23 | * 实例方法替换 24 | */ 25 | INSTANCE_METHOD 26 | } -------------------------------------------------------------------------------- /springboot-sql-tree/src/main/java/com/example/sqltree/SqlTreeApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.sqltree; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * Spring Boot SQL调用树可视化系统主启动类 8 | */ 9 | @SpringBootApplication 10 | public class SqlTreeApplication { 11 | 12 | public static void main(String[] args) { 13 | SpringApplication.run(SqlTreeApplication.class, args); 14 | } 15 | } -------------------------------------------------------------------------------- /springboot-dynamic-controller/src/main/java/com/example/controller/DynamicController.java: -------------------------------------------------------------------------------- 1 | package com.example.controller; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Target({ElementType.TYPE}) 9 | @Retention(RetentionPolicy.RUNTIME) 10 | public @interface DynamicController { 11 | 12 | // 启动时注册 13 | boolean startupRegister() default true; 14 | 15 | } 16 | -------------------------------------------------------------------------------- /springboot-scheduler/src/main/java/com/example/Application.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.scheduling.annotation.EnableScheduling; 6 | 7 | @SpringBootApplication 8 | @EnableScheduling 9 | public class Application { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(Application.class, args); 13 | } 14 | 15 | } -------------------------------------------------------------------------------- /springboot-gencode-training/src/main/java/com/yuboon/springboot/gencode/template/EntityCodeTemplate.java: -------------------------------------------------------------------------------- 1 | package com.yuboon.springboot.gencode.template; 2 | 3 | /** 4 | * 此处为类介绍 5 | * 6 | * @author yuboon 7 | * @version v1.0 8 | * @date 2020/01/08 9 | */ 10 | public class EntityCodeTemplate extends CodeTemplate { 11 | 12 | public EntityCodeTemplate(){ 13 | this.tplPath = "/template/Entity.tpl"; 14 | this.fileTag = ""; 15 | this.fileSuffix = ".java"; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /springboot-jwt-rotation/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | servlet: 4 | context-path: / 5 | 6 | spring: 7 | application: 8 | name: jwt-rotation-demo 9 | 10 | # JWT配置 11 | jwt: 12 | # Token过期时间(小时) 13 | token-expiration: 24 14 | # 密钥轮换周期(天) 15 | rotation-period-days: 7 16 | # 旧密钥保留时间(天) 17 | grace-period-days: 14 18 | # RSA密钥长度 19 | key-size: 2048 20 | 21 | # 日志配置 22 | logging: 23 | level: 24 | com.example.jwt: DEBUG 25 | io.jsonwebtoken: DEBUG -------------------------------------------------------------------------------- /springboot-object-version/src/main/java/com/example/objectversion/SpringbootObjectVersionApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.objectversion; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringbootObjectVersionApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringbootObjectVersionApplication.class, args); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /springboot-online-debug/src/main/java/com/example/onlinedebug/OnlineDebugApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.onlinedebug; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * Spring Boot 在线调试工具主类 8 | */ 9 | @SpringBootApplication 10 | public class OnlineDebugApplication { 11 | 12 | public static void main(String[] args) { 13 | SpringApplication.run(OnlineDebugApplication.class, args); 14 | } 15 | } -------------------------------------------------------------------------------- /springboot-shamir/src/main/java/com/demo/shamir/dto/SplitResponse.java: -------------------------------------------------------------------------------- 1 | package com.demo.shamir.dto; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * 拆分响应 DTO 11 | */ 12 | @Data 13 | @NoArgsConstructor 14 | @AllArgsConstructor 15 | public class SplitResponse { 16 | private String sessionId; // 会话 ID 17 | private List shares; // 密钥份额列表 18 | private String message; // 提示信息 19 | } -------------------------------------------------------------------------------- /springboot-unified-call/src/main/java/com/example/unified/dto/UserDTO.java: -------------------------------------------------------------------------------- 1 | package com.example.unified.dto; 2 | 3 | import lombok.Data; 4 | import java.io.Serializable; 5 | 6 | /** 7 | * 用户数据传输对象,用于服务间数据传递 8 | */ 9 | @Data 10 | public class UserDTO implements Serializable { 11 | private Long id; // 用户ID 12 | private String username; // 用户名 13 | private String email; // 邮箱 14 | private Integer age; // 年龄 15 | private String status; // 状态(ACTIVE/INACTIVE) 16 | } -------------------------------------------------------------------------------- /springboot-serverless/serverless-core/src/main/java/com/example/model/ServerlessFunction.java: -------------------------------------------------------------------------------- 1 | package com.example.model; 2 | 3 | import java.util.Map; 4 | 5 | /** 6 | * Serverless函数接口 7 | * 所有用户函数都需要实现这个接口 8 | */ 9 | @FunctionalInterface 10 | public interface ServerlessFunction { 11 | 12 | /** 13 | * 函数执行入口 14 | * @param input 输入参数 15 | * @param context 执行上下文 16 | * @return 执行结果 17 | */ 18 | Object handle(Map input, ExecutionContext context) throws Exception; 19 | } -------------------------------------------------------------------------------- /springboot-shamir/src/main/java/com/demo/shamir/dto/SplitRequest.java: -------------------------------------------------------------------------------- 1 | package com.demo.shamir.dto; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * 拆分请求 DTO 11 | */ 12 | @Data 13 | @NoArgsConstructor 14 | @AllArgsConstructor 15 | public class SplitRequest { 16 | private String secret; // 原始密钥 17 | private Integer totalShares; // 总份额数 (n) 18 | private Integer threshold; // 门限值 (t) 19 | } -------------------------------------------------------------------------------- /springboot-static-permit/src/main/java/com/example/staticpermit/repository/FileInfoRepository.java: -------------------------------------------------------------------------------- 1 | package com.example.staticpermit.repository; 2 | 3 | import com.example.staticpermit.entity.FileInfo; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import java.util.Optional; 8 | 9 | @Repository 10 | public interface FileInfoRepository extends JpaRepository { 11 | Optional findByFilename(String filename); 12 | } -------------------------------------------------------------------------------- /springboot-gencode-training/src/main/resources/template/Entity.tpl: -------------------------------------------------------------------------------- 1 | import lombok.Data; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * [(${comment})]-实体 7 | * 8 | * @author yuboon 9 | * @version v1.0 10 | * @date [(${createDate})] 11 | */ 12 | @Data 13 | public class [(${className})] implements Serializable { 14 | [# th:each="column : ${columnList}"] 15 | /** [(${column.comment})] */ 16 | @Column("[(${column.code})]") 17 | private [(${column.type})] [(${column.attrName})]; 18 | 19 | [/] 20 | } 21 | -------------------------------------------------------------------------------- /springboot-mybatis-interceptor/src/main/java/com/example/model/User.java: -------------------------------------------------------------------------------- 1 | package com.example.model; 2 | 3 | import com.example.interceptor.Sensitive; 4 | import com.example.interceptor.SensitiveType; 5 | import lombok.Data; 6 | 7 | @Data 8 | public class User { 9 | private Long id; 10 | private String username; 11 | 12 | @Sensitive(type = SensitiveType.PHONE) // 手机号脱敏 13 | private String phone; 14 | 15 | @Sensitive(type = SensitiveType.ID_CARD) // 身份证号脱敏 16 | private String idCard; 17 | } -------------------------------------------------------------------------------- /springboot-single-login/src/main/java/com/example/login/model/LoginInfo.java: -------------------------------------------------------------------------------- 1 | package com.example.login.model; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * 登录信息 9 | */ 10 | @Data 11 | @AllArgsConstructor 12 | @NoArgsConstructor 13 | public class LoginInfo { 14 | private String ip; // IP地址 15 | private String device; // 设备信息 16 | private String userAgent; // User-Agent 17 | private long loginTime; // 登录时间 18 | } -------------------------------------------------------------------------------- /springboot-asn1/src/main/java/com/example/asn1/Asn1ParserApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.asn1; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * SpringBoot ASN.1解析应用主类 8 | * 9 | * 10 | * @version 1.0.0 11 | */ 12 | @SpringBootApplication 13 | public class Asn1ParserApplication { 14 | 15 | public static void main(String[] args) { 16 | SpringApplication.run(Asn1ParserApplication.class, args); 17 | } 18 | } -------------------------------------------------------------------------------- /springboot-config-hot-reload/src/main/java/com/example/config/HotRefreshConfig.java: -------------------------------------------------------------------------------- 1 | package com.example.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | 6 | import java.io.IOException; 7 | 8 | @Configuration 9 | public class HotRefreshConfig { 10 | @Bean 11 | public ConfigFileWatcher configFileWatcher(ConfigRefreshHandler refreshHandler) throws IOException { 12 | return new ConfigFileWatcher(refreshHandler); 13 | } 14 | } -------------------------------------------------------------------------------- /springboot-multi-port/src/main/java/com/example/multiport/MultiPortApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.multiport; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * 多端口Spring Boot应用主类 8 | * 同时监听8082(用户端)和8083(管理端)端口 9 | */ 10 | @SpringBootApplication 11 | public class MultiPortApplication { 12 | 13 | public static void main(String[] args) { 14 | SpringApplication.run(MultiPortApplication.class, args); 15 | } 16 | } -------------------------------------------------------------------------------- /springboot-mybatis-interceptor/src/main/java/com/example/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.example.service; 2 | 3 | import com.example.mapper.UserMapper; 4 | import com.example.model.User; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | 8 | @Service 9 | public class UserService { 10 | @Autowired 11 | private UserMapper userMapper; 12 | 13 | public User getUserById(Long id) { 14 | return userMapper.selectById(id); 15 | } 16 | } -------------------------------------------------------------------------------- /springboot-lic/src/main/java/com/license/annotation/RequireFeature.java: -------------------------------------------------------------------------------- 1 | package com.license.annotation; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * 功能权限注解 7 | * 用于标记需要特定功能权限的方法或类 8 | */ 9 | @Target({ElementType.METHOD, ElementType.TYPE}) 10 | @Retention(RetentionPolicy.RUNTIME) 11 | @Documented 12 | public @interface RequireFeature { 13 | 14 | /** 15 | * 需要的功能权限 16 | */ 17 | String value(); 18 | 19 | /** 20 | * 权限不足时的提示信息 21 | */ 22 | String message() default "功能未授权"; 23 | } 24 | -------------------------------------------------------------------------------- /springboot-gencode/src/main/java/com/yuboon/springboot/gencode/template/VoCodeTemplate.java: -------------------------------------------------------------------------------- 1 | package com.yuboon.springboot.gencode.template; 2 | 3 | /** 4 | * VO模板 5 | * 6 | * @author yuboon 7 | * @version v1.0 8 | * @date 2020/01/04 9 | */ 10 | public class VoCodeTemplate extends CodeTemplate { 11 | 12 | public VoCodeTemplate() { 13 | this.tplName = "VO模板"; 14 | this.tplPath = "templates/Vo.tpl"; 15 | this.fileTag = "Vo"; 16 | this.fileSuffix = ".java"; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /springboot-gencode/src/main/resources/templates/Entity.tpl: -------------------------------------------------------------------------------- 1 | import lombok.Data; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * [(${comment})]-实体 7 | * 8 | * @author yuboon 9 | * @version v1.0 10 | * @date [(${createDate})] 11 | */ 12 | @Data 13 | public class [(${className})] implements Serializable { 14 | [# th:each="column : ${columnList}"] 15 | /** [(${column.comment})] */ 16 | @Column("[(${column.code})]") 17 | private [(${column.type})] [(${column.attrName})]; 18 | 19 | [/] 20 | } 21 | -------------------------------------------------------------------------------- /springboot-jwt-rotation/src/main/java/com/example/jwt/JwtRotationApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.jwt; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.scheduling.annotation.EnableScheduling; 6 | 7 | @SpringBootApplication 8 | @EnableScheduling 9 | public class JwtRotationApplication { 10 | public static void main(String[] args) { 11 | SpringApplication.run(JwtRotationApplication.class, args); 12 | } 13 | } -------------------------------------------------------------------------------- /springboot-live/src/main/java/com/example/livestream/LiveApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.livestream; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | 7 | @SpringBootApplication 8 | @MapperScan("com.example.livestream.mapper") 9 | public class LiveApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(LiveApplication.class, args); 13 | } 14 | } -------------------------------------------------------------------------------- /dependency-scanner/src/main/java/com/example/dependencyscanner/DependencyScannerApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.dependencyscanner; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * Spring Boot 依赖包扫描仪主启动类 8 | * 9 | */ 10 | @SpringBootApplication 11 | public class DependencyScannerApplication { 12 | 13 | public static void main(String[] args) { 14 | SpringApplication.run(DependencyScannerApplication.class, args); 15 | } 16 | } -------------------------------------------------------------------------------- /springboot-danmaku/src/main/java/com/example/danmaku/DanmakuApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.danmaku; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | 7 | @SpringBootApplication 8 | @MapperScan("com.example.danmaku.mapper") 9 | public class DanmakuApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(DanmakuApplication.class, args); 13 | } 14 | } -------------------------------------------------------------------------------- /springboot-face2face-chat/src/main/java/com/example/face2face/exception/AppException.java: -------------------------------------------------------------------------------- 1 | package com.example.face2face.exception; 2 | 3 | public class AppException extends RuntimeException { 4 | private int code; 5 | 6 | public AppException(String message) { 7 | super(message); 8 | this.code = 500; 9 | } 10 | 11 | public AppException(int code, String message) { 12 | super(message); 13 | this.code = code; 14 | } 15 | 16 | public int getCode() { 17 | return code; 18 | } 19 | } -------------------------------------------------------------------------------- /springboot-rpc/src/main/java/com/example/rpc/RpcDemoApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.rpc; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | 7 | @SpringBootApplication 8 | @EnableAutoConfiguration 9 | public class RpcDemoApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(RpcDemoApplication.class, args); 13 | } 14 | 15 | } -------------------------------------------------------------------------------- /springboot-live/src/main/java/com/example/livestream/dto/SrsCallbackDto.java: -------------------------------------------------------------------------------- 1 | package com.example.livestream.dto; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class SrsCallbackDto { 7 | private String app; 8 | private String stream; 9 | private String token; 10 | private String expire; 11 | private String file; 12 | // 其他可能的回调参数 13 | private String clientId; 14 | private String ip; 15 | private String vhost; 16 | private String param; 17 | private String tcUrl; 18 | private String domain; 19 | } -------------------------------------------------------------------------------- /springboot-asn1/src/main/java/com/example/asn1/controller/HomeController.java: -------------------------------------------------------------------------------- 1 | package com.example.asn1.controller; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.GetMapping; 5 | 6 | /** 7 | * 首页控制器 8 | * 9 | * 10 | * @version 1.0.0 11 | */ 12 | @Controller 13 | public class HomeController { 14 | 15 | /** 16 | * 首页 17 | * 18 | * @return 首页视图 19 | */ 20 | @GetMapping("/") 21 | public String index() { 22 | return "forward:/index.html"; 23 | } 24 | } -------------------------------------------------------------------------------- /springboot-gencode-training/src/main/resources/template/Controller.tpl: -------------------------------------------------------------------------------- 1 | import org.springframework.web.bind.annotation.RestController; 2 | import org.springframework.web.bind.annotation.RequestMapping; 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | 5 | /** 6 | * [(${comment})]-控制层 7 | * 8 | * @author yuboon 9 | * @version v1.0 10 | * @date [(${createDate})] 11 | */ 12 | @RestController 13 | public class [(${className})]Controller { 14 | 15 | @Autowired 16 | private [(${className})]Service [(${className})]Service; 17 | 18 | } -------------------------------------------------------------------------------- /springboot-memviz/src/main/java/com/example/memviz/util/SafeExecs.java: -------------------------------------------------------------------------------- 1 | package com.example.memviz.util; 2 | 3 | import java.io.IOException; 4 | import java.nio.file.*; 5 | 6 | public class SafeExecs { 7 | public static void assertDiskHasSpace(Path dir, long minFreeBytes) throws IOException { 8 | FileStore store = Files.getFileStore(dir); 9 | if (store.getUsableSpace() < minFreeBytes) { 10 | throw new IllegalStateException("Low disk space for heap dump: need " + minFreeBytes + " bytes free"); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /springboot-gencode/src/main/java/com/yuboon/springboot/gencode/template/EntityCodeTemplate.java: -------------------------------------------------------------------------------- 1 | package com.yuboon.springboot.gencode.template; 2 | 3 | /** 4 | * 控制类模板 5 | * 6 | * @author yuboon 7 | * @version v1.0 8 | * @date 2020/01/04 9 | */ 10 | public class EntityCodeTemplate extends CodeTemplate { 11 | 12 | public EntityCodeTemplate() { 13 | this.tplName = "控制器模板"; 14 | this.tplPath = "templates/Entity.tpl"; 15 | this.fileTag = ""; 16 | this.fileSuffix = ".java"; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /springboot-rpc/src/main/java/com/example/rpc/core/RpcService.java: -------------------------------------------------------------------------------- 1 | package com.example.rpc.core; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | import java.lang.annotation.ElementType; 6 | import java.lang.annotation.Retention; 7 | import java.lang.annotation.RetentionPolicy; 8 | import java.lang.annotation.Target; 9 | 10 | @Target(ElementType.TYPE) 11 | @Retention(RetentionPolicy.RUNTIME) 12 | @Component 13 | public @interface RpcService { 14 | Class value() default void.class; 15 | String version() default "1.0"; 16 | } 17 | 18 | -------------------------------------------------------------------------------- /java-exception/src/main/java/com/yuboon/learning/exception/ExceptionApplicatioin.java: -------------------------------------------------------------------------------- 1 | package com.yuboon.learning.exception; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * 启动类 8 | * Created by yuboon on 2019/12/11 9 | */ 10 | @SpringBootApplication 11 | public class ExceptionApplicatioin { 12 | 13 | public static void main(String[] args) { 14 | SpringApplication.run(ExceptionApplicatioin.class, args); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /springboot-gencode/src/main/resources/templates/Controller.tpl: -------------------------------------------------------------------------------- 1 | import org.springframework.web.bind.annotation.RestController; 2 | import org.springframework.web.bind.annotation.RequestMapping; 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | 5 | /** 6 | * [(${comment})]-控制层 7 | * 8 | * @author yuboon 9 | * @version v1.0 10 | * @date [(${createDate})] 11 | */ 12 | @RestController 13 | public class [(${className})]Controller { 14 | 15 | @Autowired 16 | private [(${className})]Service [(${className})]Service; 17 | 18 | } -------------------------------------------------------------------------------- /springboot-agent/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springboot-cmd/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springboot-htmx/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springboot-live/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springboot-proxy/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springboot-rpc/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springboot-api-gray/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springboot-danmaku/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springboot-live-call/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springboot-rest-chain/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springboot-scheduler/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springboot-agent/app/src/main/java/com/example/app/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package com.example.app.controller; 2 | 3 | import org.springframework.web.bind.annotation.RequestMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | import java.util.List; 7 | 8 | @RequestMapping("/user") 9 | @RestController 10 | public class UserController { 11 | 12 | // 用户查询 13 | @RequestMapping("/query") 14 | public List queryUser() { 15 | // 模拟查询用户 16 | return List.of("user1", "user2", "user3"); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /springboot-face2face-chat/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springboot-object-version/src/main/java/com/example/objectversion/config/JaversConfig.java: -------------------------------------------------------------------------------- 1 | package com.example.objectversion.config; 2 | 3 | import org.javers.core.Javers; 4 | import org.javers.core.JaversBuilder; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | 8 | @Configuration 9 | public class JaversConfig { 10 | 11 | @Bean 12 | public Javers javers() { 13 | return JaversBuilder.javers() 14 | .withPrettyPrint(true) 15 | .build(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /springboot-qrcode-login/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springboot-undertow-proxy/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springboot-undertow-proxy/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | undertow: 3 | threads: 4 | io: 8 # IO线程数,建议设置为CPU核心数 5 | worker: 64 # 工作线程数,IO线程数的8倍 6 | buffer-size: 16384 # 缓冲区大小 7 | direct-buffers: true # 使用直接缓冲区 8 | max-http-post-size: 10485760 # 最大POST大小 9 | max-parameters: 2000 # 最大参数数量 10 | max-headers: 200 # 最大请求头数量 11 | max-cookies: 200 # 最大Cookie数量 12 | user: 13 | backends: "http://127.0.0.1:8081/user,http://127.0.0.2:8082/user" 14 | -------------------------------------------------------------------------------- /springboot-unified-call/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springboot-config-hot-reload/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springboot-dynamic-controller/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springboot-mybatis-interceptor/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springboot-static-permit/src/main/resources/static/js/app.js: -------------------------------------------------------------------------------- 1 | // 简单的JavaScript文件,演示公开静态资源 2 | console.log('Spring Boot 静态资源权限控制演示 - JavaScript已加载'); 3 | 4 | document.addEventListener('DOMContentLoaded', function() { 5 | console.log('页面加载完成'); 6 | 7 | // 为所有链接添加点击提示 8 | const links = document.querySelectorAll('a[href^="/uploads/"], a[href^="/files/"]'); 9 | links.forEach(link => { 10 | link.addEventListener('click', function(e) { 11 | const href = this.getAttribute('href'); 12 | console.log('尝试访问:', href); 13 | }); 14 | }); 15 | }); -------------------------------------------------------------------------------- /springboot-dynamic-controller/src/main/java/com/example/controller/DemoController.java: -------------------------------------------------------------------------------- 1 | package com.example.controller; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | import org.springframework.web.bind.annotation.RestController; 6 | 7 | @RestController 8 | @RequestMapping("/demo") 9 | @DynamicController(startupRegister = false) 10 | public class DemoController { 11 | 12 | @GetMapping("/hello") 13 | public String hello() { 14 | return "Hello from Dynamic Controller!"; 15 | } 16 | 17 | } -------------------------------------------------------------------------------- /springboot-live-call/src/main/java/com/example/livestream/model/User.java: -------------------------------------------------------------------------------- 1 | package com.example.livestream.model; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @NoArgsConstructor 9 | @AllArgsConstructor 10 | public class User { 11 | private String username; 12 | private String password; 13 | private String nickname; 14 | private String avatar; 15 | private UserRole role; // BROADCASTER or AUDIENCE 16 | 17 | public enum UserRole { 18 | BROADCASTER, 19 | AUDIENCE 20 | } 21 | } -------------------------------------------------------------------------------- /springboot-form/src/main/java/com/example/dynamicform/DynamicFormApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.dynamicform; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class DynamicFormApplication { 8 | public static void main(String[] args) { 9 | SpringApplication.run(DynamicFormApplication.class, args); 10 | System.out.println("🚀 Dynamic Form System started successfully!"); 11 | System.out.println("📝 Visit: http://localhost:8080"); 12 | } 13 | } -------------------------------------------------------------------------------- /springboot-serverless/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | !functions/*.jar 7 | 8 | ### STS ### 9 | .apt_generated 10 | .classpath 11 | .factorypath 12 | .project 13 | .settings 14 | .springBeans 15 | .sts4-cache 16 | 17 | ### IntelliJ IDEA ### 18 | .idea 19 | *.iws 20 | *.iml 21 | *.ipr 22 | 23 | ### NetBeans ### 24 | /nbproject/private/ 25 | /nbbuild/ 26 | /dist/ 27 | /nbdist/ 28 | /.nb-gradle/ 29 | build/ 30 | !**/src/main/**/build/ 31 | !**/src/test/**/build/ 32 | 33 | ### VS Code ### 34 | .vscode/ 35 | -------------------------------------------------------------------------------- /java-exception/src/main/java/com/yuboon/learning/exception/DemoAutoConfigure.java: -------------------------------------------------------------------------------- 1 | package com.yuboon.learning.exception; 2 | 3 | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | @Configuration 8 | public class DemoAutoConfigure { 9 | 10 | @Bean 11 | @ConditionalOnMissingBean 12 | Demo demo (){ 13 | String nullStr = null; 14 | //nullStr.toString(); 15 | return new Demo(); 16 | } 17 | 18 | } -------------------------------------------------------------------------------- /springboot-serverless/serverless-core/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | demo 8 | springboot-serverless 9 | 0.0.1-SNAPSHOT 10 | 11 | 12 | serverless-core 13 | 14 | -------------------------------------------------------------------------------- /springboot-timingwheel/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | servlet: 4 | context-path: / 5 | 6 | spring: 7 | application: 8 | name: springboot-timingwheel 9 | # Timing Wheel Configuration 10 | timingwheel: 11 | config: 12 | slot-size: 512 13 | tick-duration: 100 14 | worker-threads: 4 15 | enable-multi-wheel: true 16 | enable-metrics: true 17 | 18 | logging: 19 | level: 20 | com.example.timingwheel: DEBUG 21 | org.springframework.web: INFO 22 | pattern: 23 | console: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n" -------------------------------------------------------------------------------- /springboot-unified-call/src/main/java/com/example/unified/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.example.unified.service; 2 | 3 | 4 | import com.example.unified.dto.UserDTO; 5 | import org.springframework.stereotype.Service; 6 | 7 | @Service 8 | public class UserService { 9 | public UserDTO getUser(Long id) { 10 | // 模拟数据库查询 11 | UserDTO user = new UserDTO(); 12 | user.setId(id); 13 | user.setUsername("zhangsan"); 14 | user.setEmail("zhangsan@example.com"); 15 | user.setAge(28); 16 | user.setStatus("ACTIVE"); 17 | return user; 18 | } 19 | } -------------------------------------------------------------------------------- /springboot-gencode-training/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | logback 5 | 6 | 7 | 8 | %d [%thread] %-5level %logger{36} [%file : %line] - %msg%n 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /springboot-gencode-training/src/main/java/com/yuboon/springboot/gencode/template/ControllerCodeTemplate.java: -------------------------------------------------------------------------------- 1 | package com.yuboon.springboot.gencode.template; 2 | 3 | import cn.hutool.core.io.IoUtil; 4 | 5 | import java.io.InputStream; 6 | 7 | /** 8 | * 此处为类介绍 9 | * 10 | * @author yuboon 11 | * @version v1.0 12 | * @date 2020/01/08 13 | */ 14 | public class ControllerCodeTemplate extends CodeTemplate { 15 | 16 | public ControllerCodeTemplate(){ 17 | this.tplPath = "/template/Controller.tpl"; 18 | this.fileTag = "Controller"; 19 | this.fileSuffix = ".java"; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /springboot-gencode/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | logback 5 | 6 | 7 | 8 | %d [%thread] %-5level %logger{36} [%file : %line] - %msg%n 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /springboot-multi-port/src/main/java/com/example/multiport/config/DualPortProperties.java: -------------------------------------------------------------------------------- 1 | package com.example.multiport.config; 2 | 3 | import lombok.Data; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | import org.springframework.stereotype.Component; 6 | 7 | /** 8 | * 双端口配置属性类 9 | */ 10 | @Data 11 | @Component 12 | @ConfigurationProperties(prefix = "dual.port") 13 | public class DualPortProperties { 14 | 15 | /** 16 | * 用户端端口,默认8082 17 | */ 18 | private int userPort = 8082; 19 | 20 | /** 21 | * 管理端端口,默认8083 22 | */ 23 | private int adminPort = 8083; 24 | } -------------------------------------------------------------------------------- /springboot-net-capture/src/main/java/com/example/netcapture/NetCaptureApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.netcapture; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.scheduling.annotation.EnableAsync; 6 | import org.springframework.scheduling.annotation.EnableScheduling; 7 | 8 | @SpringBootApplication 9 | @EnableAsync 10 | @EnableScheduling 11 | public class NetCaptureApplication { 12 | 13 | public static void main(String[] args) { 14 | SpringApplication.run(NetCaptureApplication.class, args); 15 | } 16 | } -------------------------------------------------------------------------------- /springboot-object-version/src/main/java/com/example/objectversion/dto/ProductRequest.java: -------------------------------------------------------------------------------- 1 | package com.example.objectversion.dto; 2 | 3 | import jakarta.validation.constraints.NotBlank; 4 | import jakarta.validation.constraints.NotNull; 5 | import jakarta.validation.constraints.PositiveOrZero; 6 | 7 | import java.math.BigDecimal; 8 | 9 | public record ProductRequest( 10 | @NotBlank(message = "name is required") 11 | String name, 12 | @NotNull(message = "price is required") 13 | @PositiveOrZero(message = "price must be >= 0") 14 | BigDecimal price, 15 | String description 16 | ) { 17 | } 18 | -------------------------------------------------------------------------------- /springboot-gencode/src/main/resources/templates/Vo.tpl: -------------------------------------------------------------------------------- 1 | import cn.wp.common.core.dao.annotation.Column; 2 | import cn.wp.common.core.dao.annotation.Table; 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * [(${comment})]-实体 9 | * 10 | * @author yuboon 11 | * @version v1.0 12 | * @date [(${createDate})] 13 | */ 14 | @Data 15 | public class [(${className})]Vo implements Serializable { 16 | [# th:each="column : ${columnList}"] 17 | /** [(${column.comment})] */ 18 | @Column("[(${column.code})]") 19 | private [(${column.type})] [(${column.attrName})]; 20 | 21 | [/] 22 | } 23 | -------------------------------------------------------------------------------- /springboot-api-doc/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=springboot-api-doc 2 | 3 | server.port=8080 4 | server.servlet.context-path=/ 5 | 6 | server.servlet.encoding.charset=UTF-8 7 | server.servlet.encoding.enabled=true 8 | server.servlet.encoding.force=true 9 | 10 | spring.web.resources.static-locations=classpath:/static/ 11 | spring.mvc.static-path-pattern=/** 12 | 13 | logging.level.com.apidoc=INFO 14 | logging.level.org.springframework=WARN 15 | logging.pattern.console=%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n 16 | 17 | info.app.name=SpringBoot API Doc Tool 18 | info.app.version=1.0.0 19 | -------------------------------------------------------------------------------- /springboot-api-dashboard/src/main/java/com/example/dashboard/DashboardApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.dashboard; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.context.annotation.EnableAspectJAutoProxy; 6 | import org.springframework.scheduling.annotation.EnableScheduling; 7 | 8 | @SpringBootApplication 9 | @EnableAspectJAutoProxy 10 | @EnableScheduling 11 | public class DashboardApplication { 12 | 13 | public static void main(String[] args) { 14 | SpringApplication.run(DashboardApplication.class, args); 15 | } 16 | } -------------------------------------------------------------------------------- /springboot-form/src/main/java/com/example/dynamicform/model/FormConfig.java: -------------------------------------------------------------------------------- 1 | package com.example.dynamicform.model; 2 | 3 | import com.fasterxml.jackson.databind.JsonNode; 4 | import lombok.Data; 5 | import lombok.Builder; 6 | import lombok.AllArgsConstructor; 7 | import lombok.NoArgsConstructor; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * 表单配置信息(用于前端渲染) 13 | */ 14 | @Data 15 | @Builder 16 | @AllArgsConstructor 17 | @NoArgsConstructor 18 | public class FormConfig { 19 | private String schemaId; 20 | private String name; 21 | private String description; 22 | private JsonNode schema; 23 | private List fields; 24 | } -------------------------------------------------------------------------------- /springboot-gencode/src/main/java/com/yuboon/springboot/gencode/command/GenControllerAndEntityCommand.java: -------------------------------------------------------------------------------- 1 | package com.yuboon.springboot.gencode.command; 2 | 3 | /** 4 | * 控制器与实体组合生成命令 5 | * 6 | * @author yuboon 7 | * @version v1.0 8 | * @date 2020/01/04 9 | */ 10 | public class GenControllerAndEntityCommand extends ComposeCommand { 11 | 12 | public GenControllerAndEntityCommand() { 13 | this.commandName = "Controller & Entity 生成命令"; 14 | this.commandCode = "03"; 15 | singleCommands.add(new GenControllerCommand()); 16 | singleCommands.add(new GenEntityCommand()); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /springboot-face2face-chat/src/main/java/com/example/face2face/dto/request/LoginRequest.java: -------------------------------------------------------------------------------- 1 | package com.example.face2face.dto.request; 2 | 3 | public class LoginRequest { 4 | private String username; 5 | private String password; 6 | 7 | // Getters and Setters 8 | public String getUsername() { 9 | return username; 10 | } 11 | 12 | public void setUsername(String username) { 13 | this.username = username; 14 | } 15 | 16 | public String getPassword() { 17 | return password; 18 | } 19 | 20 | public void setPassword(String password) { 21 | this.password = password; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /springboot-face2face-chat/src/main/java/com/example/face2face/dto/request/LocationRequest.java: -------------------------------------------------------------------------------- 1 | package com.example.face2face.dto.request; 2 | 3 | public class LocationRequest { 4 | private double latitude; 5 | private double longitude; 6 | 7 | // Getters and Setters 8 | public double getLatitude() { 9 | return latitude; 10 | } 11 | 12 | public void setLatitude(double latitude) { 13 | this.latitude = latitude; 14 | } 15 | 16 | public double getLongitude() { 17 | return longitude; 18 | } 19 | 20 | public void setLongitude(double longitude) { 21 | this.longitude = longitude; 22 | } 23 | } -------------------------------------------------------------------------------- /springboot-db-cfg/src/main/java/com/example/entity/ConfigHistory.java: -------------------------------------------------------------------------------- 1 | package com.example.entity; 2 | 3 | import lombok.Data; 4 | import lombok.NoArgsConstructor; 5 | import lombok.AllArgsConstructor; 6 | 7 | import java.time.LocalDateTime; 8 | 9 | @Data 10 | @NoArgsConstructor 11 | @AllArgsConstructor 12 | public class ConfigHistory { 13 | 14 | private Long id; 15 | private String configKey; 16 | private String configType; 17 | private String oldValue; 18 | private String newValue; 19 | private String environment; 20 | private String operatorId; 21 | private String changeReason; 22 | private LocalDateTime changeTime; 23 | } -------------------------------------------------------------------------------- /springboot-gencode/src/main/java/com/yuboon/springboot/gencode/template/ControllerCodeTemplate.java: -------------------------------------------------------------------------------- 1 | package com.yuboon.springboot.gencode.template; 2 | 3 | import cn.hutool.core.io.IoUtil; 4 | 5 | import java.io.InputStream; 6 | 7 | /** 8 | * 控制类模板 9 | * 10 | * @author yuboon 11 | * @version v1.0 12 | * @date 2020/01/04 13 | */ 14 | public class ControllerCodeTemplate extends CodeTemplate { 15 | 16 | public ControllerCodeTemplate() { 17 | this.tplName = "控制器模板"; 18 | this.tplPath = "templates/Controller.tpl"; 19 | this.fileTag = "Controller"; 20 | this.fileSuffix = ".java"; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /springboot-static-permit/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=8080 2 | spring.application.name=springboot-static-permit 3 | 4 | # H2 Database Configuration 5 | spring.datasource.url=jdbc:h2:mem:testdb 6 | spring.datasource.driver-class-name=org.h2.Driver 7 | spring.datasource.username=sa 8 | spring.datasource.password=password 9 | spring.h2.console.enabled=true 10 | 11 | # JPA Configuration 12 | spring.jpa.database-platform=org.hibernate.dialect.H2Dialect 13 | spring.jpa.hibernate.ddl-auto=create-drop 14 | spring.jpa.show-sql=true 15 | 16 | # Logging 17 | logging.level.com.example.staticpermit=DEBUG 18 | logging.level.org.springframework.security=DEBUG -------------------------------------------------------------------------------- /springboot-danmaku/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=8080 2 | 3 | # H2????? 4 | spring.datasource.url=jdbc:h2:mem:danmakudb 5 | spring.datasource.driverClassName=org.h2.Driver 6 | spring.datasource.username=sa 7 | spring.datasource.password=password 8 | spring.h2.console.enabled=true 9 | spring.h2.console.path=/h2-console 10 | 11 | # MyBatis-Plus?? 12 | mybatis-plus.configuration.map-underscore-to-camel-case=true 13 | mybatis-plus.type-aliases-package=com.example.danmaku.model 14 | mybatis-plus.global-config.db-config.id-type=auto 15 | 16 | # WebSocket?? 17 | spring.websocket.max-text-message-size=8192 18 | spring.websocket.max-binary-message-size=8192 -------------------------------------------------------------------------------- /springboot-single-login/src/main/java/com/example/login/controller/PageController.java: -------------------------------------------------------------------------------- 1 | package com.example.login.controller; 2 | 3 | import com.example.login.model.ApiResponse; 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.web.bind.annotation.GetMapping; 6 | import org.springframework.web.bind.annotation.ResponseBody; 7 | 8 | /** 9 | * 页面控制器 10 | */ 11 | @Controller 12 | public class PageController { 13 | 14 | /** 15 | * API首页 - 检查登录状态 16 | */ 17 | @GetMapping({"/api", "/api/status"}) 18 | @ResponseBody 19 | public ApiResponse apiStatus() { 20 | return ApiResponse.success("API服务正常"); 21 | } 22 | } -------------------------------------------------------------------------------- /springboot-api-gray/src/main/java/com/example/model/User.java: -------------------------------------------------------------------------------- 1 | package com.example.model; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.time.LocalDateTime; 8 | 9 | /** 10 | * 用户模型 11 | */ 12 | @Data 13 | @NoArgsConstructor 14 | @AllArgsConstructor 15 | public class User { 16 | private Long id; 17 | private String username; 18 | private String name; 19 | private String email; 20 | private LocalDateTime createdAt; 21 | private LocalDateTime updatedAt; 22 | private Boolean active; 23 | 24 | // v2 新增字段 25 | private String phone; 26 | private String avatar; 27 | 28 | } -------------------------------------------------------------------------------- /springboot-config-hot-reload/src/main/java/com/example/config/ConfigRefreshedEvent.java: -------------------------------------------------------------------------------- 1 | package com.example.config; 2 | 3 | import org.springframework.context.ApplicationEvent; 4 | 5 | import java.util.Set; 6 | 7 | /** 8 | * 自定义配置刷新事件 9 | */ 10 | public class ConfigRefreshedEvent extends ApplicationEvent { 11 | // 存储变化的配置键(可选,方便业务判断哪些配置变了) 12 | private final Set changedKeys; 13 | 14 | public ConfigRefreshedEvent(Object source, Set changedKeys) { 15 | super(source); 16 | this.changedKeys = changedKeys; 17 | } 18 | 19 | // 获取变化的配置键 20 | public Set getChangedKeys() { 21 | return changedKeys; 22 | } 23 | } -------------------------------------------------------------------------------- /springboot-jar-conflict/src/main/java/com/example/jarconflict/JarConflictDetectorApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.jarconflict; 2 | 3 | import com.example.jarconflict.advisor.ConflictAdvisor; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 7 | 8 | @SpringBootApplication 9 | @EnableConfigurationProperties(ConflictAdvisor.class) 10 | public class JarConflictDetectorApplication { 11 | 12 | public static void main(String[] args) { 13 | SpringApplication.run(JarConflictDetectorApplication.class, args); 14 | } 15 | } -------------------------------------------------------------------------------- /springboot-multi-port/src/main/java/com/example/multiport/model/CartItem.java: -------------------------------------------------------------------------------- 1 | package com.example.multiport.model; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.math.BigDecimal; 8 | import java.time.LocalDateTime; 9 | 10 | /** 11 | * 购物车项模型 12 | */ 13 | @Data 14 | @NoArgsConstructor 15 | @AllArgsConstructor 16 | public class CartItem { 17 | 18 | private Long id; 19 | 20 | private Long userId; 21 | 22 | private Long productId; 23 | 24 | private String productName; 25 | 26 | private Integer quantity; 27 | 28 | private BigDecimal price; 29 | 30 | private LocalDateTime addTime; 31 | } -------------------------------------------------------------------------------- /springboot-column-encryption/src/main/java/com/example/encryption/ColumnEncryptionApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.encryption; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class ColumnEncryptionApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(ColumnEncryptionApplication.class, args); 11 | System.out.println("🚀 Spring Boot 字段级加密演示项目启动成功!"); 12 | System.out.println("📱 前端访问地址: http://localhost:8080"); 13 | System.out.println("🔧 API文档地址: http://localhost:8080/api/users"); 14 | } 15 | } -------------------------------------------------------------------------------- /springboot-lic/src/main/java/com/license/config/AppConfig.java: -------------------------------------------------------------------------------- 1 | package com.license.config; 2 | 3 | import com.fasterxml.jackson.databind.ObjectMapper; 4 | import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | 8 | /** 9 | * 应用程序配置 10 | */ 11 | @Configuration 12 | public class AppConfig { 13 | 14 | /** 15 | * 配置Jackson ObjectMapper 16 | */ 17 | @Bean 18 | public ObjectMapper objectMapper() { 19 | ObjectMapper mapper = new ObjectMapper(); 20 | mapper.registerModule(new JavaTimeModule()); 21 | return mapper; 22 | } 23 | } -------------------------------------------------------------------------------- /springboot-cli/cli-common/src/main/java/com/example/cli/CommandHandler.java: -------------------------------------------------------------------------------- 1 | package com.example.cli; 2 | 3 | /** 4 | * 统一命令处理接口 5 | * 所有需要通过CLI调用的服务都必须实现此接口 6 | */ 7 | public interface CommandHandler { 8 | 9 | /** 10 | * 处理CLI命令 11 | * @param args 命令参数数组 12 | * @return 命令执行结果 13 | */ 14 | String handle(String[] args); 15 | 16 | /** 17 | * 获取命令描述信息 18 | * @return 命令描述 19 | */ 20 | default String getDescription() { 21 | return "No description available"; 22 | } 23 | 24 | /** 25 | * 获取命令使用帮助 26 | * @return 帮助信息 27 | */ 28 | default String getUsage() { 29 | return "Usage: command [args...]"; 30 | } 31 | } -------------------------------------------------------------------------------- /springboot-cmd/src/main/java/com/example/cmd/shell/FileCommands.java: -------------------------------------------------------------------------------- 1 | package com.example.cmd.shell; 2 | 3 | import org.springframework.shell.standard.ShellComponent; 4 | import org.springframework.shell.standard.ShellMethod; 5 | import org.springframework.shell.standard.ShellCommandGroup; 6 | 7 | @ShellComponent 8 | @ShellCommandGroup("文件操作") 9 | public class FileCommands { 10 | 11 | @ShellMethod("列出目录内容") 12 | public String ls(String path) { 13 | // 实现列出目录内容的逻辑 14 | return "列出 " + path + " 的内容"; 15 | } 16 | 17 | @ShellMethod("创建新目录") 18 | public String mkdir(String dirName) { 19 | // 实现创建目录的逻辑 20 | return "创建目录: " + dirName; 21 | } 22 | } -------------------------------------------------------------------------------- /springboot-timingwheel/src/main/java/com/example/timingwheel/model/TimerTask.java: -------------------------------------------------------------------------------- 1 | package com.example.timingwheel.model; 2 | 3 | import java.time.LocalDateTime; 4 | import java.util.UUID; 5 | 6 | /** 7 | * 定时任务接口 8 | */ 9 | public interface TimerTask { 10 | /** 11 | * 任务执行方法 12 | */ 13 | void run(); 14 | 15 | /** 16 | * 任务描述 17 | */ 18 | String getDescription(); 19 | 20 | /** 21 | * 任务ID 22 | */ 23 | default String getTaskId() { 24 | return UUID.randomUUID().toString(); 25 | } 26 | 27 | /** 28 | * 任务创建时间 29 | */ 30 | default LocalDateTime getCreateTime() { 31 | return LocalDateTime.now(); 32 | } 33 | } -------------------------------------------------------------------------------- /springboot-api-doc/src/main/java/com/apidoc/ApiDocApplication.java: -------------------------------------------------------------------------------- 1 | package com.apidoc; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * API文档工具主启动类 8 | * 9 | */ 10 | @SpringBootApplication 11 | public class ApiDocApplication { 12 | 13 | public static void main(String[] args) { 14 | SpringApplication.run(ApiDocApplication.class, args); 15 | System.out.println(); 16 | System.out.println("🚀 API文档工具启动成功!"); 17 | System.out.println("📖 访问地址: http://localhost:8080"); 18 | System.out.println("🔧 轻量级 • 零配置 • 开箱即用"); 19 | System.out.println(); 20 | } 21 | } -------------------------------------------------------------------------------- /springboot-gencode/src/main/java/com/yuboon/springboot/gencode/exception/GenCodeException.java: -------------------------------------------------------------------------------- 1 | package com.yuboon.springboot.gencode.exception; 2 | 3 | /** 4 | * 代码生成异常类 5 | * 6 | * @author yuboon 7 | * @version v1.0 8 | * @date 2020/01/04 9 | */ 10 | public class GenCodeException extends RuntimeException { 11 | 12 | private static final long serialVersionUID = 1L; 13 | 14 | public GenCodeException() { 15 | super(); 16 | } 17 | 18 | public GenCodeException(String message, Throwable cause) { 19 | super(message, cause); 20 | } 21 | 22 | public GenCodeException(String message) { 23 | super(message); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /springboot-permission/src/main/java/com/example/permission/annotation/CheckPermission.java: -------------------------------------------------------------------------------- 1 | package com.example.permission.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * 权限检查注解 10 | * 用于方法级别的权限控制 11 | */ 12 | @Target(ElementType.METHOD) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | public @interface CheckPermission { 15 | 16 | /** 17 | * 操作类型:read, edit, delete 等 18 | */ 19 | String action(); 20 | 21 | /** 22 | * 资源参数名称(默认从方法参数中获取第一个 Document 类型) 23 | */ 24 | String resourceParam() default ""; 25 | } 26 | -------------------------------------------------------------------------------- /springboot-api-doc/src/main/java/com/apidoc/annotation/ApiEnvironment.java: -------------------------------------------------------------------------------- 1 | package com.apidoc.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * API环境注解 10 | * 用于标记API在哪些环境下可见 11 | */ 12 | @Target({ElementType.METHOD, ElementType.TYPE}) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | public @interface ApiEnvironment { 15 | 16 | /** 17 | * 环境列表 18 | * 如: development, test, production, all 19 | */ 20 | String[] value() default {"all"}; 21 | 22 | /** 23 | * 环境说明 24 | */ 25 | String description() default ""; 26 | } -------------------------------------------------------------------------------- /springboot-cmd/src/main/java/com/example/cmd/shell/AdvancedCommands.java: -------------------------------------------------------------------------------- 1 | package com.example.cmd.shell; 2 | 3 | import org.springframework.shell.standard.ShellComponent; 4 | import org.springframework.shell.standard.ShellMethod; 5 | import org.springframework.shell.standard.ShellOption; 6 | 7 | @ShellComponent 8 | public class AdvancedCommands { 9 | 10 | @ShellMethod("使用高级参数选项的示例") 11 | public String greet( 12 | @ShellOption(defaultValue = "世界") String name, 13 | @ShellOption(help = "决定是否使用大写", defaultValue = "false") boolean uppercase 14 | ) { 15 | String greeting = "你好, " + name + "!"; 16 | return uppercase ? greeting.toUpperCase() : greeting; 17 | } 18 | } -------------------------------------------------------------------------------- /springboot-api-gray/src/main/java/com/example/version/ApiVersion.java: -------------------------------------------------------------------------------- 1 | package com.example.version; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * API版本注解,用于标记接口的版本 7 | */ 8 | @Target({ElementType.METHOD, ElementType.TYPE}) 9 | @Retention(RetentionPolicy.RUNTIME) 10 | @Documented 11 | public @interface ApiVersion { 12 | /** 13 | * 版本号,默认为1.0 14 | */ 15 | String value() default "1.0"; 16 | 17 | /** 18 | * 版本描述 19 | */ 20 | String description() default ""; 21 | 22 | /** 23 | * 是否废弃 24 | */ 25 | boolean deprecated() default false; 26 | 27 | /** 28 | * 废弃说明,建议使用的新版本等信息 29 | */ 30 | String deprecatedDesc() default ""; 31 | } -------------------------------------------------------------------------------- /springboot-live-call/src/main/java/com/example/livestream/model/ChatMessage.java: -------------------------------------------------------------------------------- 1 | package com.example.livestream.model; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.time.LocalDateTime; 8 | 9 | @Data 10 | @NoArgsConstructor 11 | @AllArgsConstructor 12 | public class ChatMessage { 13 | private String roomId; 14 | private String sender; 15 | private String content; 16 | private LocalDateTime timestamp; 17 | private MessageType type; 18 | 19 | public enum MessageType { 20 | CHAT, 21 | JOIN, 22 | LEAVE, 23 | MIC_REQUEST, 24 | MIC_RESPONSE, 25 | SIGNAL 26 | } 27 | } -------------------------------------------------------------------------------- /springboot-cli/cli-client/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: cli-client 4 | 5 | # CLI客户端配置 6 | cli: 7 | client: 8 | # 服务端URL 9 | server-url: http://localhost:8080 10 | # 请求超时时间(毫秒) 11 | timeout: 30000 12 | # 连接超时时间(毫秒) 13 | connect-timeout: 5000 14 | # 是否启用请求重试 15 | retry-enabled: true 16 | # 最大重试次数 17 | max-retries: 3 18 | 19 | # Spring Shell配置 20 | shell: 21 | # 启用交互模式 22 | interactive: 23 | enabled: true 24 | # 历史记录 25 | history: 26 | enabled: true 27 | size: 100 28 | 29 | # 日志配置 30 | logging: 31 | level: 32 | com.example.cli: INFO 33 | pattern: 34 | console: "%d{HH:mm:ss} %-5level %logger{36} - %msg%n" -------------------------------------------------------------------------------- /springboot-dfa/src/main/java/com/example/dfa/entity/SensitiveWordResult.java: -------------------------------------------------------------------------------- 1 | package com.example.dfa.entity; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * 敏感词检测结果 9 | */ 10 | @Data 11 | @NoArgsConstructor 12 | public class SensitiveWordResult { 13 | /** 14 | * 敏感词内容 15 | */ 16 | private String word; 17 | 18 | /** 19 | * 起始位置 20 | */ 21 | private int start; 22 | 23 | /** 24 | * 结束位置 25 | */ 26 | private int end; 27 | 28 | public SensitiveWordResult(String word, int start, int end) { 29 | this.word = word; 30 | this.start = start; 31 | this.end = end; 32 | } 33 | } -------------------------------------------------------------------------------- /springboot-unified-call/src/main/java/com/example/unified/dto/OrderDTO.java: -------------------------------------------------------------------------------- 1 | package com.example.unified.dto; 2 | 3 | import lombok.Data; 4 | import java.io.Serializable; 5 | import java.math.BigDecimal; 6 | import java.time.LocalDateTime; 7 | 8 | /** 9 | * 订单数据传输对象,表示订单基本 information 10 | */ 11 | @Data 12 | public class OrderDTO implements Serializable { 13 | private static final long serialVersionUID = 1L; // 显式声明版本号 14 | 15 | private Long id; // 订单ID 16 | private Long userId; // 用户ID 17 | private String totalAmount; // 订单总金额 18 | private String status; // 订单状态(PENDING/SUBMITTED/PAID) 19 | private LocalDateTime createTime; // 创建时间 20 | } -------------------------------------------------------------------------------- /springboot-asn1/README.md: -------------------------------------------------------------------------------- 1 | # SpringBoot ASN.1在线解析工具 2 | 3 | 基于SpringBoot和BouncyCastle实现的ASN.1在线解析工具,支持多种ASN.1编码格式的解析和可视化展示。 4 | 5 | 6 | # 📋 支持的ASN.1类型 7 | 8 | | 类型 | 描述 | 示例 | 9 | |------|------|------| 10 | | SEQUENCE | 序列类型 | `3009...` | 11 | | SET | 集合类型 | `3109...` | 12 | | INTEGER | 整数类型 | `020101` | 13 | | OCTET STRING | 八位字节串 | `04048899aabb` | 14 | | UTF8String | UTF-8字符串 | `0c0548656c6c6f` | 15 | | PrintableString | 可打印字符串 | `130548656c6c6f` | 16 | | OBJECT IDENTIFIER | 对象标识符 | `06032a0304` | 17 | | BIT STRING | 位串 | `030200ff` | 18 | | BOOLEAN | 布尔值 | `0101ff` | 19 | | NULL | 空值 | `0500` | 20 | | UTCTime | UTC时间 | `170d32333031303132303539305a` | 21 | | GeneralizedTime | 通用时间 | `18113332333031303132303539305a` | 22 | -------------------------------------------------------------------------------- /springboot-mybatis-interceptor/src/main/java/com/example/util/SensitiveUtils.java: -------------------------------------------------------------------------------- 1 | package com.example.util; 2 | 3 | public class SensitiveUtils { 4 | // 手机号脱敏:保留前3位和后4位 5 | public static String maskPhone(String phone) { 6 | if (phone == null || phone.length() != 11) { 7 | return phone; // 非手机号格式不处理 8 | } 9 | return phone.replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2"); 10 | } 11 | 12 | // 身份证号脱敏:保留最后2位 13 | public static String maskIdCard(String idCard) { 14 | if (idCard == null || idCard.length() < 18) { 15 | return idCard; // 非身份证格式不处理 16 | } 17 | return idCard.replaceAll("\\d{16}(\\d{2})", "****************$1"); 18 | } 19 | } -------------------------------------------------------------------------------- /springboot-hot-cpu/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | servlet: 4 | context-path: / 5 | 6 | spring: 7 | application: 8 | name: springboot-hot-cpu 9 | web: 10 | resources: 11 | static-locations: classpath:/static/ 12 | cache: 13 | cachecontrol: 14 | max-age: 0 15 | 16 | management: 17 | endpoints: 18 | web: 19 | exposure: 20 | include: health,info,metrics 21 | endpoint: 22 | health: 23 | show-details: always 24 | 25 | logging: 26 | level: 27 | com.example.hotcpu: INFO 28 | org.springframework: WARN 29 | org.apache: WARN 30 | pattern: 31 | console: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n" -------------------------------------------------------------------------------- /springboot-hot-patch/src/main/java/com/example/hotpatch/instrumentation/InstrumentationHolder.java: -------------------------------------------------------------------------------- 1 | package com.example.hotpatch.instrumentation; 2 | 3 | import java.lang.instrument.Instrumentation; 4 | 5 | /** 6 | * Instrumentation持有器 - 用于获取JVM的Instrumentation实例 7 | */ 8 | public class InstrumentationHolder { 9 | private static volatile Instrumentation instrumentation; 10 | 11 | public static void setInstrumentation(Instrumentation inst) { 12 | instrumentation = inst; 13 | } 14 | 15 | public static Instrumentation getInstrumentation() { 16 | return instrumentation; 17 | } 18 | 19 | public static boolean isAvailable() { 20 | return instrumentation != null; 21 | } 22 | } -------------------------------------------------------------------------------- /springboot-mutual-cert/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8443 3 | ssl: 4 | enabled: true 5 | key-store: classpath:server.jks 6 | key-store-password: changeit 7 | key-store-type: JKS 8 | key-alias: server 9 | trust-store: classpath:truststore.jks 10 | trust-store-password: changeit 11 | trust-store-type: JKS 12 | client-auth: need # 需要客户端证书 13 | 14 | spring: 15 | application: 16 | name: springboot-mutual-cert 17 | output: 18 | ansi: 19 | enabled: always 20 | banner: 21 | location: classpath:banner.txt 22 | 23 | logging: 24 | level: 25 | org.springframework.security: DEBUG 26 | com.example.mutualcert: DEBUG 27 | org.apache.catalina: DEBUG 28 | -------------------------------------------------------------------------------- /springboot-single-login/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | 35 | ###logs### 36 | logs/ 37 | *.log 38 | 39 | ###env### 40 | .env 41 | .env.local 42 | .env.development.local 43 | .env.test.local 44 | .env.production.local -------------------------------------------------------------------------------- /springboot-gencode-training/src/main/java/com/yuboon/springboot/gencode/exception/GenCodeException.java: -------------------------------------------------------------------------------- 1 | package com.yuboon.springboot.gencode.exception; 2 | 3 | import javax.management.RuntimeMBeanException; 4 | 5 | /** 6 | * 此处为类介绍 7 | * 8 | * @author yuboon 9 | * @version v1.0 10 | * @date 2020/01/08 11 | */ 12 | public class GenCodeException extends RuntimeException { 13 | 14 | private static final long serialVersionUID = 1L; 15 | 16 | public GenCodeException() { 17 | super(); 18 | } 19 | 20 | public GenCodeException(String message, Throwable cause) { 21 | super(message, cause); 22 | } 23 | 24 | public GenCodeException(String message) { 25 | super(message); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /springboot-gencode/README.md: -------------------------------------------------------------------------------- 1 | # springboot-gencode 2 | 3 | ### 通知:仓库迁移说明 4 | 5 | **为了给读者创造更好的阅读学习体验,本仓库内容已全部迁移至 [新仓库:风象南公开课](https://github.com/yuboon/OpenClass ),近期将关闭该仓库。** 6 | 7 | 8 | 9 | ### 内容概述 10 | 11 | 以代码生成工具的核心功能为案例,从需求到最终实现,较为详细的描述了工作过程和一些工作方法包括一些设计程序的思想和理念。 12 | 13 | 学习本文你或许可以收获 14 | 15 | 1、一个需求从产生、分析到解决的全过程思考 16 | 17 | 2、简单的面向对象分析实践 18 | 19 | 3、UML类图实践 20 | 21 | 4、设计模式的实践应用 22 | 23 | 5、最后收获一款还算不错的代码生成工具实现思路和源代码 24 | 25 | 26 | ### 原创文章地址 27 | 28 | https://mp.weixin.qq.com/s/ho6wJFvFKUG6fYlNDJPTIw 29 | 30 | ### 技术交流群 31 | 669030183 32 | 33 | ### 关注我 34 | 35 | 公众号「风象南」,持续输出优质内容 36 | 37 | 38 | ![](https://raw.githubusercontent.com/yuboon/java-examples/master/springboot-gencode/doc/image/qrcode.jpg) 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /springboot-hot-patch/src/main/java/com/example/hotpatch/agent/HotPatchAgent.java: -------------------------------------------------------------------------------- 1 | package com.example.hotpatch.agent; 2 | 3 | import com.example.hotpatch.instrumentation.InstrumentationHolder; 4 | 5 | import java.lang.instrument.Instrumentation; 6 | 7 | /** 8 | * Java Agent入口类 9 | */ 10 | public class HotPatchAgent { 11 | 12 | public static void premain(String agentArgs, Instrumentation inst) { 13 | System.out.println("HotPatch Agent 启动成功"); 14 | InstrumentationHolder.setInstrumentation(inst); 15 | } 16 | 17 | public static void agentmain(String agentArgs, Instrumentation inst) { 18 | System.out.println("HotPatch Agent 动态加载成功"); 19 | InstrumentationHolder.setInstrumentation(inst); 20 | } 21 | } -------------------------------------------------------------------------------- /springboot-api-dashboard/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | servlet: 4 | context-path: / 5 | 6 | spring: 7 | application: 8 | name: springboot-api-dashboard 9 | 10 | # AOP configuration 11 | aop: 12 | auto: true 13 | proxy-target-class: true 14 | 15 | # Logging configuration 16 | logging: 17 | level: 18 | com.example.dashboard: INFO 19 | org.springframework.aop: DEBUG 20 | pattern: 21 | console: "%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n" 22 | 23 | 24 | # Application specific properties 25 | dashboard: 26 | metrics: 27 | cleanup-interval: 300000 # 5 minutes in milliseconds 28 | max-age: 3600000 # 1 hour in milliseconds 29 | debug-enabled: false -------------------------------------------------------------------------------- /springboot-gencode-training/src/main/java/com/yuboon/springboot/gencode/output/ConsoleOutput.java: -------------------------------------------------------------------------------- 1 | package com.yuboon.springboot.gencode.output; 2 | 3 | 4 | import cn.hutool.core.lang.Console; 5 | import com.yuboon.springboot.gencode.metadata.Table; 6 | import com.yuboon.springboot.gencode.template.CodeTemplate; 7 | 8 | /** 9 | * 此处为类介绍 10 | * 11 | * @author yuboon 12 | * @version v1.0 13 | * @date 2020/01/08 14 | */ 15 | public class ConsoleOutput extends CodeOutput { 16 | 17 | public ConsoleOutput(){ 18 | this.code = "01"; 19 | this.name = "Console"; 20 | } 21 | 22 | @Override 23 | public void out(Table table, String content, CodeTemplate template){ 24 | Console.log(content); 25 | }; 26 | 27 | } 28 | -------------------------------------------------------------------------------- /springboot-unified-call/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | service: 2 | direct-url: # 直连地址配置 3 | user-service: http://localhost:8080/user # 订单服务REST地址 4 | config: 5 | user-service: rest # 用户服务用rest调用 6 | order-service: rpc # 订单服务用RPC调用 7 | 8 | # Dubbo 配置(若使用 Dubbo RPC) 9 | dubbo: 10 | application: 11 | name: unified-client-demo # 当前应用名 12 | # serialize-check-status: DISABLE 13 | qos-enable: false 14 | registry: 15 | address: N/A 16 | reference: 17 | # 为指定服务配置直连地址(无需注册中心) 18 | order-service: 19 | interfaceName: com.example.unified.service.OrderService # 服务接口名称 20 | url: dubbo://192.168.17.1:20880 # 格式:dubbo://IP:端口 21 | protocol: 22 | name: dubbo # RPC 协议名称 23 | port: 20880 # 端口 -------------------------------------------------------------------------------- /springboot-asn1/src/main/java/com/example/asn1/dto/Asn1ParseRequest.java: -------------------------------------------------------------------------------- 1 | package com.example.asn1.dto; 2 | 3 | import javax.validation.constraints.NotBlank; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | import lombok.AllArgsConstructor; 7 | 8 | /** 9 | * ASN.1解析请求DTO 10 | * 11 | * 12 | * @version 1.0.0 13 | */ 14 | @Data 15 | @NoArgsConstructor 16 | @AllArgsConstructor 17 | public class Asn1ParseRequest { 18 | 19 | /** 20 | * ASN.1数据,不能为空 21 | */ 22 | @NotBlank(message = "ASN.1数据不能为空") 23 | private String asn1Data; 24 | 25 | /** 26 | * 编码类型,默认为HEX 27 | */ 28 | private String encodingType = "HEX"; 29 | 30 | /** 31 | * 是否输出详细信息 32 | */ 33 | private boolean verbose = false; 34 | } -------------------------------------------------------------------------------- /springboot-dynamic-rule/src/main/java/com/example/dynamicrule/entity/RuleExecuteResponse.java: -------------------------------------------------------------------------------- 1 | package com.example.dynamicrule.entity; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @NoArgsConstructor 9 | @AllArgsConstructor 10 | public class RuleExecuteResponse { 11 | 12 | private boolean success; 13 | 14 | private Object result; 15 | 16 | private String errorMessage; 17 | 18 | public static RuleExecuteResponse success(Object result) { 19 | return new RuleExecuteResponse(true, result, null); 20 | } 21 | 22 | public static RuleExecuteResponse error(String errorMessage) { 23 | return new RuleExecuteResponse(false, null, errorMessage); 24 | } 25 | } -------------------------------------------------------------------------------- /springboot-timingwheel/src/main/java/com/example/timingwheel/config/MetricsConfig.java: -------------------------------------------------------------------------------- 1 | package com.example.timingwheel.config; 2 | 3 | import io.micrometer.core.instrument.MeterRegistry; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.boot.actuate.autoconfigure.metrics.MeterRegistryCustomizer; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | 9 | /** 10 | * 监控指标配置 11 | */ 12 | @Configuration 13 | public class MetricsConfig { 14 | 15 | @Bean 16 | public MeterRegistryCustomizer metricsCommonTags() { 17 | return registry -> registry.config().commonTags("application", "springboot-timingwheel"); 18 | } 19 | } -------------------------------------------------------------------------------- /springboot-form/src/main/java/com/example/dynamicform/model/FormSubmission.java: -------------------------------------------------------------------------------- 1 | package com.example.dynamicform.model; 2 | 3 | import lombok.Data; 4 | import lombok.Builder; 5 | import lombok.AllArgsConstructor; 6 | import lombok.NoArgsConstructor; 7 | 8 | import java.time.LocalDateTime; 9 | 10 | /** 11 | * 表单提交数据实体 12 | */ 13 | @Data 14 | @Builder 15 | @AllArgsConstructor 16 | @NoArgsConstructor 17 | public class FormSubmission { 18 | private Long id; // 提交ID 19 | private String schemaId; // 关联的表单Schema 20 | private String formData; // 用户提交的JSON数据 21 | private String submitterId; // 提交者ID 22 | private String status; // 提交状态:pending, approved, rejected 23 | private LocalDateTime submittedAt; // 提交时间 24 | } -------------------------------------------------------------------------------- /springboot-form/src/main/java/com/example/dynamicform/config/CorsConfig.java: -------------------------------------------------------------------------------- 1 | package com.example.dynamicform.config; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.web.servlet.config.annotation.CorsRegistry; 5 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 6 | 7 | /** 8 | * CORS配置 9 | */ 10 | @Configuration 11 | public class CorsConfig implements WebMvcConfigurer { 12 | 13 | @Override 14 | public void addCorsMappings(CorsRegistry registry) { 15 | registry.addMapping("/api/**") 16 | .allowedOrigins("*") 17 | .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS") 18 | .allowedHeaders("*") 19 | .maxAge(3600); 20 | } 21 | } -------------------------------------------------------------------------------- /springboot-gencode-training/src/main/java/com/yuboon/springboot/gencode/output/CodeOutput.java: -------------------------------------------------------------------------------- 1 | package com.yuboon.springboot.gencode.output; 2 | 3 | 4 | import cn.hutool.core.lang.Console; 5 | import com.yuboon.springboot.gencode.metadata.Table; 6 | import com.yuboon.springboot.gencode.template.CodeTemplate; 7 | 8 | /** 9 | * 此处为类介绍 10 | * 11 | * @author yuboon 12 | * @version v1.0 13 | * @date 2020/01/08 14 | */ 15 | public abstract class CodeOutput { 16 | 17 | protected String code; 18 | 19 | protected String name; 20 | 21 | public abstract void out(Table table, String content, CodeTemplate template); 22 | 23 | public String getCode() { 24 | return code; 25 | } 26 | 27 | public String getName() { 28 | return name; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /springboot-gencode/src/main/java/com/yuboon/springboot/gencode/output/CodeOutput.java: -------------------------------------------------------------------------------- 1 | package com.yuboon.springboot.gencode.output; 2 | 3 | import com.yuboon.springboot.gencode.meta.Table; 4 | import com.yuboon.springboot.gencode.template.CodeTemplate; 5 | 6 | /** 7 | * 输出接口 8 | * 9 | * @author yuboon 10 | * @version v1.0 11 | * @date 2020/01/04 12 | */ 13 | public abstract class CodeOutput { 14 | 15 | protected String outputCode; 16 | 17 | /** 18 | * 输出文件 19 | * @param table 20 | * @param content 21 | * @param template 22 | */ 23 | public abstract void out(Table table, String content, CodeTemplate template); 24 | 25 | public String getOutputCode() { 26 | return outputCode; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /springboot-object-version/src/main/java/com/example/objectversion/config/WebConfig.java: -------------------------------------------------------------------------------- 1 | package com.example.objectversion.config; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.web.servlet.config.annotation.CorsRegistry; 5 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 6 | 7 | @Configuration 8 | public class WebConfig implements WebMvcConfigurer { 9 | 10 | @Override 11 | public void addCorsMappings(CorsRegistry registry) { 12 | registry.addMapping("/**") 13 | .allowedOriginPatterns("*") 14 | .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS") 15 | .allowedHeaders("*") 16 | .allowCredentials(false); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /springboot-hot-patch/src/main/java/com/example/hotpatch/patches/MathHelperDividePatch.java: -------------------------------------------------------------------------------- 1 | package com.example.hotpatch.patches; 2 | 3 | import com.example.hotpatch.annotation.HotPatch; 4 | import com.example.hotpatch.annotation.PatchType; 5 | 6 | /** 7 | * MathHelper divide方法的补丁类 - 修复除零异常 8 | */ 9 | @HotPatch( 10 | type = PatchType.STATIC_METHOD, 11 | originalClass = "com.example.hotpatch.example.MathHelper", 12 | methodName = "divide", 13 | version = "1.0.3", 14 | description = "修复divide方法除零异常" 15 | ) 16 | public class MathHelperDividePatch { 17 | 18 | public static int divide(int a, int b) { 19 | // 修复除零异常 20 | if (b == 0) { 21 | throw new IllegalArgumentException("除数不能为零"); 22 | } 23 | return a / b; 24 | } 25 | } -------------------------------------------------------------------------------- /springboot-net-capture/src/main/java/com/example/netcapture/config/JacksonConfig.java: -------------------------------------------------------------------------------- 1 | package com.example.netcapture.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | 6 | import com.fasterxml.jackson.databind.ObjectMapper; 7 | import com.fasterxml.jackson.databind.SerializationFeature; 8 | import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; 9 | 10 | @Configuration 11 | public class JacksonConfig { 12 | 13 | @Bean 14 | public ObjectMapper objectMapper() { 15 | ObjectMapper mapper = new ObjectMapper(); 16 | mapper.registerModule(new JavaTimeModule()); 17 | mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); 18 | return mapper; 19 | } 20 | } -------------------------------------------------------------------------------- /springboot-shamir/src/main/java/com/demo/shamir/config/CorsConfig.java: -------------------------------------------------------------------------------- 1 | package com.demo.shamir.config; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.web.servlet.config.annotation.CorsRegistry; 5 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 6 | 7 | /** 8 | * CORS 跨域配置 9 | */ 10 | @Configuration 11 | public class CorsConfig implements WebMvcConfigurer { 12 | 13 | @Override 14 | public void addCorsMappings(CorsRegistry registry) { 15 | registry.addMapping("/api/**") 16 | .allowedOrigins("*") // 生产环境应配置具体域名 17 | .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS") 18 | .allowedHeaders("*") 19 | .maxAge(3600); 20 | } 21 | } -------------------------------------------------------------------------------- /springboot-column-encryption/src/main/java/com/example/encryption/annotation/Encrypted.java: -------------------------------------------------------------------------------- 1 | package com.example.encryption.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * 字段级加密注解 10 | * 标记需要进行加解密的字段 11 | */ 12 | @Target(ElementType.FIELD) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | public @interface Encrypted { 15 | /** 16 | * 加密算法类型,默认为 AES-GCM 17 | */ 18 | Algorithm algorithm() default Algorithm.AES_GCM; 19 | 20 | /** 21 | * 是否支持模糊查询 22 | */ 23 | boolean searchable() default false; 24 | 25 | /** 26 | * 支持的加密算法枚举 27 | */ 28 | enum Algorithm { 29 | AES_GCM 30 | } 31 | } -------------------------------------------------------------------------------- /springboot-multi-port/src/main/java/com/example/multiport/model/Product.java: -------------------------------------------------------------------------------- 1 | package com.example.multiport.model; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.math.BigDecimal; 8 | import java.time.LocalDateTime; 9 | 10 | /** 11 | * 商品模型 12 | */ 13 | @Data 14 | @NoArgsConstructor 15 | @AllArgsConstructor 16 | public class Product { 17 | 18 | private Long id; 19 | 20 | private String name; 21 | 22 | private String description; 23 | 24 | private BigDecimal price; 25 | 26 | private Integer stock; 27 | 28 | private String category; 29 | 30 | private LocalDateTime createTime; 31 | 32 | private LocalDateTime updateTime; 33 | 34 | private Boolean status; // true: 上架, false: 下架 35 | } -------------------------------------------------------------------------------- /springboot-unified-call/src/main/java/com/example/unified/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package com.example.unified.controller; 2 | 3 | import com.example.unified.ApiResponse; 4 | import com.example.unified.dto.UserDTO; 5 | import com.example.unified.service.UserService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.web.bind.annotation.*; 8 | 9 | @RestController 10 | @RequestMapping("/user") 11 | public class UserController { 12 | 13 | @Autowired 14 | private UserService userService; 15 | 16 | @RequestMapping("/getUser") 17 | public ApiResponse getUser(@RequestBody UserDTO userDTO) { 18 | UserDTO user = userService.getUser(userDTO.getId()); 19 | return ApiResponse.success(user); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /springboot-unified-call/src/main/java/com/example/unified/service/OrderServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.example.unified.service; 2 | 3 | import com.example.unified.dto.OrderDTO; 4 | import org.apache.dubbo.config.annotation.DubboService; 5 | 6 | import java.math.BigDecimal; 7 | import java.time.LocalDateTime; 8 | 9 | @DubboService(version = "1.0.0") 10 | public class OrderServiceImpl implements OrderService { 11 | 12 | public OrderDTO getOrder(OrderDTO orderDTO) { 13 | // 模拟数据库查询 14 | OrderDTO order = new OrderDTO(); 15 | order.setId(orderDTO.getId()); 16 | order.setUserId(1001L); 17 | order.setTotalAmount("99.99"); 18 | order.setStatus("PAID"); 19 | order.setCreateTime(LocalDateTime.now()); 20 | return order; 21 | } 22 | 23 | } -------------------------------------------------------------------------------- /springboot-api-doc/src/main/java/com/apidoc/annotation/ApiOperation.java: -------------------------------------------------------------------------------- 1 | package com.apidoc.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * API操作注解 10 | * 用于描述API方法的基本信息 11 | */ 12 | @Target({ElementType.METHOD}) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | public @interface ApiOperation { 15 | 16 | /** 17 | * API简短描述 18 | */ 19 | String value(); 20 | 21 | /** 22 | * API详细说明 23 | */ 24 | String description() default ""; 25 | 26 | /** 27 | * API备注信息 28 | */ 29 | String notes() default ""; 30 | 31 | /** 32 | * 是否隐藏此API 33 | */ 34 | boolean hidden() default false; 35 | } -------------------------------------------------------------------------------- /springboot-hot-patch/src/main/java/com/example/hotpatch/model/PatchResult.java: -------------------------------------------------------------------------------- 1 | package com.example.hotpatch.model; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | 6 | /** 7 | * 补丁操作结果类 8 | */ 9 | @Data 10 | @AllArgsConstructor 11 | public class PatchResult { 12 | private boolean success; 13 | private String message; 14 | private Object data; 15 | 16 | public static PatchResult success(String message) { 17 | return new PatchResult(true, message, null); 18 | } 19 | 20 | public static PatchResult success(String message, Object data) { 21 | return new PatchResult(true, message, data); 22 | } 23 | 24 | public static PatchResult failed(String message) { 25 | return new PatchResult(false, message, null); 26 | } 27 | } -------------------------------------------------------------------------------- /springboot-live/src/main/java/com/example/livestream/mapper/LiveRoomMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.livestream.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.example.livestream.entity.LiveRecording; 5 | import com.example.livestream.entity.LiveRoom; 6 | import com.example.livestream.entity.LiveStream; 7 | import org.apache.ibatis.annotations.Mapper; 8 | import org.apache.ibatis.annotations.Param; 9 | import org.apache.ibatis.annotations.Select; 10 | 11 | import java.util.List; 12 | 13 | @Mapper 14 | public interface LiveRoomMapper extends BaseMapper { 15 | // 自定义查询方法 16 | @Select("SELECT * FROM live_room WHERE status = 1 ORDER BY view_count DESC LIMIT #{limit}") 17 | List findHotLiveRooms(@Param("limit") int limit); 18 | } 19 | 20 | 21 | -------------------------------------------------------------------------------- /springboot-cli/cli-server/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | 4 | spring: 5 | application: 6 | name: cli-server 7 | 8 | # CLI服务配置 9 | cli: 10 | # 允许访问的服务列表,如果为空则允许所有实现了CommandHandler的服务 11 | allowed-services: 12 | - userService 13 | - roleService 14 | - systemService 15 | # 是否启用命令执行日志 16 | enable-execution-log: true 17 | # 命令执行超时时间(毫秒) 18 | execution-timeout: 30000 19 | 20 | # 日志配置 21 | logging: 22 | level: 23 | com.example.cli: DEBUG 24 | org.springframework.security: INFO 25 | pattern: 26 | console: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n" 27 | 28 | # 管理端点配置 29 | management: 30 | endpoints: 31 | web: 32 | exposure: 33 | include: health,info 34 | endpoint: 35 | health: 36 | show-details: always -------------------------------------------------------------------------------- /springboot-face2face-chat/src/main/java/com/example/face2face/Face2FaceApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.face2face; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.scheduling.annotation.EnableScheduling; 7 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; 8 | 9 | @SpringBootApplication 10 | @EnableScheduling 11 | public class Face2FaceApplication { 12 | 13 | public static void main(String[] args) { 14 | SpringApplication.run(Face2FaceApplication.class, args); 15 | } 16 | 17 | @Bean 18 | public BCryptPasswordEncoder passwordEncoder() { 19 | return new BCryptPasswordEncoder(); 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /springboot-gencode-training/src/main/java/com/yuboon/springboot/gencode/command/EntityCommand.java: -------------------------------------------------------------------------------- 1 | package com.yuboon.springboot.gencode.command; 2 | 3 | import com.yuboon.springboot.gencode.metadata.Table; 4 | import com.yuboon.springboot.gencode.template.CodeTemplate; 5 | import com.yuboon.springboot.gencode.template.EntityCodeTemplate; 6 | 7 | import java.util.Map; 8 | 9 | /** 10 | * 此处为类介绍 11 | * 12 | * @author yuboon 13 | * @version v1.0 14 | * @date 2020/01/08 15 | */ 16 | public class EntityCommand extends SingleCommand { 17 | 18 | public EntityCommand(){ 19 | this.code = "02"; 20 | this.name = "生成Entity"; 21 | this.codeTemplate = new EntityCodeTemplate(); 22 | } 23 | 24 | @Override 25 | public void process(Table table, Map map) { 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /springboot-gencode/src/main/java/com/yuboon/springboot/gencode/command/GenVoCommand.java: -------------------------------------------------------------------------------- 1 | package com.yuboon.springboot.gencode.command; 2 | 3 | import com.yuboon.springboot.gencode.meta.Table; 4 | import com.yuboon.springboot.gencode.template.EntityCodeTemplate; 5 | import com.yuboon.springboot.gencode.template.VoCodeTemplate; 6 | 7 | import java.util.Map; 8 | 9 | /** 10 | * 控制器生成命令 11 | * 12 | * @author yuboon 13 | * @version v1.0 14 | * @date 2020/01/04 15 | */ 16 | public class GenVoCommand extends SingleCommand { 17 | 18 | public GenVoCommand() { 19 | this.commandName = "Vo生成命令"; 20 | this.commandCode = "04"; 21 | this.template = new VoCodeTemplate(); 22 | } 23 | 24 | @Override 25 | public void process(Table table, Map map) { 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /springboot-unified-call/src/main/java/com/example/unified/exception/BusinessException.java: -------------------------------------------------------------------------------- 1 | package com.example.unified.exception; 2 | 3 | public class BusinessException extends RuntimeException{ 4 | 5 | private String code; 6 | 7 | public BusinessException() { 8 | super(); 9 | } 10 | 11 | public BusinessException(String message) { 12 | super(message); 13 | } 14 | 15 | public BusinessException(String code, String message) { 16 | super(message); 17 | this.code = code; 18 | } 19 | 20 | public BusinessException(String message, Throwable cause) { 21 | super(message, cause); 22 | } 23 | 24 | public String getCode() { 25 | return code; 26 | } 27 | 28 | public void setCode(String code) { 29 | this.code = code; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /springboot-cli/cli-common/src/main/java/com/example/cli/dto/CommandRequest.java: -------------------------------------------------------------------------------- 1 | package com.example.cli.dto; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * CLI命令请求DTO 7 | */ 8 | public class CommandRequest { 9 | private String service; 10 | private List args; 11 | 12 | public CommandRequest() {} 13 | 14 | public CommandRequest(String service, List args) { 15 | this.service = service; 16 | this.args = args; 17 | } 18 | 19 | public String getService() { 20 | return service; 21 | } 22 | 23 | public void setService(String service) { 24 | this.service = service; 25 | } 26 | 27 | public List getArgs() { 28 | return args; 29 | } 30 | 31 | public void setArgs(List args) { 32 | this.args = args; 33 | } 34 | } -------------------------------------------------------------------------------- /springboot-gencode/src/test/java/com/yuboon/gencode/test/GenCodeTest.java: -------------------------------------------------------------------------------- 1 | package com.yuboon.gencode.test; 2 | 3 | import com.yuboon.springboot.gencode.GenCode; 4 | import com.yuboon.springboot.gencode.configuration.GenCodeConfiguration; 5 | import com.yuboon.springboot.gencode.command.GenVoCommand; 6 | import com.yuboon.springboot.gencode.output.ConsoleOutput; 7 | 8 | /** 9 | * 此处为类介绍 10 | * 11 | * @author yuboon 12 | * @version v1.0 13 | * @date 2020/01/05 14 | */ 15 | public class GenCodeTest { 16 | 17 | public static void main(String[] args) { 18 | GenCodeConfiguration genCodeConfiguration = new GenCodeConfiguration(); 19 | GenCode genCode = new GenCode(genCodeConfiguration); 20 | genCode.process("sys_user",new GenVoCommand(),new ConsoleOutput()); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /springboot-net-capture/src/main/java/com/example/netcapture/config/NetworkCaptureProperties.java: -------------------------------------------------------------------------------- 1 | package com.example.netcapture.config; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | import org.springframework.stereotype.Component; 5 | 6 | import lombok.Data; 7 | 8 | @Data 9 | @Component 10 | @ConfigurationProperties(prefix = "network.capture") 11 | public class NetworkCaptureProperties { 12 | 13 | private String networkInterface = ""; 14 | 15 | private String filter = ""; 16 | 17 | private int bufferSize = 65536; 18 | 19 | private int timeout = 1000; 20 | 21 | private boolean promiscuous = false; 22 | 23 | private int maxPackets = 0; 24 | 25 | private boolean autoStart = false; 26 | 27 | private int dataRetentionHours = 24; 28 | } -------------------------------------------------------------------------------- /java-exception/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | 4 | # 默认日志配置 5 | logging: 6 | file: logs/test.log 7 | config: # 日志配置文件,Spring Boot默认使用classpath路径下的日志配置文件,如:logback.xml 8 | level: 9 | root: info # 全局默认级别 10 | pattern: 11 | #console: "%date{yyyy-MM-dd HH:mm:ss.SSS} %-5level[%thread]%logger{C}.%method:%line -%msg%n" 12 | #net.aooms.core: info # 项目级别,覆盖root默认 13 | 14 | spring: 15 | datasource: 16 | url: jdbc:mysql://localhost:3306/ppa 17 | username: root 18 | password: root 19 | driver-class-name: com.mysql.jdbc.Driver 20 | # 连接池配置 21 | maxActive: 200 22 | initialSize: 5 23 | maxWait: 60000 24 | minIdle: 3 25 | timeBetweenEvictionRunsMillis: 60000 26 | minEvictableIdleTimeMillis: 300000 27 | validationQuery: select 'x' 28 | -------------------------------------------------------------------------------- /springboot-mybatis-interceptor/src/main/java/com/example/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package com.example.controller; 2 | 3 | import com.example.model.User; 4 | import com.example.service.UserService; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.PathVariable; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | import org.springframework.web.bind.annotation.RestController; 10 | 11 | @RestController 12 | @RequestMapping 13 | public class UserController { 14 | 15 | @Autowired 16 | private UserService userService; 17 | 18 | @GetMapping("/user/{id}") 19 | private User getUserById(@PathVariable Long id) { 20 | return userService.getUserById(id); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /springboot-mybatis-interceptor/src/main/java/com/example/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.mapper; 2 | 3 | import com.example.model.User; 4 | import org.apache.ibatis.annotations.*; 5 | 6 | @Mapper 7 | public interface UserMapper { 8 | 9 | @Insert("INSERT INTO user(username, phone, id_card) " + 10 | "VALUES(#{username}, #{phone}, #{idCard})") 11 | @Options(useGeneratedKeys = true, keyProperty = "id") 12 | int insert(User user); 13 | 14 | @Update("UPDATE user SET username=#{username}, phone=#{phone}, id_card=#{idCard} " + 15 | "WHERE id=#{id}") 16 | int update(User user); 17 | 18 | @Select("SELECT * FROM user WHERE id = #{id}") 19 | User selectById(@Param("id") Long id); 20 | 21 | @Delete("DELETE FROM user WHERE id = #{id}") 22 | int deleteById(@Param("id") Long id); 23 | } -------------------------------------------------------------------------------- /springboot-single-login/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | 4 | app: 5 | login: 6 | # 登录模式:SINGLE-单用户单登录,MULTIPLE-单用户多登录 7 | mode: MULTIPLE 8 | # Token有效期(秒) 9 | token-expire-time: 1800 10 | # Token前缀 11 | token-prefix: TOKEN_ 12 | # Token请求头名称 13 | token-header: Authorization 14 | # 是否启用自动清理 15 | enable-auto-clean: true 16 | # 清理间隔(分钟) 17 | clean-interval: 5 18 | 19 | # Redis配置(可选,用于分布式部署) 20 | # spring: 21 | # redis: 22 | # host: localhost 23 | # port: 6379 24 | # database: 0 25 | # timeout: 3000ms 26 | # lettuce: 27 | # pool: 28 | # max-active: 8 29 | # max-idle: 8 30 | # min-idle: 0 31 | 32 | # 日志配置 33 | logging: 34 | level: 35 | com.example.login: DEBUG 36 | org.springframework.web: DEBUG 37 | root: INFO -------------------------------------------------------------------------------- /springboot-live-call/src/main/java/com/example/livestream/config/WebConfig.java: -------------------------------------------------------------------------------- 1 | package com.example.livestream.config; 2 | 3 | import com.example.livestream.interceptor.JwtInterceptor; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; 7 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 8 | 9 | @Configuration 10 | public class WebConfig implements WebMvcConfigurer { 11 | 12 | @Autowired 13 | private JwtInterceptor jwtInterceptor; 14 | 15 | @Override 16 | public void addInterceptors(InterceptorRegistry registry) { 17 | registry.addInterceptor(jwtInterceptor) 18 | .excludePathPatterns("/api/auth/**"); // 排除所有认证相关接口 19 | } 20 | } -------------------------------------------------------------------------------- /springboot-unified-call/src/main/java/com/example/unified/GlobalExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package com.example.unified; 2 | 3 | import com.example.unified.exception.BusinessException; 4 | import lombok.extern.slf4j.Slf4j; 5 | import org.springframework.web.bind.annotation.ExceptionHandler; 6 | import org.springframework.web.bind.annotation.RestControllerAdvice; 7 | 8 | @RestControllerAdvice 9 | @Slf4j 10 | public class GlobalExceptionHandler { 11 | @ExceptionHandler(BusinessException.class) 12 | public ApiResponse handleBusinessException(BusinessException e) { 13 | return ApiResponse.fail(e.getCode(), e.getMessage()); 14 | } 15 | 16 | @ExceptionHandler(Exception.class) 17 | public ApiResponse handleException(Exception e) { 18 | log.error("系统异常", e); 19 | return ApiResponse.fail("500", "系统内部错误"); 20 | } 21 | } -------------------------------------------------------------------------------- /springboot-api-doc/src/main/java/com/apidoc/annotation/ApiGroup.java: -------------------------------------------------------------------------------- 1 | package com.apidoc.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * API分组注解 10 | * 用于对API进行分组管理 11 | */ 12 | @Target({ElementType.TYPE}) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | public @interface ApiGroup { 15 | 16 | /** 17 | * 分组名称 18 | */ 19 | String name(); 20 | 21 | /** 22 | * 分组描述 23 | */ 24 | String description() default ""; 25 | 26 | /** 27 | * 排序权重,数字越小越靠前 28 | */ 29 | int order() default 0; 30 | 31 | /** 32 | * API版本 33 | */ 34 | String version() default "v1"; 35 | 36 | /** 37 | * 分组标签 38 | */ 39 | String[] tags() default {}; 40 | } -------------------------------------------------------------------------------- /springboot-live/src/main/java/com/example/livestream/config/MinioConfig.java: -------------------------------------------------------------------------------- 1 | package com.example.livestream.config; 2 | 3 | import io.minio.MinioClient; 4 | import org.springframework.beans.factory.annotation.Value; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | 8 | @Configuration 9 | public class MinioConfig { 10 | 11 | @Value("${minio.endpoint}") 12 | private String endpoint; 13 | 14 | @Value("${minio.access-key}") 15 | private String accessKey; 16 | 17 | @Value("${minio.secret-key}") 18 | private String secretKey; 19 | 20 | @Bean 21 | public MinioClient minioClient() { 22 | return MinioClient.builder() 23 | .endpoint(endpoint) 24 | .credentials(accessKey, secretKey) 25 | .build(); 26 | } 27 | } -------------------------------------------------------------------------------- /springboot-multi-port/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | # 多端口应用配置 2 | server: 3 | port: 8082 # 主端口(用户端) 4 | 5 | # 双端口自定义配置 6 | dual: 7 | port: 8 | user-port: 8082 9 | admin-port: 8083 10 | 11 | # Spring配置 12 | spring: 13 | application: 14 | name: multi-port-application 15 | profiles: 16 | active: default 17 | 18 | # Actuator配置 19 | management: 20 | endpoints: 21 | web: 22 | exposure: 23 | include: health,info,metrics 24 | endpoint: 25 | health: 26 | show-details: always 27 | 28 | # 日志配置 29 | logging: 30 | level: 31 | com.example.multiport: DEBUG 32 | org.springframework.web: INFO 33 | pattern: 34 | console: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n" 35 | file: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n" 36 | file: 37 | name: logs/multi-port-app.log -------------------------------------------------------------------------------- /springboot-net-capture/src/main/java/com/example/netcapture/dto/PacketInfoDto.java: -------------------------------------------------------------------------------- 1 | package com.example.netcapture.dto; 2 | 3 | import java.time.LocalDateTime; 4 | 5 | import lombok.Data; 6 | 7 | @Data 8 | public class PacketInfoDto { 9 | 10 | private Long id; 11 | 12 | private LocalDateTime captureTime; 13 | 14 | private String sourceIp; 15 | 16 | private String destinationIp; 17 | 18 | private Integer sourcePort; 19 | 20 | private Integer destinationPort; 21 | 22 | private String protocol; 23 | 24 | private Integer packetLength; 25 | 26 | private String httpMethod; 27 | 28 | private String httpUrl; 29 | 30 | private Integer httpStatus; 31 | 32 | private String tcpFlags; 33 | 34 | private String networkInterface; 35 | 36 | private String summary; 37 | } -------------------------------------------------------------------------------- /springboot-api-doc/src/main/java/com/apidoc/annotation/ApiParam.java: -------------------------------------------------------------------------------- 1 | package com.apidoc.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * API参数注解 10 | * 用于增强参数描述信息 11 | */ 12 | @Target({ElementType.PARAMETER}) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | public @interface ApiParam { 15 | 16 | /** 17 | * 参数名称 18 | */ 19 | String name() default ""; 20 | 21 | /** 22 | * 参数描述 23 | */ 24 | String description() default ""; 25 | 26 | /** 27 | * 是否必填 28 | */ 29 | boolean required() default true; 30 | 31 | /** 32 | * 示例值 33 | */ 34 | String example() default ""; 35 | 36 | /** 37 | * 默认值 38 | */ 39 | String defaultValue() default ""; 40 | } -------------------------------------------------------------------------------- /springboot-gencode/src/main/java/com/yuboon/springboot/gencode/output/ConsoleOutput.java: -------------------------------------------------------------------------------- 1 | package com.yuboon.springboot.gencode.output; 2 | 3 | 4 | import cn.hutool.core.lang.Console; 5 | import com.yuboon.springboot.gencode.meta.Table; 6 | import com.yuboon.springboot.gencode.template.CodeTemplate; 7 | 8 | /** 9 | * 控制台输出 10 | * 11 | * @author yuboon 12 | * @version v1.0 13 | * @date 2020/01/04 14 | */ 15 | public class ConsoleOutput extends CodeOutput { 16 | 17 | public ConsoleOutput() { 18 | this.outputCode = "01"; 19 | } 20 | 21 | @Override 22 | public void out(Table table, String content, CodeTemplate template) { 23 | Console.log("\n"); 24 | Console.log("-----------------------------"); 25 | Console.log(content); 26 | Console.log("-----------------------------"); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /springboot-logview/src/main/java/com/example/logviewer/dto/LogQueryResponse.java: -------------------------------------------------------------------------------- 1 | package com.example.logviewer.dto; 2 | 3 | import lombok.Data; 4 | 5 | import java.time.LocalDateTime; 6 | import java.util.List; 7 | 8 | /** 9 | * 日志查询响应对象 10 | * 11 | * @author example 12 | * @version 1.0.0 13 | */ 14 | @Data 15 | public class LogQueryResponse { 16 | 17 | /** 18 | * 日志内容列表 19 | */ 20 | private List lines; 21 | 22 | /** 23 | * 总行数 24 | */ 25 | private long totalLines; 26 | 27 | /** 28 | * 当前页码 29 | */ 30 | private int currentPage; 31 | 32 | /** 33 | * 总页数 34 | */ 35 | private int totalPages; 36 | 37 | /** 38 | * 文件大小(字节) 39 | */ 40 | private long fileSize; 41 | 42 | /** 43 | * 最后修改时间 44 | */ 45 | private LocalDateTime lastModified; 46 | } -------------------------------------------------------------------------------- /springboot-agent/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 3.4.5 9 | 10 | 11 | demo 12 | springboot-agent 13 | 0.0.1-SNAPSHOT 14 | pom 15 | 16 | agent 17 | app 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /springboot-api-doc/src/main/java/com/apidoc/annotation/ApiField.java: -------------------------------------------------------------------------------- 1 | package com.apidoc.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * 字段描述注解 10 | * 用于描述实体类字段的中文信息 11 | */ 12 | @Target({ElementType.FIELD}) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | public @interface ApiField { 15 | 16 | /** 17 | * 字段描述 18 | */ 19 | String value() default ""; 20 | 21 | /** 22 | * 字段名称(如果与字段名不同) 23 | */ 24 | String name() default ""; 25 | 26 | /** 27 | * 是否必填 28 | */ 29 | boolean required() default false; 30 | 31 | /** 32 | * 示例值 33 | */ 34 | String example() default ""; 35 | 36 | /** 37 | * 字段是否隐藏 38 | */ 39 | boolean hidden() default false; 40 | } -------------------------------------------------------------------------------- /springboot-multi-port/src/main/java/com/example/multiport/model/ErrorResponse.java: -------------------------------------------------------------------------------- 1 | package com.example.multiport.model; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * 错误响应模型 9 | */ 10 | @Data 11 | @NoArgsConstructor 12 | @AllArgsConstructor 13 | public class ErrorResponse { 14 | 15 | private String code; 16 | private String message; 17 | private String serviceType; 18 | private int port; 19 | private long timestamp; 20 | private String path; 21 | 22 | public ErrorResponse(String code, String message, String serviceType, int port, String path) { 23 | this.code = code; 24 | this.message = message; 25 | this.serviceType = serviceType; 26 | this.port = port; 27 | this.path = path; 28 | this.timestamp = System.currentTimeMillis(); 29 | } 30 | } -------------------------------------------------------------------------------- /springboot-rest-chain/src/main/java/com/example/rest/TestController.java: -------------------------------------------------------------------------------- 1 | package com.example.rest; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.web.bind.annotation.GetMapping; 5 | import org.springframework.web.bind.annotation.RestController; 6 | import org.springframework.web.client.RestTemplate; 7 | 8 | @RestController 9 | public class TestController { 10 | 11 | @Autowired 12 | private RestTemplate customRestTemplate; // 注入自定义的RestTemplate 13 | 14 | @GetMapping("/call-api") 15 | public String callThirdApi() { 16 | // 调用第三方API,拦截器自动处理认证、日志、重试 17 | return customRestTemplate.getForObject("http://localhost:8080/mock-third-api", String.class); 18 | } 19 | 20 | // 模拟一个三方接口 21 | @GetMapping("/mock-third-api") 22 | public String mockThirdApi() { 23 | return "hello"; 24 | } 25 | } -------------------------------------------------------------------------------- /springboot-api-doc/src/main/java/com/apidoc/annotation/ApiExample.java: -------------------------------------------------------------------------------- 1 | package com.apidoc.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * API示例注解 10 | * 用于指定示例数据类和场景 11 | */ 12 | @Target({ElementType.METHOD}) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | public @interface ApiExample { 15 | 16 | /** 17 | * 示例数据类 18 | */ 19 | Class value(); 20 | 21 | /** 22 | * 场景名称 23 | * 如: success, error, empty等 24 | */ 25 | String scenario() default "default"; 26 | 27 | /** 28 | * 是否生成真实数据 29 | * true: 基于字段名生成合理数据 30 | * false: 生成简单默认值 31 | */ 32 | boolean realistic() default true; 33 | 34 | /** 35 | * 示例描述 36 | */ 37 | String description() default ""; 38 | } -------------------------------------------------------------------------------- /springboot-form/src/main/java/com/example/dynamicform/model/FormSchema.java: -------------------------------------------------------------------------------- 1 | package com.example.dynamicform.model; 2 | 3 | import lombok.Data; 4 | import lombok.Builder; 5 | import lombok.AllArgsConstructor; 6 | import lombok.NoArgsConstructor; 7 | 8 | import java.time.LocalDateTime; 9 | 10 | /** 11 | * 表单Schema定义实体 12 | */ 13 | @Data 14 | @Builder 15 | @AllArgsConstructor 16 | @NoArgsConstructor 17 | public class FormSchema { 18 | private String schemaId; // 表单唯一标识 19 | private String name; // 表单名称 20 | private String description; // 表单描述 21 | private String schemaDefinition; // JSON Schema定义 22 | private String category; // 表单分类 23 | private Integer version; // 版本号 24 | private Boolean active; // 是否启用 25 | private LocalDateTime createdAt; // 创建时间 26 | private LocalDateTime updatedAt; // 更新时间 27 | } -------------------------------------------------------------------------------- /springboot-gencode/src/main/java/com/yuboon/springboot/gencode/command/GenControllerCommand.java: -------------------------------------------------------------------------------- 1 | package com.yuboon.springboot.gencode.command; 2 | 3 | import com.yuboon.springboot.gencode.meta.Table; 4 | import com.yuboon.springboot.gencode.template.ControllerCodeTemplate; 5 | import org.thymeleaf.context.Context; 6 | 7 | import java.util.Map; 8 | 9 | /** 10 | * 控制器生成命令 11 | * 12 | * @author yuboon 13 | * @version v1.0 14 | * @date 2020/01/04 15 | */ 16 | public class GenControllerCommand extends SingleCommand { 17 | 18 | public GenControllerCommand() { 19 | this.commandName = "Controller生成命令"; 20 | this.commandCode = "01"; 21 | this.template = new ControllerCodeTemplate(); 22 | } 23 | 24 | @Override 25 | public void process(Table table, Map map) { 26 | // 留给用户自定义处理过程,比如一些自定义参数的处理加一些控制等等,此处暂不需要 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /springboot-db-cfg/src/main/java/com/example/entity/ApplicationConfig.java: -------------------------------------------------------------------------------- 1 | package com.example.entity; 2 | 3 | import lombok.Data; 4 | import lombok.NoArgsConstructor; 5 | import lombok.AllArgsConstructor; 6 | 7 | import java.time.LocalDateTime; 8 | 9 | @Data 10 | @NoArgsConstructor 11 | @AllArgsConstructor 12 | public class ApplicationConfig { 13 | 14 | private Long id; 15 | private String configKey; 16 | private String configValue; 17 | private String configType; // datasource, redis, kafka, business, framework 18 | private String environment; 19 | private String description; 20 | private Boolean encrypted = false; 21 | private Boolean requiredRestart = false; // 是否需要重启应用 22 | private Boolean active = true; 23 | private LocalDateTime createdAt; 24 | private LocalDateTime updatedAt; 25 | private String createdBy; 26 | private String updatedBy; 27 | } -------------------------------------------------------------------------------- /springboot-face2face-chat/src/main/java/com/example/face2face/config/WebConfig.java: -------------------------------------------------------------------------------- 1 | package com.example.face2face.config; 2 | 3 | import com.example.face2face.interceptor.JwtAuthInterceptor; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; 7 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 8 | 9 | @Configuration 10 | public class WebConfig implements WebMvcConfigurer { 11 | 12 | @Autowired 13 | private JwtAuthInterceptor jwtAuthInterceptor; 14 | 15 | @Override 16 | public void addInterceptors(InterceptorRegistry registry) { 17 | registry.addInterceptor(jwtAuthInterceptor) 18 | .addPathPatterns("/api/**") 19 | .excludePathPatterns("/api/auth/**"); 20 | } 21 | } -------------------------------------------------------------------------------- /springboot-gencode/src/main/java/com/yuboon/springboot/gencode/command/GenEntityCommand.java: -------------------------------------------------------------------------------- 1 | package com.yuboon.springboot.gencode.command; 2 | 3 | import com.yuboon.springboot.gencode.meta.Table; 4 | import com.yuboon.springboot.gencode.template.ControllerCodeTemplate; 5 | import com.yuboon.springboot.gencode.template.EntityCodeTemplate; 6 | 7 | import java.util.Map; 8 | 9 | /** 10 | * 控制器生成命令 11 | * 12 | * @author yuboon 13 | * @version v1.0 14 | * @date 2020/01/04 15 | */ 16 | public class GenEntityCommand extends SingleCommand { 17 | 18 | public GenEntityCommand() { 19 | this.commandName = "Entity生成命令"; 20 | this.commandCode = "02"; 21 | this.template = new EntityCodeTemplate(); 22 | } 23 | 24 | @Override 25 | public void process(Table table, Map map) { 26 | // 留给用户自定义处理过程,比如一些自定义参数的处理加一些控制等等,此处暂不需要 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /springboot-rpc/src/main/java/com/example/rpc/demo/UserController.java: -------------------------------------------------------------------------------- 1 | package com.example.rpc.demo; 2 | 3 | import com.example.rpc.core.RpcReference; 4 | import org.springframework.web.bind.annotation.*; 5 | 6 | import java.util.List; 7 | 8 | @RestController 9 | @RequestMapping("/user") 10 | public class UserController { 11 | 12 | @RpcReference 13 | private UserService userService; 14 | 15 | @GetMapping("/{userId}") 16 | public String getUser(@PathVariable Long userId) { 17 | return userService.getUserName(userId); 18 | } 19 | 20 | @PostMapping("/{userId}") 21 | public boolean updateUser(@PathVariable Long userId, @RequestParam String name) { 22 | return userService.updateUser(userId, name); 23 | } 24 | 25 | @GetMapping("/list") 26 | public List getUserList() { 27 | return userService.getUserList(); 28 | } 29 | } -------------------------------------------------------------------------------- /springboot-timingwheel/src/main/java/com/example/timingwheel/SpringbootTimingwheelApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.timingwheel; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * Spring Boot应用程序主类 8 | */ 9 | @SpringBootApplication 10 | public class SpringbootTimingwheelApplication { 11 | 12 | public static void main(String[] args) { 13 | SpringApplication.run(SpringbootTimingwheelApplication.class, args); 14 | System.out.println("========================================="); 15 | System.out.println("Timing Wheel Application Started!"); 16 | System.out.println("访问地址: http://localhost:8080"); 17 | System.out.println("API文档: http://localhost:8080/api/timingwheel/stats"); 18 | System.out.println("========================================="); 19 | } 20 | } -------------------------------------------------------------------------------- /springboot-sql-tree/src/main/java/com/example/sqltree/SqlTreeProperties.java: -------------------------------------------------------------------------------- 1 | package com.example.sqltree; 2 | 3 | import lombok.Data; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | import org.springframework.stereotype.Component; 6 | 7 | /** 8 | * SQL调用树配置属性 9 | */ 10 | @Data 11 | @Component 12 | @ConfigurationProperties(prefix = "sql-tree") 13 | public class SqlTreeProperties { 14 | 15 | /** 16 | * 慢SQL阈值(毫秒) 17 | */ 18 | private long slowSqlThreshold = 1000L; 19 | 20 | /** 21 | * 是否启用SQL追踪 22 | */ 23 | private boolean traceEnabled = true; 24 | 25 | /** 26 | * 最大调用深度 27 | */ 28 | private int maxDepth = 50; 29 | 30 | /** 31 | * 最大会话数量 32 | */ 33 | private int maxSessions = 100; 34 | 35 | /** 36 | * 是否记录SQL参数 37 | */ 38 | private boolean recordParameters = true; 39 | } -------------------------------------------------------------------------------- /springboot-timingwheel/src/main/java/com/example/timingwheel/config/WebConfig.java: -------------------------------------------------------------------------------- 1 | package com.example.timingwheel.config; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.web.servlet.config.annotation.CorsRegistry; 5 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 6 | 7 | /** 8 | * Web配置类 - 配置CORS跨域支持 9 | */ 10 | @Configuration 11 | public class WebConfig implements WebMvcConfigurer { 12 | 13 | @Override 14 | public void addCorsMappings(CorsRegistry registry) { 15 | registry.addMapping("/api/**") 16 | .allowedOriginPatterns("*") // 允许所有来源 17 | .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS") // 允许的HTTP方法 18 | .allowedHeaders("*") // 允许所有请求头 19 | .allowCredentials(false) // 不允许携带凭证 20 | .maxAge(3600); // 预检请求缓存时间 21 | } 22 | } -------------------------------------------------------------------------------- /springboot-web-ssh/src/main/resources/db/schema.sql: -------------------------------------------------------------------------------- 1 | -- 服务器配置表 2 | CREATE TABLE IF NOT EXISTS servers ( 3 | id BIGINT AUTO_INCREMENT PRIMARY KEY, 4 | name VARCHAR(100) NOT NULL COMMENT '服务器名称', 5 | host VARCHAR(255) NOT NULL COMMENT '服务器地址', 6 | port INT DEFAULT 22 COMMENT 'SSH端口', 7 | username VARCHAR(100) NOT NULL COMMENT '用户名', 8 | password VARCHAR(500) NOT NULL COMMENT '密码(建议加密存储)', 9 | created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, 10 | updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP 11 | ); 12 | 13 | -- 删除现有测试数据(避免重复插入) 14 | DELETE FROM servers; 15 | 16 | -- 插入测试服务器数据 17 | INSERT INTO servers (name, host, port, username, password) VALUES 18 | ('本地测试服务器', 'localhost', 22, 'root', 'password'), 19 | ('开发服务器', '192.168.1.100', 22, 'dev', 'devpass'), 20 | ('测试服务器', '192.168.1.101', 22, 'test', 'testpass'), 21 | ('生产服务器', '192.168.1.200', 22, 'prod', 'prodpass'); -------------------------------------------------------------------------------- /springboot-gencode-training/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | 4 | # 默认日志配置 5 | logging: 6 | file: logs/test.log 7 | config: # 日志配置文件,Spring Boot默认使用classpath路径下的日志配置文件,如:logback.xml 8 | level: 9 | #root: info # 全局默认级别 10 | org.thymeleaf: info # 控制thymeleaf日志级别 11 | pattern: 12 | #console: "%date{yyyy-MM-dd HH:mm:ss.SSS} %-5level[%thread]%logger{C}.%method:%line -%msg%n" 13 | #net.aooms.core: info # 项目级别,覆盖root默认 14 | 15 | spring: 16 | datasource: 17 | url: jdbc:mysql://localhost:3306/demo 18 | username: root 19 | password: root 20 | driver-class-name: com.mysql.jdbc.Driver 21 | # 连接池配置 22 | maxActive: 200 23 | initialSize: 5 24 | maxWait: 60000 25 | minIdle: 3 26 | timeBetweenEvictionRunsMillis: 60000 27 | minEvictableIdleTimeMillis: 300000 28 | validationQuery: select 'x' 29 | thymeleaf: 30 | prefix: classpath:/template -------------------------------------------------------------------------------- /springboot-gencode/doc/sys_user.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Navicat MySQL Data Transfer 3 | 4 | Source Server : local 5 | Source Server Version : 50727 6 | Source Host : localhost:3306 7 | Source Database : demo 8 | 9 | Target Server Type : MYSQL 10 | Target Server Version : 50727 11 | File Encoding : 65001 12 | 13 | Date: 2020-01-06 23:05:44 14 | */ 15 | 16 | SET FOREIGN_KEY_CHECKS=0; 17 | 18 | -- ---------------------------- 19 | -- Table structure for sys_user 20 | -- ---------------------------- 21 | DROP TABLE IF EXISTS `sys_user`; 22 | CREATE TABLE `sys_user` ( 23 | `id` int(11) DEFAULT NULL COMMENT '主键', 24 | `name` varchar(255) DEFAULT NULL COMMENT '姓名' 25 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户信息'; 26 | 27 | -- ---------------------------- 28 | -- Records of sys_user 29 | -- ---------------------------- 30 | INSERT INTO `sys_user` VALUES ('1', '2'); 31 | -------------------------------------------------------------------------------- /springboot-single-login/src/main/java/com/example/login/model/ApiResponse.java: -------------------------------------------------------------------------------- 1 | package com.example.login.model; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | 6 | /** 7 | * 统一响应格式 8 | */ 9 | @Data 10 | @AllArgsConstructor 11 | public class ApiResponse { 12 | private int code; 13 | private String message; 14 | private T data; 15 | 16 | public static ApiResponse success(String message, T data) { 17 | return new ApiResponse<>(200, message, data); 18 | } 19 | 20 | public static ApiResponse success(String message) { 21 | return success(message, null); 22 | } 23 | 24 | public static ApiResponse fail(String message) { 25 | return new ApiResponse<>(500, message, null); 26 | } 27 | 28 | public static ApiResponse fail(int code, String message) { 29 | return new ApiResponse<>(code, message, null); 30 | } 31 | } -------------------------------------------------------------------------------- /springboot-cli/README.md: -------------------------------------------------------------------------------- 1 | # Spring Boot CLI 通用命令系统 2 | 3 | 基于 Spring Boot + Spring Shell 的通用CLI系统,实现了"通用命令 + 动态分发"的设计模式,支持通过一个命令动态调用服务端的多个服务。 4 | 5 | ## 快速开始 6 | 7 | ### 1. 启动服务端 8 | 9 | ```bash 10 | cd cli-server 11 | mvn spring-boot:run 12 | ``` 13 | 14 | 服务端将在 http://localhost:8080 启动 15 | 16 | ### 2. 启动客户端 17 | 18 | ```bash 19 | cd cli-client 20 | mvn spring-boot:run 21 | ``` 22 | 23 | ### 3. 使用CLI命令 24 | 25 | 客户端启动后,进入Spring Shell交互模式,可使用以下命令: 26 | 27 | ```shell 28 | # 查看帮助 29 | help-exec 30 | 31 | # 列出所有可用服务 32 | list-services 33 | 34 | # 用户服务示例 35 | exec userService --args list 36 | exec userService --args get 1 37 | exec userService --args count admin 38 | 39 | # 角色服务示例 40 | exec roleService --args list 41 | exec roleService --args users admin 42 | exec roleService --args check 1 admin 43 | 44 | # 系统服务示例 45 | exec systemService --args status 46 | exec systemService --args memory 47 | exec systemService --args time 48 | ``` -------------------------------------------------------------------------------- /springboot-danmaku/src/main/resources/schema.sql: -------------------------------------------------------------------------------- 1 | -- schema.sql 2 | CREATE TABLE IF NOT EXISTS danmaku ( 3 | id BIGINT AUTO_INCREMENT PRIMARY KEY, 4 | content VARCHAR(255) NOT NULL, 5 | color VARCHAR(20) DEFAULT '#ffffff', 6 | font_size INT DEFAULT 24, 7 | time DOUBLE NOT NULL, 8 | video_id VARCHAR(50) NOT NULL, 9 | user_id VARCHAR(50) NOT NULL, 10 | username VARCHAR(50), 11 | created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP 12 | ); 13 | 14 | -- 添加一些测试数据 15 | INSERT INTO danmaku (content, color, font_size, time, video_id, user_id, username, created_at) 16 | VALUES 17 | ('这是第一条测试弹幕', '#ffffff', 24, 1.0, 'video123', 'user1', '测试用户1', CURRENT_TIMESTAMP), 18 | ('这是第二条测试弹幕', '#ff0000', 24, 3.0, 'video123', 'user2', '测试用户2', CURRENT_TIMESTAMP), 19 | ('这是第三条测试弹幕', '#00ff00', 24, 5.0, 'video123', 'user3', '测试用户3', CURRENT_TIMESTAMP), 20 | ('这是第四条测试弹幕', '#0000ff', 24, 7.0, 'video123', 'user4', '测试用户4', CURRENT_TIMESTAMP); -------------------------------------------------------------------------------- /springboot-live/src/main/java/com/example/livestream/entity/LiveStream.java: -------------------------------------------------------------------------------- 1 | package com.example.livestream.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | import lombok.Data; 7 | 8 | import java.time.LocalDateTime; 9 | 10 | @Data 11 | @TableName("live_stream") 12 | public class LiveStream { 13 | 14 | @TableId(value = "id", type = IdType.AUTO) 15 | private Long id; 16 | 17 | private Long roomId; 18 | 19 | private String streamId; // 流ID 20 | 21 | private String protocol; // 协议类型:rtmp/hls/flv 22 | 23 | private Integer bitrate; // 码率 24 | 25 | private String resolution; // 分辨率 26 | 27 | private Integer status; // 0:未启动 1:活跃 2:已结束 28 | 29 | private LocalDateTime createdAt; 30 | 31 | private LocalDateTime updatedAt; 32 | } -------------------------------------------------------------------------------- /springboot-memviz/src/main/java/com/example/memviz/model/User.java: -------------------------------------------------------------------------------- 1 | package com.example.memviz.model; 2 | 3 | import cn.hutool.core.util.RandomUtil; 4 | 5 | /** 6 | * 测试深度大小计算的User类 7 | */ 8 | public class User { 9 | private String name; 10 | private int age; 11 | 12 | public User(String name, int age) { 13 | this.name = name; 14 | this.age = age; 15 | } 16 | 17 | // 静态创建一些测试用户,用于验证深度大小计算 18 | public static void createTestUsers() { 19 | // 创建几个有大字符串的User对象 20 | for (int i = 0; i < 5; i++) { 21 | String largeName = RandomUtil.randomString(200 * 1024); // 200KB的name 22 | User user = new User(largeName, 25 + i); 23 | 24 | // 将User对象存储在某个地方,避免被GC 25 | TestUserStorage.users.add(user); 26 | } 27 | } 28 | 29 | public String getName() { return name; } 30 | public int getAge() { return age; } 31 | } -------------------------------------------------------------------------------- /springboot-hot-patch/src/main/java/com/example/hotpatch/patches/StringUtilsPatch.java: -------------------------------------------------------------------------------- 1 | package com.example.hotpatch.patches; 2 | 3 | import com.example.hotpatch.annotation.HotPatch; 4 | import com.example.hotpatch.annotation.PatchType; 5 | 6 | /** 7 | * StringUtils的补丁类 - 修复isEmpty方法逻辑 8 | */ 9 | @HotPatch( 10 | type = PatchType.JAVA_CLASS, 11 | originalClass = "com.example.hotpatch.example.StringUtils", 12 | version = "1.0.2", 13 | description = "修复isEmpty方法逻辑,考虑空白字符" 14 | ) 15 | public class StringUtilsPatch { 16 | 17 | public static boolean isEmpty(String str) { 18 | System.err.println("this is StringUtilsPatch isEmpty"); 19 | // 修复:考虑空白字符 20 | return str == null || str.trim().length() == 0; 21 | } 22 | 23 | public static String trim(String str) { 24 | System.err.println("this is StringUtilsPatch trim"); 25 | return str == null ? null : str.trim(); 26 | } 27 | } -------------------------------------------------------------------------------- /springboot-gencode/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | 4 | # 默认日志配置 5 | logging: 6 | file: logs/test.log 7 | config: # 日志配置文件,Spring Boot默认使用classpath路径下的日志配置文件,如:logback.xml 8 | level: 9 | #root: info # 全局默认级别 10 | org.thymeleaf: info # 控制thymeleaf日志级别 11 | pattern: 12 | #console: "%date{yyyy-MM-dd HH:mm:ss.SSS} %-5level[%thread]%logger{C}.%method:%line -%msg%n" 13 | #net.aooms.core: info # 项目级别,覆盖root默认 14 | 15 | spring: 16 | datasource: 17 | url: jdbc:mysql://localhost:3306/demo 18 | username: root 19 | password: root 20 | driver-class-name: com.mysql.jdbc.Driver 21 | # 连接池配置 22 | maxActive: 200 23 | initialSize: 5 24 | maxWait: 60000 25 | minIdle: 3 26 | timeBetweenEvictionRunsMillis: 60000 27 | minEvictableIdleTimeMillis: 300000 28 | validationQuery: select 'x' 29 | thymeleaf: 30 | prefix: classpath:/template -------------------------------------------------------------------------------- /springboot-cmd/src/main/java/com/example/cmd/shell/MyCommands.java: -------------------------------------------------------------------------------- 1 | package com.example.cmd.shell; 2 | 3 | import org.springframework.shell.standard.ShellComponent; 4 | import org.springframework.shell.standard.ShellMethod; 5 | 6 | @ShellComponent 7 | public class MyCommands { 8 | 9 | @ShellMethod("显示欢迎消息") 10 | public String hello(String name) { 11 | return "你好, " + name + "!"; 12 | } 13 | 14 | @ShellMethod("计算两个数字的和") 15 | public int add(int a, int b) { 16 | return a + b; 17 | } 18 | 19 | // 注意: 如果方法名为驼峰式命名,则shell使用时需要使用-分隔符,如addBig -> add-big 20 | @ShellMethod(value = "计算两个数字的和,注意大小写") 21 | public int addBig(int a, int b) { 22 | return a + b; 23 | } 24 | 25 | // 关于驼峰命名也可以使用key属性进行指定,则shell使用时仍然是驼峰式命名,如addSmall -> addSmall 26 | @ShellMethod(value = "计算两个数字的和,注意大小写",key = {"addSmall"}) 27 | public int addSmall(int a, int b) { 28 | return a + b; 29 | } 30 | } -------------------------------------------------------------------------------- /springboot-hot-patch/.gitignore: -------------------------------------------------------------------------------- 1 | # Git 忽略文件配置 2 | 3 | # Maven 构建产物 4 | target/ 5 | !.mvn/wrapper/maven-wrapper.jar 6 | !**/src/main/**/target/ 7 | !**/src/test/**/target/ 8 | 9 | # IDE 文件 10 | .idea/ 11 | *.iws 12 | *.iml 13 | *.ipr 14 | .vscode/ 15 | *.code-workspace 16 | 17 | # 编译产物 18 | *.class 19 | *.jar 20 | *.war 21 | *.ear 22 | *.nar 23 | 24 | # 日志文件 25 | *.log 26 | logs/ 27 | 28 | # 操作系统文件 29 | .DS_Store 30 | Thumbs.db 31 | 32 | # 补丁文件 33 | patches/*.jar 34 | !patches/README.md 35 | 36 | # 临时文件 37 | *.tmp 38 | *.temp 39 | *.swp 40 | *~ 41 | 42 | # Spring Boot 43 | .gradle 44 | build/ 45 | !gradle/wrapper/gradle-wrapper.jar 46 | !**/src/main/**/build/ 47 | !**/src/test/**/build/ 48 | 49 | # 数据库文件 50 | *.db 51 | *.h2.db 52 | 53 | # 配置文件(可能包含敏感信息) 54 | application-local.properties 55 | application-dev.properties 56 | application-prod.properties 57 | 58 | # 密钥文件 59 | *.key 60 | *.pem 61 | *.p12 62 | *.jks 63 | 64 | # 备份文件 65 | *.bak 66 | *.backup -------------------------------------------------------------------------------- /springboot-dynamic-rule/src/main/java/com/example/dynamicrule/entity/RuleScript.java: -------------------------------------------------------------------------------- 1 | package com.example.dynamicrule.entity; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.time.LocalDateTime; 8 | 9 | @Data 10 | @NoArgsConstructor 11 | @AllArgsConstructor 12 | public class RuleScript { 13 | 14 | private String ruleName; 15 | 16 | private String script; 17 | 18 | private String description; 19 | 20 | private boolean enabled; 21 | 22 | private LocalDateTime createTime; 23 | 24 | private LocalDateTime updateTime; 25 | 26 | public RuleScript(String ruleName, String script, String description) { 27 | this.ruleName = ruleName; 28 | this.script = script; 29 | this.description = description; 30 | this.enabled = true; 31 | this.createTime = LocalDateTime.now(); 32 | this.updateTime = LocalDateTime.now(); 33 | } 34 | } -------------------------------------------------------------------------------- /springboot-net-capture/src/main/java/com/example/netcapture/config/MyBatisPlusConfig.java: -------------------------------------------------------------------------------- 1 | package com.example.netcapture.config; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.context.annotation.Configuration; 5 | 6 | import com.baomidou.mybatisplus.annotation.DbType; 7 | import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; 8 | import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; 9 | import org.springframework.context.annotation.Bean; 10 | 11 | @Configuration 12 | @MapperScan("com.example.netcapture.repository") 13 | public class MyBatisPlusConfig { 14 | 15 | @Bean 16 | public MybatisPlusInterceptor mybatisPlusInterceptor() { 17 | MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); 18 | // 分页插件 19 | interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.H2)); 20 | return interceptor; 21 | } 22 | } -------------------------------------------------------------------------------- /springboot-permission/src/main/java/com/example/permission/common/Result.java: -------------------------------------------------------------------------------- 1 | package com.example.permission.common; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * 统一响应结果 9 | */ 10 | @Data 11 | @NoArgsConstructor 12 | @AllArgsConstructor 13 | public class Result { 14 | 15 | private Integer code; 16 | private String message; 17 | private T data; 18 | 19 | public static Result success(T data) { 20 | return new Result<>(200, "success", data); 21 | } 22 | 23 | public static Result success() { 24 | return new Result<>(200, "success", null); 25 | } 26 | 27 | public static Result error(String message) { 28 | return new Result<>(500, message, null); 29 | } 30 | 31 | public static Result error(Integer code, String message) { 32 | return new Result<>(code, message, null); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /springboot-api-gray/src/main/java/com/example/version/GrayRelease.java: -------------------------------------------------------------------------------- 1 | package com.example.version; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * 灰度发布注解,用于定义灰度发布规则 7 | */ 8 | @Target({ElementType.METHOD, ElementType.TYPE}) 9 | @Retention(RetentionPolicy.RUNTIME) 10 | @Documented 11 | public @interface GrayRelease { 12 | /** 13 | * 开始时间,格式:yyyy-MM-dd HH:mm:ss 14 | */ 15 | String startTime() default ""; 16 | 17 | /** 18 | * 结束时间,格式:yyyy-MM-dd HH:mm:ss 19 | */ 20 | String endTime() default ""; 21 | 22 | /** 23 | * 用户ID白名单,多个ID用逗号分隔 24 | */ 25 | String userIds() default ""; 26 | 27 | /** 28 | * 用户比例,0-100之间的整数,表示百分比 29 | */ 30 | int percentage() default 0; 31 | 32 | /** 33 | * 指定的用户组 34 | */ 35 | String[] userGroups() default {}; 36 | 37 | /** 38 | * 地区限制,支持国家、省份、城市,如:CN,US,Beijing 39 | */ 40 | String[] regions() default {}; 41 | } -------------------------------------------------------------------------------- /springboot-net-capture/src/main/java/com/example/netcapture/config/WebMvcConfig.java: -------------------------------------------------------------------------------- 1 | package com.example.netcapture.config; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; 5 | import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; 6 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 7 | 8 | @Configuration 9 | public class WebMvcConfig implements WebMvcConfigurer { 10 | 11 | @Override 12 | public void addResourceHandlers(ResourceHandlerRegistry registry) { 13 | // 配置静态资源处理 14 | registry.addResourceHandler("/**") 15 | .addResourceLocations("classpath:/static/"); 16 | } 17 | 18 | @Override 19 | public void addViewControllers(ViewControllerRegistry registry) { 20 | // 设置默认首页 21 | registry.addViewController("/").setViewName("forward:/index.html"); 22 | } 23 | } -------------------------------------------------------------------------------- /springboot-form/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | 4 | # Log file 5 | *.log 6 | 7 | # BlueJ files 8 | *.ctxt 9 | 10 | # Mobile Tools for Java (J2ME) 11 | .mtj.tmp/ 12 | 13 | # Package Files # 14 | *.jar 15 | *.war 16 | *.nar 17 | *.ear 18 | *.zip 19 | *.tar.gz 20 | *.rar 21 | 22 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 23 | hs_err_pid* 24 | replay_pid* 25 | 26 | # Maven 27 | target/ 28 | pom.xml.tag 29 | pom.xml.releaseBackup 30 | pom.xml.versionsBackup 31 | pom.xml.next 32 | release.properties 33 | dependency-reduced-pom.xml 34 | buildNumber.properties 35 | .mvn/timing.properties 36 | .mvn/wrapper/maven-wrapper.jar 37 | 38 | # IDE 39 | .idea/ 40 | *.iws 41 | *.iml 42 | *.ipr 43 | .vscode/ 44 | 45 | # OS 46 | .DS_Store 47 | .DS_Store? 48 | ._* 49 | .Spotlight-V100 50 | .Trashes 51 | ehthumbs.db 52 | Thumbs.db 53 | 54 | # Application logs 55 | logs/ 56 | application.log 57 | 58 | # Temporary files 59 | *.tmp 60 | *.temp -------------------------------------------------------------------------------- /springboot-cli/cli-common/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 4.0.0 7 | 8 | 9 | com.example 10 | springboot-cli 11 | 1.0.0 12 | 13 | 14 | cli-common 15 | 16 | 17 | 18 | com.fasterxml.jackson.core 19 | jackson-annotations 20 | 21 | 22 | com.fasterxml.jackson.core 23 | jackson-databind 24 | 25 | 26 | -------------------------------------------------------------------------------- /springboot-column-encryption/src/main/resources/sql/schema.sql: -------------------------------------------------------------------------------- 1 | -- 用户表结构 (H2数据库兼容版本) 2 | -- 注意:加密字段在数据库中存储为 VARCHAR 类型,应用层会自动进行加解密处理 3 | 4 | DROP TABLE IF EXISTS users; 5 | 6 | CREATE TABLE users ( 7 | id BIGINT AUTO_INCREMENT PRIMARY KEY, 8 | username VARCHAR(50) NOT NULL UNIQUE, 9 | phone VARCHAR(500), 10 | id_card VARCHAR(500), 11 | email VARCHAR(500), 12 | bank_card VARCHAR(500), 13 | address VARCHAR(500), 14 | age INT, 15 | gender VARCHAR(10), 16 | occupation VARCHAR(100), 17 | enabled BOOLEAN DEFAULT TRUE, 18 | remark VARCHAR(500), 19 | create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP, 20 | update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP 21 | ); 22 | 23 | -- 创建索引 24 | CREATE INDEX idx_users_username ON users(username); 25 | CREATE INDEX idx_users_phone ON users(phone); 26 | CREATE INDEX idx_users_email ON users(email); 27 | CREATE INDEX idx_users_enabled ON users(enabled); 28 | CREATE INDEX idx_users_create_time ON users(create_time); -------------------------------------------------------------------------------- /springboot-form/src/main/java/com/example/dynamicform/model/FormField.java: -------------------------------------------------------------------------------- 1 | package com.example.dynamicform.model; 2 | 3 | import lombok.Data; 4 | import lombok.Builder; 5 | import lombok.AllArgsConstructor; 6 | import lombok.NoArgsConstructor; 7 | 8 | /** 9 | * 表单字段信息 10 | */ 11 | @Data 12 | @Builder 13 | @AllArgsConstructor 14 | @NoArgsConstructor 15 | public class FormField { 16 | private String name; // 字段名 17 | private String type; // 字段类型 18 | private String title; // 字段标题 19 | private String description; // 字段描述 20 | private boolean required; // 是否必填 21 | private Integer minLength; // 最小长度 22 | private Integer maxLength; // 最大长度 23 | private Double minimum; // 最小值 24 | private Double maximum; // 最大值 25 | private String pattern; // 正则表达式 26 | private String format; // 格式(email, date等) 27 | private String[] enumValues; // 枚举值 28 | } -------------------------------------------------------------------------------- /springboot-live-call/src/main/resources/static/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 直播连麦系统 - 登录 7 | 8 | 9 | 10 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /springboot-report/src/main/java/com/example/report/config/CorsConfig.java: -------------------------------------------------------------------------------- 1 | package com.example.report.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.web.cors.CorsConfiguration; 6 | import org.springframework.web.cors.UrlBasedCorsConfigurationSource; 7 | import org.springframework.web.filter.CorsFilter; 8 | 9 | @Configuration 10 | public class CorsConfig { 11 | 12 | @Bean 13 | public CorsFilter corsFilter() { 14 | UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); 15 | CorsConfiguration config = new CorsConfiguration(); 16 | 17 | config.setAllowCredentials(true); 18 | config.addAllowedOriginPattern("*"); 19 | config.addAllowedHeader("*"); 20 | config.addAllowedMethod("*"); 21 | 22 | source.registerCorsConfiguration("/**", config); 23 | return new CorsFilter(source); 24 | } 25 | } -------------------------------------------------------------------------------- /springboot-timingwheel/src/main/java/com/example/timingwheel/config/TimingWheelConfig.java: -------------------------------------------------------------------------------- 1 | package com.example.timingwheel.config; 2 | 3 | import com.example.timingwheel.model.TimingWheelProperties; 4 | import com.example.timingwheel.util.TimingWheel; 5 | import io.micrometer.core.instrument.MeterRegistry; 6 | import lombok.extern.slf4j.Slf4j; 7 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 8 | import org.springframework.context.annotation.Bean; 9 | import org.springframework.context.annotation.Configuration; 10 | 11 | /** 12 | * 时间轮配置类 13 | */ 14 | @Slf4j 15 | @Configuration 16 | @EnableConfigurationProperties(TimingWheelProperties.class) 17 | public class TimingWheelConfig { 18 | 19 | @Bean 20 | public TimingWheel timingWheel(TimingWheelProperties properties, MeterRegistry meterRegistry) { 21 | log.info("Creating timing wheel with properties: {}", properties); 22 | return new TimingWheel(properties, meterRegistry); 23 | } 24 | } -------------------------------------------------------------------------------- /springboot-api-signature/src/main/java/com/example/sign/ApiSignatureApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.sign; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | 7 | /** 8 | * Spring Boot API签名验证应用启动类 9 | * 10 | */ 11 | @Slf4j 12 | @SpringBootApplication 13 | public class ApiSignatureApplication { 14 | 15 | public static void main(String[] args) { 16 | SpringApplication.run(ApiSignatureApplication.class, args); 17 | log.info("========================================"); 18 | log.info("Spring Boot API Signature Application Started Successfully!"); 19 | log.info("API Base URL: http://localhost:8080/api"); 20 | log.info("Health Check: http://localhost:8080/api/public/health"); 21 | log.info("Public Info: http://localhost:8080/api/public/info"); 22 | log.info("========================================"); 23 | } 24 | } -------------------------------------------------------------------------------- /springboot-cmd/src/main/java/com/example/cmd/ShellToolApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.cmd; 2 | 3 | import org.jline.utils.AttributedString; 4 | import org.jline.utils.AttributedStyle; 5 | import org.springframework.boot.Banner; 6 | import org.springframework.boot.SpringApplication; 7 | import org.springframework.boot.autoconfigure.SpringBootApplication; 8 | import org.springframework.context.annotation.Bean; 9 | import org.springframework.shell.jline.PromptProvider; 10 | 11 | @SpringBootApplication 12 | public class ShellToolApplication { 13 | public static void main(String[] args) { 14 | SpringApplication application = new SpringApplication(ShellToolApplication.class); 15 | application.setBannerMode(Banner.Mode.OFF); 16 | application.run(args); 17 | } 18 | 19 | @Bean 20 | public PromptProvider shellPromptProvider() { 21 | return () -> new AttributedString("shell:>", AttributedStyle.DEFAULT.foreground(AttributedStyle.YELLOW)); 22 | } 23 | 24 | } -------------------------------------------------------------------------------- /springboot-web-ssh/src/main/java/com/example/webssh/config/WebSocketConfig.java: -------------------------------------------------------------------------------- 1 | package com.example.webssh.config; 2 | 3 | import com.example.webssh.websocket.SSHWebSocketHandler; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.web.socket.config.annotation.EnableWebSocket; 7 | import org.springframework.web.socket.config.annotation.WebSocketConfigurer; 8 | import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; 9 | 10 | @Configuration 11 | @EnableWebSocket 12 | public class WebSocketConfig implements WebSocketConfigurer { 13 | 14 | @Autowired 15 | private SSHWebSocketHandler sshWebSocketHandler; 16 | 17 | @Override 18 | public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) { 19 | registry.addHandler(sshWebSocketHandler, "/ssh") 20 | .setAllowedOriginPatterns("*"); // 生产环境中应该限制域名 21 | } 22 | } -------------------------------------------------------------------------------- /springboot-proxy/src/main/java/com/example/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package com.example.controller; 2 | 3 | import cn.hutool.json.JSONUtil; 4 | import jakarta.servlet.http.HttpServletRequest; 5 | import lombok.extern.slf4j.Slf4j; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.http.*; 8 | import org.springframework.web.bind.annotation.RequestBody; 9 | import org.springframework.web.bind.annotation.RequestMapping; 10 | import org.springframework.web.bind.annotation.RestController; 11 | import org.springframework.web.client.RestTemplate; 12 | 13 | import java.util.Enumeration; 14 | import java.util.Map; 15 | 16 | @RestController 17 | @RequestMapping("/user") 18 | @Slf4j 19 | public class UserController { 20 | 21 | @RequestMapping("/save") 22 | public ResponseEntity addUser(@RequestBody Map data) { 23 | log.info("save user :{}", JSONUtil.toJsonStr(data)); 24 | return ResponseEntity.ok("ok"); 25 | } 26 | } -------------------------------------------------------------------------------- /springboot-config-hot-reload/src/main/java/com/example/controller/ConfigController.java: -------------------------------------------------------------------------------- 1 | package com.example.controller; 2 | 3 | import com.example.AppConfig; 4 | import com.example.config.ConfigRefreshedEvent; 5 | import lombok.extern.slf4j.Slf4j; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.context.event.EventListener; 8 | import org.springframework.web.bind.annotation.GetMapping; 9 | import org.springframework.web.bind.annotation.RestController; 10 | 11 | @RestController 12 | @Slf4j 13 | public class ConfigController { 14 | @Autowired 15 | private AppConfig appConfig; 16 | 17 | @GetMapping("/config") 18 | public AppConfig getConfig() { 19 | return appConfig; // 返回当前配置 20 | } 21 | 22 | // 监听配置刷新事件,可进行业务特殊处理 23 | @EventListener(ConfigRefreshedEvent.class) 24 | public void appConfigUpdate(ConfigRefreshedEvent event) { 25 | event.getChangedKeys().forEach(key -> log.info("配置项 {} 发生变化", key)); 26 | } 27 | 28 | } -------------------------------------------------------------------------------- /springboot-unified-call/src/main/java/com/example/unified/UnifiedApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.unified; 2 | 3 | import org.apache.dubbo.config.spring.context.annotation.EnableDubbo; 4 | import org.apache.dubbo.config.utils.SimpleReferenceCache; 5 | import org.apache.dubbo.rpc.Filter; 6 | import org.springframework.boot.SpringApplication; 7 | import org.springframework.boot.autoconfigure.SpringBootApplication; 8 | import org.springframework.context.annotation.Bean; 9 | import org.springframework.web.client.RestTemplate; 10 | 11 | @SpringBootApplication 12 | @EnableDubbo 13 | public class UnifiedApplication { 14 | 15 | public static void main(String[] args) { 16 | SpringApplication.run(UnifiedApplication.class, args); 17 | } 18 | 19 | 20 | @Bean 21 | public SimpleReferenceCache simpleReferenceCache() { 22 | return SimpleReferenceCache.getCache(); 23 | } 24 | 25 | @Bean 26 | public RestTemplate restTemplate() { 27 | return new RestTemplate(); 28 | } 29 | } --------------------------------------------------------------------------------