├── README.md ├── cache ├── pom.xml └── src │ └── main │ ├── java │ └── xyz │ │ └── zhouzhaodong │ │ └── cache │ │ ├── CacheApplication.java │ │ ├── controller │ │ └── UserController.java │ │ ├── entity │ │ └── User.java │ │ ├── repository │ │ └── UserRepository.java │ │ └── service │ │ ├── UserService.java │ │ └── impl │ │ └── UserServiceImpl.java │ └── resources │ └── application.yml ├── cross-domain ├── cross-domain-one │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── xyz │ │ │ │ └── zhouzhaodong │ │ │ │ └── crossdomainone │ │ │ │ ├── CrossDomainOneApplication.java │ │ │ │ └── controller │ │ │ │ └── CrossDomainOneController.java │ │ └── resources │ │ │ ├── application.yml │ │ │ └── templates │ │ │ └── cross-domain-one.html │ │ └── test │ │ └── java │ │ └── xyz │ │ └── zhouzhaodong │ │ └── crossdomainone │ │ └── CrossDomainOneApplicationTests.java └── cross-domain-two │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── xyz │ │ │ └── zhouzhaodong │ │ │ └── crossdomaintwo │ │ │ ├── CrossDomainTwoApplication.java │ │ │ ├── config │ │ │ └── MyConfiguration.java │ │ │ └── controller │ │ │ └── CrossDomainTwoController.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── xyz │ └── zhouzhaodong │ └── crossdomaintwo │ └── CrossDomainTwoApplicationTests.java ├── dubboPractice ├── common │ ├── common.iml │ ├── pom.xml │ ├── src │ │ └── main │ │ │ └── java │ │ │ ├── entity │ │ │ └── User.java │ │ │ └── service │ │ │ └── GetUserService.java │ └── target │ │ └── classes │ │ ├── entity │ │ └── User.class │ │ └── service │ │ └── GetUserService.class ├── consumer │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── MavenWrapperDownloader.java │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── zhouxiaoxi │ │ │ │ └── consumer │ │ │ │ ├── ConsumerApplication.java │ │ │ │ └── controller │ │ │ │ └── GetUserController.java │ │ └── resources │ │ │ └── application.yml │ │ └── test │ │ └── java │ │ └── com │ │ └── zhouxiaoxi │ │ └── consumer │ │ └── ConsumerApplicationTests.java └── provider │ ├── .gitignore │ ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── zhouxiaoxi │ │ │ └── provider │ │ │ ├── ProviderApplication.java │ │ │ └── service │ │ │ └── impl │ │ │ └── GetUserServiceImpl.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── com │ └── zhouxiaoxi │ └── provider │ └── ProviderApplicationTests.java ├── filter ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── zhouxiaoxi │ │ └── filter │ │ ├── FilterApplication.java │ │ ├── controller │ │ └── TestController.java │ │ └── util │ │ ├── FilterConfig.java │ │ ├── HttpLister.java │ │ ├── MyFilter.java │ │ ├── MyInterceptor.java │ │ ├── ServletLister.java │ │ └── WebMvcConfigurer.java │ └── resources │ └── application.yml ├── html2Image ├── pom.xml └── src │ ├── main │ ├── java │ │ └── xyz │ │ │ └── zhouzhaodong │ │ │ └── html2image │ │ │ ├── Html2imageApplication.java │ │ │ ├── controller │ │ │ └── TestController.java │ │ │ └── util │ │ │ └── Html2Image.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── xyz │ └── zhouzhaodong │ └── html2image │ └── Html2imageApplicationTests.java ├── jdbctemplate ├── pom.xml └── src │ ├── main │ ├── java │ │ └── xyz │ │ │ └── zhouzhaodong │ │ │ └── jdbctemplate │ │ │ ├── JdbctemplateApplication.java │ │ │ ├── controller │ │ │ └── StudyController.java │ │ │ ├── entity │ │ │ └── Study.java │ │ │ └── service │ │ │ ├── StudyService.java │ │ │ └── impl │ │ │ └── StudyServiceImpl.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── xyz │ └── zhouzhaodong │ └── jdbctemplate │ └── JdbctemplateApplicationTests.java ├── jooq ├── pom.xml └── src │ └── main │ ├── java │ └── xyz │ │ └── zhouzhaodong │ │ └── jooq │ │ ├── JooqApplication.java │ │ ├── controller │ │ └── JooqController.java │ │ ├── dao │ │ ├── DefaultCatalog.java │ │ ├── Jooq.java │ │ ├── Keys.java │ │ ├── Tables.java │ │ └── tables │ │ │ ├── Jooq.java │ │ │ └── records │ │ │ └── JooqRecord.java │ │ ├── entity │ │ └── JooqPojo.java │ │ ├── service │ │ ├── JooqService.java │ │ └── impl │ │ │ └── JooqServiceImpl.java │ │ ├── sql │ │ └── jooq.sql │ │ └── util │ │ └── JOOQGenerator.java │ └── resources │ └── application.yml ├── jpa ├── pom.xml └── src │ ├── main │ └── java │ │ └── xyz │ │ └── zhouzhaodong │ │ └── www │ │ └── jpa │ │ ├── JpaApplication.java │ │ ├── controller │ │ └── StudyController.java │ │ ├── dao │ │ └── StudyDao.java │ │ ├── entity │ │ └── Study.java │ │ └── service │ │ ├── StudyService.java │ │ └── impl │ │ └── StudyServiceImpl.java │ └── test │ └── java │ └── xyz │ └── zhouzhaodong │ └── www │ └── jpa │ └── JpaApplicationTests.java ├── mongodb ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── example │ │ └── mongodb │ │ ├── MongodbApplication.java │ │ ├── controller │ │ └── UserController.java │ │ ├── entity │ │ └── User.java │ │ └── repository │ │ └── UserRepository.java │ └── resources │ └── application.yml ├── mybatis ├── pom.xml └── src │ └── main │ ├── java │ └── xyz │ │ └── zhouzhaodong │ │ └── mybatis │ │ ├── MybatisApplication.java │ │ ├── controller │ │ └── MybatisController.java │ │ ├── entity │ │ └── Study.java │ │ ├── mapper │ │ └── StudyMapper.java │ │ └── service │ │ └── StudyService.java │ └── resources │ └── application.yml ├── mybatisplus-pagination ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── zhouzhaodong │ │ │ └── pagination │ │ │ ├── MybatisplusPaginationApplication.java │ │ │ ├── config │ │ │ ├── CodeGenerator.java │ │ │ └── MybatisPlusConfig.java │ │ │ ├── controller │ │ │ └── StudentController.java │ │ │ ├── entity │ │ │ └── Student.java │ │ │ ├── mapper │ │ │ └── StudentMapper.java │ │ │ └── service │ │ │ ├── IStudentService.java │ │ │ └── impl │ │ │ └── StudentServiceImpl.java │ └── resources │ │ ├── application.yml │ │ └── mapper │ │ └── StudentMapper.xml │ └── test │ └── java │ └── com │ └── zhouzhaodong │ └── pagination │ └── MybatisplusPaginationApplicationTests.java ├── querydsl ├── pom.xml └── src │ └── main │ ├── java │ └── xyz │ │ └── zhouzhaodong │ │ └── querydsl │ │ ├── QuerydslApplication.java │ │ ├── config │ │ └── PeopleQueryConfig.java │ │ ├── controller │ │ └── PeopleController.java │ │ ├── entity │ │ └── People.java │ │ ├── repository │ │ └── PeopleRepository.java │ │ └── service │ │ ├── PeopleService.java │ │ └── impl │ │ └── PeopleServiceImpl.java │ └── resources │ └── application.yml ├── redis ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── zhouxiaoxi │ │ │ └── redis │ │ │ ├── RedisApplication.java │ │ │ └── util │ │ │ └── RedisDao.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── com │ └── zhouxiaoxi │ └── redis │ └── RedisApplicationTests.java ├── redis_geo ├── pom.xml └── src │ ├── main │ ├── java │ │ └── xyz │ │ │ └── zhouzhaodong │ │ │ └── redis_geo │ │ │ ├── RedisGeoApplication.java │ │ │ ├── entity │ │ │ └── ServiceStation.java │ │ │ └── service │ │ │ ├── RedisGeoService.java │ │ │ └── impl │ │ │ └── RedisGeoServiceImpl.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── xyz │ └── zhouzhaodong │ └── redis_geo │ └── RedisGeoApplicationTests.java ├── repeat-submission ├── pom.xml └── src │ └── main │ ├── java │ └── xyz │ │ └── zhouzhaodong │ │ └── repeatsubmission │ │ ├── RepeatSubmissionApplication.java │ │ ├── controller │ │ └── TestController.java │ │ └── util │ │ ├── NoRepeatSubmit.java │ │ ├── NoRepeatSubmitAop.java │ │ └── RestMessage.java │ └── resources │ └── application.yml ├── sharding ├── pom.xml └── src │ └── main │ ├── java │ └── xyz │ │ └── zhouzhaodong │ │ └── sharding │ │ ├── ShardingApplication.java │ │ ├── controller │ │ └── UserController.java │ │ ├── entity │ │ └── User.java │ │ ├── repository │ │ └── UserRepository.java │ │ └── service │ │ ├── UserService.java │ │ └── impl │ │ └── UserServiceImpl.java │ └── resources │ └── application.yml ├── spring-boot-delayqueue ├── pom.xml └── src │ └── main │ ├── java │ └── xyz │ │ └── zhouzhaodong │ │ └── springbootdelayqueue │ │ ├── SpringBootDelayqueueApplication.java │ │ ├── config │ │ └── ExecutorConfig.java │ │ ├── controller │ │ └── CancelOrderController.java │ │ ├── service │ │ ├── CancelOrderService.java │ │ └── impl │ │ │ └── CancelOrderServiceImpl.java │ │ └── vo │ │ └── Order.java │ └── resources │ └── application.yml ├── spring-boot-druid ├── pom.xml └── src │ └── main │ ├── java │ └── xyz │ │ └── zhouzhaodong │ │ └── springbootdruid │ │ ├── SpringBootDruidApplication.java │ │ ├── controller │ │ └── PersonController.java │ │ ├── entity │ │ └── Person.java │ │ └── jpa │ │ └── PersonRepository.java │ └── resources │ └── application.yml ├── spring-boot-h2 ├── pom.xml └── src │ └── main │ ├── java │ └── xyz │ │ └── zhouzhaodong │ │ └── springbooth2 │ │ ├── SpringBootH2Application.java │ │ ├── controller │ │ └── UserController.java │ │ ├── dao │ │ └── UserDao.java │ │ └── entity │ │ └── User.java │ └── resources │ └── application.yml ├── spring-boot-https ├── pom.xml └── src │ └── main │ ├── java │ └── xyz │ │ └── zhouzhaodong │ │ └── springboothttps │ │ ├── SpringBootHttpsApplication.java │ │ ├── config │ │ └── HttpsConfig.java │ │ └── controller │ │ └── HttpsController.java │ └── resources │ ├── application.yml │ └── server.keystore ├── spring-boot-japidocs ├── pom.xml └── src │ └── main │ ├── java │ └── xyz │ │ └── zhouzhaodong │ │ └── springbootjapidocs │ │ ├── SpringBootJapidocsApplication.java │ │ ├── config │ │ └── JapidocsConfig.java │ │ ├── controller │ │ └── SysUserController.java │ │ └── entity │ │ └── SysUser.java │ └── resources │ └── application.yml ├── spring-boot-qrcode ├── pom.xml └── src │ └── main │ ├── java │ └── xyz │ │ └── zhouzhaodong │ │ └── www │ │ └── qrcode │ │ ├── QrcodeApplication.java │ │ ├── config │ │ └── QRCodeGenerator.java │ │ └── controller │ │ └── QRCodeController.java │ └── resources │ ├── application.yml │ └── png │ └── 123456.png ├── spring-boot-screw ├── pom.xml └── src │ ├── main │ ├── java │ │ └── xyz │ │ │ └── zhouzhaodong │ │ │ └── springbootscrew │ │ │ ├── SpringBootScrewApplication.java │ │ │ └── config │ │ │ └── DocumentConfig.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── xyz │ └── zhouzhaodong │ └── springbootscrew │ ├── ScrewApplicationTests.java │ └── SpringBootScrewApplicationTests.java ├── spring-boot-swagger ├── pom.xml └── src │ └── main │ ├── java │ └── xyz │ │ └── zhouzhaodong │ │ └── springbootswagger │ │ ├── SpringBootSwaggerApplication.java │ │ ├── controller │ │ └── PersonController.java │ │ ├── entity │ │ └── Person.java │ │ └── util │ │ └── ResponseBody.java │ └── resources │ └── application.yml ├── spring-boot-ureport2 ├── pom.xml └── src │ └── main │ ├── java │ └── xyz │ │ └── zhouzhaodong │ │ └── springbootureport2 │ │ ├── SpringBootUreport2Application.java │ │ └── config │ │ ├── BeanConfig.java │ │ └── UreportDataSource.java │ └── resources │ ├── application.yml │ ├── context.properties │ ├── context.xml │ └── ureportfiles │ └── 报表文件保存地址,需要创建 ├── spring-boot-webservice ├── pom.xml └── src │ └── main │ ├── java │ └── xyz │ │ └── zhouzhaodong │ │ └── springbootwebservice │ │ ├── SpringBootWebserviceApplication.java │ │ ├── client │ │ └── CxfClient.java │ │ ├── config │ │ └── CxfConfig.java │ │ └── service │ │ ├── CommonService.java │ │ └── impl │ │ └── CommonServiceImpl.java │ └── resources │ └── application.yml ├── springboot-interceptor ├── pom.xml └── src │ ├── main │ ├── java │ │ └── xyz │ │ │ └── zhouzhaodong │ │ │ └── springbootinterceptor │ │ │ ├── SpringbootInterceptorApplication.java │ │ │ ├── controller │ │ │ └── TestController.java │ │ │ ├── entity │ │ │ └── User.java │ │ │ └── interceptor │ │ │ ├── ChannelFilter.java │ │ │ ├── MyInterceptor.java │ │ │ ├── RequestWrapper.java │ │ │ └── WebConfig.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── xyz │ └── zhouzhaodong │ └── springbootinterceptor │ └── SpringbootInterceptorApplicationTests.java ├── springboot-jwt ├── pom.xml └── src │ ├── main │ ├── java │ │ └── xyz │ │ │ └── zhouzhaodong │ │ │ └── springbootjwt │ │ │ ├── SpringbootJwtApplication.java │ │ │ ├── controller │ │ │ └── TestController.java │ │ │ ├── filter │ │ │ ├── JwtCfg.java │ │ │ └── JwtFilter.java │ │ │ └── util │ │ │ └── JwtUtils.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── xyz │ └── zhouzhaodong │ └── springbootjwt │ └── SpringbootJwtApplicationTests.java ├── springcloud ├── server-center │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── xyz │ │ │ │ └── springboot │ │ │ │ └── servercenter │ │ │ │ └── ServerCenterApplication.java │ │ └── resources │ │ │ └── application.yml │ │ └── test │ │ └── java │ │ └── xyz │ │ └── springboot │ │ └── servercenter │ │ └── ServerCenterApplicationTests.java ├── server-order │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── xyz │ │ │ │ └── zhouzhaodong │ │ │ │ └── serverorder │ │ │ │ ├── ServerOrderApplication.java │ │ │ │ └── controller │ │ │ │ └── OrderController.java │ │ └── resources │ │ │ └── application.yml │ │ └── test │ │ └── java │ │ └── xyz │ │ └── zhouzhaodong │ │ └── serverorder │ │ └── ServerOrderApplicationTests.java └── server-user │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── xyz │ │ │ └── zhouzhaodong │ │ │ └── serveruser │ │ │ ├── ServerUserApplication.java │ │ │ └── controller │ │ │ └── UserController.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── xyz │ └── zhouzhaodong │ └── serveruser │ └── ServerUserApplicationTests.java ├── timingtasks ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── zhouxiaoxi │ │ │ └── timingtasks │ │ │ ├── TimingtasksApplication.java │ │ │ └── util │ │ │ └── TimingTasks.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── com │ └── zhouxiaoxi │ └── timingtasks │ └── TimingtasksApplicationTests.java ├── websocket ├── pom.xml └── src │ ├── main │ ├── java │ │ └── xyz │ │ │ └── zhouzhaodong │ │ │ └── websocket │ │ │ ├── WebsocketApplication.java │ │ │ ├── config │ │ │ └── WebsocketConfiguration.java │ │ │ ├── controller │ │ │ └── TestController.java │ │ │ └── server │ │ │ └── MyWebsocketServer.java │ └── resources │ │ ├── application.yml │ │ └── templates │ │ └── index.html │ └── test │ └── java │ └── xyz │ └── zhouzhaodong │ └── websocket │ └── WebsocketApplicationTests.java └── xxl-job ├── LICENSE ├── NOTICE ├── README.md ├── demo ├── pom.xml └── src │ ├── main │ ├── java │ │ └── xyz │ │ │ └── zhouzhaodong │ │ │ └── demo │ │ │ ├── DemoApplication.java │ │ │ ├── config │ │ │ └── XxlJobConfig.java │ │ │ └── jobhandler │ │ │ └── SampleXxlJob.java │ └── resources │ │ ├── application.properties │ │ └── logback.xml │ └── test │ └── java │ └── xyz │ └── zhouzhaodong │ └── demo │ └── DemoApplicationTests.java ├── doc ├── XXL-JOB-English-Documentation.md ├── XXL-JOB官方文档.md ├── XXL-JOB架构图.pptx ├── db │ └── tables_xxl_job.sql └── images │ ├── cnblog-首页-每日一博-第一.png │ ├── cnblog-首页-热门动弹-第一.png │ ├── donate-alipay.jpg │ ├── donate-paypal.png │ ├── donate-wechat.png │ ├── gitee-gvp.jpg │ ├── img_1001.png │ ├── img_1002.png │ ├── img_6yC0.png │ ├── img_BPLG.png │ ├── img_EB65.png │ ├── img_Fgql.png │ ├── img_Hr2T.png │ ├── img_Qohm.png │ ├── img_UDSo.png │ ├── img_V3vF.png │ ├── img_Wb2o.png │ ├── img_Ypik.png │ ├── img_Z9Qr.png │ ├── img_ZAhX.png │ ├── img_ZAsz.png │ ├── img_dNUJ.png │ ├── img_eYrv.png │ ├── img_hIci.png │ ├── img_iUw0.png │ ├── img_inc8.png │ ├── img_jOAU.png │ ├── img_jrdI.png │ ├── img_o8HQ.png │ ├── img_tJOq.png │ ├── img_tvGI.png │ ├── qq群-一个xxl同学进了58.png │ ├── xxl-logo.jpg │ └── xxl-logo.png ├── pom.xml ├── xxl-job-admin ├── Dockerfile ├── pom.xml ├── src │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── xxl │ │ │ │ └── job │ │ │ │ └── admin │ │ │ │ ├── XxlJobAdminApplication.java │ │ │ │ ├── controller │ │ │ │ ├── IndexController.java │ │ │ │ ├── JobApiController.java │ │ │ │ ├── JobCodeController.java │ │ │ │ ├── JobGroupController.java │ │ │ │ ├── JobInfoController.java │ │ │ │ ├── JobLogController.java │ │ │ │ ├── UserController.java │ │ │ │ ├── annotation │ │ │ │ │ └── PermissionLimit.java │ │ │ │ ├── interceptor │ │ │ │ │ ├── CookieInterceptor.java │ │ │ │ │ ├── PermissionInterceptor.java │ │ │ │ │ └── WebMvcConfig.java │ │ │ │ └── resolver │ │ │ │ │ └── WebExceptionResolver.java │ │ │ │ ├── core │ │ │ │ ├── alarm │ │ │ │ │ ├── JobAlarm.java │ │ │ │ │ ├── JobAlarmer.java │ │ │ │ │ └── impl │ │ │ │ │ │ └── EmailJobAlarm.java │ │ │ │ ├── conf │ │ │ │ │ └── XxlJobAdminConfig.java │ │ │ │ ├── cron │ │ │ │ │ └── CronExpression.java │ │ │ │ ├── exception │ │ │ │ │ └── XxlJobException.java │ │ │ │ ├── model │ │ │ │ │ ├── XxlJobGroup.java │ │ │ │ │ ├── XxlJobInfo.java │ │ │ │ │ ├── XxlJobLog.java │ │ │ │ │ ├── XxlJobLogGlue.java │ │ │ │ │ ├── XxlJobLogReport.java │ │ │ │ │ ├── XxlJobRegistry.java │ │ │ │ │ └── XxlJobUser.java │ │ │ │ ├── old │ │ │ │ │ ├── RemoteHttpJobBean.java │ │ │ │ │ ├── XxlJobDynamicScheduler.java │ │ │ │ │ └── XxlJobThreadPool.java │ │ │ │ ├── route │ │ │ │ │ ├── ExecutorRouteStrategyEnum.java │ │ │ │ │ ├── ExecutorRouter.java │ │ │ │ │ └── strategy │ │ │ │ │ │ ├── ExecutorRouteBusyover.java │ │ │ │ │ │ ├── ExecutorRouteConsistentHash.java │ │ │ │ │ │ ├── ExecutorRouteFailover.java │ │ │ │ │ │ ├── ExecutorRouteFirst.java │ │ │ │ │ │ ├── ExecutorRouteLFU.java │ │ │ │ │ │ ├── ExecutorRouteLRU.java │ │ │ │ │ │ ├── ExecutorRouteLast.java │ │ │ │ │ │ ├── ExecutorRouteRandom.java │ │ │ │ │ │ └── ExecutorRouteRound.java │ │ │ │ ├── scheduler │ │ │ │ │ └── XxlJobScheduler.java │ │ │ │ ├── thread │ │ │ │ │ ├── JobFailMonitorHelper.java │ │ │ │ │ ├── JobLogReportHelper.java │ │ │ │ │ ├── JobLosedMonitorHelper.java │ │ │ │ │ ├── JobRegistryMonitorHelper.java │ │ │ │ │ ├── JobScheduleHelper.java │ │ │ │ │ └── JobTriggerPoolHelper.java │ │ │ │ ├── trigger │ │ │ │ │ ├── TriggerTypeEnum.java │ │ │ │ │ └── XxlJobTrigger.java │ │ │ │ └── util │ │ │ │ │ ├── CookieUtil.java │ │ │ │ │ ├── FtlUtil.java │ │ │ │ │ ├── I18nUtil.java │ │ │ │ │ ├── JacksonUtil.java │ │ │ │ │ └── LocalCacheUtil.java │ │ │ │ ├── dao │ │ │ │ ├── XxlJobGroupDao.java │ │ │ │ ├── XxlJobInfoDao.java │ │ │ │ ├── XxlJobLogDao.java │ │ │ │ ├── XxlJobLogGlueDao.java │ │ │ │ ├── XxlJobLogReportDao.java │ │ │ │ ├── XxlJobRegistryDao.java │ │ │ │ └── XxlJobUserDao.java │ │ │ │ └── service │ │ │ │ ├── LoginService.java │ │ │ │ ├── XxlJobService.java │ │ │ │ └── impl │ │ │ │ ├── AdminBizImpl.java │ │ │ │ └── XxlJobServiceImpl.java │ │ └── resources │ │ │ ├── application.properties │ │ │ ├── i18n │ │ │ ├── message_en.properties │ │ │ ├── message_zh_CN.properties │ │ │ └── message_zh_TC.properties │ │ │ ├── logback.xml │ │ │ ├── mybatis-mapper │ │ │ ├── XxlJobGroupMapper.xml │ │ │ ├── XxlJobInfoMapper.xml │ │ │ ├── XxlJobLogGlueMapper.xml │ │ │ ├── XxlJobLogMapper.xml │ │ │ ├── XxlJobLogReportMapper.xml │ │ │ ├── XxlJobRegistryMapper.xml │ │ │ └── XxlJobUserMapper.xml │ │ │ ├── static │ │ │ ├── adminlte │ │ │ │ ├── bower_components │ │ │ │ │ ├── Ionicons │ │ │ │ │ │ ├── css │ │ │ │ │ │ │ └── ionicons.min.css │ │ │ │ │ │ └── fonts │ │ │ │ │ │ │ ├── ionicons.eot │ │ │ │ │ │ │ ├── ionicons.svg │ │ │ │ │ │ │ ├── ionicons.ttf │ │ │ │ │ │ │ └── ionicons.woff │ │ │ │ │ ├── PACE │ │ │ │ │ │ ├── pace.min.js │ │ │ │ │ │ └── themes │ │ │ │ │ │ │ └── blue │ │ │ │ │ │ │ └── pace-theme-flash.css │ │ │ │ │ ├── bootstrap-daterangepicker │ │ │ │ │ │ ├── daterangepicker.css │ │ │ │ │ │ └── daterangepicker.js │ │ │ │ │ ├── bootstrap │ │ │ │ │ │ ├── css │ │ │ │ │ │ │ ├── bootstrap.min.css │ │ │ │ │ │ │ └── bootstrap.min.css.map │ │ │ │ │ │ ├── fonts │ │ │ │ │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ │ │ │ │ ├── glyphicons-halflings-regular.svg │ │ │ │ │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ │ │ │ │ ├── glyphicons-halflings-regular.woff │ │ │ │ │ │ │ └── glyphicons-halflings-regular.woff2 │ │ │ │ │ │ └── js │ │ │ │ │ │ │ └── bootstrap.min.js │ │ │ │ │ ├── datatables.net-bs │ │ │ │ │ │ ├── css │ │ │ │ │ │ │ └── dataTables.bootstrap.min.css │ │ │ │ │ │ └── js │ │ │ │ │ │ │ └── dataTables.bootstrap.min.js │ │ │ │ │ ├── datatables.net │ │ │ │ │ │ └── js │ │ │ │ │ │ │ └── jquery.dataTables.min.js │ │ │ │ │ ├── fastclick │ │ │ │ │ │ └── fastclick.js │ │ │ │ │ ├── font-awesome │ │ │ │ │ │ ├── css │ │ │ │ │ │ │ ├── font-awesome.css.map │ │ │ │ │ │ │ └── font-awesome.min.css │ │ │ │ │ │ └── fonts │ │ │ │ │ │ │ ├── FontAwesome.otf │ │ │ │ │ │ │ ├── fontawesome-webfont.eot │ │ │ │ │ │ │ ├── fontawesome-webfont.svg │ │ │ │ │ │ │ ├── fontawesome-webfont.ttf │ │ │ │ │ │ │ ├── fontawesome-webfont.woff │ │ │ │ │ │ │ └── fontawesome-webfont.woff2 │ │ │ │ │ ├── jquery-slimscroll │ │ │ │ │ │ └── jquery.slimscroll.min.js │ │ │ │ │ ├── jquery │ │ │ │ │ │ └── jquery.min.js │ │ │ │ │ └── moment │ │ │ │ │ │ └── moment.min.js │ │ │ │ ├── dist │ │ │ │ │ ├── css │ │ │ │ │ │ ├── AdminLTE.min.css │ │ │ │ │ │ └── skins │ │ │ │ │ │ │ └── _all-skins.min.css │ │ │ │ │ └── js │ │ │ │ │ │ └── adminlte.min.js │ │ │ │ └── plugins │ │ │ │ │ └── iCheck │ │ │ │ │ ├── icheck.min.js │ │ │ │ │ └── square │ │ │ │ │ ├── blue.css │ │ │ │ │ ├── blue.png │ │ │ │ │ └── blue@2x.png │ │ │ ├── favicon.ico │ │ │ ├── js │ │ │ │ ├── common.1.js │ │ │ │ ├── index.js │ │ │ │ ├── jobcode.index.1.js │ │ │ │ ├── jobgroup.index.1.js │ │ │ │ ├── jobinfo.index.1.js │ │ │ │ ├── joblog.detail.1.js │ │ │ │ ├── joblog.index.1.js │ │ │ │ ├── login.1.js │ │ │ │ └── user.index.1.js │ │ │ └── plugins │ │ │ │ ├── codemirror │ │ │ │ ├── addon │ │ │ │ │ └── hint │ │ │ │ │ │ ├── anyword-hint.js │ │ │ │ │ │ ├── show-hint.css │ │ │ │ │ │ └── show-hint.js │ │ │ │ ├── lib │ │ │ │ │ ├── codemirror.css │ │ │ │ │ └── codemirror.js │ │ │ │ └── mode │ │ │ │ │ ├── clike │ │ │ │ │ └── clike.js │ │ │ │ │ ├── javascript │ │ │ │ │ └── javascript.js │ │ │ │ │ ├── php │ │ │ │ │ └── php.js │ │ │ │ │ ├── powershell │ │ │ │ │ └── powershell.js │ │ │ │ │ ├── python │ │ │ │ │ └── python.js │ │ │ │ │ └── shell │ │ │ │ │ └── shell.js │ │ │ │ ├── cronGen │ │ │ │ ├── cronGen.js │ │ │ │ └── cronGen_en.js │ │ │ │ ├── echarts │ │ │ │ └── echarts.common.min.js │ │ │ │ ├── jquery │ │ │ │ ├── jquery.cookie.js │ │ │ │ └── jquery.validate.min.js │ │ │ │ └── layer │ │ │ │ ├── layer.js │ │ │ │ └── theme │ │ │ │ └── default │ │ │ │ ├── icon-ext.png │ │ │ │ ├── icon.png │ │ │ │ ├── layer.css │ │ │ │ ├── loading-0.gif │ │ │ │ ├── loading-1.gif │ │ │ │ └── loading-2.gif │ │ │ └── templates │ │ │ ├── common │ │ │ ├── common.exception.ftl │ │ │ └── common.macro.ftl │ │ │ ├── help.ftl │ │ │ ├── index.ftl │ │ │ ├── jobcode │ │ │ └── jobcode.index.ftl │ │ │ ├── jobgroup │ │ │ └── jobgroup.index.ftl │ │ │ ├── jobinfo │ │ │ └── jobinfo.index.ftl │ │ │ ├── joblog │ │ │ ├── joblog.detail.ftl │ │ │ └── joblog.index.ftl │ │ │ ├── login.ftl │ │ │ └── user │ │ │ └── user.index.ftl │ └── test │ │ └── java │ │ └── com │ │ └── xxl │ │ └── job │ │ ├── admin │ │ ├── controller │ │ │ ├── AbstractSpringMvcTest.java │ │ │ └── JobInfoControllerTest.java │ │ ├── core │ │ │ └── util │ │ │ │ └── JacksonUtilTest.java │ │ ├── dao │ │ │ ├── XxlJobGroupDaoTest.java │ │ │ ├── XxlJobInfoDaoTest.java │ │ │ ├── XxlJobLogDaoTest.java │ │ │ ├── XxlJobLogGlueDaoTest.java │ │ │ └── XxlJobRegistryDaoTest.java │ │ └── util │ │ │ └── I18nUtilTest.java │ │ ├── adminbiz │ │ └── AdminBizTest.java │ │ └── executorbiz │ │ └── ExecutorBizTest.java └── xxl-job-admin.iml ├── xxl-job-core ├── pom.xml ├── src │ └── main │ │ └── java │ │ └── com │ │ └── xxl │ │ └── job │ │ └── core │ │ ├── biz │ │ ├── AdminBiz.java │ │ ├── ExecutorBiz.java │ │ ├── client │ │ │ ├── AdminBizClient.java │ │ │ └── ExecutorBizClient.java │ │ ├── impl │ │ │ └── ExecutorBizImpl.java │ │ └── model │ │ │ ├── HandleCallbackParam.java │ │ │ ├── IdleBeatParam.java │ │ │ ├── KillParam.java │ │ │ ├── LogParam.java │ │ │ ├── LogResult.java │ │ │ ├── RegistryParam.java │ │ │ ├── ReturnT.java │ │ │ └── TriggerParam.java │ │ ├── enums │ │ ├── ExecutorBlockStrategyEnum.java │ │ └── RegistryConfig.java │ │ ├── executor │ │ ├── XxlJobExecutor.java │ │ └── impl │ │ │ └── XxlJobSpringExecutor.java │ │ ├── glue │ │ ├── GlueFactory.java │ │ ├── GlueTypeEnum.java │ │ └── impl │ │ │ └── SpringGlueFactory.java │ │ ├── handler │ │ ├── IJobHandler.java │ │ ├── annotation │ │ │ ├── JobHandler.java │ │ │ └── XxlJob.java │ │ └── impl │ │ │ ├── GlueJobHandler.java │ │ │ ├── MethodJobHandler.java │ │ │ └── ScriptJobHandler.java │ │ ├── log │ │ ├── XxlJobFileAppender.java │ │ └── XxlJobLogger.java │ │ ├── server │ │ └── EmbedServer.java │ │ ├── thread │ │ ├── ExecutorRegistryThread.java │ │ ├── JobLogFileCleanThread.java │ │ ├── JobThread.java │ │ └── TriggerCallbackThread.java │ │ └── util │ │ ├── DateUtil.java │ │ ├── FileUtil.java │ │ ├── GsonTool.java │ │ ├── IpUtil.java │ │ ├── JdkSerializeTool.java │ │ ├── NetUtil.java │ │ ├── ScriptUtil.java │ │ ├── ShardingUtil.java │ │ ├── ThrowableUtil.java │ │ └── XxlJobRemotingUtil.java └── xxl-job-core.iml ├── xxl-job-executor-samples ├── pom.xml ├── xxl-job-executor-sample-frameless │ ├── pom.xml │ ├── src │ │ └── main │ │ │ ├── java │ │ │ └── com │ │ │ │ └── xuxueli │ │ │ │ └── executor │ │ │ │ └── sample │ │ │ │ └── frameless │ │ │ │ ├── FramelessApplication.java │ │ │ │ ├── config │ │ │ │ └── FrameLessXxlJobConfig.java │ │ │ │ └── jobhandler │ │ │ │ ├── CommandJobHandler.java │ │ │ │ ├── DemoJobHandler.java │ │ │ │ ├── HttpJobHandler.java │ │ │ │ └── ShardingJobHandler.java │ │ │ └── resources │ │ │ ├── log4j.xml │ │ │ └── xxl-job-executor.properties │ └── xxl-job-executor-sample-frameless.iml ├── xxl-job-executor-sample-jboot │ ├── pom.xml │ ├── src │ │ ├── main │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── xuxueli │ │ │ │ │ └── executor │ │ │ │ │ └── sample │ │ │ │ │ └── jboot │ │ │ │ │ ├── JbootApp.java │ │ │ │ │ ├── config │ │ │ │ │ └── JbootConfig.java │ │ │ │ │ ├── controller │ │ │ │ │ └── IndexController.java │ │ │ │ │ └── jobhandler │ │ │ │ │ ├── CommandJobHandler.java │ │ │ │ │ ├── DemoJobHandler.java │ │ │ │ │ ├── HttpJobHandler.java │ │ │ │ │ └── ShardingJobHandler.java │ │ │ └── resources │ │ │ │ ├── jboot.properties │ │ │ │ └── logback.xml │ │ └── test │ │ │ └── java │ │ │ └── com │ │ │ └── xuxueli │ │ │ └── AppTest.java │ └── xxl-job-executor-sample-jboot.iml ├── xxl-job-executor-sample-jfinal │ ├── pom.xml │ ├── src │ │ └── main │ │ │ ├── java │ │ │ └── com │ │ │ │ └── xuxueli │ │ │ │ └── executor │ │ │ │ └── sample │ │ │ │ └── jfinal │ │ │ │ ├── config │ │ │ │ └── JFinalCoreConfig.java │ │ │ │ ├── controller │ │ │ │ └── IndexController.java │ │ │ │ └── jobhandler │ │ │ │ ├── CommandJobHandler.java │ │ │ │ ├── DemoJobHandler.java │ │ │ │ ├── HttpJobHandler.java │ │ │ │ └── ShardingJobHandler.java │ │ │ ├── resources │ │ │ ├── log4j.xml │ │ │ └── xxl-job-executor.properties │ │ │ └── webapp │ │ │ ├── WEB-INF │ │ │ └── web.xml │ │ │ └── index.html │ └── xxl-job-executor-sample-jfinal.iml ├── xxl-job-executor-sample-nutz │ ├── pom.xml │ ├── src │ │ └── main │ │ │ ├── java │ │ │ └── com │ │ │ │ └── xuxueli │ │ │ │ └── executor │ │ │ │ └── sample │ │ │ │ └── nutz │ │ │ │ ├── MainModule.java │ │ │ │ ├── config │ │ │ │ └── NutzSetup.java │ │ │ │ ├── jobhandler │ │ │ │ ├── CommandJobHandler.java │ │ │ │ ├── DemoJobHandler.java │ │ │ │ ├── HttpJobHandler.java │ │ │ │ └── ShardingJobHandler.java │ │ │ │ └── module │ │ │ │ └── IndexModule.java │ │ │ ├── resources │ │ │ ├── log4j.xml │ │ │ └── xxl-job-executor.properties │ │ │ └── webapp │ │ │ ├── WEB-INF │ │ │ └── web.xml │ │ │ └── index.html │ └── xxl-job-executor-sample-nutz.iml ├── xxl-job-executor-sample-spring │ ├── pom.xml │ ├── src │ │ └── main │ │ │ ├── java │ │ │ └── com │ │ │ │ └── xxl │ │ │ │ └── job │ │ │ │ └── executor │ │ │ │ └── service │ │ │ │ └── jobhandler │ │ │ │ └── SampleXxlJob.java │ │ │ ├── resources │ │ │ ├── applicationcontext-xxl-job.xml │ │ │ ├── log4j.xml │ │ │ ├── logback.xml │ │ │ └── xxl-job-executor.properties │ │ │ └── webapp │ │ │ ├── WEB-INF │ │ │ └── web.xml │ │ │ └── index.html │ └── xxl-job-executor-sample-spring.iml ├── xxl-job-executor-sample-springboot │ ├── Dockerfile │ ├── pom.xml │ ├── src │ │ ├── main │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── xxl │ │ │ │ │ └── job │ │ │ │ │ └── executor │ │ │ │ │ ├── XxlJobExecutorApplication.java │ │ │ │ │ ├── core │ │ │ │ │ └── config │ │ │ │ │ │ └── XxlJobConfig.java │ │ │ │ │ ├── mvc │ │ │ │ │ └── controller │ │ │ │ │ │ └── IndexController.java │ │ │ │ │ └── service │ │ │ │ │ └── jobhandler │ │ │ │ │ └── SampleXxlJob.java │ │ │ └── resources │ │ │ │ ├── application.properties │ │ │ │ └── logback.xml │ │ └── test │ │ │ └── java │ │ │ └── com │ │ │ └── xxl │ │ │ └── job │ │ │ └── executor │ │ │ └── test │ │ │ └── XxlJobExecutorExampleBootApplicationTests.java │ ├── target │ │ ├── classes │ │ │ ├── application.properties │ │ │ ├── com │ │ │ │ └── xxl │ │ │ │ │ └── job │ │ │ │ │ └── executor │ │ │ │ │ ├── XxlJobExecutorApplication.class │ │ │ │ │ ├── core │ │ │ │ │ └── config │ │ │ │ │ │ └── XxlJobConfig.class │ │ │ │ │ └── service │ │ │ │ │ └── jobhandler │ │ │ │ │ └── SampleXxlJob.class │ │ │ └── logback.xml │ │ └── test-classes │ │ │ └── com │ │ │ └── xxl │ │ │ └── job │ │ │ └── executor │ │ │ └── test │ │ │ └── XxlJobExecutorExampleBootApplicationTests.class │ └── xxl-job-executor-sample-springboot.iml └── xxl-job-executor-samples.iml └── xxl-job.iml /README.md: -------------------------------------------------------------------------------- 1 | # 本项目主要写一些关于springboot的项目 2 | ## 已写项目: 3 | ### 1. Spring Boot与Dubbo结合 4 | ### 2. Spring Boot的过滤器,拦截器,监听器 5 | ### 3. Spring Boot通过JDBCTemplate进行数据库操作 6 | ### 4. Spring Boot使用mybatisplus自带的分页插件进行分页查询 7 | ### 5. Spring Boot整合Redis 8 | ### 6. Spring Boot使用定时任务 9 | ### 7. Spring Boot通过Jpa进行数据库操作 10 | ### 8. Spring Boot通过Mybatis进行数据库操作 11 | ### 9. Spring Boot整合JWT实现认证登录 12 | ### 10. Spring Boot解决跨域访问 13 | ### 11. Spring Boot使用Cache缓存 14 | ### 12. Spring Boot + ShardingSphere + JPA 实现读写分离 15 | ### 13. Spring Cloud项目的搭建 16 | ### 14. Spring Boot整合WebSocket实现双向通信 17 | ### 15. Spring Boot整合xxl-job实现定时任务可视化调配 18 | ### 16. Spring Boot集成https 19 | ### 17. Spring Boot集成Swagger 20 | ### 18. Spring Boot集成DelayQueue实现订单到期自动取消 21 | ### 19. Spring Boot 整合 screw 实现数据库文档自动生成 22 | ### 20. Spring Boot 整合 H2 23 | ### 21. Spring Boot 整合 UReport2 24 | ### 22. Spring Boot 整合 Druid 25 | ### 23. Spring Boot 集成 WebService 26 | ### 24. Spring Boot 集成 JApiDocs生成接口文档 27 | -------------------------------------------------------------------------------- /cache/src/main/java/xyz/zhouzhaodong/cache/CacheApplication.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.cache; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cache.annotation.EnableCaching; 6 | 7 | /** 8 | * 启动类 9 | * @author zhouzhaodong 10 | */ 11 | @SpringBootApplication 12 | @EnableCaching 13 | public class CacheApplication { 14 | 15 | public static void main(String[] args) { 16 | SpringApplication.run(CacheApplication.class, args); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /cache/src/main/java/xyz/zhouzhaodong/cache/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.cache.controller; 2 | 3 | import org.springframework.web.bind.annotation.RequestMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | import xyz.zhouzhaodong.cache.entity.User; 6 | import xyz.zhouzhaodong.cache.service.UserService; 7 | 8 | import javax.annotation.Resource; 9 | 10 | /** 11 | * 控制层 12 | * @author zhouzhaodong 13 | */ 14 | @RestController 15 | public class UserController { 16 | 17 | @Resource 18 | UserService userService; 19 | 20 | @RequestMapping("/save") 21 | public User saveUser(User user){ 22 | return userService.insert(user); 23 | } 24 | 25 | @RequestMapping("/delete") 26 | public void deleteUser(int id){ 27 | userService.delete(id); 28 | } 29 | 30 | @RequestMapping("/update") 31 | public User updateUser(User user){ 32 | return userService.update(user); 33 | } 34 | 35 | @RequestMapping("/find") 36 | public Object findById(int id){ 37 | return userService.findById(id); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /cache/src/main/java/xyz/zhouzhaodong/cache/repository/UserRepository.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.cache.repository; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | import org.springframework.data.jpa.repository.Modifying; 5 | import org.springframework.data.jpa.repository.Query; 6 | import org.springframework.data.repository.query.Param; 7 | import org.springframework.transaction.annotation.Transactional; 8 | import xyz.zhouzhaodong.cache.entity.User; 9 | 10 | /** 11 | * 数据库访问层 12 | * 13 | * @author zhouzhaodong 14 | */ 15 | @Transactional(rollbackFor = Exception.class) 16 | public interface UserRepository extends JpaRepository { 17 | 18 | /** 19 | * 根据id更新 20 | * @param id 21 | * @param name 22 | * @param address 23 | * @param age 24 | * @return 25 | */ 26 | @Modifying 27 | @Query(value = "update user u set u.name = :name, u.address = :address, u.age = :age where u.id = :id", nativeQuery = true) 28 | User updateById(@Param("id") Integer id, 29 | @Param("name") String name, 30 | @Param("address") String address, 31 | @Param("age") int age); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /cache/src/main/java/xyz/zhouzhaodong/cache/service/UserService.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.cache.service; 2 | 3 | import org.springframework.stereotype.Service; 4 | import xyz.zhouzhaodong.cache.entity.User; 5 | 6 | /** 7 | * Service 8 | * @author zhouzhaodong 9 | */ 10 | @Service 11 | public interface UserService { 12 | 13 | /** 14 | * 新增 15 | * @param user 16 | * @return 17 | */ 18 | User insert(User user); 19 | 20 | /** 21 | * 删除 22 | * @param id 23 | * @return 24 | */ 25 | void delete(int id); 26 | 27 | /** 28 | * 更新 29 | * @param user 30 | * @return 31 | */ 32 | User update(User user); 33 | 34 | /** 35 | * 根据id查询 36 | * @param id 37 | * @return 38 | */ 39 | Object findById(int id); 40 | 41 | } 42 | -------------------------------------------------------------------------------- /cache/src/main/resources/application.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/cache/src/main/resources/application.yml -------------------------------------------------------------------------------- /cross-domain/cross-domain-one/src/main/java/xyz/zhouzhaodong/crossdomainone/CrossDomainOneApplication.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.crossdomainone; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class CrossDomainOneApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(CrossDomainOneApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /cross-domain/cross-domain-one/src/main/java/xyz/zhouzhaodong/crossdomainone/controller/CrossDomainOneController.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.crossdomainone.controller; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | 6 | /** 7 | * 跨域8080端口方法 8 | * @author zhouzhaodong 9 | */ 10 | @Controller 11 | public class CrossDomainOneController { 12 | 13 | @RequestMapping("/") 14 | public String index(){ 15 | return "cross-domain-one"; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /cross-domain/cross-domain-one/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | 4 | spring: 5 | thymeleaf: 6 | prefix: classpath:/templates/ 7 | suffix: .html -------------------------------------------------------------------------------- /cross-domain/cross-domain-one/src/main/resources/templates/cross-domain-one.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 跨域测试-8080端口 6 | 7 | 8 | 9 | 10 | 11 | 22 | -------------------------------------------------------------------------------- /cross-domain/cross-domain-one/src/test/java/xyz/zhouzhaodong/crossdomainone/CrossDomainOneApplicationTests.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.crossdomainone; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class CrossDomainOneApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /cross-domain/cross-domain-two/src/main/java/xyz/zhouzhaodong/crossdomaintwo/CrossDomainTwoApplication.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.crossdomaintwo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class CrossDomainTwoApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(CrossDomainTwoApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /cross-domain/cross-domain-two/src/main/java/xyz/zhouzhaodong/crossdomaintwo/config/MyConfiguration.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.crossdomaintwo.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.web.servlet.config.annotation.CorsRegistry; 6 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 7 | 8 | /** 9 | * 定义全局CORS配置 10 | * @author zhouzhaodong 11 | */ 12 | @Configuration 13 | public class MyConfiguration { 14 | @Bean 15 | public WebMvcConfigurer corsConfigurer() { 16 | return new WebMvcConfigurer() { 17 | @Override 18 | public void addCorsMappings(CorsRegistry registry) { 19 | registry.addMapping("/*") 20 | .allowedOrigins("*") 21 | .allowCredentials(true) 22 | .allowedMethods("GET", "POST", "DELETE", "PUT","PATCH") 23 | .maxAge(3600); 24 | } 25 | }; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /cross-domain/cross-domain-two/src/main/java/xyz/zhouzhaodong/crossdomaintwo/controller/CrossDomainTwoController.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.crossdomaintwo.controller; 2 | 3 | import org.springframework.web.bind.annotation.CrossOrigin; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | import org.springframework.web.bind.annotation.RestController; 6 | 7 | /** 8 | * 跨域8080端口方法 9 | * @author zhouzhaodong 10 | */ 11 | @RestController 12 | public class CrossDomainTwoController { 13 | 14 | /** 15 | * 测试端口 16 | * @return 17 | */ 18 | // @CrossOrigin 19 | @RequestMapping("/hello") 20 | public String hello(){ 21 | return "这是一个来自8081端口的接口!"; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /cross-domain/cross-domain-two/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8081 3 | -------------------------------------------------------------------------------- /cross-domain/cross-domain-two/src/test/java/xyz/zhouzhaodong/crossdomaintwo/CrossDomainTwoApplicationTests.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.crossdomaintwo; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class CrossDomainTwoApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /dubboPractice/common/src/main/java/entity/User.java: -------------------------------------------------------------------------------- 1 | package entity; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * 实体类(序列化) 7 | * @author zhouxiaoxi 8 | */ 9 | public class User implements Serializable { 10 | 11 | private String name; 12 | 13 | private Integer age; 14 | 15 | public User() { 16 | } 17 | 18 | public User(String name, Integer age) { 19 | this.name = name; 20 | this.age = age; 21 | } 22 | 23 | public String getName() { 24 | return name; 25 | } 26 | 27 | public void setName(String name) { 28 | this.name = name; 29 | } 30 | 31 | public Integer getAge() { 32 | return age; 33 | } 34 | 35 | public void setAge(Integer age) { 36 | this.age = age; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /dubboPractice/common/src/main/java/service/GetUserService.java: -------------------------------------------------------------------------------- 1 | package service; 2 | 3 | import entity.User; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 接口类 9 | * @author zhouxiaoxi 10 | */ 11 | public interface GetUserService { 12 | 13 | /** 14 | * 根据名称获取用户信息 15 | * @param name 名称 16 | * @return 17 | */ 18 | List getUserList(String name); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /dubboPractice/common/target/classes/entity/User.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/dubboPractice/common/target/classes/entity/User.class -------------------------------------------------------------------------------- /dubboPractice/common/target/classes/service/GetUserService.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/dubboPractice/common/target/classes/service/GetUserService.class -------------------------------------------------------------------------------- /dubboPractice/consumer/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 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 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /dubboPractice/consumer/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/dubboPractice/consumer/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /dubboPractice/consumer/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip 2 | -------------------------------------------------------------------------------- /dubboPractice/consumer/src/main/java/com/zhouxiaoxi/consumer/ConsumerApplication.java: -------------------------------------------------------------------------------- 1 | package com.zhouxiaoxi.consumer; 2 | 3 | import org.apache.dubbo.config.spring.context.annotation.EnableDubbo; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | 7 | @EnableDubbo 8 | @SpringBootApplication 9 | public class ConsumerApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(ConsumerApplication.class, args); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /dubboPractice/consumer/src/main/java/com/zhouxiaoxi/consumer/controller/GetUserController.java: -------------------------------------------------------------------------------- 1 | package com.zhouxiaoxi.consumer.controller; 2 | 3 | import entity.User; 4 | import org.apache.dubbo.config.annotation.Reference; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | import org.springframework.web.bind.annotation.RequestParam; 7 | import org.springframework.web.bind.annotation.RestController; 8 | import service.GetUserService; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * @author zhouxiaoxi 14 | */ 15 | @RestController 16 | public class GetUserController { 17 | 18 | @Reference 19 | GetUserService getUserService; 20 | 21 | @RequestMapping("getUserList") 22 | public List getUserList(@RequestParam("name") String name){ 23 | return getUserService.getUserList(name); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /dubboPractice/consumer/src/main/resources/application.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/dubboPractice/consumer/src/main/resources/application.yml -------------------------------------------------------------------------------- /dubboPractice/consumer/src/test/java/com/zhouxiaoxi/consumer/ConsumerApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.zhouxiaoxi.consumer; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class ConsumerApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /dubboPractice/provider/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 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 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /dubboPractice/provider/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/dubboPractice/provider/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /dubboPractice/provider/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip 2 | -------------------------------------------------------------------------------- /dubboPractice/provider/src/main/java/com/zhouxiaoxi/provider/ProviderApplication.java: -------------------------------------------------------------------------------- 1 | package com.zhouxiaoxi.provider; 2 | 3 | import org.apache.dubbo.config.spring.context.annotation.EnableDubbo; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | 7 | @EnableDubbo 8 | @SpringBootApplication 9 | public class ProviderApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(ProviderApplication.class, args); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /dubboPractice/provider/src/main/java/com/zhouxiaoxi/provider/service/impl/GetUserServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.zhouxiaoxi.provider.service.impl; 2 | 3 | import entity.User; 4 | import org.apache.dubbo.config.annotation.Service; 5 | import service.GetUserService; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | /** 11 | * 生产者实现类 12 | * @author zhouxiaoxi 13 | */ 14 | @Service 15 | public class GetUserServiceImpl implements GetUserService { 16 | 17 | @Override 18 | public List getUserList(String name) { 19 | //此处没有连接数据库,所以就先生成几条数据返回即可。 20 | System.out.println(name); 21 | List list = new ArrayList<>(); 22 | list.add(new User("小明",20)); 23 | list.add(new User("小强",21)); 24 | list.add(new User("小红",22)); 25 | return list; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /dubboPractice/provider/src/main/resources/application.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/dubboPractice/provider/src/main/resources/application.yml -------------------------------------------------------------------------------- /dubboPractice/provider/src/test/java/com/zhouxiaoxi/provider/ProviderApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.zhouxiaoxi.provider; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class ProviderApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /filter/src/main/java/com/zhouxiaoxi/filter/FilterApplication.java: -------------------------------------------------------------------------------- 1 | package com.zhouxiaoxi.filter; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.web.servlet.ServletComponentScan; 6 | 7 | /** 8 | * 过滤器等 9 | * @author zhouzhaodong 10 | */ 11 | @SpringBootApplication 12 | @ServletComponentScan 13 | public class FilterApplication { 14 | 15 | public static void main(String[] args) { 16 | SpringApplication.run(FilterApplication.class, args); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /filter/src/main/java/com/zhouxiaoxi/filter/controller/TestController.java: -------------------------------------------------------------------------------- 1 | package com.zhouxiaoxi.filter.controller; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | import org.springframework.web.bind.annotation.RestController; 6 | 7 | /** 8 | * @author zhouzhaodong 9 | */ 10 | @RestController 11 | @Slf4j 12 | public class TestController { 13 | 14 | @RequestMapping(value = "/hello") 15 | public void test(){ 16 | log.info("Hello World!"); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /filter/src/main/java/com/zhouxiaoxi/filter/util/FilterConfig.java: -------------------------------------------------------------------------------- 1 | package com.zhouxiaoxi.filter.util; 2 | 3 | import org.springframework.boot.web.servlet.FilterRegistrationBean; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | /** 8 | * 调用过滤器 9 | * @author zhouzhaodong 10 | */ 11 | @Configuration 12 | public class FilterConfig { 13 | @Bean 14 | public FilterRegistrationBean ResistFilter() { 15 | FilterRegistrationBean registration = new FilterRegistrationBean(); 16 | //当过滤器有注入其他bean类时,可直接通过@bean的方式进行实体类过滤器,这样不可自动注入过滤器使用的其他bean类。 17 | //当然,若无其他bean需要获取时,可直接new MyFilter(),也可使用getBean的方式。 18 | registration.setFilter(new MyFilter()); 19 | //过滤器名称 20 | registration.setName("customFilter"); 21 | //拦截路径 22 | registration.addUrlPatterns("/hello"); 23 | //设置顺序 24 | registration.setOrder(10); 25 | return registration; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /filter/src/main/java/com/zhouxiaoxi/filter/util/HttpLister.java: -------------------------------------------------------------------------------- 1 | package com.zhouxiaoxi.filter.util; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | 5 | import javax.servlet.annotation.WebListener; 6 | import javax.servlet.http.HttpSessionEvent; 7 | import javax.servlet.http.HttpSessionListener; 8 | 9 | /** 10 | * 监听器 11 | * httpSessionListener来实如今线人数的统计 12 | * @author zhouzhaodong 13 | */ 14 | @WebListener 15 | @Slf4j 16 | public class HttpLister implements HttpSessionListener { 17 | 18 | @Override 19 | public void sessionCreated(HttpSessionEvent se) { 20 | log.info("又有人上线了,统计一下总人数吧!"); 21 | } 22 | 23 | @Override 24 | public void sessionDestroyed(HttpSessionEvent se) { 25 | log.info("又有人下线了,统计一下总人数吧!"); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /filter/src/main/java/com/zhouxiaoxi/filter/util/MyFilter.java: -------------------------------------------------------------------------------- 1 | package com.zhouxiaoxi.filter.util; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | 5 | import javax.servlet.FilterConfig; 6 | import javax.servlet.*; 7 | import java.io.IOException; 8 | 9 | /** 10 | * 过滤器 11 | * @author zhouzhaodong 12 | */ 13 | @Slf4j 14 | public class MyFilter implements Filter { 15 | 16 | @Override 17 | public void init(FilterConfig filterConfig) throws ServletException { 18 | log.info("filter 初始化"); 19 | } 20 | 21 | @Override 22 | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) 23 | throws IOException, ServletException { 24 | // TODO Auto-generated method stub 25 | log.info("doFilter 请求处理"); 26 | //对request、response进行一些预处理 27 | // 比如设置请求编码 28 | // request.setCharacterEncoding("UTF-8"); 29 | // response.setCharacterEncoding("UTF-8"); 30 | //TODO 进行业务逻辑 31 | 32 | //链路 直接传给下一个过滤器 33 | chain.doFilter(request, response); 34 | } 35 | 36 | @Override 37 | public void destroy() { 38 | log.info("filter 销毁"); 39 | } 40 | 41 | } 42 | 43 | 44 | -------------------------------------------------------------------------------- /filter/src/main/java/com/zhouxiaoxi/filter/util/MyInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.zhouxiaoxi.filter.util; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | import org.springframework.web.servlet.HandlerInterceptor; 5 | import org.springframework.web.servlet.ModelAndView; 6 | 7 | import javax.servlet.http.HttpServletRequest; 8 | import javax.servlet.http.HttpServletResponse; 9 | 10 | /** 11 | * 自定义一个过滤器 12 | * @author zhouzhaodong 13 | */ 14 | @Slf4j 15 | public class MyInterceptor implements HandlerInterceptor { 16 | 17 | @Override 18 | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) 19 | throws Exception { 20 | log.info("preHandle:请求前调用"); 21 | //返回 false 则请求中断 22 | return true; 23 | } 24 | 25 | @Override 26 | public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, 27 | ModelAndView modelAndView) throws Exception { 28 | log.info("postHandle:请求后调用"); 29 | } 30 | 31 | @Override 32 | public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) 33 | throws Exception { 34 | log.info("afterCompletion:请求调用完成后回调方法,即在视图渲染完成后回调"); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /filter/src/main/java/com/zhouxiaoxi/filter/util/ServletLister.java: -------------------------------------------------------------------------------- 1 | package com.zhouxiaoxi.filter.util; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | 5 | import javax.servlet.ServletRequestEvent; 6 | import javax.servlet.ServletRequestListener; 7 | import javax.servlet.annotation.WebListener; 8 | 9 | /** 10 | * 监听器 11 | * servletRequestListener一般来实现web浏览量 12 | * @author zhouzhaodong 13 | */ 14 | @WebListener 15 | @Slf4j 16 | public class ServletLister implements ServletRequestListener { 17 | 18 | @Override 19 | public void requestDestroyed(ServletRequestEvent sre) { 20 | log.info("监听器:销毁"); 21 | } 22 | 23 | @Override 24 | public void requestInitialized(ServletRequestEvent sre) { 25 | log.info("监听器:初始化"); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /filter/src/main/java/com/zhouxiaoxi/filter/util/WebMvcConfigurer.java: -------------------------------------------------------------------------------- 1 | package com.zhouxiaoxi.filter.util; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.web.servlet.HandlerInterceptor; 5 | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; 6 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; 7 | 8 | /** 9 | * 注册拦截器 10 | * @author zhouzhaodong 11 | */ 12 | public class WebMvcConfigurer extends WebMvcConfigurationSupport { 13 | 14 | @Override 15 | public void addInterceptors(InterceptorRegistry registry) { 16 | //注册拦截器 拦截规则 17 | //多个拦截器时 以此添加 执行顺序按添加顺序 18 | registry.addInterceptor(getHandlerInterceptor()).addPathPatterns("/*"); 19 | } 20 | 21 | @Bean 22 | public static HandlerInterceptor getHandlerInterceptor() { 23 | return new MyInterceptor(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /filter/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8888 3 | -------------------------------------------------------------------------------- /html2Image/src/main/java/xyz/zhouzhaodong/html2image/Html2imageApplication.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.html2image; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Html2imageApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Html2imageApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /html2Image/src/main/java/xyz/zhouzhaodong/html2image/controller/TestController.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.html2image.controller; 2 | 3 | import org.springframework.web.bind.annotation.RequestMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | import xyz.zhouzhaodong.html2image.util.Html2Image; 6 | 7 | /** 8 | * 控制层 9 | * 10 | * @author zhouzhaodong 11 | */ 12 | @RestController 13 | public class TestController { 14 | 15 | @RequestMapping("/test") 16 | public String message(){ 17 | return Html2Image.html2Img("./m.jpg"); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /html2Image/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8888 -------------------------------------------------------------------------------- /html2Image/src/test/java/xyz/zhouzhaodong/html2image/Html2imageApplicationTests.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.html2image; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class Html2imageApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /jdbctemplate/src/main/java/xyz/zhouzhaodong/jdbctemplate/JdbctemplateApplication.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.jdbctemplate; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class JdbctemplateApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(JdbctemplateApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /jdbctemplate/src/main/java/xyz/zhouzhaodong/jdbctemplate/controller/StudyController.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.jdbctemplate.controller; 2 | 3 | import org.springframework.web.bind.annotation.*; 4 | import xyz.zhouzhaodong.jdbctemplate.entity.Study; 5 | import xyz.zhouzhaodong.jdbctemplate.service.StudyService; 6 | 7 | import javax.annotation.Resource; 8 | import java.util.List; 9 | 10 | /** 11 | * @author 10166815 12 | */ 13 | @RestController 14 | public class StudyController { 15 | 16 | @Resource 17 | StudyService studyService; 18 | 19 | @PutMapping("/study") 20 | public int addStudy(@RequestBody Study study) { 21 | return studyService.addStudy(study); 22 | } 23 | 24 | @DeleteMapping("/study") 25 | public int deleteStudy(@RequestParam int id){ 26 | return studyService.deleteStudy(id); 27 | } 28 | 29 | @PostMapping("/study") 30 | public int updateStudy(@RequestBody Study study){ 31 | return studyService.updateStudy(study); 32 | } 33 | 34 | @GetMapping("/study/{id}") 35 | public Study getStudyById(@PathVariable("id") int id){ 36 | return studyService.getStudyById(id); 37 | } 38 | 39 | @GetMapping("/study") 40 | public List getStudyList(){ 41 | return studyService.getStudyList(); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /jdbctemplate/src/main/java/xyz/zhouzhaodong/jdbctemplate/entity/Study.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.jdbctemplate.entity; 2 | 3 | /** 4 | * @author 10166815 5 | */ 6 | public class Study { 7 | 8 | private int id; 9 | 10 | private String name; 11 | 12 | private int age; 13 | 14 | private String address; 15 | 16 | public int getId() { 17 | return id; 18 | } 19 | 20 | public void setId(int id) { 21 | this.id = id; 22 | } 23 | 24 | public String getName() { 25 | return name; 26 | } 27 | 28 | public void setName(String name) { 29 | this.name = name; 30 | } 31 | 32 | public int getAge() { 33 | return age; 34 | } 35 | 36 | public void setAge(int age) { 37 | this.age = age; 38 | } 39 | 40 | public String getAddress() { 41 | return address; 42 | } 43 | 44 | public void setAddress(String address) { 45 | this.address = address; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /jdbctemplate/src/main/java/xyz/zhouzhaodong/jdbctemplate/service/StudyService.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.jdbctemplate.service; 2 | 3 | import org.springframework.stereotype.Service; 4 | import xyz.zhouzhaodong.jdbctemplate.entity.Study; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * @author 10166815 10 | */ 11 | public interface StudyService { 12 | 13 | /** 14 | * 新增 15 | * @param study 16 | * @return 17 | */ 18 | int addStudy(Study study); 19 | 20 | /** 21 | * 根据id删除 22 | * @param id 23 | * @return 24 | */ 25 | int deleteStudy(int id); 26 | 27 | /** 28 | * 更新 29 | * @param study 30 | * @return 31 | */ 32 | int updateStudy(Study study); 33 | 34 | /** 35 | * 根据id获取 36 | * @param id 37 | * @return 38 | */ 39 | Study getStudyById(int id); 40 | 41 | /** 42 | * 获取list 43 | * @return 44 | */ 45 | List getStudyList(); 46 | 47 | } 48 | -------------------------------------------------------------------------------- /jdbctemplate/src/main/resources/application.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/jdbctemplate/src/main/resources/application.yml -------------------------------------------------------------------------------- /jdbctemplate/src/test/java/xyz/zhouzhaodong/jdbctemplate/JdbctemplateApplicationTests.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.jdbctemplate; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class JdbctemplateApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /jooq/src/main/java/xyz/zhouzhaodong/jooq/JooqApplication.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.jooq; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class JooqApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(JooqApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /jooq/src/main/java/xyz/zhouzhaodong/jooq/controller/JooqController.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.jooq.controller; 2 | 3 | import org.springframework.web.bind.annotation.RequestMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | import xyz.zhouzhaodong.jooq.entity.JooqPojo; 6 | import xyz.zhouzhaodong.jooq.service.JooqService; 7 | 8 | import javax.annotation.Resource; 9 | 10 | /** 11 | * 控制层 12 | * 13 | * @author zhouzhaodong 14 | */ 15 | @RestController 16 | public class JooqController { 17 | 18 | @Resource 19 | JooqService jooqService; 20 | 21 | @RequestMapping("/selectByName") 22 | public JooqPojo selectByName(String name) { 23 | return jooqService.selectByName(name); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /jooq/src/main/java/xyz/zhouzhaodong/jooq/dao/DefaultCatalog.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is generated by jOOQ. 3 | */ 4 | package xyz.zhouzhaodong.jooq.dao; 5 | 6 | 7 | import java.util.Arrays; 8 | import java.util.List; 9 | 10 | import org.jooq.Schema; 11 | import org.jooq.impl.CatalogImpl; 12 | 13 | 14 | /** 15 | * This class is generated by jOOQ. 16 | */ 17 | @SuppressWarnings({ "all", "unchecked", "rawtypes" }) 18 | public class DefaultCatalog extends CatalogImpl { 19 | 20 | private static final long serialVersionUID = -1783878802; 21 | 22 | /** 23 | * The reference instance of DEFAULT_CATALOG 24 | */ 25 | public static final DefaultCatalog DEFAULT_CATALOG = new DefaultCatalog(); 26 | 27 | /** 28 | * The schema jooq. 29 | */ 30 | public final Jooq JOOQ = Jooq.JOOQ; 31 | 32 | /** 33 | * No further instances allowed 34 | */ 35 | private DefaultCatalog() { 36 | super(""); 37 | } 38 | 39 | @Override 40 | public final List getSchemas() { 41 | return Arrays.asList( 42 | Jooq.JOOQ); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /jooq/src/main/java/xyz/zhouzhaodong/jooq/dao/Jooq.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is generated by jOOQ. 3 | */ 4 | package xyz.zhouzhaodong.jooq.dao; 5 | 6 | 7 | import java.util.Arrays; 8 | import java.util.List; 9 | 10 | import org.jooq.Catalog; 11 | import org.jooq.Table; 12 | import org.jooq.impl.SchemaImpl; 13 | 14 | 15 | /** 16 | * This class is generated by jOOQ. 17 | */ 18 | @SuppressWarnings({ "all", "unchecked", "rawtypes" }) 19 | public class Jooq extends SchemaImpl { 20 | 21 | private static final long serialVersionUID = -923737812; 22 | 23 | /** 24 | * The reference instance of jooq 25 | */ 26 | public static final Jooq JOOQ = new Jooq(); 27 | 28 | /** 29 | * The table jooq.jooq. 30 | */ 31 | public final xyz.zhouzhaodong.jooq.dao.tables.Jooq JOOQ_ = xyz.zhouzhaodong.jooq.dao.tables.Jooq.JOOQ_; 32 | 33 | /** 34 | * No further instances allowed 35 | */ 36 | private Jooq() { 37 | super("jooq", null); 38 | } 39 | 40 | 41 | @Override 42 | public Catalog getCatalog() { 43 | return DefaultCatalog.DEFAULT_CATALOG; 44 | } 45 | 46 | @Override 47 | public final List> getTables() { 48 | return Arrays.>asList( 49 | xyz.zhouzhaodong.jooq.dao.tables.Jooq.JOOQ_); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /jooq/src/main/java/xyz/zhouzhaodong/jooq/dao/Tables.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is generated by jOOQ. 3 | */ 4 | package xyz.zhouzhaodong.jooq.dao; 5 | 6 | 7 | import xyz.zhouzhaodong.jooq.dao.tables.Jooq; 8 | 9 | 10 | /** 11 | * Convenience access to all tables in jooq 12 | */ 13 | @SuppressWarnings({ "all", "unchecked", "rawtypes" }) 14 | public class Tables { 15 | 16 | /** 17 | * The table jooq.jooq. 18 | */ 19 | public static final Jooq JOOQ_ = Jooq.JOOQ_; 20 | } 21 | -------------------------------------------------------------------------------- /jooq/src/main/java/xyz/zhouzhaodong/jooq/entity/JooqPojo.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.jooq.entity; 2 | 3 | /** 4 | * 实体类 5 | * 6 | * @author zhouzhaodong 7 | */ 8 | public class JooqPojo { 9 | 10 | private String name; 11 | 12 | private Integer age; 13 | 14 | private String address; 15 | 16 | public String getName() { 17 | return name; 18 | } 19 | 20 | public void setName(String name) { 21 | this.name = name; 22 | } 23 | 24 | public Integer getAge() { 25 | return age; 26 | } 27 | 28 | public void setAge(Integer age) { 29 | this.age = age; 30 | } 31 | 32 | public String getAddress() { 33 | return address; 34 | } 35 | 36 | public void setAddress(String address) { 37 | this.address = address; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /jooq/src/main/java/xyz/zhouzhaodong/jooq/service/JooqService.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.jooq.service; 2 | 3 | 4 | import xyz.zhouzhaodong.jooq.entity.JooqPojo; 5 | 6 | /** 7 | * @author zhouzhaodong 8 | */ 9 | public interface JooqService { 10 | 11 | /** 12 | * 根据姓名查询 13 | * @param name 14 | * @return 15 | */ 16 | JooqPojo selectByName(String name); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /jooq/src/main/java/xyz/zhouzhaodong/jooq/service/impl/JooqServiceImpl.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.jooq.service.impl; 2 | 3 | import org.jooq.DSLContext; 4 | import org.jooq.Record; 5 | import org.jooq.Result; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | import xyz.zhouzhaodong.jooq.dao.tables.Jooq; 9 | import xyz.zhouzhaodong.jooq.entity.JooqPojo; 10 | import xyz.zhouzhaodong.jooq.service.JooqService; 11 | 12 | import javax.annotation.Resource; 13 | 14 | /** 15 | * @author zhouzhaodong 16 | */ 17 | @Service 18 | public class JooqServiceImpl implements JooqService { 19 | 20 | @Resource 21 | DSLContext dslContext; 22 | 23 | Jooq jooq = Jooq.JOOQ_.as("jooq"); 24 | 25 | @Override 26 | public JooqPojo selectByName(String name) { 27 | return dslContext.select() 28 | .from(jooq) 29 | .where(jooq.NAME.eq(name)).fetchAny(r -> r.into(JooqPojo.class)); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /jooq/src/main/java/xyz/zhouzhaodong/jooq/sql/jooq.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Navicat Premium Data Transfer 3 | 4 | Source Server : 腾讯云 5 | Source Server Type : MySQL 6 | Source Server Version : 80020 7 | Source Host : 122.51.202.242:3306 8 | Source Schema : jooq 9 | 10 | Target Server Type : MySQL 11 | Target Server Version : 80020 12 | File Encoding : 65001 13 | 14 | Date: 24/08/2020 09:26:30 15 | */ 16 | 17 | SET NAMES utf8mb4; 18 | SET FOREIGN_KEY_CHECKS = 0; 19 | 20 | -- ---------------------------- 21 | -- Table structure for jooq 22 | -- ---------------------------- 23 | DROP TABLE IF EXISTS `jooq`; 24 | CREATE TABLE `jooq` ( 25 | `name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL, 26 | `age` int NULL DEFAULT NULL, 27 | `address` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL, 28 | `id` int NOT NULL, 29 | PRIMARY KEY (`id`) USING BTREE 30 | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic; 31 | 32 | SET FOREIGN_KEY_CHECKS = 1; 33 | -------------------------------------------------------------------------------- /jooq/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 9999 # 端口号 3 | spring: 4 | # 数据库连接信息 5 | datasource: 6 | url: jdbc:mysql://IP地址:3306/jooq?useUnicode=true&characterEncoding=utf8 7 | username: 用户名 8 | password: 密码 9 | -------------------------------------------------------------------------------- /jpa/src/main/java/xyz/zhouzhaodong/www/jpa/JpaApplication.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.www.jpa; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class JpaApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(JpaApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /jpa/src/main/java/xyz/zhouzhaodong/www/jpa/dao/StudyDao.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.www.jpa.dao; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | import xyz.zhouzhaodong.www.jpa.entity.Study; 5 | 6 | /** 7 | * @author 10166815 8 | */ 9 | public interface StudyDao extends JpaRepository { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /jpa/src/main/java/xyz/zhouzhaodong/www/jpa/entity/Study.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.www.jpa.entity; 2 | 3 | import lombok.Data; 4 | 5 | import javax.persistence.Entity; 6 | import javax.persistence.GeneratedValue; 7 | import javax.persistence.GenerationType; 8 | import javax.persistence.Id; 9 | 10 | /** 11 | * @author 10166815 12 | */ 13 | @Data 14 | @Entity 15 | public class Study { 16 | 17 | @Id 18 | @GeneratedValue(strategy = GenerationType.IDENTITY) 19 | private int id; 20 | 21 | private String name; 22 | 23 | private int age; 24 | 25 | private String address; 26 | 27 | } 28 | -------------------------------------------------------------------------------- /jpa/src/main/java/xyz/zhouzhaodong/www/jpa/service/StudyService.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.www.jpa.service; 2 | 3 | import org.springframework.stereotype.Service; 4 | import xyz.zhouzhaodong.www.jpa.entity.Study; 5 | 6 | import java.util.List; 7 | import java.util.Optional; 8 | 9 | /** 10 | * @author 10166815 11 | */ 12 | @Service 13 | public interface StudyService { 14 | 15 | /** 16 | * 新增 17 | * @param study 18 | * @return 19 | */ 20 | String addStudy(Study study); 21 | 22 | /** 23 | * 根据id删除 24 | * @param id 25 | * @return 26 | */ 27 | void deleteStudy(int id); 28 | 29 | /** 30 | * 更新 31 | * @param study 32 | * @return 33 | */ 34 | Study updateStudy(Study study); 35 | 36 | /** 37 | * 根据id查询 38 | * @param id 39 | * @return 40 | */ 41 | Optional getStudyById(int id); 42 | 43 | /** 44 | * 查询所有 45 | * @return 46 | */ 47 | List getStudyList(); 48 | 49 | } 50 | -------------------------------------------------------------------------------- /jpa/src/test/java/xyz/zhouzhaodong/www/jpa/JpaApplicationTests.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.www.jpa; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class JpaApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /mongodb/src/main/java/com/example/mongodb/MongodbApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.mongodb; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class MongodbApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(MongodbApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /mongodb/src/main/java/com/example/mongodb/entity/User.java: -------------------------------------------------------------------------------- 1 | package com.example.mongodb.entity; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | @Data 8 | public class User implements Serializable { 9 | 10 | /** 11 | * id主键 12 | */ 13 | private Integer id; 14 | 15 | /** 16 | * 用户名 17 | */ 18 | private String name; 19 | 20 | /** 21 | * 年龄 22 | */ 23 | private Integer age; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /mongodb/src/main/java/com/example/mongodb/repository/UserRepository.java: -------------------------------------------------------------------------------- 1 | package com.example.mongodb.repository; 2 | 3 | import com.example.mongodb.entity.User; 4 | import org.springframework.data.mongodb.repository.MongoRepository; 5 | 6 | import java.util.List; 7 | 8 | public interface UserRepository extends MongoRepository { 9 | 10 | /** 11 | * 根据姓名进行查询 12 | * @param name 13 | * @return 14 | */ 15 | User findByName(String name); 16 | 17 | /** 18 | * 根据姓名进行模糊查询 19 | * @param name 20 | * @return 21 | */ 22 | List findByNameLike(String name); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /mongodb/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | data: 3 | mongodb: 4 | uri: mongodb://localhost:27017/test 5 | -------------------------------------------------------------------------------- /mybatis/src/main/java/xyz/zhouzhaodong/mybatis/MybatisApplication.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.mybatis; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class MybatisApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(MybatisApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /mybatis/src/main/java/xyz/zhouzhaodong/mybatis/entity/Study.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.mybatis.entity; 2 | 3 | /** 4 | * @author 10166815 5 | */ 6 | public class Study { 7 | 8 | private int id; 9 | 10 | private String name; 11 | 12 | private int age; 13 | 14 | private String address; 15 | 16 | public int getId() { 17 | return id; 18 | } 19 | 20 | public void setId(int id) { 21 | this.id = id; 22 | } 23 | 24 | public String getName() { 25 | return name; 26 | } 27 | 28 | public void setName(String name) { 29 | this.name = name; 30 | } 31 | 32 | public int getAge() { 33 | return age; 34 | } 35 | 36 | public void setAge(int age) { 37 | this.age = age; 38 | } 39 | 40 | public String getAddress() { 41 | return address; 42 | } 43 | 44 | public void setAddress(String address) { 45 | this.address = address; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /mybatis/src/main/resources/application.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/mybatis/src/main/resources/application.yml -------------------------------------------------------------------------------- /mybatisplus-pagination/src/main/java/com/zhouzhaodong/pagination/MybatisplusPaginationApplication.java: -------------------------------------------------------------------------------- 1 | package com.zhouzhaodong.pagination; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class MybatisplusPaginationApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(MybatisplusPaginationApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /mybatisplus-pagination/src/main/java/com/zhouzhaodong/pagination/config/MybatisPlusConfig.java: -------------------------------------------------------------------------------- 1 | package com.zhouzhaodong.pagination.config; 2 | 3 | import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; 4 | import org.mybatis.spring.annotation.MapperScan; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | 8 | @Configuration 9 | @MapperScan("com.zhouzhaodong.pagehelper.mapper") 10 | public class MybatisPlusConfig { 11 | 12 | /** 13 | * 分页插件 14 | */ 15 | @Bean 16 | public PaginationInterceptor paginationInterceptor() { 17 | PaginationInterceptor paginationInterceptor = new PaginationInterceptor(); 18 | paginationInterceptor.setDialectType("mysql"); 19 | return paginationInterceptor; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /mybatisplus-pagination/src/main/java/com/zhouzhaodong/pagination/entity/Student.java: -------------------------------------------------------------------------------- 1 | package com.zhouzhaodong.pagination.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableField; 4 | import java.io.Serializable; 5 | import lombok.Data; 6 | import lombok.EqualsAndHashCode; 7 | import lombok.experimental.Accessors; 8 | 9 | /** 10 | *

11 | * 12 | *

13 | * 14 | * @author jobob 15 | * @since 2019-06-04 16 | */ 17 | @Data 18 | @EqualsAndHashCode(callSuper = false) 19 | @Accessors(chain = true) 20 | public class Student implements Serializable { 21 | 22 | private static final long serialVersionUID = 1L; 23 | 24 | private Integer id; 25 | 26 | @TableField("NAME") 27 | private String name; 28 | 29 | 30 | } 31 | -------------------------------------------------------------------------------- /mybatisplus-pagination/src/main/java/com/zhouzhaodong/pagination/mapper/StudentMapper.java: -------------------------------------------------------------------------------- 1 | package com.zhouzhaodong.pagination.mapper; 2 | 3 | import com.zhouzhaodong.pagination.entity.Student; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | *

9 | * Mapper 接口 10 | *

11 | * 12 | * @author jobob 13 | * @since 2019-06-04 14 | */ 15 | @Mapper 16 | public interface StudentMapper extends BaseMapper { 17 | 18 | } 19 | -------------------------------------------------------------------------------- /mybatisplus-pagination/src/main/java/com/zhouzhaodong/pagination/service/IStudentService.java: -------------------------------------------------------------------------------- 1 | package com.zhouzhaodong.pagination.service; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | import com.zhouzhaodong.pagination.entity.Student; 6 | 7 | /** 8 | *

9 | * 服务类 10 | *

11 | * 12 | * @author jobob 13 | * @since 2019-06-04 14 | */ 15 | public interface IStudentService extends IService { 16 | 17 | Object findList(IPage page); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /mybatisplus-pagination/src/main/java/com/zhouzhaodong/pagination/service/impl/StudentServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.zhouzhaodong.pagination.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 6 | import com.zhouzhaodong.pagination.entity.Student; 7 | import com.zhouzhaodong.pagination.mapper.StudentMapper; 8 | import com.zhouzhaodong.pagination.service.IStudentService; 9 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 10 | import org.springframework.stereotype.Service; 11 | 12 | /** 13 | *

14 | * 服务实现类 15 | *

16 | * 17 | * @author jobob 18 | * @since 2019-06-04 19 | */ 20 | @Service 21 | public class StudentServiceImpl extends ServiceImpl implements IStudentService { 22 | 23 | @Override 24 | public Object findList(IPage page) { 25 | QueryWrapper wrapper = new QueryWrapper<>(); 26 | IPage userIPage = baseMapper.selectPage(page, wrapper); 27 | return userIPage; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /mybatisplus-pagination/src/main/resources/application.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/mybatisplus-pagination/src/main/resources/application.yml -------------------------------------------------------------------------------- /mybatisplus-pagination/src/main/resources/mapper/StudentMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /mybatisplus-pagination/src/test/java/com/zhouzhaodong/pagination/MybatisplusPaginationApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.zhouzhaodong.pagination; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class MybatisplusPaginationApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /querydsl/src/main/java/xyz/zhouzhaodong/querydsl/QuerydslApplication.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.querydsl; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * @author zhouzhaodong 8 | */ 9 | @SpringBootApplication 10 | public class QuerydslApplication { 11 | 12 | public static void main(String[] args) { 13 | SpringApplication.run(QuerydslApplication.class, args); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /querydsl/src/main/java/xyz/zhouzhaodong/querydsl/config/PeopleQueryConfig.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.querydsl.config; 2 | 3 | import com.querydsl.jpa.impl.JPAQueryFactory; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | import javax.persistence.EntityManager; 8 | 9 | /** 10 | * JPAQueryFactory Bean 11 | * @author zhouzhaodong 12 | */ 13 | @Configuration 14 | public class PeopleQueryConfig { 15 | @Bean 16 | public JPAQueryFactory jpaQuery(EntityManager entityManager) { 17 | return new JPAQueryFactory(entityManager); 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /querydsl/src/main/java/xyz/zhouzhaodong/querydsl/controller/PeopleController.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.querydsl.controller; 2 | 3 | import org.springframework.web.bind.annotation.RequestMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | import xyz.zhouzhaodong.querydsl.entity.People; 6 | import xyz.zhouzhaodong.querydsl.service.PeopleService; 7 | 8 | import javax.annotation.Resource; 9 | 10 | /** 11 | * controller 12 | * @author zhouzhaodong 13 | */ 14 | @RestController 15 | public class PeopleController { 16 | 17 | @Resource 18 | PeopleService peopleService; 19 | 20 | @RequestMapping("/selectById") 21 | public People selectById(){ 22 | return peopleService.selectOne(0); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /querydsl/src/main/java/xyz/zhouzhaodong/querydsl/entity/People.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.querydsl.entity; 2 | 3 | 4 | import javax.persistence.*; 5 | 6 | /** 7 | * 实体类 8 | * @author zhouzhaodong 9 | */ 10 | @Entity 11 | @Table(name="people") 12 | public class People { 13 | 14 | @Id 15 | @Column(name="id") 16 | @GeneratedValue 17 | private Integer id; 18 | 19 | @Column(name="name") 20 | private String name; 21 | 22 | @Column(name="age") 23 | private Integer age; 24 | 25 | @Column(name="address") 26 | private String address; 27 | 28 | public Integer getId() { 29 | return id; 30 | } 31 | 32 | public void setId(Integer id) { 33 | this.id = id; 34 | } 35 | 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | 44 | public Integer getAge() { 45 | return age; 46 | } 47 | 48 | public void setAge(Integer age) { 49 | this.age = age; 50 | } 51 | 52 | public String getAddress() { 53 | return address; 54 | } 55 | 56 | public void setAddress(String address) { 57 | this.address = address; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /querydsl/src/main/java/xyz/zhouzhaodong/querydsl/repository/PeopleRepository.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.querydsl.repository; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | import xyz.zhouzhaodong.querydsl.entity.People; 5 | 6 | /** 7 | * 实现jpaRepository 8 | * @author zhouzhaodong 9 | */ 10 | public interface PeopleRepository extends JpaRepository { 11 | } 12 | -------------------------------------------------------------------------------- /querydsl/src/main/java/xyz/zhouzhaodong/querydsl/service/PeopleService.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.querydsl.service; 2 | 3 | import xyz.zhouzhaodong.querydsl.entity.People; 4 | 5 | /** 6 | * service 7 | * @author zhouzhaodong 8 | */ 9 | public interface PeopleService { 10 | 11 | /** 12 | * 根据id查询 13 | * @param id 14 | * @return 15 | */ 16 | People selectOne(Integer id); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /querydsl/src/main/java/xyz/zhouzhaodong/querydsl/service/impl/PeopleServiceImpl.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.querydsl.service.impl; 2 | 3 | import com.querydsl.jpa.impl.JPAQueryFactory; 4 | import org.springframework.stereotype.Service; 5 | import xyz.zhouzhaodong.querydsl.entity.People; 6 | import xyz.zhouzhaodong.querydsl.entity.QPeople; 7 | import xyz.zhouzhaodong.querydsl.service.PeopleService; 8 | 9 | import javax.annotation.Resource; 10 | 11 | /** 12 | * serviceImpl 13 | * @author zhouzhaodong 14 | */ 15 | @Service 16 | public class PeopleServiceImpl implements PeopleService { 17 | 18 | @Resource 19 | JPAQueryFactory queryFactory; 20 | 21 | @Override 22 | public People selectOne(Integer id) { 23 | QPeople people = QPeople.people; 24 | return queryFactory.selectFrom(people).where(people.id.eq(id)).fetchOne(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /querydsl/src/main/resources/application.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/querydsl/src/main/resources/application.yml -------------------------------------------------------------------------------- /redis/src/main/java/com/zhouxiaoxi/redis/RedisApplication.java: -------------------------------------------------------------------------------- 1 | package com.zhouxiaoxi.redis; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * springboot启动 8 | * @author zhouzhaodong 9 | */ 10 | @SpringBootApplication 11 | public class RedisApplication { 12 | 13 | public static void main(String[] args) { 14 | SpringApplication.run(RedisApplication.class, args); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /redis/src/main/java/com/zhouxiaoxi/redis/util/RedisDao.java: -------------------------------------------------------------------------------- 1 | package com.zhouxiaoxi.redis.util; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.data.redis.core.StringRedisTemplate; 5 | import org.springframework.data.redis.core.ValueOperations; 6 | import org.springframework.stereotype.Repository; 7 | 8 | /** 9 | * redis访问层 10 | * @author zhouzhaodong 11 | */ 12 | @Repository 13 | public class RedisDao { 14 | 15 | @Autowired 16 | private StringRedisTemplate template; 17 | 18 | /** 19 | * 新增redis缓存 20 | * @param key 21 | * @param value 22 | */ 23 | public void setKey(String key, String value){ 24 | ValueOperations ops = template.opsForValue(); 25 | ops.set(key,value,1); 26 | } 27 | 28 | /** 29 | * 获取对应key的缓存 30 | * @param key 31 | * @return 32 | */ 33 | public String getValue(String key){ 34 | ValueOperations ops = template.opsForValue(); 35 | return ops.get(key); 36 | } 37 | 38 | /** 39 | * 删除对应key的缓存 40 | * @param key 41 | * @return 42 | */ 43 | public void delValue(String key){ 44 | template.delete(key); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /redis/src/main/resources/application.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/redis/src/main/resources/application.yml -------------------------------------------------------------------------------- /redis/src/test/java/com/zhouxiaoxi/redis/RedisApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.zhouxiaoxi.redis; 2 | 3 | import com.zhouxiaoxi.redis.util.RedisDao; 4 | import org.junit.Test; 5 | import org.junit.runner.RunWith; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.boot.test.context.SpringBootTest; 10 | import org.springframework.test.context.junit4.SpringRunner; 11 | 12 | @RunWith(SpringRunner.class) 13 | @SpringBootTest 14 | public class RedisApplicationTests { 15 | 16 | public static Logger logger= LoggerFactory.getLogger(RedisApplicationTests.class); 17 | 18 | @Test 19 | public void contextLoads() { 20 | } 21 | 22 | @Autowired 23 | RedisDao redisDao; 24 | @Test 25 | public void testRedis(){ 26 | redisDao.setKey("name","forezp"); 27 | redisDao.setKey("age","11"); 28 | logger.info(redisDao.getValue("name")); 29 | logger.info(redisDao.getValue("age")); 30 | redisDao.delValue("age"); 31 | logger.info(redisDao.getValue("age")); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /redis_geo/src/main/java/xyz/zhouzhaodong/redis_geo/RedisGeoApplication.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.redis_geo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class RedisGeoApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(RedisGeoApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /redis_geo/src/main/java/xyz/zhouzhaodong/redis_geo/entity/ServiceStation.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.redis_geo.entity; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | import java.io.Serializable; 9 | 10 | /** 11 | * 油站实体类 12 | * @author zhouzhaodong 13 | */ 14 | @Data 15 | @Builder 16 | @NoArgsConstructor 17 | @AllArgsConstructor 18 | public class ServiceStation implements Serializable { 19 | 20 | /** 油站 */ 21 | private String serviceStationName; 22 | 23 | /** 经度 */ 24 | private Double longitude; 25 | 26 | /** 纬度 */ 27 | private Double latitude; 28 | 29 | } 30 | -------------------------------------------------------------------------------- /redis_geo/src/main/resources/application.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/redis_geo/src/main/resources/application.yml -------------------------------------------------------------------------------- /repeat-submission/src/main/java/xyz/zhouzhaodong/repeatsubmission/RepeatSubmissionApplication.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.repeatsubmission; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class RepeatSubmissionApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(RepeatSubmissionApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /repeat-submission/src/main/java/xyz/zhouzhaodong/repeatsubmission/controller/TestController.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.repeatsubmission.controller; 2 | 3 | import org.springframework.web.bind.annotation.RequestMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | import xyz.zhouzhaodong.repeatsubmission.util.NoRepeatSubmit; 6 | import xyz.zhouzhaodong.repeatsubmission.util.RestMessage; 7 | 8 | /** 9 | * 测试 10 | * @author zhouzhaodong 11 | */ 12 | @RestController 13 | @RequestMapping("/test") 14 | public class TestController { 15 | 16 | /** 17 | * 添加防重复提交注解 18 | * @return 19 | */ 20 | @NoRepeatSubmit 21 | @RequestMapping("/one") 22 | public RestMessage test(){ 23 | return new RestMessage(0, "测试通过"); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /repeat-submission/src/main/java/xyz/zhouzhaodong/repeatsubmission/util/NoRepeatSubmit.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.repeatsubmission.util; 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 | * @apiNote @Target(ElementType.METHOD) 作用到方法上 11 | * @apiNote @Retention(RetentionPolicy.RUNTIME) 只有运行时有效 12 | * @author zhouzhaodong 13 | */ 14 | @Target(ElementType.METHOD) 15 | @Retention(RetentionPolicy.RUNTIME) 16 | public @interface NoRepeatSubmit { 17 | 18 | } 19 | -------------------------------------------------------------------------------- /repeat-submission/src/main/java/xyz/zhouzhaodong/repeatsubmission/util/RestMessage.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.repeatsubmission.util; 2 | 3 | /** 4 | * 返回信息 5 | * 6 | * @author zhouzhaodong 7 | */ 8 | public class RestMessage { 9 | 10 | private int code; 11 | 12 | private String message; 13 | 14 | private Object data; 15 | 16 | public int getCode() { 17 | return code; 18 | } 19 | 20 | public void setCode(int code) { 21 | this.code = code; 22 | } 23 | 24 | public String getMessage() { 25 | return message; 26 | } 27 | 28 | public void setMessage(String message) { 29 | this.message = message; 30 | } 31 | 32 | public Object getData() { 33 | return data; 34 | } 35 | 36 | public void setData(Object data) { 37 | this.data = data; 38 | } 39 | 40 | public RestMessage(int code, String message, Object data) { 41 | this.code = code; 42 | this.message = message; 43 | this.data = data; 44 | } 45 | 46 | public RestMessage(int code, String message) { 47 | this.code = code; 48 | this.message = message; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /repeat-submission/src/main/resources/application.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/repeat-submission/src/main/resources/application.yml -------------------------------------------------------------------------------- /sharding/src/main/java/xyz/zhouzhaodong/sharding/ShardingApplication.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.sharding; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * 启动类 8 | * 9 | * @author zhouzhaodong 10 | */ 11 | @SpringBootApplication 12 | public class ShardingApplication { 13 | 14 | public static void main(String[] args) { 15 | SpringApplication.run(ShardingApplication.class, args); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /sharding/src/main/java/xyz/zhouzhaodong/sharding/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.sharding.controller; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.web.bind.annotation.GetMapping; 5 | import org.springframework.web.bind.annotation.PostMapping; 6 | import org.springframework.web.bind.annotation.RestController; 7 | import xyz.zhouzhaodong.sharding.entity.User; 8 | import xyz.zhouzhaodong.sharding.service.UserService; 9 | 10 | import javax.annotation.Resource; 11 | 12 | /** 13 | * 控制层 14 | * 15 | * @author zhouzhaodong 16 | */ 17 | @RestController 18 | public class UserController { 19 | 20 | @Resource 21 | private UserService userService; 22 | 23 | @GetMapping("/users") 24 | public Object list() { 25 | return userService.list(); 26 | } 27 | 28 | @PostMapping("/add") 29 | public Object add(String name, String city) { 30 | User user = new User(); 31 | user.setCity(city); 32 | user.setName(name); 33 | return userService.addUser(user); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /sharding/src/main/java/xyz/zhouzhaodong/sharding/entity/User.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.sharding.entity; 2 | 3 | import javax.persistence.*; 4 | import java.io.Serializable; 5 | 6 | /** 7 | * 实体类 8 | * 9 | * @author zhouzhaodong 10 | */ 11 | @Entity 12 | @Table(name = "user") 13 | public class User implements Serializable { 14 | 15 | @Id 16 | @GeneratedValue(strategy = GenerationType.IDENTITY) 17 | private Long id; 18 | 19 | private String city; 20 | 21 | private String name; 22 | 23 | public Long getId() { 24 | return id; 25 | } 26 | 27 | public void setId(Long id) { 28 | this.id = id; 29 | } 30 | 31 | public String getCity() { 32 | return city; 33 | } 34 | 35 | public void setCity(String city) { 36 | this.city = city; 37 | } 38 | 39 | public String getName() { 40 | return name; 41 | } 42 | 43 | public void setName(String name) { 44 | this.name = name; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /sharding/src/main/java/xyz/zhouzhaodong/sharding/repository/UserRepository.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.sharding.repository; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | import org.springframework.stereotype.Repository; 5 | import xyz.zhouzhaodong.sharding.entity.User; 6 | 7 | /** 8 | * 数据访问层 9 | * 10 | * @author zhouzhaodong 11 | */ 12 | @Repository 13 | public interface UserRepository extends JpaRepository { 14 | } 15 | -------------------------------------------------------------------------------- /sharding/src/main/java/xyz/zhouzhaodong/sharding/service/UserService.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.sharding.service; 2 | 3 | import xyz.zhouzhaodong.sharding.entity.User; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 服务层 9 | * 10 | * @author zhouzhaodong 11 | */ 12 | public interface UserService { 13 | 14 | /** 15 | * 新增 16 | * 17 | * @param user 18 | * @return 19 | */ 20 | User addUser(User user); 21 | 22 | /** 23 | * 查询所有 24 | * 25 | * @return 26 | */ 27 | List list(); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /sharding/src/main/java/xyz/zhouzhaodong/sharding/service/impl/UserServiceImpl.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.sharding.service.impl; 2 | 3 | import org.springframework.stereotype.Service; 4 | import xyz.zhouzhaodong.sharding.entity.User; 5 | import xyz.zhouzhaodong.sharding.repository.UserRepository; 6 | import xyz.zhouzhaodong.sharding.service.UserService; 7 | 8 | import javax.annotation.Resource; 9 | import java.util.List; 10 | 11 | /** 12 | * 服务层实现类 13 | * 14 | * @author zhouzhaodong 15 | */ 16 | @Service 17 | public class UserServiceImpl implements UserService { 18 | 19 | @Resource 20 | UserRepository userRepository; 21 | 22 | @Override 23 | public User addUser(User user) { 24 | 25 | // 强制路由主库 26 | // HintManager.getInstance().setMasterRouteOnly(); 27 | return userRepository.save(user); 28 | } 29 | 30 | @Override 31 | public List list() { 32 | return userRepository.findAll(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /spring-boot-delayqueue/src/main/java/xyz/zhouzhaodong/springbootdelayqueue/SpringBootDelayqueueApplication.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.springbootdelayqueue; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringBootDelayqueueApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringBootDelayqueueApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /spring-boot-delayqueue/src/main/java/xyz/zhouzhaodong/springbootdelayqueue/controller/CancelOrderController.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.springbootdelayqueue.controller; 2 | 3 | import org.springframework.web.bind.annotation.RequestMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | import xyz.zhouzhaodong.springbootdelayqueue.service.CancelOrderService; 6 | 7 | import javax.annotation.Resource; 8 | 9 | /** 10 | * 控制器 11 | * @author zhouzhaodong 12 | */ 13 | @RestController 14 | public class CancelOrderController { 15 | 16 | @Resource 17 | CancelOrderService cancelOrderService; 18 | 19 | @RequestMapping("/") 20 | public void cancelOrder(){ 21 | cancelOrderService.getOrder(); 22 | cancelOrderService.cancelOrder(); 23 | } 24 | 25 | @RequestMapping("/queue") 26 | public void getOrder(){ 27 | cancelOrderService.getOrder(); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /spring-boot-delayqueue/src/main/java/xyz/zhouzhaodong/springbootdelayqueue/service/CancelOrderService.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.springbootdelayqueue.service; 2 | 3 | import xyz.zhouzhaodong.springbootdelayqueue.vo.Order; 4 | 5 | import java.util.concurrent.DelayQueue; 6 | 7 | /** 8 | * 取消订单service类 9 | * @author zhouzhaodong 10 | */ 11 | public interface CancelOrderService { 12 | 13 | /** 14 | * 取消订单 15 | */ 16 | void cancelOrder(); 17 | 18 | /** 19 | * 获取队列 20 | * @return 21 | */ 22 | DelayQueue getOrder(); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /spring-boot-delayqueue/src/main/resources/application.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/spring-boot-delayqueue/src/main/resources/application.yml -------------------------------------------------------------------------------- /spring-boot-druid/src/main/java/xyz/zhouzhaodong/springbootdruid/SpringBootDruidApplication.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.springbootdruid; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringBootDruidApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringBootDruidApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /spring-boot-druid/src/main/java/xyz/zhouzhaodong/springbootdruid/controller/PersonController.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.springbootdruid.controller; 2 | 3 | import org.springframework.web.bind.annotation.RequestMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | import xyz.zhouzhaodong.springbootdruid.entity.Person; 6 | import xyz.zhouzhaodong.springbootdruid.jpa.PersonRepository; 7 | 8 | import javax.annotation.Resource; 9 | import java.util.List; 10 | 11 | /** 12 | * @author zhouzhaodong 13 | */ 14 | @RestController 15 | public class PersonController { 16 | 17 | @Resource 18 | PersonRepository personRepository; 19 | 20 | @RequestMapping("/getAll") 21 | public List getAll(){ 22 | return personRepository.findAll(); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /spring-boot-druid/src/main/java/xyz/zhouzhaodong/springbootdruid/entity/Person.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.springbootdruid.entity; 2 | 3 | import javax.persistence.Column; 4 | import javax.persistence.Entity; 5 | import javax.persistence.GeneratedValue; 6 | import javax.persistence.Id; 7 | 8 | /** 9 | * 实体类 10 | * @author zhouzhaodong 11 | */ 12 | @Entity 13 | public class Person { 14 | 15 | @Id 16 | @GeneratedValue 17 | private Integer id; 18 | 19 | @Column(nullable = false) 20 | private String name; 21 | 22 | @Column(nullable = false) 23 | private Integer age; 24 | 25 | @Column(nullable = false) 26 | private String address; 27 | 28 | public Integer getId() { 29 | return id; 30 | } 31 | 32 | public void setId(Integer id) { 33 | this.id = id; 34 | } 35 | 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | 44 | public Integer getAge() { 45 | return age; 46 | } 47 | 48 | public void setAge(Integer age) { 49 | this.age = age; 50 | } 51 | 52 | public String getAddress() { 53 | return address; 54 | } 55 | 56 | public void setAddress(String address) { 57 | this.address = address; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /spring-boot-druid/src/main/java/xyz/zhouzhaodong/springbootdruid/jpa/PersonRepository.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.springbootdruid.jpa; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | import xyz.zhouzhaodong.springbootdruid.entity.Person; 5 | 6 | /** 7 | * @author zhouzhaodong 8 | */ 9 | public interface PersonRepository extends JpaRepository { 10 | } 11 | -------------------------------------------------------------------------------- /spring-boot-druid/src/main/resources/application.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/spring-boot-druid/src/main/resources/application.yml -------------------------------------------------------------------------------- /spring-boot-h2/src/main/java/xyz/zhouzhaodong/springbooth2/SpringBootH2Application.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.springbooth2; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringBootH2Application { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringBootH2Application.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /spring-boot-h2/src/main/java/xyz/zhouzhaodong/springbooth2/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.springbooth2.controller; 2 | 3 | import org.springframework.web.bind.annotation.RequestMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | import xyz.zhouzhaodong.springbooth2.dao.UserDao; 6 | import xyz.zhouzhaodong.springbooth2.entity.User; 7 | 8 | import javax.annotation.Resource; 9 | 10 | /** 11 | * 控制层 12 | * @author zhouzhaodong 13 | */ 14 | @RestController 15 | public class UserController { 16 | 17 | @Resource 18 | UserDao userDao; 19 | 20 | @RequestMapping("/findById") 21 | public Object findById(Integer id){ 22 | return userDao.findById(id); 23 | } 24 | 25 | @RequestMapping("/insert") 26 | public void insert(User user){ 27 | userDao.save(user); 28 | } 29 | 30 | @RequestMapping("/delete") 31 | public void delete(Integer id){ 32 | userDao.deleteById(id); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /spring-boot-h2/src/main/java/xyz/zhouzhaodong/springbooth2/dao/UserDao.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.springbooth2.dao; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | import xyz.zhouzhaodong.springbooth2.entity.User; 5 | 6 | /** 7 | * dao 8 | * @author zhouzhaodong 9 | */ 10 | public interface UserDao extends JpaRepository { 11 | } 12 | -------------------------------------------------------------------------------- /spring-boot-h2/src/main/java/xyz/zhouzhaodong/springbooth2/entity/User.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.springbooth2.entity; 2 | 3 | import javax.persistence.*; 4 | 5 | /** 6 | * 实体类 7 | * @author zhouzhaodong 8 | */ 9 | @Entity 10 | @Table(name="user") 11 | public class User { 12 | 13 | @Id 14 | @GeneratedValue(strategy = GenerationType.IDENTITY) 15 | private Integer id; 16 | 17 | @Column 18 | private String name; 19 | 20 | @Column 21 | private String phone; 22 | 23 | public Integer getId() { 24 | return id; 25 | } 26 | 27 | public void setId(Integer id) { 28 | this.id = id; 29 | } 30 | 31 | public String getName() { 32 | return name; 33 | } 34 | 35 | public void setName(String name) { 36 | this.name = name; 37 | } 38 | 39 | public String getPhone() { 40 | return phone; 41 | } 42 | 43 | public void setPhone(String phone) { 44 | this.phone = phone; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /spring-boot-h2/src/main/resources/application.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/spring-boot-h2/src/main/resources/application.yml -------------------------------------------------------------------------------- /spring-boot-https/src/main/java/xyz/zhouzhaodong/springboothttps/SpringBootHttpsApplication.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.springboothttps; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringBootHttpsApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringBootHttpsApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /spring-boot-https/src/main/java/xyz/zhouzhaodong/springboothttps/controller/HttpsController.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.springboothttps.controller; 2 | 3 | import org.springframework.web.bind.annotation.RequestMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | /** 7 | * 控制器 8 | * @author www.zhouzhaodong.xyz 9 | * @date Created in 2020/9/17 14:30 10 | */ 11 | @RestController 12 | public class HttpsController { 13 | 14 | @RequestMapping("/") 15 | public String https(){ 16 | return "success"; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /spring-boot-https/src/main/resources/application.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/spring-boot-https/src/main/resources/application.yml -------------------------------------------------------------------------------- /spring-boot-https/src/main/resources/server.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/spring-boot-https/src/main/resources/server.keystore -------------------------------------------------------------------------------- /spring-boot-japidocs/src/main/java/xyz/zhouzhaodong/springbootjapidocs/SpringBootJapidocsApplication.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.springbootjapidocs; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringBootJapidocsApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringBootJapidocsApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /spring-boot-japidocs/src/main/java/xyz/zhouzhaodong/springbootjapidocs/config/JapidocsConfig.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.springbootjapidocs.config; 2 | 3 | import io.github.yedaxia.apidocs.Docs; 4 | import io.github.yedaxia.apidocs.DocsConfig; 5 | 6 | /** 7 | * @author zhouzhaodong 8 | */ 9 | public class JapidocsConfig { 10 | 11 | public static void main(String[] args) { 12 | DocsConfig config = new DocsConfig(); 13 | // 项目根目录 14 | config.setProjectPath("D:\\work\\workSpace\\springboot\\spring-boot-japidocs"); 15 | // 项目名称 16 | config.setProjectName("springbootjapidocs"); 17 | // 声明该API的版本 18 | config.setApiVersion("V1.0"); 19 | // 生成API 文档所在目录 20 | config.setDocsPath("D:\\"); 21 | // 配置自动生成 22 | config.setAutoGenerate(Boolean.TRUE); 23 | // 执行生成文档 24 | Docs.buildHtmlDocs(config); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /spring-boot-japidocs/src/main/java/xyz/zhouzhaodong/springbootjapidocs/controller/SysUserController.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.springbootjapidocs.controller; 2 | 3 | import io.github.yedaxia.apidocs.Ignore; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | import org.springframework.web.bind.annotation.RestController; 6 | import xyz.zhouzhaodong.springbootjapidocs.entity.SysUser; 7 | 8 | /** 9 | * 用户管理 10 | * @author zhouzhaodong 11 | */ 12 | @RestController 13 | public class SysUserController { 14 | 15 | /** 16 | * 根据用户id获取用户信息 17 | * @param id 18 | * @return 19 | */ 20 | @RequestMapping("/getSysUser") 21 | public SysUser getSysUser(Integer id){ 22 | SysUser sysUser = new SysUser(); 23 | sysUser.setId(id); 24 | sysUser.setName("address"); 25 | sysUser.setPassword("12345"); 26 | sysUser.setAddress("青岛"); 27 | return sysUser; 28 | } 29 | 30 | /** 31 | * 测试接口 32 | * @Ignore 该注解在生成文档的时候会被忽略掉 33 | * @param id 34 | * @return 35 | */ 36 | @Ignore 37 | @RequestMapping("/getOne") 38 | public SysUser getOne(Integer id){ 39 | return null; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /spring-boot-japidocs/src/main/java/xyz/zhouzhaodong/springbootjapidocs/entity/SysUser.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.springbootjapidocs.entity; 2 | 3 | import io.github.yedaxia.apidocs.Ignore; 4 | import lombok.Data; 5 | 6 | /** 7 | * @author zhouzhaodong 8 | */ 9 | @Data 10 | public class SysUser { 11 | 12 | /** 13 | * id 14 | */ 15 | private Integer id; 16 | 17 | /** 18 | * 姓名 19 | */ 20 | private String name; 21 | 22 | /** 23 | * 密码 24 | */ 25 | private String password; 26 | 27 | /** 28 | * 地址 29 | */ 30 | private String address; 31 | 32 | /** 33 | * 测试字段 34 | * @Ignore 该注解在生成文档的时候会被忽略掉 35 | */ 36 | @Ignore 37 | private String balabala; 38 | 39 | } 40 | -------------------------------------------------------------------------------- /spring-boot-japidocs/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /spring-boot-qrcode/src/main/java/xyz/zhouzhaodong/www/qrcode/QrcodeApplication.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.www.qrcode; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class QrcodeApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(QrcodeApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /spring-boot-qrcode/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /spring-boot-qrcode/src/main/resources/png/123456.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/spring-boot-qrcode/src/main/resources/png/123456.png -------------------------------------------------------------------------------- /spring-boot-screw/src/main/java/xyz/zhouzhaodong/springbootscrew/SpringBootScrewApplication.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.springbootscrew; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringBootScrewApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringBootScrewApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /spring-boot-screw/src/main/resources/application.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/spring-boot-screw/src/main/resources/application.yml -------------------------------------------------------------------------------- /spring-boot-screw/src/test/java/xyz/zhouzhaodong/springbootscrew/SpringBootScrewApplicationTests.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.springbootscrew; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringBootScrewApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /spring-boot-swagger/src/main/java/xyz/zhouzhaodong/springbootswagger/SpringBootSwaggerApplication.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.springbootswagger; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringBootSwaggerApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringBootSwaggerApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /spring-boot-swagger/src/main/java/xyz/zhouzhaodong/springbootswagger/entity/Person.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.springbootswagger.entity; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | import java.io.Serializable; 10 | 11 | /** 12 | * 用户实体类 13 | * 14 | * @author zhouzhaodong 15 | */ 16 | @Data 17 | @NoArgsConstructor 18 | @AllArgsConstructor 19 | @ApiModel(value = "用户实体", description = "User Entity") 20 | public class Person implements Serializable { 21 | private static final long serialVersionUID = 5057954049311281252L; 22 | /** 23 | * 主键id 24 | */ 25 | @ApiModelProperty(value = "主键id", required = true) 26 | private Integer id; 27 | /** 28 | * 用户名 29 | */ 30 | @ApiModelProperty(value = "用户名", required = true) 31 | private String name; 32 | /** 33 | * 工作岗位 34 | */ 35 | @ApiModelProperty(value = "工作岗位", required = true) 36 | private String job; 37 | } 38 | -------------------------------------------------------------------------------- /spring-boot-swagger/src/main/java/xyz/zhouzhaodong/springbootswagger/util/ResponseBody.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.springbootswagger.util; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Builder; 7 | import lombok.Data; 8 | import lombok.NoArgsConstructor; 9 | 10 | import java.io.Serializable; 11 | 12 | /** 13 | * 接口返回实体类 14 | * 15 | * @author zhouzhaodong 16 | */ 17 | @Data 18 | @Builder 19 | @NoArgsConstructor 20 | @AllArgsConstructor 21 | @ApiModel(value = "接口返回实体类", description = "Common Api Response") 22 | public class ResponseBody implements Serializable { 23 | private static final long serialVersionUID = -8987146499044811408L; 24 | /** 25 | * 返回状态 26 | */ 27 | @ApiModelProperty(value = "返回状态", required = true) 28 | private Integer code; 29 | /** 30 | * 返回信息 31 | */ 32 | @ApiModelProperty(value = "返回信息", required = true) 33 | private String message; 34 | /** 35 | * 返回数据 36 | */ 37 | @ApiModelProperty(value = "返回数据", required = true) 38 | private T data; 39 | } 40 | -------------------------------------------------------------------------------- /spring-boot-ureport2/src/main/java/xyz/zhouzhaodong/springbootureport2/SpringBootUreport2Application.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.springbootureport2; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * 启动类 8 | * 9 | * @author zhouzhaodong 10 | */ 11 | @SpringBootApplication 12 | public class SpringBootUreport2Application { 13 | 14 | public static void main(String[] args) { 15 | SpringApplication.run(SpringBootUreport2Application.class, args); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /spring-boot-ureport2/src/main/java/xyz/zhouzhaodong/springbootureport2/config/BeanConfig.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.springbootureport2.config; 2 | 3 | import com.bstek.ureport.console.UReportServlet; 4 | import org.springframework.boot.web.servlet.ServletRegistrationBean; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | import org.springframework.context.annotation.ImportResource; 8 | 9 | import javax.servlet.Servlet; 10 | 11 | /** 12 | * springboot实体类配置 13 | * 14 | * @author zhouzhaodong 15 | */ 16 | @ImportResource("classpath:context.xml") 17 | @Configuration 18 | public class BeanConfig { 19 | 20 | @Bean 21 | public ServletRegistrationBean ureport2Servlet() { 22 | return new ServletRegistrationBean<>(new UReportServlet(), "/ureport/*"); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /spring-boot-ureport2/src/main/resources/application.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/spring-boot-ureport2/src/main/resources/application.yml -------------------------------------------------------------------------------- /spring-boot-ureport2/src/main/resources/context.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/spring-boot-ureport2/src/main/resources/context.properties -------------------------------------------------------------------------------- /spring-boot-ureport2/src/main/resources/context.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /spring-boot-ureport2/src/main/resources/ureportfiles/报表文件保存地址,需要创建: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/spring-boot-ureport2/src/main/resources/ureportfiles/报表文件保存地址,需要创建 -------------------------------------------------------------------------------- /spring-boot-webservice/src/main/java/xyz/zhouzhaodong/springbootwebservice/SpringBootWebserviceApplication.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.springbootwebservice; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringBootWebserviceApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringBootWebserviceApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /spring-boot-webservice/src/main/java/xyz/zhouzhaodong/springbootwebservice/config/CxfConfig.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.springbootwebservice.config; 2 | 3 | import javax.xml.ws.Endpoint; 4 | 5 | import org.apache.cxf.Bus; 6 | import org.apache.cxf.jaxws.EndpointImpl; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.context.annotation.Bean; 9 | import org.springframework.context.annotation.Configuration; 10 | import xyz.zhouzhaodong.springbootwebservice.service.CommonService; 11 | 12 | /** 13 | * cxf配置类 14 | * @author zhouzhaodong 15 | */ 16 | @Configuration 17 | public class CxfConfig { 18 | @Autowired 19 | private Bus bus; 20 | 21 | @Autowired 22 | CommonService commonService; 23 | 24 | /** JAX-WS **/ 25 | @Bean 26 | public Endpoint endpoint() { 27 | EndpointImpl endpoint = new EndpointImpl(bus, commonService); 28 | //发布地址 29 | endpoint.publish("/CommonService"); 30 | return endpoint; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /spring-boot-webservice/src/main/java/xyz/zhouzhaodong/springbootwebservice/service/CommonService.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.springbootwebservice.service; 2 | 3 | import javax.jws.WebMethod; 4 | import javax.jws.WebParam; 5 | import javax.jws.WebService; 6 | 7 | /** 8 | * @author zhouzhaodong 9 | */ 10 | @WebService(name = "CommonService", // 暴露服务名称 11 | targetNamespace = "http://springbootwebservice.zhouzhaodong.xyz/"// 命名空间,一般是接口的包名倒序 12 | ) 13 | public interface CommonService { 14 | 15 | /** 16 | * 暴露接口 17 | * @param name 18 | * @return 19 | */ 20 | @WebMethod 21 | String sayHello(@WebParam(name = "userName") String name); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /spring-boot-webservice/src/main/java/xyz/zhouzhaodong/springbootwebservice/service/impl/CommonServiceImpl.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.springbootwebservice.service.impl; 2 | 3 | import org.springframework.stereotype.Component; 4 | import xyz.zhouzhaodong.springbootwebservice.service.CommonService; 5 | 6 | import javax.jws.WebService; 7 | 8 | /** 9 | * @author zhouzhaodong 10 | */ 11 | @WebService(serviceName = "CommonService", // 与接口中指定的name一致 12 | targetNamespace = "http://springbootwebservice.zhouzhaodong.xyz/", // 与接口中的命名空间一致,一般是接口的包名倒 13 | endpointInterface = "xyz.zhouzhaodong.springbootwebservice.service.CommonService"// 接口地址 14 | ) 15 | @Component 16 | public class CommonServiceImpl implements CommonService { 17 | 18 | @Override 19 | public String sayHello(String name) { 20 | return "HELLO" + name; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /spring-boot-webservice/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /springboot-interceptor/src/main/java/xyz/zhouzhaodong/springbootinterceptor/SpringbootInterceptorApplication.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.springbootinterceptor; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.web.servlet.ServletComponentScan; 6 | 7 | /** 8 | * 启动类 9 | * 10 | * @author zhouzhaodong 11 | */ 12 | @ServletComponentScan 13 | @SpringBootApplication 14 | public class SpringbootInterceptorApplication { 15 | 16 | public static void main(String[] args) { 17 | SpringApplication.run(SpringbootInterceptorApplication.class, args); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /springboot-interceptor/src/main/java/xyz/zhouzhaodong/springbootinterceptor/controller/TestController.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.springbootinterceptor.controller; 2 | 3 | import org.springframework.web.bind.annotation.PostMapping; 4 | import org.springframework.web.bind.annotation.RequestBody; 5 | import org.springframework.web.bind.annotation.RestController; 6 | import xyz.zhouzhaodong.springbootinterceptor.entity.User; 7 | 8 | /** 9 | * @date: 2023/2/6 12:24 10 | * @author: zhouzhaodong 11 | * @description: 测试 12 | */ 13 | @RestController 14 | public class TestController { 15 | 16 | @PostMapping("/one/abc") 17 | public String abc(@RequestBody User user){ 18 | return user.getName(); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /springboot-interceptor/src/main/java/xyz/zhouzhaodong/springbootinterceptor/entity/User.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.springbootinterceptor.entity; 2 | 3 | /** 4 | * @date: 2023/2/6 12:24 5 | * @author: zhouzhaodong 6 | * @description: 7 | */ 8 | public class User { 9 | 10 | private String name; 11 | 12 | private Integer age; 13 | 14 | private String address; 15 | 16 | public String getName() { 17 | return name; 18 | } 19 | 20 | public void setName(String name) { 21 | this.name = name; 22 | } 23 | 24 | public Integer getAge() { 25 | return age; 26 | } 27 | 28 | public void setAge(Integer age) { 29 | this.age = age; 30 | } 31 | 32 | public String getAddress() { 33 | return address; 34 | } 35 | 36 | public void setAddress(String address) { 37 | this.address = address; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /springboot-interceptor/src/main/java/xyz/zhouzhaodong/springbootinterceptor/interceptor/WebConfig.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.springbootinterceptor.interceptor; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; 5 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 6 | 7 | /** 8 | * @date: 2023/2/6 11:21 9 | * @author: zhouzhaodong 10 | * @description: 11 | */ 12 | @Configuration 13 | public class WebConfig implements WebMvcConfigurer { 14 | /** 15 | * 添加Web项目的拦截器 16 | */ 17 | @Override 18 | public void addInterceptors(InterceptorRegistry registry) { 19 | // 对所有访问路径,都通过MyInterceptor类型的拦截器进行拦截 20 | // 放行登录页,登陆操作,静态资源 21 | registry.addInterceptor(new MyInterceptor()).addPathPatterns("/**") 22 | .excludePathPatterns("/", "/login", "/index.html", "/user/login", "/css/**", "/images/**", "/js/**", "/fonts/**"); 23 | } 24 | } -------------------------------------------------------------------------------- /springboot-interceptor/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | main: 3 | # 当出现相同名字的类进行注册时,准许覆盖注册 4 | allow-bean-definition-overriding: true 5 | -------------------------------------------------------------------------------- /springboot-interceptor/src/test/java/xyz/zhouzhaodong/springbootinterceptor/SpringbootInterceptorApplicationTests.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.springbootinterceptor; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringbootInterceptorApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springboot-jwt/src/main/java/xyz/zhouzhaodong/springbootjwt/SpringbootJwtApplication.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.springbootjwt; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * @author 84266 8 | */ 9 | @SpringBootApplication 10 | public class SpringbootJwtApplication { 11 | 12 | public static void main(String[] args) { 13 | SpringApplication.run(SpringbootJwtApplication.class, args); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /springboot-jwt/src/main/java/xyz/zhouzhaodong/springbootjwt/controller/TestController.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.springbootjwt.controller; 2 | 3 | import org.springframework.web.bind.annotation.RequestMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | import xyz.zhouzhaodong.springbootjwt.util.JwtUtils; 6 | 7 | import javax.servlet.http.HttpServletResponse; 8 | 9 | /** 10 | * 登陆 11 | * @author zhouzhaodong 12 | */ 13 | @RestController 14 | public class TestController { 15 | 16 | @RequestMapping("/login") 17 | public String login(HttpServletResponse response, String userName, String passWord) { 18 | // 假装判断一下登陆是否成功 19 | if(userName == null || "".equals(userName) || passWord == null || "".equals(passWord)){ 20 | return "用户名或者密码不能为空"; 21 | } 22 | String token = JwtUtils.geneJsonWebToken(userName, passWord); 23 | // 将token放在响应头 24 | response.setHeader("Authorization", token); 25 | return token; 26 | } 27 | 28 | @RequestMapping("/secure/check") 29 | public String check(){ 30 | return "登陆成功"; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /springboot-jwt/src/main/java/xyz/zhouzhaodong/springbootjwt/filter/JwtCfg.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.springbootjwt.filter; 2 | 3 | import org.springframework.boot.web.servlet.FilterRegistrationBean; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | /** 8 | * 拦截器 9 | * @author zhouzhaodong 10 | */ 11 | @Configuration 12 | public class JwtCfg { 13 | 14 | @Bean 15 | public FilterRegistrationBean jwtFilter() { 16 | final FilterRegistrationBean registrationBean = new FilterRegistrationBean<>(); 17 | registrationBean.setFilter(new JwtFilter()); 18 | // 对/test/*下的url进行拦截验证 19 | registrationBean.addUrlPatterns("/**"); 20 | // 忽略某些url 21 | registrationBean.addInitParameter("exclusions","/update/*,/login"); 22 | return registrationBean; 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /springboot-jwt/src/main/resources/application.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/springboot-jwt/src/main/resources/application.yml -------------------------------------------------------------------------------- /springboot-jwt/src/test/java/xyz/zhouzhaodong/springbootjwt/SpringbootJwtApplicationTests.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.springbootjwt; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringbootJwtApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springcloud/server-center/src/main/java/xyz/springboot/servercenter/ServerCenterApplication.java: -------------------------------------------------------------------------------- 1 | package xyz.springboot.servercenter; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; 6 | 7 | /** 8 | * 注册中心启动类 9 | * @author zhouzhaodong 10 | */ 11 | @EnableEurekaServer 12 | @SpringBootApplication 13 | public class ServerCenterApplication { 14 | 15 | public static void main(String[] args) { 16 | SpringApplication.run(ServerCenterApplication.class, args); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /springcloud/server-center/src/main/resources/application.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/springcloud/server-center/src/main/resources/application.yml -------------------------------------------------------------------------------- /springcloud/server-center/src/test/java/xyz/springboot/servercenter/ServerCenterApplicationTests.java: -------------------------------------------------------------------------------- 1 | package xyz.springboot.servercenter; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class ServerCenterApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springcloud/server-order/src/main/java/xyz/zhouzhaodong/serverorder/ServerOrderApplication.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.serverorder; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.netflix.eureka.EnableEurekaClient; 6 | 7 | /** 8 | * 服务提供者启动类 9 | * @author zhouzhaodong 10 | */ 11 | @EnableEurekaClient 12 | @SpringBootApplication 13 | public class ServerOrderApplication { 14 | 15 | public static void main(String[] args) { 16 | SpringApplication.run(ServerOrderApplication.class, args); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /springcloud/server-order/src/main/java/xyz/zhouzhaodong/serverorder/controller/OrderController.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.serverorder.controller; 2 | 3 | import org.springframework.web.bind.annotation.RequestMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | /** 7 | * 服务提供者方法 8 | * @author zhouzhaodong 9 | */ 10 | @RestController 11 | @RequestMapping("/order") 12 | public class OrderController { 13 | 14 | /** 15 | * 测试方法 16 | * @return 17 | */ 18 | @RequestMapping("/getMessage") 19 | public String getMessage(){ 20 | return "order-one"; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /springcloud/server-order/src/main/resources/application.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/springcloud/server-order/src/main/resources/application.yml -------------------------------------------------------------------------------- /springcloud/server-order/src/test/java/xyz/zhouzhaodong/serverorder/ServerOrderApplicationTests.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.serverorder; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class ServerOrderApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springcloud/server-user/src/main/java/xyz/zhouzhaodong/serveruser/ServerUserApplication.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.serveruser; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.client.loadbalancer.LoadBalanced; 6 | import org.springframework.cloud.netflix.eureka.EnableEurekaClient; 7 | import org.springframework.context.annotation.Bean; 8 | import org.springframework.web.client.RestTemplate; 9 | 10 | /** 11 | * 服务消费者 12 | * @author zhouzhaodong 13 | */ 14 | @EnableEurekaClient 15 | @SpringBootApplication 16 | public class ServerUserApplication { 17 | 18 | /** 19 | * @Bean 注解用来注入restTemplate 20 | * @LoadBalanced 注解用来在注册中心里进行查找微服务,Ribbon负载均衡 21 | * 生成一个RestTemplate实例对象 22 | * 使用user服务调用order服务就是通过这个restTemplate对象实现的 23 | * @return 24 | */ 25 | @Bean 26 | @LoadBalanced 27 | public RestTemplate restTemplate(){ 28 | return new RestTemplate(); 29 | } 30 | 31 | public static void main(String[] args) { 32 | SpringApplication.run(ServerUserApplication.class, args); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /springcloud/server-user/src/main/java/xyz/zhouzhaodong/serveruser/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.serveruser.controller; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | import org.springframework.web.bind.annotation.RestController; 6 | import org.springframework.web.client.RestTemplate; 7 | 8 | import javax.annotation.Resource; 9 | 10 | /** 11 | * 消费者 12 | * 13 | * @author zhouzhaodong 14 | */ 15 | @RestController 16 | public class UserController { 17 | 18 | @Resource 19 | private RestTemplate restTemplate; 20 | 21 | /** 22 | * 返回值类型需要和我们的业务返回值一致 23 | * @return 24 | */ 25 | @RequestMapping("getUserOrder") 26 | public String getUserOrder() { 27 | String url = "http://service-order/order/getMessage"; 28 | return restTemplate.getForObject(url, String.class); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /springcloud/server-user/src/main/resources/application.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/springcloud/server-user/src/main/resources/application.yml -------------------------------------------------------------------------------- /springcloud/server-user/src/test/java/xyz/zhouzhaodong/serveruser/ServerUserApplicationTests.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.serveruser; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class ServerUserApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /timingtasks/src/main/java/com/zhouxiaoxi/timingtasks/TimingtasksApplication.java: -------------------------------------------------------------------------------- 1 | package com.zhouxiaoxi.timingtasks; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.scheduling.annotation.EnableScheduling; 6 | 7 | /** 8 | * 定时任务 9 | * @author zhouzhaodong 10 | */ 11 | @SpringBootApplication 12 | @EnableScheduling 13 | public class TimingtasksApplication { 14 | 15 | public static void main(String[] args) { 16 | SpringApplication.run(TimingtasksApplication.class, args); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /timingtasks/src/main/java/com/zhouxiaoxi/timingtasks/util/TimingTasks.java: -------------------------------------------------------------------------------- 1 | package com.zhouxiaoxi.timingtasks.util; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | import org.springframework.scheduling.annotation.Scheduled; 5 | import org.springframework.stereotype.Component; 6 | 7 | import java.text.SimpleDateFormat; 8 | import java.util.Date; 9 | 10 | /** 11 | * 定时任务 12 | * @author zhouzhaodong 13 | */ 14 | @Component 15 | @Slf4j 16 | public class TimingTasks { 17 | 18 | /** 19 | * 定时打印时间 20 | */ 21 | @Scheduled(fixedRate = 5000) 22 | public void printCurrentTime(){ 23 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 24 | String time = sdf.format(new Date()); 25 | log.info("现在的时间为:{}",time); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /timingtasks/src/main/resources/application.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/timingtasks/src/main/resources/application.yml -------------------------------------------------------------------------------- /timingtasks/src/test/java/com/zhouxiaoxi/timingtasks/TimingtasksApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.zhouxiaoxi.timingtasks; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class TimingtasksApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /websocket/src/main/java/xyz/zhouzhaodong/websocket/WebsocketApplication.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.websocket; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * 启动类 8 | * @author zhouzhaodong 9 | */ 10 | @SpringBootApplication 11 | public class WebsocketApplication { 12 | 13 | public static void main(String[] args) { 14 | SpringApplication.run(WebsocketApplication.class, args); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /websocket/src/main/java/xyz/zhouzhaodong/websocket/config/WebsocketConfiguration.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.websocket.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.web.socket.server.standard.ServerEndpointExporter; 6 | 7 | /** 8 | * WebSocket配置类 9 | * @author zhouzhaodong 10 | */ 11 | @Configuration 12 | public class WebsocketConfiguration { 13 | 14 | @Bean 15 | public ServerEndpointExporter serverEndpointExporter() { 16 | return new ServerEndpointExporter(); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /websocket/src/main/java/xyz/zhouzhaodong/websocket/controller/TestController.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.websocket.controller; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | 6 | /** 7 | * 测试控制器 8 | * @author zhouzhaodong 9 | */ 10 | @Controller 11 | public class TestController { 12 | 13 | @RequestMapping("/") 14 | public String view(){ 15 | return "index"; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /websocket/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8888 3 | spring: 4 | freemarker: 5 | prefix: classpath:/templates/ 6 | suffix: .html -------------------------------------------------------------------------------- /websocket/src/test/java/xyz/zhouzhaodong/websocket/WebsocketApplicationTests.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.websocket; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class WebsocketApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /xxl-job/NOTICE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015-present, xuxueli. 2 | 3 | Dependencies: 4 | ================================================================ 5 | 6 | Spring: 7 | 8 | * LICENSE: 9 | * http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0) 10 | * HOMEPAGE: 11 | * http://www.springsource.org 12 | 13 | Netty: 14 | 15 | * LICENSE: 16 | * http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0) 17 | * HOMEPAGE: 18 | * https://github.com/netty/netty 19 | 20 | Hessian: 21 | 22 | * LICENSE: 23 | * http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0) 24 | * HOMEPAGE: 25 | * http://hessian.caucho.com 26 | 27 | SLF4J: 28 | 29 | * LICENSE: 30 | * http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0) 31 | * HOMEPAGE: 32 | * http://www.slf4j.org 33 | -------------------------------------------------------------------------------- /xxl-job/demo/src/main/java/xyz/zhouzhaodong/demo/DemoApplication.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.demo; 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, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /xxl-job/demo/src/main/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/demo/src/main/resources/application.properties -------------------------------------------------------------------------------- /xxl-job/demo/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | logback 5 | 6 | 7 | 8 | 9 | %d{HH:mm:ss.SSS} %contextName [%thread] %-5level %logger{36} - %msg%n 10 | 11 | 12 | 13 | 14 | ${log.path} 15 | 16 | ${log.path}.%d{yyyy-MM-dd}.zip 17 | 18 | 19 | %date %level [%thread] %logger{36} [%file : %line] %msg%n 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /xxl-job/demo/src/test/java/xyz/zhouzhaodong/demo/DemoApplicationTests.java: -------------------------------------------------------------------------------- 1 | package xyz.zhouzhaodong.demo; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class DemoApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /xxl-job/doc/XXL-JOB架构图.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/doc/XXL-JOB架构图.pptx -------------------------------------------------------------------------------- /xxl-job/doc/images/cnblog-首页-每日一博-第一.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/doc/images/cnblog-首页-每日一博-第一.png -------------------------------------------------------------------------------- /xxl-job/doc/images/cnblog-首页-热门动弹-第一.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/doc/images/cnblog-首页-热门动弹-第一.png -------------------------------------------------------------------------------- /xxl-job/doc/images/donate-alipay.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/doc/images/donate-alipay.jpg -------------------------------------------------------------------------------- /xxl-job/doc/images/donate-paypal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/doc/images/donate-paypal.png -------------------------------------------------------------------------------- /xxl-job/doc/images/donate-wechat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/doc/images/donate-wechat.png -------------------------------------------------------------------------------- /xxl-job/doc/images/gitee-gvp.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/doc/images/gitee-gvp.jpg -------------------------------------------------------------------------------- /xxl-job/doc/images/img_1001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/doc/images/img_1001.png -------------------------------------------------------------------------------- /xxl-job/doc/images/img_1002.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/doc/images/img_1002.png -------------------------------------------------------------------------------- /xxl-job/doc/images/img_6yC0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/doc/images/img_6yC0.png -------------------------------------------------------------------------------- /xxl-job/doc/images/img_BPLG.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/doc/images/img_BPLG.png -------------------------------------------------------------------------------- /xxl-job/doc/images/img_EB65.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/doc/images/img_EB65.png -------------------------------------------------------------------------------- /xxl-job/doc/images/img_Fgql.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/doc/images/img_Fgql.png -------------------------------------------------------------------------------- /xxl-job/doc/images/img_Hr2T.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/doc/images/img_Hr2T.png -------------------------------------------------------------------------------- /xxl-job/doc/images/img_Qohm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/doc/images/img_Qohm.png -------------------------------------------------------------------------------- /xxl-job/doc/images/img_UDSo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/doc/images/img_UDSo.png -------------------------------------------------------------------------------- /xxl-job/doc/images/img_V3vF.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/doc/images/img_V3vF.png -------------------------------------------------------------------------------- /xxl-job/doc/images/img_Wb2o.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/doc/images/img_Wb2o.png -------------------------------------------------------------------------------- /xxl-job/doc/images/img_Ypik.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/doc/images/img_Ypik.png -------------------------------------------------------------------------------- /xxl-job/doc/images/img_Z9Qr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/doc/images/img_Z9Qr.png -------------------------------------------------------------------------------- /xxl-job/doc/images/img_ZAhX.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/doc/images/img_ZAhX.png -------------------------------------------------------------------------------- /xxl-job/doc/images/img_ZAsz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/doc/images/img_ZAsz.png -------------------------------------------------------------------------------- /xxl-job/doc/images/img_dNUJ.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/doc/images/img_dNUJ.png -------------------------------------------------------------------------------- /xxl-job/doc/images/img_eYrv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/doc/images/img_eYrv.png -------------------------------------------------------------------------------- /xxl-job/doc/images/img_hIci.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/doc/images/img_hIci.png -------------------------------------------------------------------------------- /xxl-job/doc/images/img_iUw0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/doc/images/img_iUw0.png -------------------------------------------------------------------------------- /xxl-job/doc/images/img_inc8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/doc/images/img_inc8.png -------------------------------------------------------------------------------- /xxl-job/doc/images/img_jOAU.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/doc/images/img_jOAU.png -------------------------------------------------------------------------------- /xxl-job/doc/images/img_jrdI.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/doc/images/img_jrdI.png -------------------------------------------------------------------------------- /xxl-job/doc/images/img_o8HQ.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/doc/images/img_o8HQ.png -------------------------------------------------------------------------------- /xxl-job/doc/images/img_tJOq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/doc/images/img_tJOq.png -------------------------------------------------------------------------------- /xxl-job/doc/images/img_tvGI.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/doc/images/img_tvGI.png -------------------------------------------------------------------------------- /xxl-job/doc/images/qq群-一个xxl同学进了58.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/doc/images/qq群-一个xxl同学进了58.png -------------------------------------------------------------------------------- /xxl-job/doc/images/xxl-logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/doc/images/xxl-logo.jpg -------------------------------------------------------------------------------- /xxl-job/doc/images/xxl-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/doc/images/xxl-logo.png -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:8-jre-slim 2 | MAINTAINER xuxueli 3 | 4 | ENV PARAMS="" 5 | 6 | ENV TZ=PRC 7 | RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone 8 | 9 | ADD target/xxl-job-admin-*.jar /app.jar 10 | 11 | ENTRYPOINT ["sh","-c","java -jar $JAVA_OPTS /app.jar $PARAMS"] -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/XxlJobAdminApplication.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * @author xuxueli 2018-10-28 00:38:13 8 | */ 9 | @SpringBootApplication 10 | public class XxlJobAdminApplication { 11 | 12 | public static void main(String[] args) { 13 | SpringApplication.run(XxlJobAdminApplication.class, args); 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/annotation/PermissionLimit.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.controller.annotation; 2 | 3 | 4 | import java.lang.annotation.ElementType; 5 | import java.lang.annotation.Retention; 6 | import java.lang.annotation.RetentionPolicy; 7 | import java.lang.annotation.Target; 8 | 9 | /** 10 | * 权限限制 11 | * @author xuxueli 2015-12-12 18:29:02 12 | */ 13 | @Target(ElementType.METHOD) 14 | @Retention(RetentionPolicy.RUNTIME) 15 | public @interface PermissionLimit { 16 | 17 | /** 18 | * 登录拦截 (默认拦截) 19 | */ 20 | boolean limit() default true; 21 | 22 | /** 23 | * 要求管理员权限 24 | * 25 | * @return 26 | */ 27 | boolean adminuser() default false; 28 | 29 | } -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/WebMvcConfig.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.controller.interceptor; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; 5 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 6 | 7 | import javax.annotation.Resource; 8 | 9 | /** 10 | * web mvc config 11 | * 12 | * @author xuxueli 2018-04-02 20:48:20 13 | */ 14 | @Configuration 15 | public class WebMvcConfig implements WebMvcConfigurer { 16 | 17 | @Resource 18 | private PermissionInterceptor permissionInterceptor; 19 | @Resource 20 | private CookieInterceptor cookieInterceptor; 21 | 22 | @Override 23 | public void addInterceptors(InterceptorRegistry registry) { 24 | registry.addInterceptor(permissionInterceptor).addPathPatterns("/**"); 25 | registry.addInterceptor(cookieInterceptor).addPathPatterns("/**"); 26 | } 27 | 28 | } -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/alarm/JobAlarm.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.core.alarm; 2 | 3 | import com.xxl.job.admin.core.model.XxlJobInfo; 4 | import com.xxl.job.admin.core.model.XxlJobLog; 5 | 6 | /** 7 | * @author xuxueli 2020-01-19 8 | */ 9 | public interface JobAlarm { 10 | 11 | /** 12 | * job alarm 13 | * 14 | * @param info 15 | * @param jobLog 16 | * @return 17 | */ 18 | public boolean doAlarm(XxlJobInfo info, XxlJobLog jobLog); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/exception/XxlJobException.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.core.exception; 2 | 3 | /** 4 | * @author xuxueli 2019-05-04 23:19:29 5 | */ 6 | public class XxlJobException extends RuntimeException { 7 | 8 | public XxlJobException() { 9 | } 10 | public XxlJobException(String message) { 11 | super(message); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobLogReport.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.core.model; 2 | 3 | import java.util.Date; 4 | 5 | public class XxlJobLogReport { 6 | 7 | private int id; 8 | 9 | private Date triggerDay; 10 | 11 | private int runningCount; 12 | private int sucCount; 13 | private int failCount; 14 | 15 | public int getId() { 16 | return id; 17 | } 18 | 19 | public void setId(int id) { 20 | this.id = id; 21 | } 22 | 23 | public Date getTriggerDay() { 24 | return triggerDay; 25 | } 26 | 27 | public void setTriggerDay(Date triggerDay) { 28 | this.triggerDay = triggerDay; 29 | } 30 | 31 | public int getRunningCount() { 32 | return runningCount; 33 | } 34 | 35 | public void setRunningCount(int runningCount) { 36 | this.runningCount = runningCount; 37 | } 38 | 39 | public int getSucCount() { 40 | return sucCount; 41 | } 42 | 43 | public void setSucCount(int sucCount) { 44 | this.sucCount = sucCount; 45 | } 46 | 47 | public int getFailCount() { 48 | return failCount; 49 | } 50 | 51 | public void setFailCount(int failCount) { 52 | this.failCount = failCount; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/old/RemoteHttpJobBean.java: -------------------------------------------------------------------------------- 1 | //package com.xxl.job.admin.core.jobbean; 2 | // 3 | //import com.xxl.job.admin.core.thread.JobTriggerPoolHelper; 4 | //import com.xxl.job.admin.core.trigger.TriggerTypeEnum; 5 | //import org.quartz.JobExecutionContext; 6 | //import org.quartz.JobExecutionException; 7 | //import org.quartz.JobKey; 8 | //import org.slf4j.Logger; 9 | //import org.slf4j.LoggerFactory; 10 | //import org.springframework.scheduling.quartz.QuartzJobBean; 11 | // 12 | ///** 13 | // * http job bean 14 | // * “@DisallowConcurrentExecution” disable concurrent, thread size can not be only one, better given more 15 | // * @author xuxueli 2015-12-17 18:20:34 16 | // */ 17 | ////@DisallowConcurrentExecution 18 | //public class RemoteHttpJobBean extends QuartzJobBean { 19 | // private static Logger logger = LoggerFactory.getLogger(RemoteHttpJobBean.class); 20 | // 21 | // @Override 22 | // protected void executeInternal(JobExecutionContext context) 23 | // throws JobExecutionException { 24 | // 25 | // // load jobId 26 | // JobKey jobKey = context.getTrigger().getJobKey(); 27 | // Integer jobId = Integer.valueOf(jobKey.getName()); 28 | // 29 | // 30 | // } 31 | // 32 | //} -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/ExecutorRouter.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.core.route; 2 | 3 | import com.xxl.job.core.biz.model.ReturnT; 4 | import com.xxl.job.core.biz.model.TriggerParam; 5 | import org.slf4j.Logger; 6 | import org.slf4j.LoggerFactory; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * Created by xuxueli on 17/3/10. 12 | */ 13 | public abstract class ExecutorRouter { 14 | protected static Logger logger = LoggerFactory.getLogger(ExecutorRouter.class); 15 | 16 | /** 17 | * route address 18 | * 19 | * @param addressList 20 | * @return ReturnT.content=address 21 | */ 22 | public abstract ReturnT route(TriggerParam triggerParam, List addressList); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteFirst.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.core.route.strategy; 2 | 3 | import com.xxl.job.admin.core.route.ExecutorRouter; 4 | import com.xxl.job.core.biz.model.ReturnT; 5 | import com.xxl.job.core.biz.model.TriggerParam; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by xuxueli on 17/3/10. 11 | */ 12 | public class ExecutorRouteFirst extends ExecutorRouter { 13 | 14 | @Override 15 | public ReturnT route(TriggerParam triggerParam, List addressList){ 16 | return new ReturnT(addressList.get(0)); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteLast.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.core.route.strategy; 2 | 3 | import com.xxl.job.admin.core.route.ExecutorRouter; 4 | import com.xxl.job.core.biz.model.ReturnT; 5 | import com.xxl.job.core.biz.model.TriggerParam; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by xuxueli on 17/3/10. 11 | */ 12 | public class ExecutorRouteLast extends ExecutorRouter { 13 | 14 | @Override 15 | public ReturnT route(TriggerParam triggerParam, List addressList) { 16 | return new ReturnT(addressList.get(addressList.size()-1)); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteRandom.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.core.route.strategy; 2 | 3 | import com.xxl.job.admin.core.route.ExecutorRouter; 4 | import com.xxl.job.core.biz.model.ReturnT; 5 | import com.xxl.job.core.biz.model.TriggerParam; 6 | 7 | import java.util.List; 8 | import java.util.Random; 9 | 10 | /** 11 | * Created by xuxueli on 17/3/10. 12 | */ 13 | public class ExecutorRouteRandom extends ExecutorRouter { 14 | 15 | private static Random localRandom = new Random(); 16 | 17 | @Override 18 | public ReturnT route(TriggerParam triggerParam, List addressList) { 19 | String address = addressList.get(localRandom.nextInt(addressList.size())); 20 | return new ReturnT(address); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/trigger/TriggerTypeEnum.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.core.trigger; 2 | 3 | import com.xxl.job.admin.core.util.I18nUtil; 4 | 5 | /** 6 | * trigger type enum 7 | * 8 | * @author xuxueli 2018-09-16 04:56:41 9 | */ 10 | public enum TriggerTypeEnum { 11 | 12 | MANUAL(I18nUtil.getString("jobconf_trigger_type_manual")), 13 | CRON(I18nUtil.getString("jobconf_trigger_type_cron")), 14 | RETRY(I18nUtil.getString("jobconf_trigger_type_retry")), 15 | PARENT(I18nUtil.getString("jobconf_trigger_type_parent")), 16 | API(I18nUtil.getString("jobconf_trigger_type_api")); 17 | 18 | private TriggerTypeEnum(String title){ 19 | this.title = title; 20 | } 21 | private String title; 22 | public String getTitle() { 23 | return title; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/FtlUtil.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.core.util; 2 | 3 | import freemarker.ext.beans.BeansWrapper; 4 | import freemarker.ext.beans.BeansWrapperBuilder; 5 | import freemarker.template.Configuration; 6 | import freemarker.template.TemplateHashModel; 7 | import org.slf4j.Logger; 8 | import org.slf4j.LoggerFactory; 9 | 10 | /** 11 | * ftl util 12 | * 13 | * @author xuxueli 2018-01-17 20:37:48 14 | */ 15 | public class FtlUtil { 16 | private static Logger logger = LoggerFactory.getLogger(FtlUtil.class); 17 | 18 | private static BeansWrapper wrapper = new BeansWrapperBuilder(Configuration.DEFAULT_INCOMPATIBLE_IMPROVEMENTS).build(); //BeansWrapper.getDefaultInstance(); 19 | 20 | public static TemplateHashModel generateStaticModel(String packageName) { 21 | try { 22 | TemplateHashModel staticModels = wrapper.getStaticModels(); 23 | TemplateHashModel fileStatics = (TemplateHashModel) staticModels.get(packageName); 24 | return fileStatics; 25 | } catch (Exception e) { 26 | logger.error(e.getMessage(), e); 27 | } 28 | return null; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobLogGlueDao.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.dao; 2 | 3 | import com.xxl.job.admin.core.model.XxlJobLogGlue; 4 | import org.apache.ibatis.annotations.Mapper; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * job log for glue 11 | * @author xuxueli 2016-5-19 18:04:56 12 | */ 13 | @Mapper 14 | public interface XxlJobLogGlueDao { 15 | 16 | public int save(XxlJobLogGlue xxlJobLogGlue); 17 | 18 | public List findByJobId(@Param("jobId") int jobId); 19 | 20 | public int removeOld(@Param("jobId") int jobId, @Param("limit") int limit); 21 | 22 | public int deleteByJobId(@Param("jobId") int jobId); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobLogReportDao.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.dao; 2 | 3 | import com.xxl.job.admin.core.model.XxlJobLogReport; 4 | import org.apache.ibatis.annotations.Mapper; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.Date; 8 | import java.util.List; 9 | 10 | /** 11 | * job log 12 | * @author xuxueli 2019-11-22 13 | */ 14 | @Mapper 15 | public interface XxlJobLogReportDao { 16 | 17 | public int save(XxlJobLogReport xxlJobLogReport); 18 | 19 | public int update(XxlJobLogReport xxlJobLogReport); 20 | 21 | public List queryLogReport(@Param("triggerDayFrom") Date triggerDayFrom, 22 | @Param("triggerDayTo") Date triggerDayTo); 23 | 24 | public XxlJobLogReport queryLogReportTotal(); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobUserDao.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.dao; 2 | 3 | import com.xxl.job.admin.core.model.XxlJobUser; 4 | import org.apache.ibatis.annotations.Mapper; 5 | import org.apache.ibatis.annotations.Param; 6 | import java.util.List; 7 | 8 | /** 9 | * @author xuxueli 2019-05-04 16:44:59 10 | */ 11 | @Mapper 12 | public interface XxlJobUserDao { 13 | 14 | public List pageList(@Param("offset") int offset, 15 | @Param("pagesize") int pagesize, 16 | @Param("username") String username, 17 | @Param("role") int role); 18 | public int pageListCount(@Param("offset") int offset, 19 | @Param("pagesize") int pagesize, 20 | @Param("username") String username, 21 | @Param("role") int role); 22 | 23 | public XxlJobUser loadByUserName(@Param("username") String username); 24 | 25 | public int save(XxlJobUser xxlJobUser); 26 | 27 | public int update(XxlJobUser xxlJobUser); 28 | 29 | public int delete(@Param("id") int id); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/xxl-job-admin/src/main/resources/application.properties -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | logback 5 | 6 | 7 | 8 | 9 | %d{HH:mm:ss.SSS} %contextName [%thread] %-5level %logger{36} - %msg%n 10 | 11 | 12 | 13 | 14 | ${log.path} 15 | 16 | ${log.path}.%d{yyyy-MM-dd}.zip 17 | 18 | 19 | %date %level [%thread] %logger{36} [%file : %line] %msg%n 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/Ionicons/fonts/ionicons.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/Ionicons/fonts/ionicons.eot -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/Ionicons/fonts/ionicons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/Ionicons/fonts/ionicons.ttf -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/Ionicons/fonts/ionicons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/Ionicons/fonts/ionicons.woff -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/bootstrap/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/bootstrap/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/bootstrap/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/bootstrap/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/bootstrap/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/bootstrap/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/bootstrap/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/bootstrap/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/font-awesome/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/font-awesome/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/font-awesome/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/font-awesome/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/font-awesome/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/font-awesome/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/font-awesome/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/font-awesome/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/font-awesome/fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/xxl-job-admin/src/main/resources/static/adminlte/bower_components/font-awesome/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/adminlte/plugins/iCheck/square/blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/xxl-job-admin/src/main/resources/static/adminlte/plugins/iCheck/square/blue.png -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/adminlte/plugins/iCheck/square/blue@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/xxl-job-admin/src/main/resources/static/adminlte/plugins/iCheck/square/blue@2x.png -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/xxl-job-admin/src/main/resources/static/favicon.ico -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/plugins/codemirror/addon/hint/show-hint.css: -------------------------------------------------------------------------------- 1 | .CodeMirror-hints { 2 | position: absolute; 3 | z-index: 10; 4 | overflow: hidden; 5 | list-style: none; 6 | 7 | margin: 0; 8 | padding: 2px; 9 | 10 | -webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2); 11 | -moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2); 12 | box-shadow: 2px 3px 5px rgba(0,0,0,.2); 13 | border-radius: 3px; 14 | border: 1px solid silver; 15 | 16 | background: white; 17 | font-size: 90%; 18 | font-family: monospace; 19 | 20 | max-height: 20em; 21 | overflow-y: auto; 22 | } 23 | 24 | .CodeMirror-hint { 25 | margin: 0; 26 | padding: 0 4px; 27 | border-radius: 2px; 28 | white-space: pre; 29 | color: black; 30 | cursor: pointer; 31 | } 32 | 33 | li.CodeMirror-hint-active { 34 | background: #08f; 35 | color: white; 36 | } 37 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/plugins/layer/theme/default/icon-ext.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/xxl-job-admin/src/main/resources/static/plugins/layer/theme/default/icon-ext.png -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/plugins/layer/theme/default/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/xxl-job-admin/src/main/resources/static/plugins/layer/theme/default/icon.png -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/plugins/layer/theme/default/loading-0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/xxl-job-admin/src/main/resources/static/plugins/layer/theme/default/loading-0.gif -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/plugins/layer/theme/default/loading-1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/xxl-job-admin/src/main/resources/static/plugins/layer/theme/default/loading-1.gif -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/static/plugins/layer/theme/default/loading-2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/xxl-job-admin/src/main/resources/static/plugins/layer/theme/default/loading-2.gif -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/main/resources/templates/common/common.exception.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Error 6 | 18 | 19 | 20 | 21 | 22 | 23 |
24 |

System Error

25 |

${exceptionMsg}

26 | Back 27 |

28 |
29 | 30 | 31 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/test/java/com/xxl/job/admin/controller/AbstractSpringMvcTest.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.controller; 2 | 3 | import org.junit.Before; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.boot.test.context.SpringBootTest; 7 | import org.springframework.test.context.ContextConfiguration; 8 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 9 | import org.springframework.test.context.junit4.SpringRunner; 10 | import org.springframework.test.context.web.WebAppConfiguration; 11 | import org.springframework.test.web.servlet.MockMvc; 12 | import org.springframework.test.web.servlet.setup.MockMvcBuilders; 13 | import org.springframework.web.context.WebApplicationContext; 14 | 15 | @RunWith(SpringRunner.class) 16 | @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) 17 | public class AbstractSpringMvcTest { 18 | 19 | @Autowired 20 | private WebApplicationContext applicationContext; 21 | protected MockMvc mockMvc; 22 | 23 | @Before 24 | public void setup() { 25 | this.mockMvc = MockMvcBuilders.webAppContextSetup(this.applicationContext).build(); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/test/java/com/xxl/job/admin/core/util/JacksonUtilTest.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.core.util; 2 | 3 | import org.hamcrest.core.Is; 4 | import org.junit.Test; 5 | 6 | import java.util.HashMap; 7 | import java.util.Map; 8 | 9 | import static com.xxl.job.admin.core.util.JacksonUtil.writeValueAsString; 10 | import static org.hamcrest.core.Is.is; 11 | import static org.junit.Assert.assertThat; 12 | 13 | public class JacksonUtilTest { 14 | 15 | @Test 16 | public void shouldWriteValueAsString() { 17 | //given 18 | Map map = new HashMap<>(); 19 | map.put("aaa", "111"); 20 | map.put("bbb", "222"); 21 | 22 | //when 23 | String json = writeValueAsString(map); 24 | 25 | //then 26 | assertThat(json, is("{\"aaa\":\"111\",\"bbb\":\"222\"}")); 27 | } 28 | 29 | @Test 30 | public void shouldReadValueAsObject() { 31 | //given 32 | String jsonString = "{\"aaa\":\"111\",\"bbb\":\"222\"}"; 33 | 34 | //when 35 | Map result = JacksonUtil.readValue(jsonString, Map.class); 36 | 37 | //then 38 | assertThat(result.get("aaa"), Is.is("111")); 39 | assertThat(result.get("bbb"), Is.is("222")); 40 | 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/test/java/com/xxl/job/admin/dao/XxlJobLogGlueDaoTest.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.dao; 2 | 3 | import com.xxl.job.admin.core.model.XxlJobLogGlue; 4 | import org.junit.Test; 5 | import org.junit.runner.RunWith; 6 | import org.springframework.boot.test.context.SpringBootTest; 7 | import org.springframework.test.context.junit4.SpringRunner; 8 | 9 | import javax.annotation.Resource; 10 | import java.util.Date; 11 | import java.util.List; 12 | 13 | @RunWith(SpringRunner.class) 14 | @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) 15 | public class XxlJobLogGlueDaoTest { 16 | 17 | @Resource 18 | private XxlJobLogGlueDao xxlJobLogGlueDao; 19 | 20 | @Test 21 | public void test(){ 22 | XxlJobLogGlue logGlue = new XxlJobLogGlue(); 23 | logGlue.setJobId(1); 24 | logGlue.setGlueType("1"); 25 | logGlue.setGlueSource("1"); 26 | logGlue.setGlueRemark("1"); 27 | 28 | logGlue.setAddTime(new Date()); 29 | logGlue.setUpdateTime(new Date()); 30 | int ret = xxlJobLogGlueDao.save(logGlue); 31 | 32 | List list = xxlJobLogGlueDao.findByJobId(1); 33 | 34 | int ret2 = xxlJobLogGlueDao.removeOld(1, 1); 35 | 36 | int ret3 =xxlJobLogGlueDao.deleteByJobId(1); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/test/java/com/xxl/job/admin/dao/XxlJobRegistryDaoTest.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.dao; 2 | 3 | import com.xxl.job.admin.core.model.XxlJobRegistry; 4 | import org.junit.Test; 5 | import org.junit.runner.RunWith; 6 | import org.springframework.boot.test.context.SpringBootTest; 7 | import org.springframework.test.context.junit4.SpringRunner; 8 | 9 | import javax.annotation.Resource; 10 | import java.util.Arrays; 11 | import java.util.Date; 12 | import java.util.List; 13 | 14 | @RunWith(SpringRunner.class) 15 | @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) 16 | public class XxlJobRegistryDaoTest { 17 | 18 | @Resource 19 | private XxlJobRegistryDao xxlJobRegistryDao; 20 | 21 | @Test 22 | public void test(){ 23 | int ret = xxlJobRegistryDao.registryUpdate("g1", "k1", "v1", new Date()); 24 | if (ret < 1) { 25 | ret = xxlJobRegistryDao.registrySave("g1", "k1", "v1", new Date()); 26 | } 27 | 28 | List list = xxlJobRegistryDao.findAll(1, new Date()); 29 | 30 | int ret2 = xxlJobRegistryDao.removeDead(Arrays.asList(1)); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-admin/src/test/java/com/xxl/job/admin/util/I18nUtilTest.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.admin.util; 2 | 3 | import com.xxl.job.admin.core.util.I18nUtil; 4 | import org.junit.Test; 5 | import org.junit.runner.RunWith; 6 | import org.springframework.boot.test.context.SpringBootTest; 7 | import org.springframework.test.context.ContextConfiguration; 8 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 9 | import org.springframework.test.context.junit4.SpringRunner; 10 | 11 | /** 12 | * email util test 13 | * 14 | * @author xuxueli 2017-12-22 17:16:23 15 | */ 16 | @RunWith(SpringRunner.class) 17 | @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) 18 | public class I18nUtilTest { 19 | 20 | @Test 21 | public void test(){ 22 | System.out.println(I18nUtil.getString("admin_name")); 23 | System.out.println(I18nUtil.getMultString("admin_name", "admin_name_full")); 24 | System.out.println(I18nUtil.getMultString()); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-core/src/main/java/com/xxl/job/core/biz/AdminBiz.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.core.biz; 2 | 3 | import com.xxl.job.core.biz.model.HandleCallbackParam; 4 | import com.xxl.job.core.biz.model.RegistryParam; 5 | import com.xxl.job.core.biz.model.ReturnT; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @author xuxueli 2017-07-27 21:52:49 11 | */ 12 | public interface AdminBiz { 13 | 14 | 15 | // ---------------------- callback ---------------------- 16 | 17 | /** 18 | * callback 19 | * 20 | * @param callbackParamList 21 | * @return 22 | */ 23 | public ReturnT callback(List callbackParamList); 24 | 25 | 26 | // ---------------------- registry ---------------------- 27 | 28 | /** 29 | * registry 30 | * 31 | * @param registryParam 32 | * @return 33 | */ 34 | public ReturnT registry(RegistryParam registryParam); 35 | 36 | /** 37 | * registry remove 38 | * 39 | * @param registryParam 40 | * @return 41 | */ 42 | public ReturnT registryRemove(RegistryParam registryParam); 43 | 44 | 45 | // ---------------------- biz (custome) ---------------------- 46 | // group、job ... manage 47 | 48 | } 49 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-core/src/main/java/com/xxl/job/core/biz/ExecutorBiz.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.core.biz; 2 | 3 | import com.xxl.job.core.biz.model.*; 4 | 5 | /** 6 | * Created by xuxueli on 17/3/1. 7 | */ 8 | public interface ExecutorBiz { 9 | 10 | /** 11 | * beat 12 | * @return 13 | */ 14 | public ReturnT beat(); 15 | 16 | /** 17 | * idle beat 18 | * 19 | * @param idleBeatParam 20 | * @return 21 | */ 22 | public ReturnT idleBeat(IdleBeatParam idleBeatParam); 23 | 24 | /** 25 | * run 26 | * @param triggerParam 27 | * @return 28 | */ 29 | public ReturnT run(TriggerParam triggerParam); 30 | 31 | /** 32 | * kill 33 | * @param killParam 34 | * @return 35 | */ 36 | public ReturnT kill(KillParam killParam); 37 | 38 | /** 39 | * log 40 | * @param logParam 41 | * @return 42 | */ 43 | public ReturnT log(LogParam logParam); 44 | 45 | } 46 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-core/src/main/java/com/xxl/job/core/biz/model/IdleBeatParam.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.core.biz.model; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * @author xuxueli 2020-04-11 22:27 7 | */ 8 | public class IdleBeatParam implements Serializable { 9 | private static final long serialVersionUID = 42L; 10 | 11 | public IdleBeatParam() { 12 | } 13 | public IdleBeatParam(int jobId) { 14 | this.jobId = jobId; 15 | } 16 | 17 | private int jobId; 18 | 19 | 20 | public int getJobId() { 21 | return jobId; 22 | } 23 | 24 | public void setJobId(int jobId) { 25 | this.jobId = jobId; 26 | } 27 | 28 | } -------------------------------------------------------------------------------- /xxl-job/xxl-job-core/src/main/java/com/xxl/job/core/biz/model/KillParam.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.core.biz.model; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * @author xuxueli 2020-04-11 22:27 7 | */ 8 | public class KillParam implements Serializable { 9 | private static final long serialVersionUID = 42L; 10 | 11 | public KillParam() { 12 | } 13 | public KillParam(int jobId) { 14 | this.jobId = jobId; 15 | } 16 | 17 | private int jobId; 18 | 19 | 20 | public int getJobId() { 21 | return jobId; 22 | } 23 | 24 | public void setJobId(int jobId) { 25 | this.jobId = jobId; 26 | } 27 | 28 | } -------------------------------------------------------------------------------- /xxl-job/xxl-job-core/src/main/java/com/xxl/job/core/biz/model/LogParam.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.core.biz.model; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * @author xuxueli 2020-04-11 22:27 7 | */ 8 | public class LogParam implements Serializable { 9 | private static final long serialVersionUID = 42L; 10 | 11 | public LogParam() { 12 | } 13 | public LogParam(long logDateTim, long logId, int fromLineNum) { 14 | this.logDateTim = logDateTim; 15 | this.logId = logId; 16 | this.fromLineNum = fromLineNum; 17 | } 18 | 19 | private long logDateTim; 20 | private long logId; 21 | private int fromLineNum; 22 | 23 | public long getLogDateTim() { 24 | return logDateTim; 25 | } 26 | 27 | public void setLogDateTim(long logDateTim) { 28 | this.logDateTim = logDateTim; 29 | } 30 | 31 | public long getLogId() { 32 | return logId; 33 | } 34 | 35 | public void setLogId(long logId) { 36 | this.logId = logId; 37 | } 38 | 39 | public int getFromLineNum() { 40 | return fromLineNum; 41 | } 42 | 43 | public void setFromLineNum(int fromLineNum) { 44 | this.fromLineNum = fromLineNum; 45 | } 46 | 47 | } -------------------------------------------------------------------------------- /xxl-job/xxl-job-core/src/main/java/com/xxl/job/core/enums/ExecutorBlockStrategyEnum.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.core.enums; 2 | 3 | /** 4 | * Created by xuxueli on 17/5/9. 5 | */ 6 | public enum ExecutorBlockStrategyEnum { 7 | 8 | SERIAL_EXECUTION("Serial execution"), 9 | /*CONCURRENT_EXECUTION("并行"),*/ 10 | DISCARD_LATER("Discard Later"), 11 | COVER_EARLY("Cover Early"); 12 | 13 | private String title; 14 | private ExecutorBlockStrategyEnum (String title) { 15 | this.title = title; 16 | } 17 | 18 | public void setTitle(String title) { 19 | this.title = title; 20 | } 21 | public String getTitle() { 22 | return title; 23 | } 24 | 25 | public static ExecutorBlockStrategyEnum match(String name, ExecutorBlockStrategyEnum defaultItem) { 26 | if (name != null) { 27 | for (ExecutorBlockStrategyEnum item:ExecutorBlockStrategyEnum.values()) { 28 | if (item.name().equals(name)) { 29 | return item; 30 | } 31 | } 32 | } 33 | return defaultItem; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-core/src/main/java/com/xxl/job/core/enums/RegistryConfig.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.core.enums; 2 | 3 | /** 4 | * Created by xuxueli on 17/5/10. 5 | */ 6 | public class RegistryConfig { 7 | 8 | public static final int BEAT_TIMEOUT = 30; 9 | public static final int DEAD_TIMEOUT = BEAT_TIMEOUT * 3; 10 | 11 | public enum RegistType{ EXECUTOR, ADMIN } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-core/src/main/java/com/xxl/job/core/handler/annotation/JobHandler.java: -------------------------------------------------------------------------------- 1 | //package com.xxl.job.core.handler.annotation; 2 | // 3 | //import java.lang.annotation.ElementType; 4 | //import java.lang.annotation.Inherited; 5 | //import java.lang.annotation.Retention; 6 | //import java.lang.annotation.RetentionPolicy; 7 | //import java.lang.annotation.Target; 8 | // 9 | ///** 10 | // * annotation for job handler 11 | // * 12 | // * will be replaced by {@link com.xxl.job.core.handler.annotation.XxlJob} 13 | // * 14 | // * @author 2016-5-17 21:06:49 15 | // */ 16 | //@Target({ElementType.TYPE}) 17 | //@Retention(RetentionPolicy.RUNTIME) 18 | //@Inherited 19 | //@Deprecated 20 | //public @interface JobHandler { 21 | // 22 | // String value(); 23 | // 24 | //} 25 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-core/src/main/java/com/xxl/job/core/handler/annotation/XxlJob.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.core.handler.annotation; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * annotation for method jobhandler 7 | * 8 | * @author xuxueli 2019-12-11 20:50:13 9 | */ 10 | @Target({ElementType.METHOD}) 11 | @Retention(RetentionPolicy.RUNTIME) 12 | @Inherited 13 | public @interface XxlJob { 14 | 15 | /** 16 | * jobhandler name 17 | */ 18 | String value(); 19 | 20 | /** 21 | * init handler, invoked when JobThread init 22 | */ 23 | String init() default ""; 24 | 25 | /** 26 | * destroy handler, invoked when JobThread destroy 27 | */ 28 | String destroy() default ""; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-core/src/main/java/com/xxl/job/core/handler/impl/GlueJobHandler.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.core.handler.impl; 2 | 3 | import com.xxl.job.core.biz.model.ReturnT; 4 | import com.xxl.job.core.handler.IJobHandler; 5 | import com.xxl.job.core.log.XxlJobLogger; 6 | 7 | /** 8 | * glue job handler 9 | * 10 | * @author xuxueli 2016-5-19 21:05:45 11 | */ 12 | public class GlueJobHandler extends IJobHandler { 13 | 14 | private long glueUpdatetime; 15 | private IJobHandler jobHandler; 16 | public GlueJobHandler(IJobHandler jobHandler, long glueUpdatetime) { 17 | this.jobHandler = jobHandler; 18 | this.glueUpdatetime = glueUpdatetime; 19 | } 20 | public long getGlueUpdatetime() { 21 | return glueUpdatetime; 22 | } 23 | 24 | @Override 25 | public ReturnT execute(String param) throws Exception { 26 | XxlJobLogger.log("----------- glue.version:"+ glueUpdatetime +" -----------"); 27 | return jobHandler.execute(param); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-core/src/main/java/com/xxl/job/core/util/ShardingUtil.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.core.util; 2 | 3 | /** 4 | * sharding vo 5 | * @author xuxueli 2017-07-25 21:26:38 6 | */ 7 | public class ShardingUtil { 8 | 9 | private static InheritableThreadLocal contextHolder = new InheritableThreadLocal(); 10 | 11 | public static class ShardingVO { 12 | 13 | private int index; // sharding index 14 | private int total; // sharding total 15 | 16 | public ShardingVO(int index, int total) { 17 | this.index = index; 18 | this.total = total; 19 | } 20 | 21 | public int getIndex() { 22 | return index; 23 | } 24 | 25 | public void setIndex(int index) { 26 | this.index = index; 27 | } 28 | 29 | public int getTotal() { 30 | return total; 31 | } 32 | 33 | public void setTotal(int total) { 34 | this.total = total; 35 | } 36 | } 37 | 38 | public static void setShardingVo(ShardingVO shardingVo){ 39 | contextHolder.set(shardingVo); 40 | } 41 | 42 | public static ShardingVO getShardingVo(){ 43 | return contextHolder.get(); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-core/src/main/java/com/xxl/job/core/util/ThrowableUtil.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.core.util; 2 | 3 | import java.io.PrintWriter; 4 | import java.io.StringWriter; 5 | 6 | /** 7 | * @author xuxueli 2018-10-20 20:07:26 8 | */ 9 | public class ThrowableUtil { 10 | 11 | /** 12 | * parse error to string 13 | * 14 | * @param e 15 | * @return 16 | */ 17 | public static String toString(Throwable e) { 18 | StringWriter stringWriter = new StringWriter(); 19 | e.printStackTrace(new PrintWriter(stringWriter)); 20 | String errorMsg = stringWriter.toString(); 21 | return errorMsg; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-executor-samples/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 4.0.0 5 | 6 | com.xuxueli 7 | xxl-job 8 | 2.2.1-SNAPSHOT 9 | 10 | xxl-job-executor-samples 11 | pom 12 | 13 | 14 | xxl-job-executor-sample-frameless 15 | xxl-job-executor-sample-springboot 16 | xxl-job-executor-sample-spring 17 | xxl-job-executor-sample-jfinal 18 | xxl-job-executor-sample-nutz 19 | xxl-job-executor-sample-jboot 20 | 21 | 22 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-frameless/src/main/java/com/xuxueli/executor/sample/frameless/FramelessApplication.java: -------------------------------------------------------------------------------- 1 | package com.xuxueli.executor.sample.frameless; 2 | 3 | import com.xuxueli.executor.sample.frameless.config.FrameLessXxlJobConfig; 4 | import org.slf4j.Logger; 5 | import org.slf4j.LoggerFactory; 6 | 7 | import java.util.concurrent.TimeUnit; 8 | 9 | /** 10 | * @author xuxueli 2018-10-31 19:05:43 11 | */ 12 | public class FramelessApplication { 13 | private static Logger logger = LoggerFactory.getLogger(FramelessApplication.class); 14 | 15 | public static void main(String[] args) { 16 | 17 | try { 18 | // start 19 | FrameLessXxlJobConfig.getInstance().initXxlJobExecutor(); 20 | 21 | // Blocks until interrupted 22 | while (true) { 23 | try { 24 | TimeUnit.HOURS.sleep(1); 25 | } catch (InterruptedException e) { 26 | break; 27 | } 28 | } 29 | } catch (Exception e) { 30 | logger.error(e.getMessage(), e); 31 | } finally { 32 | // destory 33 | FrameLessXxlJobConfig.getInstance().destoryXxlJobExecutor(); 34 | } 35 | 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-frameless/src/main/java/com/xuxueli/executor/sample/frameless/jobhandler/DemoJobHandler.java: -------------------------------------------------------------------------------- 1 | package com.xuxueli.executor.sample.frameless.jobhandler; 2 | 3 | import com.xxl.job.core.biz.model.ReturnT; 4 | import com.xxl.job.core.handler.IJobHandler; 5 | import com.xxl.job.core.log.XxlJobLogger; 6 | 7 | import java.util.concurrent.TimeUnit; 8 | 9 | /** 10 | * 任务Handler示例(Bean模式) 11 | * 12 | * 开发步骤: 13 | * 1、继承"IJobHandler":“com.xxl.job.core.handler.IJobHandler”; 14 | * 2、注册到执行器工厂:在 "JFinalCoreConfig.initXxlJobExecutor" 中手动注册,注解key值对应的是调度中心新建任务的JobHandler属性的值。 15 | * 3、执行日志:需要通过 "XxlJobLogger.log" 打印执行日志; 16 | * 17 | * @author xuxueli 2015-12-19 19:43:36 18 | */ 19 | public class DemoJobHandler extends IJobHandler { 20 | 21 | @Override 22 | public ReturnT execute(String param) throws Exception { 23 | XxlJobLogger.log("XXL-JOB, Hello World."); 24 | 25 | for (int i = 0; i < 5; i++) { 26 | XxlJobLogger.log("beat at:" + i); 27 | TimeUnit.SECONDS.sleep(2); 28 | } 29 | return SUCCESS; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-frameless/src/main/java/com/xuxueli/executor/sample/frameless/jobhandler/ShardingJobHandler.java: -------------------------------------------------------------------------------- 1 | package com.xuxueli.executor.sample.frameless.jobhandler; 2 | 3 | import com.xxl.job.core.biz.model.ReturnT; 4 | import com.xxl.job.core.handler.IJobHandler; 5 | import com.xxl.job.core.log.XxlJobLogger; 6 | import com.xxl.job.core.util.ShardingUtil; 7 | 8 | /** 9 | * 分片广播任务 10 | * 11 | * @author xuxueli 2017-07-25 20:56:50 12 | */ 13 | public class ShardingJobHandler extends IJobHandler { 14 | 15 | @Override 16 | public ReturnT execute(String param) throws Exception { 17 | 18 | // 分片参数 19 | ShardingUtil.ShardingVO shardingVO = ShardingUtil.getShardingVo(); 20 | XxlJobLogger.log("分片参数:当前分片序号 = {}, 总分片数 = {}", shardingVO.getIndex(), shardingVO.getTotal()); 21 | 22 | // 业务逻辑 23 | for (int i = 0; i < shardingVO.getTotal(); i++) { 24 | if (i == shardingVO.getIndex()) { 25 | XxlJobLogger.log("第 {} 片, 命中分片开始处理", i); 26 | } else { 27 | XxlJobLogger.log("第 {} 片, 忽略", i); 28 | } 29 | } 30 | 31 | return SUCCESS; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-frameless/src/main/resources/xxl-job-executor.properties: -------------------------------------------------------------------------------- 1 | ### xxl-job admin address list, such as "http://address" or "http://address01,http://address02" 2 | xxl.job.admin.addresses=http://127.0.0.1:8080/xxl-job-admin 3 | 4 | ### xxl-job, access token 5 | xxl.job.accessToken= 6 | 7 | ### xxl-job executor appname 8 | xxl.job.executor.appname=xxl-job-executor-sample 9 | ### xxl-job executor registry-address: default use address to registry , otherwise use ip:port if address is null 10 | xxl.job.executor.address= 11 | ### xxl-job executor server-info 12 | xxl.job.executor.ip= 13 | xxl.job.executor.port=9999 14 | ### xxl-job executor log-path 15 | xxl.job.executor.logpath=/data/applogs/xxl-job/jobhandler 16 | ### xxl-job executor log-retention-days 17 | xxl.job.executor.logretentiondays=30 -------------------------------------------------------------------------------- /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-jboot/src/main/java/com/xuxueli/executor/sample/jboot/JbootApp.java: -------------------------------------------------------------------------------- 1 | package com.xuxueli.executor.sample.jboot; 2 | 3 | import io.jboot.app.JbootApplication; 4 | 5 | /** 6 | * Jboot app 7 | */ 8 | public class JbootApp { 9 | public static void main(String[] args) { 10 | JbootApplication.run(args); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-jboot/src/main/java/com/xuxueli/executor/sample/jboot/controller/IndexController.java: -------------------------------------------------------------------------------- 1 | package com.xuxueli.executor.sample.jboot.controller; 2 | 3 | import io.jboot.web.controller.JbootController; 4 | import io.jboot.web.controller.annotation.RequestMapping; 5 | 6 | 7 | @RequestMapping("/") 8 | public class IndexController extends JbootController { 9 | 10 | public void index() { 11 | renderText("xxl job executor running."); 12 | } 13 | 14 | } -------------------------------------------------------------------------------- /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-jboot/src/main/java/com/xuxueli/executor/sample/jboot/jobhandler/DemoJobHandler.java: -------------------------------------------------------------------------------- 1 | package com.xuxueli.executor.sample.jboot.jobhandler; 2 | 3 | import com.xxl.job.core.biz.model.ReturnT; 4 | import com.xxl.job.core.handler.IJobHandler; 5 | import com.xxl.job.core.log.XxlJobLogger; 6 | 7 | import java.util.concurrent.TimeUnit; 8 | 9 | /** 10 | * 任务Handler示例(Bean模式) 11 | * 12 | * 开发步骤: 13 | * 1、继承"IJobHandler":“com.xxl.job.core.handler.IJobHandler”; 14 | * 2、注册到执行器工厂:在 "JFinalCoreConfig.initXxlJobExecutor" 中手动注册,注解key值对应的是调度中心新建任务的JobHandler属性的值。 15 | * 3、执行日志:需要通过 "XxlJobLogger.log" 打印执行日志; 16 | * 17 | * @author xuxueli 2015-12-19 19:43:36 18 | */ 19 | public class DemoJobHandler extends IJobHandler { 20 | 21 | @Override 22 | public ReturnT execute(String param) throws Exception { 23 | XxlJobLogger.log("XXL-JOB, Hello World."); 24 | 25 | for (int i = 0; i < 5; i++) { 26 | XxlJobLogger.log("beat at:" + i); 27 | TimeUnit.SECONDS.sleep(2); 28 | } 29 | return SUCCESS; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-jboot/src/main/java/com/xuxueli/executor/sample/jboot/jobhandler/ShardingJobHandler.java: -------------------------------------------------------------------------------- 1 | package com.xuxueli.executor.sample.jboot.jobhandler; 2 | 3 | import com.xxl.job.core.biz.model.ReturnT; 4 | import com.xxl.job.core.handler.IJobHandler; 5 | import com.xxl.job.core.log.XxlJobLogger; 6 | import com.xxl.job.core.util.ShardingUtil; 7 | 8 | /** 9 | * 分片广播任务 10 | * 11 | * @author xuxueli 2017-07-25 20:56:50 12 | */ 13 | public class ShardingJobHandler extends IJobHandler { 14 | 15 | @Override 16 | public ReturnT execute(String param) throws Exception { 17 | 18 | // 分片参数 19 | ShardingUtil.ShardingVO shardingVO = ShardingUtil.getShardingVo(); 20 | XxlJobLogger.log("分片参数:当前分片序号 = {}, 总分片数 = {}", shardingVO.getIndex(), shardingVO.getTotal()); 21 | 22 | // 业务逻辑 23 | for (int i = 0; i < shardingVO.getTotal(); i++) { 24 | if (i == shardingVO.getIndex()) { 25 | XxlJobLogger.log("第 {} 片, 命中分片开始处理", i); 26 | } else { 27 | XxlJobLogger.log("第 {} 片, 忽略", i); 28 | } 29 | } 30 | 31 | return SUCCESS; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-jboot/src/main/resources/jboot.properties: -------------------------------------------------------------------------------- 1 | ### xxl-job admin address list, such as "http://address" or "http://address01,http://address02" 2 | xxl.job.admin.addresses=http://127.0.0.1:8080/xxl-job-admin 3 | 4 | ### xxl-job, access token 5 | xxl.job.accessToken= 6 | 7 | ### xxl-job executor appname 8 | xxl.job.executor.appname=xxl-job-executor-sample 9 | ### xxl-job executor registry-address: default use address to registry , otherwise use ip:port if address is null 10 | xxl.job.executor.address= 11 | ### xxl-job executor server-info 12 | xxl.job.executor.ip= 13 | xxl.job.executor.port=9999 14 | ### xxl-job executor log-path 15 | xxl.job.executor.logpath=/data/applogs/xxl-job/jobhandler 16 | ### xxl-job executor log-retention-days 17 | xxl.job.executor.logretentiondays=30 -------------------------------------------------------------------------------- /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-jboot/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | logback 5 | 6 | 7 | 8 | 9 | %d{HH:mm:ss.SSS} %contextName [%thread] %-5level %logger{36} - %msg%n 10 | 11 | 12 | 13 | 14 | ${log.path} 15 | 16 | ${log.path}.%d{yyyy-MM-dd}.zip 17 | 18 | 19 | %date %level [%thread] %logger{36} [%file : %line] %msg%n 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-jboot/src/test/java/com/xuxueli/AppTest.java: -------------------------------------------------------------------------------- 1 | package com.xuxueli; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.assertTrue; 6 | 7 | /** 8 | * Unit test for simple App. 9 | */ 10 | public class AppTest { 11 | /** 12 | * Rigorous Test :-) 13 | */ 14 | @Test 15 | public void shouldAnswerWithTrue() { 16 | assertTrue(true); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-jfinal/src/main/java/com/xuxueli/executor/sample/jfinal/controller/IndexController.java: -------------------------------------------------------------------------------- 1 | package com.xuxueli.executor.sample.jfinal.controller; 2 | 3 | import com.jfinal.core.Controller; 4 | 5 | public class IndexController extends Controller { 6 | 7 | public void index(){ 8 | renderText("xxl job executor running."); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-jfinal/src/main/java/com/xuxueli/executor/sample/jfinal/jobhandler/DemoJobHandler.java: -------------------------------------------------------------------------------- 1 | package com.xuxueli.executor.sample.jfinal.jobhandler; 2 | 3 | import com.xxl.job.core.biz.model.ReturnT; 4 | import com.xxl.job.core.handler.IJobHandler; 5 | import com.xxl.job.core.log.XxlJobLogger; 6 | 7 | import java.util.concurrent.TimeUnit; 8 | 9 | /** 10 | * 任务Handler示例(Bean模式) 11 | * 12 | * 开发步骤: 13 | * 1、继承"IJobHandler":“com.xxl.job.core.handler.IJobHandler”; 14 | * 2、注册到执行器工厂:在 "JFinalCoreConfig.initXxlJobExecutor" 中手动注册,注解key值对应的是调度中心新建任务的JobHandler属性的值。 15 | * 3、执行日志:需要通过 "XxlJobLogger.log" 打印执行日志; 16 | * 17 | * @author xuxueli 2015-12-19 19:43:36 18 | */ 19 | public class DemoJobHandler extends IJobHandler { 20 | 21 | @Override 22 | public ReturnT execute(String param) throws Exception { 23 | XxlJobLogger.log("XXL-JOB, Hello World."); 24 | 25 | for (int i = 0; i < 5; i++) { 26 | XxlJobLogger.log("beat at:" + i); 27 | TimeUnit.SECONDS.sleep(2); 28 | } 29 | return SUCCESS; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-jfinal/src/main/java/com/xuxueli/executor/sample/jfinal/jobhandler/ShardingJobHandler.java: -------------------------------------------------------------------------------- 1 | package com.xuxueli.executor.sample.jfinal.jobhandler; 2 | 3 | import com.xxl.job.core.biz.model.ReturnT; 4 | import com.xxl.job.core.handler.IJobHandler; 5 | import com.xxl.job.core.log.XxlJobLogger; 6 | import com.xxl.job.core.util.ShardingUtil; 7 | 8 | /** 9 | * 分片广播任务 10 | * 11 | * @author xuxueli 2017-07-25 20:56:50 12 | */ 13 | public class ShardingJobHandler extends IJobHandler { 14 | 15 | @Override 16 | public ReturnT execute(String param) throws Exception { 17 | 18 | // 分片参数 19 | ShardingUtil.ShardingVO shardingVO = ShardingUtil.getShardingVo(); 20 | XxlJobLogger.log("分片参数:当前分片序号 = {}, 总分片数 = {}", shardingVO.getIndex(), shardingVO.getTotal()); 21 | 22 | // 业务逻辑 23 | for (int i = 0; i < shardingVO.getTotal(); i++) { 24 | if (i == shardingVO.getIndex()) { 25 | XxlJobLogger.log("第 {} 片, 命中分片开始处理", i); 26 | } else { 27 | XxlJobLogger.log("第 {} 片, 忽略", i); 28 | } 29 | } 30 | 31 | return SUCCESS; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-jfinal/src/main/resources/xxl-job-executor.properties: -------------------------------------------------------------------------------- 1 | ### xxl-job admin address list, such as "http://address" or "http://address01,http://address02" 2 | xxl.job.admin.addresses=http://127.0.0.1:8080/xxl-job-admin 3 | 4 | ### xxl-job, access token 5 | xxl.job.accessToken= 6 | 7 | ### xxl-job executor appname 8 | xxl.job.executor.appname=xxl-job-executor-sample 9 | ### xxl-job executor registry-address: default use address to registry , otherwise use ip:port if address is null 10 | xxl.job.executor.address= 11 | ### xxl-job executor server-info 12 | xxl.job.executor.ip= 13 | xxl.job.executor.port=9999 14 | ### xxl-job executor log-path 15 | xxl.job.executor.logpath=/data/applogs/xxl-job/jobhandler 16 | ### xxl-job executor log-retention-days 17 | xxl.job.executor.logretentiondays=30 -------------------------------------------------------------------------------- /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-jfinal/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | xxl-job-executor-sample-jfinal 8 | 9 | webAppRootKey 10 | xxl-job-executor-sample-jfinal 11 | 12 | 13 | 14 | 15 | jfinal 16 | com.jfinal.core.JFinalFilter 17 | 18 | configClass 19 | com.xuxueli.executor.sample.jfinal.config.JFinalCoreConfig 20 | 21 | 22 | 23 | jfinal 24 | /* 25 | 26 | 27 | 28 | 29 | index.html 30 | 31 | 32 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-jfinal/src/main/webapp/index.html: -------------------------------------------------------------------------------- 1 | i am alive. -------------------------------------------------------------------------------- /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/MainModule.java: -------------------------------------------------------------------------------- 1 | package com.xuxueli.executor.sample.nutz; 2 | 3 | import com.xuxueli.executor.sample.nutz.config.NutzSetup; 4 | import org.nutz.mvc.annotation.*; 5 | import org.nutz.mvc.ioc.provider.ComboIocProvider; 6 | 7 | /** 8 | * nutz module 9 | * 10 | * @author xuxueli 2017-12-25 17:58:43 11 | */ 12 | @IocBy(type = ComboIocProvider.class, 13 | args = {"*org.nutz.ioc.loader.annotation.AnnotationIocLoader", 14 | "com.xuxueli.executor.sample.nutz"}) 15 | @Encoding(input = "utf-8", output = "utf-8") 16 | @Modules(scanPackage = true) 17 | @Localization("msg") 18 | @Ok("json") 19 | @Fail("json") 20 | @SetupBy(NutzSetup.class) 21 | public class MainModule { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/jobhandler/DemoJobHandler.java: -------------------------------------------------------------------------------- 1 | package com.xuxueli.executor.sample.nutz.jobhandler; 2 | 3 | import com.xxl.job.core.biz.model.ReturnT; 4 | import com.xxl.job.core.handler.IJobHandler; 5 | import com.xxl.job.core.log.XxlJobLogger; 6 | 7 | import java.util.concurrent.TimeUnit; 8 | 9 | /** 10 | * 任务Handler示例(Bean模式) 11 | * 12 | * 开发步骤: 13 | * 1、继承"IJobHandler":“com.xxl.job.core.handler.IJobHandler”; 14 | * 2、注册到Nutz容器:添加“@IocBean”注解,被Nutz容器扫描为Bean实例; 15 | * 3、注册到执行器工厂:添加“@JobHandler(value="自定义jobhandler名称")”注解,注解value值对应的是调度中心新建任务的JobHandler属性的值。 16 | * 4、执行日志:需要通过 "XxlJobLogger.log" 打印执行日志; 17 | * 18 | * @author xuxueli 2015-12-19 19:43:36 19 | */ 20 | public class DemoJobHandler extends IJobHandler { 21 | 22 | @Override 23 | public ReturnT execute(String param) throws Exception { 24 | XxlJobLogger.log("XXL-JOB, Hello World."); 25 | 26 | for (int i = 0; i < 5; i++) { 27 | XxlJobLogger.log("beat at:" + i); 28 | TimeUnit.SECONDS.sleep(2); 29 | } 30 | return SUCCESS; 31 | } 32 | 33 | } 34 | 35 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/jobhandler/ShardingJobHandler.java: -------------------------------------------------------------------------------- 1 | package com.xuxueli.executor.sample.nutz.jobhandler; 2 | 3 | import com.xxl.job.core.biz.model.ReturnT; 4 | import com.xxl.job.core.handler.IJobHandler; 5 | import com.xxl.job.core.log.XxlJobLogger; 6 | import com.xxl.job.core.util.ShardingUtil; 7 | 8 | /** 9 | * 分片广播任务 10 | * 11 | * @author xuxueli 2017-07-25 20:56:50 12 | */ 13 | public class ShardingJobHandler extends IJobHandler { 14 | 15 | @Override 16 | public ReturnT execute(String param) throws Exception { 17 | 18 | // 分片参数 19 | ShardingUtil.ShardingVO shardingVO = ShardingUtil.getShardingVo(); 20 | XxlJobLogger.log("分片参数:当前分片序号 = {}, 总分片数 = {}", shardingVO.getIndex(), shardingVO.getTotal()); 21 | 22 | // 业务逻辑 23 | for (int i = 0; i < shardingVO.getTotal(); i++) { 24 | if (i == shardingVO.getIndex()) { 25 | XxlJobLogger.log("第 {} 片, 命中分片开始处理", i); 26 | } else { 27 | XxlJobLogger.log("第 {} 片, 忽略", i); 28 | } 29 | } 30 | 31 | return SUCCESS; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/module/IndexModule.java: -------------------------------------------------------------------------------- 1 | package com.xuxueli.executor.sample.nutz.module; 2 | 3 | import org.nutz.ioc.loader.annotation.IocBean; 4 | import org.nutz.mvc.annotation.At; 5 | import org.nutz.mvc.annotation.Ok; 6 | 7 | @IocBean 8 | public class IndexModule { 9 | 10 | @At("/") 11 | @Ok("json") 12 | public String index() { 13 | return "xxl job executor running."; 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/resources/xxl-job-executor.properties: -------------------------------------------------------------------------------- 1 | ### xxl-job admin address list, such as "http://address" or "http://address01,http://address02" 2 | xxl.job.admin.addresses=http://127.0.0.1:8080/xxl-job-admin 3 | 4 | ### xxl-job, access token 5 | xxl.job.accessToken= 6 | 7 | ### xxl-job executor appname 8 | xxl.job.executor.appname=xxl-job-executor-sample 9 | ### xxl-job executor registry-address: default use address to registry , otherwise use ip:port if address is null 10 | xxl.job.executor.address= 11 | ### xxl-job executor server-info 12 | xxl.job.executor.ip= 13 | xxl.job.executor.port=9999 14 | ### xxl-job executor log-path 15 | xxl.job.executor.logpath=/data/applogs/xxl-job/jobhandler 16 | ### xxl-job executor log-retention-days 17 | xxl.job.executor.logretentiondays=30 -------------------------------------------------------------------------------- /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | xxl-job-executor-sample-nutz 8 | 9 | webAppRootKey 10 | xxl-job-executor-sample-nutz 11 | 12 | 13 | 14 | 15 | nutz 16 | org.nutz.mvc.NutFilter 17 | 18 | modules 19 | com.xuxueli.executor.sample.nutz.MainModule 20 | 21 | 22 | 23 | nutz 24 | /* 25 | 26 | 27 | 28 | 29 | index.html 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/webapp/index.html: -------------------------------------------------------------------------------- 1 | i am alive. -------------------------------------------------------------------------------- /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | logback 5 | 6 | 7 | 8 | 9 | %d{HH:mm:ss.SSS} %contextName [%thread] %-5level %logger{36} - %msg%n 10 | 11 | 12 | 13 | 14 | ${log.path} 15 | 16 | ${log.path}.%d{yyyy-MM-dd}.zip 17 | 18 | 19 | %date %level [%thread] %logger{36} [%file : %line] %msg%n 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/resources/xxl-job-executor.properties: -------------------------------------------------------------------------------- 1 | ### xxl-job admin address list, such as "http://address" or "http://address01,http://address02" 2 | xxl.job.admin.addresses=http://127.0.0.1:8080/xxl-job-admin 3 | 4 | ### xxl-job, access token 5 | xxl.job.accessToken= 6 | 7 | ### xxl-job executor appname 8 | xxl.job.executor.appname=xxl-job-executor-sample 9 | ### xxl-job executor registry-address: default use address to registry , otherwise use ip:port if address is null 10 | xxl.job.executor.address= 11 | ### xxl-job executor server-info 12 | xxl.job.executor.ip= 13 | xxl.job.executor.port=9999 14 | ### xxl-job executor log-path 15 | xxl.job.executor.logpath=/data/applogs/xxl-job/jobhandler 16 | ### xxl-job executor log-retention-days 17 | xxl.job.executor.logretentiondays=30 -------------------------------------------------------------------------------- /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/webapp/index.html: -------------------------------------------------------------------------------- 1 | i am alive. -------------------------------------------------------------------------------- /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-springboot/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:8-jre-slim 2 | MAINTAINER xuxueli 3 | 4 | ENV PARAMS="" 5 | 6 | ENV TZ=PRC 7 | RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone 8 | 9 | ADD target/xxl-job-executor-sample-springboot-*.jar /app.jar 10 | 11 | ENTRYPOINT ["sh","-c","java -jar $JAVA_OPTS /app.jar $PARAMS"] -------------------------------------------------------------------------------- /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/XxlJobExecutorApplication.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.executor; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * @author xuxueli 2018-10-28 00:38:13 8 | */ 9 | @SpringBootApplication 10 | public class XxlJobExecutorApplication { 11 | 12 | public static void main(String[] args) { 13 | SpringApplication.run(XxlJobExecutorApplication.class, args); 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/mvc/controller/IndexController.java: -------------------------------------------------------------------------------- 1 | //package com.xxl.job.executor.mvc.controller; 2 | // 3 | //import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 4 | //import org.springframework.stereotype.Controller; 5 | //import org.springframework.web.bind.annotation.RequestMapping; 6 | //import org.springframework.web.bind.annotation.ResponseBody; 7 | // 8 | //@Controller 9 | //@EnableAutoConfiguration 10 | //public class IndexController { 11 | // 12 | // @RequestMapping("/") 13 | // @ResponseBody 14 | // String index() { 15 | // return "xxl job executor running."; 16 | // } 17 | // 18 | //} -------------------------------------------------------------------------------- /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/resources/application.properties -------------------------------------------------------------------------------- /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | logback 5 | 6 | 7 | 8 | 9 | %d{HH:mm:ss.SSS} %contextName [%thread] %-5level %logger{36} - %msg%n 10 | 11 | 12 | 13 | 14 | ${log.path} 15 | 16 | ${log.path}.%d{yyyy-MM-dd}.zip 17 | 18 | 19 | %date %level [%thread] %logger{36} [%file : %line] %msg%n 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/test/java/com/xxl/job/executor/test/XxlJobExecutorExampleBootApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xxl.job.executor.test; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class XxlJobExecutorExampleBootApplicationTests { 11 | 12 | @Test 13 | public void test() { 14 | 15 | } 16 | 17 | } -------------------------------------------------------------------------------- /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-springboot/target/classes/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-springboot/target/classes/application.properties -------------------------------------------------------------------------------- /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-springboot/target/classes/com/xxl/job/executor/XxlJobExecutorApplication.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-springboot/target/classes/com/xxl/job/executor/XxlJobExecutorApplication.class -------------------------------------------------------------------------------- /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-springboot/target/classes/com/xxl/job/executor/core/config/XxlJobConfig.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-springboot/target/classes/com/xxl/job/executor/core/config/XxlJobConfig.class -------------------------------------------------------------------------------- /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-springboot/target/classes/com/xxl/job/executor/service/jobhandler/SampleXxlJob.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-springboot/target/classes/com/xxl/job/executor/service/jobhandler/SampleXxlJob.class -------------------------------------------------------------------------------- /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-springboot/target/classes/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | logback 5 | 6 | 7 | 8 | 9 | %d{HH:mm:ss.SSS} %contextName [%thread] %-5level %logger{36} - %msg%n 10 | 11 | 12 | 13 | 14 | ${log.path} 15 | 16 | ${log.path}.%d{yyyy-MM-dd}.zip 17 | 18 | 19 | %date %level [%thread] %logger{36} [%file : %line] %msg%n 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-springboot/target/test-classes/com/xxl/job/executor/test/XxlJobExecutorExampleBootApplicationTests.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouzhaodong/springboot/3eae84f3d12cbcd8b00723ea8b6d805800e41680/xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-springboot/target/test-classes/com/xxl/job/executor/test/XxlJobExecutorExampleBootApplicationTests.class -------------------------------------------------------------------------------- /xxl-job/xxl-job-executor-samples/xxl-job-executor-samples.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /xxl-job/xxl-job.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | --------------------------------------------------------------------------------