Showing preview only (5,505K chars total). Download the full file or copy to clipboard to get everything.
Repository: haoxiaoyong1014/springboot-examples
Branch: master
Commit: 4f75ef71f309
Files: 361
Total size: 5.1 MB
Directory structure:
gitextract_bgd7uglu/
├── .gitignore
├── README.md
├── distributed-job/
│ ├── README.md
│ ├── pom.xml
│ └── src/
│ └── main/
│ ├── java/
│ │ └── cn/
│ │ └── haoxy/
│ │ └── distributed/
│ │ ├── JobApplication.java
│ │ ├── config/
│ │ │ ├── JobConfig.java
│ │ │ └── XxlJobProps.java
│ │ ├── controller/
│ │ │ └── ManualOperateController.java
│ │ ├── handler/
│ │ │ └── TestJobHandler.java
│ │ └── service/
│ │ └── InService.java
│ └── resources/
│ ├── application.properties-out
│ ├── application.yml
│ └── logback.xml
├── global-exception/
│ ├── README.md
│ ├── pom.xml
│ └── src/
│ └── main/
│ └── java/
│ └── cn/
│ └── haoxiaoyong/
│ └── ex/
│ ├── ExceptionApp.java
│ ├── common/
│ │ ├── Parameter.java
│ │ └── RespInfo.java
│ ├── controller/
│ │ └── LoginController.java
│ ├── exception/
│ │ └── CustomizeException.java
│ └── global/
│ └── GlobalExceptionHandler.java
├── mybatis-plus-example/
│ ├── README.md
│ ├── plus-condition/
│ │ ├── pom.xml
│ │ └── src/
│ │ ├── main/
│ │ │ ├── java/
│ │ │ │ └── cn/
│ │ │ │ └── haoxy/
│ │ │ │ └── mybatis/
│ │ │ │ └── plus/
│ │ │ │ └── condition/
│ │ │ │ ├── ConditionApp.java
│ │ │ │ ├── mapper/
│ │ │ │ │ ├── RoleMapper.java
│ │ │ │ │ └── UserMapper.java
│ │ │ │ └── pojo/
│ │ │ │ ├── Role.java
│ │ │ │ └── User.java
│ │ │ └── resources/
│ │ │ └── application.yml
│ │ └── test/
│ │ └── java/
│ │ └── cn/
│ │ └── haoxy/
│ │ └── mybatis/
│ │ └── plus/
│ │ └── condition/
│ │ └── PlusConditionTest.java
│ ├── plus-curd/
│ │ ├── pom.xml
│ │ └── src/
│ │ ├── main/
│ │ │ ├── java/
│ │ │ │ └── cn/
│ │ │ │ └── haoxy/
│ │ │ │ └── mybatis/
│ │ │ │ └── plus/
│ │ │ │ └── curd/
│ │ │ │ ├── PlusApp.java
│ │ │ │ ├── mapper/
│ │ │ │ │ └── UserMapper.java
│ │ │ │ └── pojo/
│ │ │ │ └── User.java
│ │ │ └── resources/
│ │ │ ├── application.yml
│ │ │ └── spy.properties
│ │ └── test/
│ │ └── java/
│ │ └── cn/
│ │ └── haoxy/
│ │ └── mybatis/
│ │ └── plus/
│ │ └── curd/
│ │ └── SampleTest.java
│ ├── plus-generator/
│ │ ├── pom.xml
│ │ └── src/
│ │ └── main/
│ │ └── java/
│ │ └── cn/
│ │ └── haoxy/
│ │ └── mybatis/
│ │ └── plus/
│ │ └── generator/
│ │ ├── CodeGenerator.java
│ │ ├── GeneratorApplication.java
│ │ └── MysqlGenerator.java
│ ├── plus-page/
│ │ ├── pom.xml
│ │ └── src/
│ │ ├── main/
│ │ │ ├── java/
│ │ │ │ └── cn/
│ │ │ │ └── haoxy/
│ │ │ │ └── mybatis/
│ │ │ │ └── plus/
│ │ │ │ └── page/
│ │ │ │ ├── PageApp.java
│ │ │ │ ├── mapper/
│ │ │ │ │ └── UserMapper.java
│ │ │ │ └── pojo/
│ │ │ │ ├── MyPage.java
│ │ │ │ ├── ParamSome.java
│ │ │ │ └── User.java
│ │ │ └── resources/
│ │ │ ├── application.yml
│ │ │ └── mapper/
│ │ │ └── UserMapper.xml
│ │ └── test/
│ │ └── java/
│ │ └── cn/
│ │ └── haoxy/
│ │ └── mybatis/
│ │ └── plus/
│ │ └── page/
│ │ └── PlusPageTest.java
│ ├── plus-page-ui/
│ │ ├── pom.xml
│ │ └── src/
│ │ └── main/
│ │ ├── java/
│ │ │ └── cn/
│ │ │ └── haoxy/
│ │ │ └── mybatis/
│ │ │ └── plus/
│ │ │ └── page/
│ │ │ └── ui/
│ │ │ └── PageUiApplication.java
│ │ └── resources/
│ │ └── application.yml
│ └── pom.xml
├── okay-spring-boot-starter/
│ ├── README.md
│ ├── pom.xml
│ └── src/
│ └── main/
│ ├── java/
│ │ └── cn/
│ │ └── haoxiaoyong/
│ │ └── okay/
│ │ └── starter/
│ │ ├── annotation/
│ │ │ └── EnableOkay.java
│ │ ├── config/
│ │ │ ├── OkayProperties.java
│ │ │ └── OkayStarterAutoConfiguration.java
│ │ └── model/
│ │ └── Okay.java
│ └── resources/
│ └── META-INF/
│ └── spring.factories
├── pom.xml
├── springboot-admin-monitor/
│ ├── README.md
│ ├── pom.xml
│ ├── springboot-admin-client/
│ │ ├── pom.xml
│ │ └── src/
│ │ └── main/
│ │ ├── java/
│ │ │ └── cn/
│ │ │ └── haoxiaoyong/
│ │ │ └── sba/
│ │ │ └── client/
│ │ │ ├── AdminClientApplication.java
│ │ │ └── controller/
│ │ │ └── UserController.java
│ │ └── resources/
│ │ └── application.yml
│ ├── springboot-admin-client2/
│ │ ├── pom.xml
│ │ └── src/
│ │ └── main/
│ │ ├── java/
│ │ │ └── cn/
│ │ │ └── haoxiaoyong/
│ │ │ └── sba/
│ │ │ └── client/
│ │ │ ├── AdminClientApplication.java
│ │ │ └── controller/
│ │ │ └── UserController.java
│ │ └── resources/
│ │ └── application.yml
│ └── springboot-admin-server/
│ ├── pom.xml
│ └── src/
│ └── main/
│ ├── java/
│ │ └── cn/
│ │ └── haoxiaoyong/
│ │ └── sba/
│ │ └── server/
│ │ ├── AdminServerApplication.java
│ │ └── config/
│ │ └── SecuritySecureConfig.java
│ └── resources/
│ └── application.yml
├── springboot-druid/
│ ├── README.md
│ ├── pom.xml
│ └── src/
│ └── main/
│ ├── java/
│ │ └── cn/
│ │ └── haoxiaoyong/
│ │ └── druid/
│ │ ├── DruidApplication.java
│ │ ├── controller/
│ │ │ └── UserController.java
│ │ ├── entity/
│ │ │ └── User.java
│ │ ├── mapper/
│ │ │ └── UserMapper.java
│ │ └── service/
│ │ └── UserService.java
│ └── resources/
│ ├── application.properties
│ └── mapper/
│ └── UserMapper.xml
├── springboot-easyexcel-encapsulation/
│ ├── README.md
│ ├── pom.xml
│ └── src/
│ └── main/
│ ├── java/
│ │ └── cn/
│ │ └── haoxy/
│ │ └── easyexcel/
│ │ ├── EasyexcelMethodEncapsulationApplication.java
│ │ ├── controller/
│ │ │ └── ExcelController.java
│ │ ├── excel/
│ │ │ ├── ExcelException.java
│ │ │ ├── ExcelListener.java
│ │ │ ├── ExcelUtil.java
│ │ │ └── ExcelWriterFactroy.java
│ │ └── model/
│ │ ├── ExportInfo.java
│ │ └── ImportInfo.java
│ └── resources/
│ └── application.properties
├── springboot-elk/
│ ├── ELK安装时错误记录.md
│ ├── ELK安装步骤.md
│ ├── pom.xml
│ └── src/
│ └── main/
│ ├── java/
│ │ └── cn/
│ │ └── haoxxiaoyong/
│ │ └── elk/
│ │ ├── ElkApplication.java
│ │ └── controller/
│ │ └── ElkController.java
│ └── resources/
│ └── logback-spring.xml
├── springboot-fastDFS/
│ ├── README.md
│ ├── README2.md
│ ├── pom.xml
│ └── src/
│ ├── main/
│ │ ├── java/
│ │ │ └── cn/
│ │ │ └── haoxiaoyong/
│ │ │ └── fastdfs/
│ │ │ ├── Main.java
│ │ │ └── util/
│ │ │ ├── FastDFSClient.java
│ │ │ └── FiletoMuit.java
│ │ └── resources/
│ │ └── application.properties
│ └── test/
│ └── java/
│ └── cn/
│ └── haoxiaoyong/
│ └── fastdfs/
│ └── TestFastDFSClient.java
├── springboot-idempotent/
│ ├── README.md
│ ├── pom.xml
│ └── src/
│ └── main/
│ ├── java/
│ │ └── cn/
│ │ └── haoxy/
│ │ └── redis/
│ │ └── token/
│ │ ├── TokenApplication.java
│ │ ├── annotation/
│ │ │ └── ApiIdempotent.java
│ │ ├── common/
│ │ │ ├── Constant.java
│ │ │ ├── ResponseCode.java
│ │ │ └── ServerResponse.java
│ │ ├── config/
│ │ │ └── JedisConfig.java
│ │ ├── controller/
│ │ │ ├── TestController.java
│ │ │ └── TokenController.java
│ │ ├── exception/
│ │ │ ├── MyControllerAdvice.java
│ │ │ └── ServiceException.java
│ │ ├── interceptor/
│ │ │ └── ApiIdempotentInterceptor.java
│ │ ├── service/
│ │ │ ├── TestService.java
│ │ │ ├── TokenService.java
│ │ │ └── impl/
│ │ │ ├── TestServiceImpl.java
│ │ │ └── TokenServiceImpl.java
│ │ └── utils/
│ │ ├── JedisUtil.java
│ │ └── RandomUtil.java
│ └── resources/
│ └── application.properties
├── springboot-login-Interceptor/
│ ├── pom.xml
│ └── src/
│ └── main/
│ ├── java/
│ │ └── cn/
│ │ └── haoxy/
│ │ └── interceptor/
│ │ ├── InterApplication.java
│ │ ├── annotation/
│ │ │ └── LoginRequired.java
│ │ ├── config/
│ │ │ ├── AuthenticationInterceptor.java
│ │ │ └── MvcConfigurer.java
│ │ ├── controller/
│ │ │ ├── LoginController.java
│ │ │ └── UserController.java
│ │ ├── model/
│ │ │ └── User.java
│ │ ├── service/
│ │ │ └── UserService.java
│ │ └── utils/
│ │ ├── CacheCollection.java
│ │ └── TokenUtils.java
│ └── resources/
│ └── application.yml
├── springboot-mongodb/
│ ├── README.md
│ ├── pom.xml
│ └── src/
│ ├── main/
│ │ ├── java/
│ │ │ └── cn/
│ │ │ └── haoxy/
│ │ │ └── mongodb/
│ │ │ ├── MongodbApplication.java
│ │ │ ├── controller/
│ │ │ │ └── CmsPageController.java
│ │ │ ├── dao/
│ │ │ │ └── CmsPageRepository.java
│ │ │ ├── domain/
│ │ │ │ ├── CmsPage.java
│ │ │ │ └── CmsPageParam.java
│ │ │ ├── request/
│ │ │ │ └── QueryPageRequest.java
│ │ │ ├── response/
│ │ │ │ ├── CommonCode.java
│ │ │ │ ├── QueryResponseResult.java
│ │ │ │ ├── QueryResult.java
│ │ │ │ ├── Response.java
│ │ │ │ ├── ResponseResult.java
│ │ │ │ └── ResultCode.java
│ │ │ └── service/
│ │ │ └── PageService.java
│ │ └── resources/
│ │ ├── application.yml
│ │ └── sql/
│ │ ├── cms_config.json
│ │ ├── cms_page.json
│ │ ├── cms_site.json
│ │ ├── cms_site_server.json
│ │ ├── cms_template.json
│ │ ├── filesystem.json
│ │ ├── fs.chunks.json
│ │ ├── fs.files.json
│ │ ├── sys_dictionary.json
│ │ └── user_test.json
│ └── test/
│ └── java/
│ └── cn/
│ └── haoxy/
│ └── mongodb/
│ └── CmsPageRepositoryTest.java
├── springboot-mybatis-myehcache/
│ ├── pom.xml
│ └── src/
│ ├── main/
│ │ ├── java/
│ │ │ └── com/
│ │ │ └── haoxy/
│ │ │ └── example/
│ │ │ ├── AppEhcache.java
│ │ │ ├── controller/
│ │ │ │ └── PersonController.java
│ │ │ ├── mapper/
│ │ │ │ └── PersonMapper.java
│ │ │ ├── model/
│ │ │ │ └── Person.java
│ │ │ ├── page/
│ │ │ │ └── PageInfo.java
│ │ │ └── service/
│ │ │ ├── PersonService.java
│ │ │ └── impl/
│ │ │ └── PersonServiceImpl.java
│ │ └── resources/
│ │ ├── application.properties
│ │ ├── ehcache.xml
│ │ └── mappers/
│ │ └── PersonMapper.xml
│ └── test/
│ └── java/
│ └── com/
│ └── haoxy/
│ └── test/
│ ├── DataSourceTests.java
│ └── PersonMapperTests.java
├── springboot-oauth2-authorization-server/
│ ├── README.md
│ ├── pom.xml
│ └── src/
│ ├── main/
│ │ ├── java/
│ │ │ └── cn/
│ │ │ └── merryyou/
│ │ │ └── security/
│ │ │ ├── SpringBoot2Oauth2Application.java
│ │ │ ├── config/
│ │ │ │ └── TokenStoreConfig.java
│ │ │ ├── handler/
│ │ │ │ └── AppLoginInSuccessHandler.java
│ │ │ ├── properties/
│ │ │ │ ├── OAuth2ClientProperties.java
│ │ │ │ ├── OAuth2CoreConfig.java
│ │ │ │ └── OAuth2Properties.java
│ │ │ ├── security/
│ │ │ │ ├── MyUserDetailsService.java
│ │ │ │ ├── SecurityConfig.java
│ │ │ │ └── jwt/
│ │ │ │ └── MerryyouJwtTokenEnhancer.java
│ │ │ ├── server/
│ │ │ │ ├── MerryyouAuthorizationServerConfig.java
│ │ │ │ └── MerryyouResourceServerConfig.java
│ │ │ └── utils/
│ │ │ └── JsonUtil.java
│ │ └── resources/
│ │ └── application.yml
│ └── test/
│ └── java/
│ └── cn/
│ └── merryyou/
│ └── security/
│ └── SpringBoot2Oauth2Test.java
├── springboot-oauth2-resource-server/
│ ├── pom.xml
│ └── src/
│ └── main/
│ ├── java/
│ │ └── cn/
│ │ └── merryyou/
│ │ └── security/
│ │ ├── SpringBoot2Oauth2ResourceApplication.java
│ │ ├── config/
│ │ │ └── TokenStoreConfig.java
│ │ └── resource/
│ │ └── MerryyouResourceServerConfiguration.java
│ └── resources/
│ └── application.yml
├── springboot-rabbitmq/
│ ├── README.md
│ ├── pom.xml
│ └── src/
│ ├── main/
│ │ ├── java/
│ │ │ └── com/
│ │ │ └── hxy/
│ │ │ └── rabbitmq/
│ │ │ ├── RabbitmqApp.java
│ │ │ ├── config/
│ │ │ │ ├── FanoutRabbitConfig.java
│ │ │ │ ├── RabbitConfig.java
│ │ │ │ └── TopicRabbitConfig.java
│ │ │ ├── fanout/
│ │ │ │ ├── FanoutReceiverA.java
│ │ │ │ ├── FanoutReceiverB.java
│ │ │ │ ├── FanoutReceiverC.java
│ │ │ │ └── FanoutSender.java
│ │ │ ├── hello/
│ │ │ │ ├── HelloReceiver.java
│ │ │ │ └── HelloSender.java
│ │ │ ├── many/
│ │ │ │ ├── NeoReceiver1.java
│ │ │ │ ├── NeoReceiver2.java
│ │ │ │ ├── NeoSender1.java
│ │ │ │ └── NeoSender2.java
│ │ │ ├── model/
│ │ │ │ └── User.java
│ │ │ ├── object/
│ │ │ │ ├── ObjectReceiver.java
│ │ │ │ └── ObjectSender.java
│ │ │ └── topic/
│ │ │ ├── TopicReceiver1.java
│ │ │ ├── TopicReceiver2.java
│ │ │ └── TopicSender.java
│ │ └── resources/
│ │ └── application.yml
│ └── test/
│ └── java/
│ └── com/
│ └── hxy/
│ └── rabbitmq/
│ ├── FanoutTest.java
│ ├── HelloTest.java
│ ├── ManyTest.java
│ ├── ObjectTest.java
│ └── TopicTest.java
├── springboot-rabbitmq-ack/
│ ├── pom.xml
│ └── src/
│ └── main/
│ ├── java/
│ │ └── com/
│ │ └── haoxy/
│ │ └── rabbitmq/
│ │ ├── RabbitmqApp.java
│ │ ├── comsumer/
│ │ │ └── Receiver.java
│ │ ├── config/
│ │ │ └── RabbitConfig.java
│ │ ├── controller/
│ │ │ └── SendController.java
│ │ └── model/
│ │ └── ResponseEntity.java
│ └── resources/
│ ├── application.yml
│ └── logback.xml
├── springboot-redis-docker/
│ ├── README.md
│ ├── pom.xml
│ └── src/
│ └── main/
│ ├── java/
│ │ └── com/
│ │ └── haoxy/
│ │ └── example/
│ │ └── SpringBootDemoApplication.java
│ └── resources/
│ ├── Dockerfile
│ ├── application.properties
│ └── static/
│ ├── fonts/
│ │ └── FontAwesome.otf
│ ├── index.html
│ ├── js/
│ │ ├── countdown.js
│ │ ├── custom.js
│ │ ├── init.js
│ │ ├── jquery.js
│ │ └── typed.js
│ └── templatemo-style.css
├── springboot-swagger-enhance/
│ ├── README.md
│ ├── pom.xml
│ └── src/
│ └── main/
│ ├── java/
│ │ └── cn/
│ │ └── haoxiaoyong/
│ │ └── swagger/
│ │ └── enhance/
│ │ ├── ApiApplication.java
│ │ ├── common/
│ │ │ └── ApiResponse.java
│ │ ├── config/
│ │ │ └── SwaggerConfiguration.java
│ │ ├── controller/
│ │ │ └── UserController.java
│ │ └── entity/
│ │ └── User.java
│ └── resources/
│ └── application.yml
├── springboot-threadpool/
│ ├── README.md
│ ├── pom.xml
│ └── src/
│ └── main/
│ ├── java/
│ │ └── cn/
│ │ └── haoxiaoyong/
│ │ └── thread/
│ │ └── pool/
│ │ ├── Application.java
│ │ └── boot/
│ │ ├── OrderQueueThread.java
│ │ ├── TestController.java
│ │ ├── ThreadPoolConfig.java
│ │ ├── ThreadService.java
│ │ └── ThreadServiceImpl.java
│ └── resources/
│ └── application.yml
├── springboot-web-thymeleaf/
│ ├── pom.xml
│ └── src/
│ └── main/
│ ├── java/
│ │ └── com/
│ │ └── haoxy/
│ │ └── thymeleaf/
│ │ ├── ThymeleafApplication.java
│ │ ├── controller/
│ │ │ └── MessageController.java
│ │ ├── model/
│ │ │ └── Message.java
│ │ └── repository/
│ │ ├── InMemoryMessageRepository.java
│ │ └── MessageRepository.java
│ └── resources/
│ ├── application.properties
│ ├── logback.xml
│ └── templates/
│ ├── fragments.html
│ └── messages/
│ ├── form.html
│ ├── list.html
│ └── view.html
├── springboot-websocket/
│ ├── .gitattributes
│ ├── .gitignore
│ ├── README.md
│ ├── buile_image.sh
│ ├── docker-compose.yml
│ ├── pom.xml
│ ├── rm_images.sh
│ └── src/
│ └── main/
│ ├── java/
│ │ └── com/
│ │ └── suyu/
│ │ └── websocket/
│ │ ├── Application.java
│ │ ├── config/
│ │ │ └── WebSocketConfig.java
│ │ ├── controller/
│ │ │ └── WebSocketController.java
│ │ └── server/
│ │ └── SocketServer.java
│ └── resources/
│ ├── application.yml
│ ├── static/
│ │ ├── js/
│ │ │ └── request.js
│ │ ├── layui/
│ │ │ ├── css/
│ │ │ │ ├── layui.css
│ │ │ │ ├── layui.mobile.css
│ │ │ │ └── modules/
│ │ │ │ ├── code.css
│ │ │ │ ├── laydate/
│ │ │ │ │ └── default/
│ │ │ │ │ └── laydate.css
│ │ │ │ └── layer/
│ │ │ │ └── default/
│ │ │ │ └── layer.css
│ │ │ ├── lay/
│ │ │ │ └── modules/
│ │ │ │ ├── carousel.js
│ │ │ │ ├── code.js
│ │ │ │ ├── element.js
│ │ │ │ ├── flow.js
│ │ │ │ ├── form.js
│ │ │ │ ├── jquery.js
│ │ │ │ ├── laydate.js
│ │ │ │ ├── layedit.js
│ │ │ │ ├── layer.js
│ │ │ │ ├── laypage.js
│ │ │ │ ├── laytpl.js
│ │ │ │ ├── mobile.js
│ │ │ │ ├── rate.js
│ │ │ │ ├── table.js
│ │ │ │ ├── tree.js
│ │ │ │ ├── upload.js
│ │ │ │ └── util.js
│ │ │ ├── layui.all.js
│ │ │ └── layui.js
│ │ ├── layui.all.js
│ │ ├── layui.css
│ │ └── layui.js
│ └── templates/
│ ├── admin.html
│ └── index.html
├── springboot2-redis/
│ ├── README.md
│ ├── pom.xml
│ └── src/
│ ├── main/
│ │ ├── java/
│ │ │ └── cn/
│ │ │ └── haoxy/
│ │ │ └── redis/
│ │ │ └── example/
│ │ │ ├── RedisMain.java
│ │ │ ├── bean/
│ │ │ │ └── RedisConnector.java
│ │ │ ├── common/
│ │ │ │ └── User.java
│ │ │ ├── config/
│ │ │ │ └── RedisConfig.java
│ │ │ └── tool/
│ │ │ ├── HashUtil.java
│ │ │ ├── ListUtil.java
│ │ │ ├── SetUtil.java
│ │ │ └── StringUtil.java
│ │ └── resources/
│ │ └── redis.properties
│ └── test/
│ ├── java/
│ │ └── cn/
│ │ └── haoxy/
│ │ └── redis/
│ │ └── exampl/
│ │ ├── TestRedisListUtil.java
│ │ └── TestRedisStringUtil.java
│ └── resources/
│ └── application.yml
└── strategy-aop/
├── README.md
├── pom.xml
└── src/
└── main/
├── java/
│ └── cn/
│ └── haoxy/
│ └── strategy/
│ └── aop/
│ ├── StrategApplication.java
│ ├── annotation/
│ │ └── MessageLog.java
│ ├── constant/
│ │ └── MessageCodeEnum.java
│ ├── controller/
│ │ └── UserController.java
│ ├── handler/
│ │ ├── DataSourceContextAware.java
│ │ ├── MessageInitHandler.java
│ │ └── MessageMonitorHandler.java
│ ├── pojo/
│ │ ├── AnalysisMessage.java
│ │ ├── AnalysisRole.java
│ │ └── AnalysisUser.java
│ ├── service/
│ │ ├── AnalysisMessageService.java
│ │ ├── AnalysisRoleService.java
│ │ ├── AnalysisUserService.java
│ │ └── MessageStrategyService.java
│ ├── strategys/
│ │ ├── MessageAddUserStrategy.java
│ │ ├── MessageDelUserStrategy.java
│ │ ├── MessageIsLockStrategy.java
│ │ └── StrategyBase.java
│ └── utils/
│ ├── MapCacheUtils.java
│ └── ReturnUtils.java
└── resources/
├── application.yml
└── test.json
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
.idea
vendor
composer.lock
composer.phar
*.iml
target
.DS_Store
*.bak
node_modules
*.log
*.gz
================================================
FILE: README.md
================================================
# springboot-examples
spring boot 集成各技术案例 <img src="https://camo.githubusercontent.com/95c3d7ef0b5da8445087e462514063675f79321d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4372656174697665253230436f6d6d6f6e732d4443334432342e737667" alt="知识共享协议(CC协议)" data-canonical-src="https://img.shields.io/badge/License-Creative%20Commons-DC3D24.svg" style="max-width:100%;">
[](https://starchart.cc/haoxiaoyong1014/springboot-examples)
2018/5/24 添加 springboot-rabbitMQ(<a href="https://github.com/haoxiaoyong1014/springboot-examples/tree/master/springboot-rabbitmq">消息队列</a>)
2018/6/12 添加 springboot-redis-docker(<a href="https://github.com/haoxiaoyong1014/springboot-examples/tree/master/springboot-redis-docker">Docker 部署 SpringBoot 项目整合 Redis 镜像做访问计数Demo</a>)
2018/6/13 添加 springboot-web-thymeleaf (<a href="https://github.com/haoxiaoyong1014/springboot-examples/tree/master/springboot-web-thymeleaf">springboot整合thymeleaf</a>)
2018/6/20 添加 springboot2-oauth2(springBoot版本:2.0.1.RELEASE)
**springboot2-oauth2 包括:**
* springboot-oauth2-authorization-server(<a href="https://github.com/haoxiaoyong1014/springboot-examples/tree/master/springboot-oauth2-authorization-server">springboot整合OAuth2.0认证服务</a>),
* springboot-oauth2-resource-server(<a href="https://github.com/haoxiaoyong1014/springboot-examples/tree/master/springboot-oauth2-resource-server">资源服务</a>)
2018/6/30 添加 springboot-mybatis-ehcache (<a href="https://github.com/haoxiaoyong1014/springboot-examples/tree/master/springboot-mybatis-myehcache">使用EhcacheCache做二级缓存,使用pageHelper做分页插件</a>)
2018/7/14 添加 springboot-websocket (<a href="https://github.com/haoxiaoyong1014/springboot-examples/tree/master/springboot-websocket">在线人数统计,消息发送,一对一,一对多发送消息<a>)
2018/8/10 添加 springboot-shrio(<a href="https://github.com/haoxiaoyong1014/springboot-shiro">基础版<a>)
2018/8/13 添加 springboot-shiro-v1.2.0(<a href="https://github.com/haoxiaoyong1014/springboot-shiro-v1.2.0">加强版<a>)
2018/9/28 添加 springboot-quartz(<a href="https://github.com/haoxiaoyong1014/springboot-quartz">任务调度,持久化任务<a>)
2018/10/15 添加 springboot-SpringDataJpa(<a href="https://github.com/haoxiaoyong1014/springboot-SpringDataJpa">Spring Data JPA 使用<a>)
2018/10/20 添加 springboot-netty(<a href="https://github.com/haoxiaoyong1014/springboot-netty">springboot整合netty做心跳检测<a>)
2018/11/29 添加 springboot2-redis(<a href="https://github.com/haoxiaoyong1014/springboot-examples/tree/master/springboot2-redis">springboot2x系列整合Redis(Lettuce版)<a>)
2019/2/20 添加 springboot-fastDFS(<a href="https://github.com/haoxiaoyong1014/springboot-examples/tree/master/springboot-fastDFS">springboot-fastDFS</a>)
2019/3/12 添加 global-exception(<a href="https://github.com/haoxiaoyong1014/springboot-examples/tree/master/global-exception">global-exception(Spring全局异常处理)</a>)
2019/5/11 添加 springboot-mongodb(<a href="https://github.com/haoxiaoyong1014/springboot-examples/tree/master/springboot-mongodb">springboot-mongodb(springboot整合mongodb)</a>)
2019/5/31 添加 springboot-login-Interceptor(<a href="https://github.com/haoxiaoyong1014/springboot-examples/tree/master/springboot-login-Interceptor">springboot拦截器整合JWT做验证token,以及token过期解决方案</a>)
2019/6/24 添加 springboot-druid(<a href="https://github.com/haoxiaoyong1014/springboot-examples/tree/master/springboot-druid">使用阿里巴巴提供的springboot整合druid包管理连接池</a>)
2019/7/30 添加 springboot-easyexcel-encapsulation(<a href="https://github.com/haoxiaoyong1014/springboot-examples/tree/master/springboot-easyexcel-encapsulation">对阿里巴巴easyexcel导入导出excel文件进行封装</a>)
2019/9/08 添加 strategy-aop(<a href="https://github.com/haoxiaoyong1014/springboot-examples/tree/master/strategy-aop">AOP+自定义注解+策略模式 记录操作日志,避免过多的 if else</a>)
2019/10/15 添加 chat-software(<a href="https://github.com/haoxiaoyong1014/chat-software"> 基于Netty Spring Boot仿微信聊天项目</a>)
2020/1/11 添加 distributed-job(<a href="https://github.com/haoxiaoyong1014/springboot-examples/tree/master/distributed-job">spring-boot整合xxl-job,手动触发定时任务</a>)
2020/2/29 添加 mybatis-plus-example(<a href="https://github.com/haoxiaoyong1014/springboot-examples/tree/master/mybatis-plus-example">springboot整合mybatis-plus</a>)
2020/3/20 添加 okay-spring-boot-starter(<a href="https://github.com/haoxiaoyong1014/springboot-examples/tree/master/okay-spring-boot-starter">从SpringBoot源码到自己封装一个Starter</a>)
2020/5/08 添加 springboot-threadpool(<a href="https://github.com/haoxiaoyong1014/springboot-examples/tree/master/springboot-threadpool">SpringBoot 使用线程池-线程池隔离</a>)
2020/5/14 添加 springboot-swagger-enhance(<a href="https://github.com/haoxiaoyong1014/springboot-examples/tree/master/springboot-swagger-enhance">SpringBoot集成第三方swagger美化文档样式</a>)
2020/8/14 添加 springboot-admin-monitor(<a href="https://github.com/haoxiaoyong1014/springboot-examples/tree/master/springboot-admin-monitor">springBoot-admin 日志,系统监控</a>)
2020/9/10 添加 springboot-elk(<a href="https://github.com/haoxiaoyong1014/springboot-examples/tree/master/springboot-elk">springboot集成ELK,包含安装步骤</a>)
# springboot-redis-example(<a href="https://github.com/haoxiaoyong1014/springboot-redis-examples">redis系列</a>)
2018/6/12 添加 springboot-redis-docker(<a href="https://github.com/haoxiaoyong1014/springboot-examples/tree/master/springboot-redis-docker">Docker 部署 SpringBoot 项目整合 Redis 镜像做访问计数(PV)Demo</a>)
2018/07/27 添加springboot-redis-ranking (<a href="https://github.com/haoxiaoyong1014/springboot-redis-examples/tree/master/springboot-redis-ranking">基于Redis实现商品排行榜</a>)
2018/08/01 添加 springboot-redis-fridends (<a href="https://github.com/haoxiaoyong1014/springboot-redis-examples/tree/master/springboot-redis-friends">基于Redis实现查询共同好友</a>,
结合前端vue.js,前端项目地址: <a href="https://github.com/haoxiaoyong1014/common-friends">common-friends</a>)
2018/11/16 添加 redis-manage(<a href="https://github.com/haoxiaoyong1014/redis-manage">Redis的后台管理</a>,结合前端项目<a href="https://github.com/haoxiaoyong1014/redis-manage-view">redis-manage-view</a>)
2019/8/16 添加 springboot-idempotent(<a href="https://github.com/haoxiaoyong1014/springboot-examples/tree/master/springboot-idempotent">springboot + redis + 注解 + 拦截器 实现接口幂等性校验</a>)
2019/9/14 添加 springboot-mybatis-redis-cache(<a href="https://github.com/haoxiaoyong1014/springboot-redis-examples/tree/master/springboot-mybatis-redis-cache">使用redis做二级缓存</a>)
2019/10/29添加 [Redis专题(七)--基于Sentinel(哨兵)搭建实现Redis高可用集群](https://haoxiaoyong.cn/2019/10/29/2019/2019-12-03-redis-master-slave/)
2020/09/18添加 springboot-redis-range( [SpringBoot 使用 Redis Geo 实现查找附近的位置](https://github.com/haoxiaoyong1014/springboot-redis-examples/tree/master/springboot-redis-range))
持续更新中....
================================================
FILE: distributed-job/README.md
================================================
### distribute-job
> 此 demo 主要演示了 Spring Boot 如何集成 XXL-JOB 实现分布式定时任务,并提供绕过 xxl-job-admin 对定时任务的管理的方法,包括定时任务列表,触发器列表,新增定时任务,删除定时任务,停止定时任务,启动定时任务,修改定时任务,手动触发定时任务。
#### xxl-job-admin调度中心
* 克隆 调度中心代码
$ git clone https://github.com/xuxueli/xxl-job.git
* 修改 application.properties
```properties
server.port=8084
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/xxl_job?Unicode=true&characterEncoding=UTF-8&useSSL=false
spring.datasource.username=root
spring.datasource.password=root
```
#### 启动xxl-job-admin调度中心
`Run XxlJobAdminApplication`
在浏览器输入: `http://localhost:8084/xxl-job-admin`
默认用户名密码:admin/admin

#### 编写执行器项目
pom.xml
```xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.xuxueli</groupId>
<artifactId>xxl-job-core</artifactId>
<version>2.1.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-commons -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-commons</artifactId>
<version>2.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.7</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<!--改造成API的方式时需要-->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.1.0</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>28.2-jre</version>
</dependency>
```
#### 编写配置类
* XxlJobProps
```java
/**
* Created by haoxiaoyong on 2020/1/10 下午 4:52
* e-mail: hxyHelloWorld@163.com
* github:https://github.com/haoxiaoyong1014
* Blog: www.haoxiaoyong.cn
*/
@Data
@ConfigurationProperties(prefix = "xxl.job")
public class XxlJobProps {
/**
* 调度中心配置
*/
private XxlJobAdminProps admin;
/**
* 执行器配置
*/
private XxlJobExecutorProps executor;
/**
* 与调度中心交互的accessToken
*/
private String accessToken;
@Data
public static class XxlJobAdminProps {
/**
* 调度中心地址
*/
private String address;
}
@Data
public static class XxlJobExecutorProps {
/**
* 执行器名称
*/
private String appName;
/**
* 执行器 IP
*/
private String ip;
/**
* 执行器端口
*/
private int port;
/**
* 执行器日志
*/
private String logPath;
/**
* 执行器日志保留天数
*/
private int logRetentionDays;
}
}
```
* 配置文件
```yaml
# web port
server:
port: 8082
### xxl-job admin address list, such as "http://address" or "http://address01,http://address02"
xxl:
job:
# 执行器通讯TOKEN [选填]:非空时启用;
access-token:
admin:
# 调度中心部署跟地址 [选填]:如调度中心集群部署存在多个地址则用逗号分隔。执行器将会使用该地址进行"执行器心跳注册"和"任务结果回调";为空则关闭自动注册;
address: http://127.0.0.1:8084/xxl-job-admin
executor:
# 执行器AppName [选填]:执行器心跳注册分组依据;为空则关闭自动注册
app-name: xxl-job-executor-sample
# 执行器IP [选填]:默认为空表示自动获取IP,多网卡时可手动设置指定IP,该IP不会绑定Host仅作为通讯实用;地址信息用于 "执行器注册" 和 "调度中心请求并触发任务";
ip:
# 执行器端口号 [选填]:小于等于0则自动获取;默认端口为9999,单机部署多个执行器时,注意要配置不同执行器端口;
port: 9999
# 执行器运行日志文件存储磁盘路径 [选填] :需要对该路径拥有读写权限;为空则使用默认路径;
log-path: /data/applogs/xxl-job/jobhandler
# 执行器日志保存天数 [选填] :值大于3时生效,启用执行器Log文件定期清理功能,否则不生效;
log-retention-days: 30
```
* 编写自动装配类 JobConfig.java
```java
@Slf4j
@Configuration
@EnableConfigurationProperties(XxlJobProps.class)
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class JobConfig {
private final XxlJobProps xxlJobProps;
private final InetUtils inetUtils;
@Bean
public XxlJobSpringExecutor xxlJobExecutor() {
log.info(">>>>>>>>>>> xxl-job config init.");
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
xxlJobSpringExecutor.setAdminAddresses(xxlJobProps.getAdmin().getAddress());
xxlJobSpringExecutor.setAppName(xxlJobProps.getExecutor().getAppName());
String ip = xxlJobProps.getExecutor().getIp();
if (StringUtils.isBlank(ip)) {
ip = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress();
}
log.info("IP地址为: " + ip);
log.info("AdminAddresses地址为: " + xxlJobProps.getAdmin().getAddress());
xxlJobSpringExecutor.setIp(ip);
xxlJobSpringExecutor.setPort(xxlJobProps.getExecutor().getPort());
xxlJobSpringExecutor.setAccessToken(xxlJobProps.getAccessToken());
xxlJobSpringExecutor.setLogPath(xxlJobProps.getExecutor().getLogPath());
xxlJobSpringExecutor.setLogRetentionDays(xxlJobProps.getExecutor().getLogRetentionDays());
return xxlJobSpringExecutor;
}
}
```
#### 编写具体的定时逻辑 TestJobHandler
```java
@Component
public class TestJobHandler {
@Autowired
private InService inService;
@XxlJob("jobHandler")
public ReturnT<String> execute(String param) throws InterruptedException {
for (int i = 0; i < 5; i++) {
XxlJobLogger.log("beat at:" + i);
TimeUnit.SECONDS.sleep(2);
}
inService.xxl();
return ReturnT.SUCCESS;
}
}
```
```java
@Service
public class InService {
public void xxl(){
System.out.println("Hello World......");
}
}
```
#### 启动执行器 JobApplication
* 将启动的执行器添加到调度中心
执行器管理 - 新增执行器

* 添加定时任务
任务管理 - 新增 - 保存

这里的JobHandler要和@XxlJob()注解中的值一致;
* 点击操作,执行一次任务,控制台输出Hello World...... 你也可以在ui界面中查看日志
#### 使用API添加定时任务
> 实际场景中,如果添加定时任务都需要手动在 xxl-job-admin 去操作,这样可能比较麻烦,用户更希望在自己的页面,添加定时任务参数、定时调度表达式,然后通过 API 的方式添加定时任务
**克隆调度中心代码**
`git clone https://github.com/xuxueli/xxl-job/`
**改造xxl-job-admin**
* 在`JobGroupController`中新增
```java
// 添加执行器列表
@RequestMapping("/list")
@ResponseBody
// 去除权限校验
@PermissionLimit(limit = false)
public ReturnT<List<XxlJobGroup>> list(){
return new ReturnT<>(xxlJobGroupDao.findAll());
}
```
* 修改 JobInfoController
```java
// 分别在 pageList、add、update、remove、pause、start、triggerJob 方法上添加注解,去除权限校验
@PermissionLimit(limit = false)
```
**改造执行器项目**
* 添加手动触发类
```java
/**
* Created by haoxiaoyong on 2020/1/11 下午 3:39
* e-mail: hxyHelloWorld@163.com
* github:https://github.com/haoxiaoyong1014
* Blog: www.haoxiaoyong.cn
*/
@Slf4j
@RestController
@RequestMapping("/xxl-job")
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class ManualOperateController {
private final static String baseUri = "http://127.0.0.1:8084/xxl-job-admin";
private final static String JOB_INFO_URI = "/jobinfo";
private final static String JOB_GROUP_URI = "/jobgroup";
/**
* 任务组列表,xxl-job叫做触发器列表
*/
@GetMapping("/group")
public String xxlJobGroup() {
HttpResponse execute = HttpUtil.createGet(baseUri + JOB_GROUP_URI + "/list").execute();
log.info("【execute】= {}", execute);
return execute.body();
}
/**
* 分页任务列表
*
* @param page 当前页,第一页 -> 0
* @param size 每页条数,默认10
* @return 分页任务列表
*/
@GetMapping("/list")
public String xxlJobList(Integer page, Integer size) {
Map<String, Object> jobInfo = Maps.newHashMap();
jobInfo.put("start", page != null ? page : 0);
jobInfo.put("length", size != null ? size : 10);
jobInfo.put("jobGroup", 2);
jobInfo.put("triggerStatus", -1);
HttpResponse execute = HttpUtil.createGet(baseUri + JOB_INFO_URI + "/pageList").form(jobInfo).execute();
log.info("【execute】= {}", execute);
return execute.body();
}
/**
* 测试手动保存任务
*/
@GetMapping("/add")
public String xxlJobAdd() {
Map<String, Object> jobInfo = Maps.newHashMap();
jobInfo.put("jobGroup", 2);
jobInfo.put("jobCron", "0 0/1 * * * ? *");
jobInfo.put("jobDesc", "手动添加的任务");
jobInfo.put("author", "admin");
jobInfo.put("executorRouteStrategy", "ROUND");
jobInfo.put("executorHandler", "demoTask");
jobInfo.put("executorParam", "手动添加的任务的参数");
jobInfo.put("executorBlockStrategy", ExecutorBlockStrategyEnum.SERIAL_EXECUTION);
jobInfo.put("glueType", GlueTypeEnum.BEAN);
HttpResponse execute = HttpUtil.createGet(baseUri + JOB_INFO_URI + "/add").form(jobInfo).execute();
log.info("【execute】= {}", execute);
return execute.body();
}
/**
* 测试手动触发一次任务
*/
@GetMapping("/trigger")
public String xxlJobTrigger() {
Map<String, Object> jobInfo = Maps.newHashMap();
jobInfo.put("id", 5);
jobInfo.put("executorParam", JSONUtil.toJsonStr(jobInfo));
HttpResponse execute = HttpUtil.createGet(baseUri + JOB_INFO_URI + "/trigger").form(jobInfo).execute();
log.info("【execute】= {}", execute);
return execute.body();
}
/**
* 测试手动删除任务
*/
@GetMapping("/remove")
public String xxlJobRemove() {
Map<String, Object> jobInfo = Maps.newHashMap();
jobInfo.put("id", 4);
HttpResponse execute = HttpUtil.createGet(baseUri + JOB_INFO_URI + "/remove").form(jobInfo).execute();
log.info("【execute】= {}", execute);
return execute.body();
}
/**
* 测试手动停止任务
*/
@GetMapping("/stop")
public String xxlJobStop() {
Map<String, Object> jobInfo = Maps.newHashMap();
jobInfo.put("id", 4);
HttpResponse execute = HttpUtil.createGet(baseUri + JOB_INFO_URI + "/stop").form(jobInfo).execute();
log.info("【execute】= {}", execute);
return execute.body();
}
/**
* 测试手动启动任务
*/
@GetMapping("/start")
public String xxlJobStart() {
Map<String, Object> jobInfo = Maps.newHashMap();
jobInfo.put("id", 4);
HttpResponse execute = HttpUtil.createGet(baseUri + JOB_INFO_URI + "/start").form(jobInfo).execute();
log.info("【execute】= {}", execute);
return execute.body();
}
}
```
**测试**
以手动触发一次任务为例
* 启动 xxl-job-admin
* 启动执行器项目
* 访问`localhost:8082/xxl-job/trigger`
* 控制台日志
<img src="https://cg-mall.oss-cn-shanghai.aliyuncs.com/cg/doc/xxl.png" alt="xxl-job.png" style="zoom:67%;" />
#### 扩展:使用Docker 镜像方式搭建调度中心
使用docker镜像方式部署`xxl-job-admin`;
附上执行脚本: [xxl-job.sh](https://cg-mall.oss-cn-shanghai.aliyuncs.com/cg/doc/xxl-job.sh)
不使用脚本也可以直接在命令窗口键入:
```shell
docker run -d --rm -e PARAMS="--spring.datasource.url=jdbc:mysql://127.0.0.1:3306/xxl_job?Unicode=true&characterEncoding=UTF-8 --spring.datasource.use
rname=root --spring.datasource.password=123456" -p 8680:8080 --name xxl-job-admin xuxueli/xxl-job-admin:2.1.1
```
配置好数据库名称以及密码即可!
================================================
FILE: distributed-job/pom.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>cn.haoxy.job</groupId>
<artifactId>distributed-job</artifactId>
<version>v1.0.0</version>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.xuxueli</groupId>
<artifactId>xxl-job-core</artifactId>
<version>2.1.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-commons -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-commons</artifactId>
<version>2.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.7</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<!--改造需要-->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.1.0</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>28.2-jre</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
<goal>build-info</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
================================================
FILE: distributed-job/src/main/java/cn/haoxy/distributed/JobApplication.java
================================================
package cn.haoxy.distributed;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* Created by haoxiaoyong on 2019/12/26 下午 1:11
* e-mail: hxyHelloWorld@163.com
* github:https://github.com/haoxiaoyong1014
* Blog: www.haoxiaoyong.cn
*/
@SpringBootApplication
public class JobApplication {
public static void main(String[] args) {
SpringApplication.run(JobApplication.class, args);
}
}
================================================
FILE: distributed-job/src/main/java/cn/haoxy/distributed/config/JobConfig.java
================================================
package cn.haoxy.distributed.config;
import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.commons.util.InetUtils;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* Created by haoxiaoyong on 2019/12/26 下午 1:12
* e-mail: hxyHelloWorld@163.com
* github:https://github.com/haoxiaoyong1014
* Blog: www.haoxiaoyong.cn
*/
@Slf4j
@Configuration
@EnableConfigurationProperties(XxlJobProps.class)
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class JobConfig {
private final XxlJobProps xxlJobProps;
private final InetUtils inetUtils;
/*@Value("${xxl.job.admin.addresses}")
private String adminAddresses;
@Value("${xxl.job.executor.appname}")
private String appName;
@Value("${xxl.job.executor.ip}")
private String ip;
@Value("${xxl.job.executor.port}")
private int port;
@Value("${xxl.job.accessToken}")
private String accessToken;
@Value("${xxl.job.executor.logpath}")
private String logPath;
@Value("${xxl.job.executor.logretentiondays}")
private int logRetentionDays;*/
@Bean
public XxlJobSpringExecutor xxlJobExecutor() {
log.info(">>>>>>>>>>> xxl-job config init.");
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
xxlJobSpringExecutor.setAdminAddresses(xxlJobProps.getAdmin().getAddress());
xxlJobSpringExecutor.setAppName(xxlJobProps.getExecutor().getAppName());
String ip = xxlJobProps.getExecutor().getIp();
if (StringUtils.isBlank(ip)) {
ip = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress();
}
log.info("IP地址为: " + ip);
log.info("AdminAddresses地址为: " + xxlJobProps.getAdmin().getAddress());
xxlJobSpringExecutor.setIp(ip);
xxlJobSpringExecutor.setPort(xxlJobProps.getExecutor().getPort());
xxlJobSpringExecutor.setAccessToken(xxlJobProps.getAccessToken());
xxlJobSpringExecutor.setLogPath(xxlJobProps.getExecutor().getLogPath());
xxlJobSpringExecutor.setLogRetentionDays(xxlJobProps.getExecutor().getLogRetentionDays());
return xxlJobSpringExecutor;
}
/*@Bean
public XxlJobSpringExecutor xxlJobExecutor() {
log.info(">>>>>>>>>>> xxl-job config init.");
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
xxlJobSpringExecutor.setAdminAddresses(adminAddresses);
xxlJobSpringExecutor.setAppName(appName);
if (StringUtils.isBlank(ip)) {
ip = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress();
}
log.info("IP地址为: " + ip);
log.info("AdminAddresses地址为: " + adminAddresses);
xxlJobSpringExecutor.setIp(ip);
xxlJobSpringExecutor.setPort(port);
xxlJobSpringExecutor.setAccessToken(accessToken);
xxlJobSpringExecutor.setLogPath(logPath);
xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays);
return xxlJobSpringExecutor;
}*/
}
================================================
FILE: distributed-job/src/main/java/cn/haoxy/distributed/config/XxlJobProps.java
================================================
package cn.haoxy.distributed.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* Created by haoxiaoyong on 2020/1/10 下午 4:52
* e-mail: hxyHelloWorld@163.com
* github:https://github.com/haoxiaoyong1014
* Blog: www.haoxiaoyong.cn
*/
@Data
@ConfigurationProperties(prefix = "xxl.job")
public class XxlJobProps {
/**
* 调度中心配置
*/
private XxlJobAdminProps admin;
/**
* 执行器配置
*/
private XxlJobExecutorProps executor;
/**
* 与调度中心交互的accessToken
*/
private String accessToken;
@Data
public static class XxlJobAdminProps {
/**
* 调度中心地址
*/
private String address;
}
@Data
public static class XxlJobExecutorProps {
/**
* 执行器名称
*/
private String appName;
/**
* 执行器 IP
*/
private String ip;
/**
* 执行器端口
*/
private int port;
/**
* 执行器日志
*/
private String logPath;
/**
* 执行器日志保留天数
*/
private int logRetentionDays;
}
}
================================================
FILE: distributed-job/src/main/java/cn/haoxy/distributed/controller/ManualOperateController.java
================================================
package cn.haoxy.distributed.controller;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;
import com.google.common.collect.Maps;
import com.xxl.job.core.enums.ExecutorBlockStrategyEnum;
import com.xxl.job.core.glue.GlueTypeEnum;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
/**
* Created by haoxiaoyong on 2020/1/11 下午 3:39
* e-mail: hxyHelloWorld@163.com
* github:https://github.com/haoxiaoyong1014
* Blog: www.haoxiaoyong.cn
*/
@Slf4j
@RestController
@RequestMapping("/xxl-job")
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class ManualOperateController {
private final static String baseUri = "http://127.0.0.1:8084/xxl-job-admin";
private final static String JOB_INFO_URI = "/jobinfo";
private final static String JOB_GROUP_URI = "/jobgroup";
/**
* 任务组列表,xxl-job叫做触发器列表
*/
@GetMapping("/group")
public String xxlJobGroup() {
HttpResponse execute = HttpUtil.createGet(baseUri + JOB_GROUP_URI + "/list").execute();
log.info("【execute】= {}", execute);
return execute.body();
}
/**
* 分页任务列表
*
* @param page 当前页,第一页 -> 0
* @param size 每页条数,默认10
* @return 分页任务列表
*/
@GetMapping("/list")
public String xxlJobList(Integer page, Integer size) {
Map<String, Object> jobInfo = Maps.newHashMap();
jobInfo.put("start", page != null ? page : 0);
jobInfo.put("length", size != null ? size : 10);
jobInfo.put("jobGroup", 2);
jobInfo.put("triggerStatus", -1);
HttpResponse execute = HttpUtil.createGet(baseUri + JOB_INFO_URI + "/pageList").form(jobInfo).execute();
log.info("【execute】= {}", execute);
return execute.body();
}
/**
* 测试手动保存任务
*/
@GetMapping("/add")
public String xxlJobAdd() {
Map<String, Object> jobInfo = Maps.newHashMap();
jobInfo.put("jobGroup", 2);
jobInfo.put("jobCron", "0 0/1 * * * ? *");
jobInfo.put("jobDesc", "手动添加的任务");
jobInfo.put("author", "admin");
jobInfo.put("executorRouteStrategy", "ROUND");
jobInfo.put("executorHandler", "demoTask");
jobInfo.put("executorParam", "手动添加的任务的参数");
jobInfo.put("executorBlockStrategy", ExecutorBlockStrategyEnum.SERIAL_EXECUTION);
jobInfo.put("glueType", GlueTypeEnum.BEAN);
HttpResponse execute = HttpUtil.createGet(baseUri + JOB_INFO_URI + "/add").form(jobInfo).execute();
log.info("【execute】= {}", execute);
return execute.body();
}
/**
* 测试手动触发一次任务
*/
@GetMapping("/trigger")
public String xxlJobTrigger() {
Map<String, Object> jobInfo = Maps.newHashMap();
jobInfo.put("id", 5);
jobInfo.put("executorParam", JSONUtil.toJsonStr(jobInfo));
HttpResponse execute = HttpUtil.createGet(baseUri + JOB_INFO_URI + "/trigger").form(jobInfo).execute();
log.info("【execute】= {}", execute);
return execute.body();
}
/**
* 测试手动删除任务
*/
@GetMapping("/remove")
public String xxlJobRemove() {
Map<String, Object> jobInfo = Maps.newHashMap();
jobInfo.put("id", 4);
HttpResponse execute = HttpUtil.createGet(baseUri + JOB_INFO_URI + "/remove").form(jobInfo).execute();
log.info("【execute】= {}", execute);
return execute.body();
}
/**
* 测试手动停止任务
*/
@GetMapping("/stop")
public String xxlJobStop() {
Map<String, Object> jobInfo = Maps.newHashMap();
jobInfo.put("id", 4);
HttpResponse execute = HttpUtil.createGet(baseUri + JOB_INFO_URI + "/stop").form(jobInfo).execute();
log.info("【execute】= {}", execute);
return execute.body();
}
/**
* 测试手动启动任务
*/
@GetMapping("/start")
public String xxlJobStart() {
Map<String, Object> jobInfo = Maps.newHashMap();
jobInfo.put("id", 4);
HttpResponse execute = HttpUtil.createGet(baseUri + JOB_INFO_URI + "/start").form(jobInfo).execute();
log.info("【execute】= {}", execute);
return execute.body();
}
}
================================================
FILE: distributed-job/src/main/java/cn/haoxy/distributed/handler/TestJobHandler.java
================================================
package cn.haoxy.distributed.handler;
import cn.haoxy.distributed.service.InService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.JobHandler;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.xxl.job.core.log.XxlJobLogger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.concurrent.TimeUnit;
/**
* Created by haoxiaoyong on 2019/12/26 下午 1:22
* e-mail: hxyHelloWorld@163.com
* github:https://github.com/haoxiaoyong1014
* Blog: www.haoxiaoyong.cn
*/
@Component
public class TestJobHandler {
@Autowired
private InService inService;
@XxlJob("jobHandler")
public ReturnT<String> execute(String param) throws InterruptedException {
for (int i = 0; i < 5; i++) {
XxlJobLogger.log("beat at:" + i);
TimeUnit.SECONDS.sleep(2);
}
inService.xxl();
return ReturnT.SUCCESS;
}
}
================================================
FILE: distributed-job/src/main/java/cn/haoxy/distributed/service/InService.java
================================================
package cn.haoxy.distributed.service;
import org.springframework.stereotype.Service;
/**
* Created by haoxiaoyong on 2019/12/26 下午 1:25
* e-mail: hxyHelloWorld@163.com
* github:https://github.com/haoxiaoyong1014
* Blog: www.haoxiaoyong.cn
*/
@Service
public class InService {
public void xxl(){
System.out.println("Hello World......");
}
}
================================================
FILE: distributed-job/src/main/resources/application.properties-out
================================================
# web port
server.port=8082
# log config
#logging.config=classpath:logback.xml
### xxl-job admin address list, such as "http://address" or "http://address01,http://address02"
#xxl.job.admin.addresses=http://127.0.0.1:8081/xxl-job-admin
xxl.job.admin.addresses=http://47.100.102.136:8680/xxl-job-admin
### xxl-job executor address
xxl.job.executor.appname=xxl-job-executor-sample
xxl.job.executor.ip=
xxl.job.executor.port=9999
### xxl-job, access token
xxl.job.accessToken=
### xxl-job log path
xxl.job.executor.logpath=/data/applogs/xxl-job/jobhandler
### xxl-job log retention days
xxl.job.executor.logretentiondays=30
================================================
FILE: distributed-job/src/main/resources/application.yml
================================================
# web port
server:
port: 8082
# log config
#logging:
# config: classpath:logback.xml
### xxl-job admin address list, such as "http://address" or "http://address01,http://address02"
#xxl.job.admin.addresses=http://127.0.0.1:8081/xxl-job-admin
xxl:
job:
access-token:
admin:
address: http://127.0.0.1:8084/xxl-job-admin
executor:
app-name: xxl-job-executor-sample
ip:
port: 9999
# xxl-job, access token
log-path: /data/applogs/xxl-job/jobhandler
# xxl-job log retention days
log-retention-days: 30
================================================
FILE: distributed-job/src/main/resources/logback.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false" scan="true" scanPeriod="1 seconds">
<contextName>logback</contextName>
<property name="log.path" value="logs/xxl-job/xxl-job-admin.log"/>
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} %contextName [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.path}.%d{yyyy-MM-dd}.zip</fileNamePattern>
</rollingPolicy>
<encoder>
<pattern>%date %level [%thread] %logger{36} [%file : %line] %msg%n
</pattern>
</encoder>
</appender>
<root level="info">
<appender-ref ref="console"/>
<appender-ref ref="file"/>
</root>
</configuration>
================================================
FILE: global-exception/README.md
================================================
### Spring,Spring Boot 实战,- 全局异常处理
#### 异常处理
当我们开发过程中或者说一个web程序在运行中,由于用户操作不当,或者说程序中存在的bug,有大量的异常需要处理,有些异常要告知开发人员,有些异常要提示用户,
在很久之前我们处理全局异常通常都定义一个异常基类,然后每个Controller去继承这个异常基类,虽然这种方式可以解决问题,但是极其不灵活,因为动用了继承机制就只为获取一个默认的方法,这显然是不好的。
在探寻spring的异常处理机制的时候发现@ExceptionHandler注解来处理异常,下面就介绍一下这种方式:
**1,自定义一个异常类并继承RuntimeException**
```java
public class CustomizeException extends RuntimeException {
private String content;
public CustomizeException() {
}
public CustomizeException(int code, String msg) {
JSONObject returnJson = new JSONObject();
returnJson.put("code", code);
returnJson.put("msg", msg);
this.setContent(returnJson.toJSONString());
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
}
```
**2,定义一个全局的异常处理类**
```java
@ControllerAdvice
public class GlobalExceptionHandler {
/**
* 处理系统异常
*
* @param ex
* @return
*/
@ExceptionHandler(value = Exception.class)
@ResponseBody
public String systemErrorHandler(Exception ex) {
RespInfo respInfo = new RespInfo();
respInfo.setCode(400);
respInfo.setMsg("系统异常");
respInfo.setData(ex.getMessage());
return JSONObject.toJSONString(respInfo);
}
/**
* 处理自定义异常
*/
@ExceptionHandler(value = CustomizeException.class)
@ResponseBody
public String customizeException(CustomizeException ce) {
return ce.getContent();
}
}
```
所谓加强Controller就是`@ControllerAdvice`注解,这中处理异常的方式也叫`使用加强Controller做全局异常处理。`
`@ExceptionHandler`中的value值就是需要异常类(自定义异常(CustomizeException),系统异常(Exception,NullPointerException,ArrayIndexOutOfBoundsException等等..))
**定义一个RespInfo**
用于接收系统异常参数
```java
public class RespInfo {
public int code;
public String msg;
public Object data;
//省略 get和 set 方法
}
```
**定义一个Controller**
```java
@RestController
@RequestMapping(value = "login")
public class LoginController {
@RequestMapping(value = "in")
public String login(@RequestBody Parameter parameter) {
if (StringUtils.isAnyBlank(parameter.getPassword(), parameter.getPhone())) {
throw new CustomizeException(1001, "必要参数不能为空");
}
//int i = 1 / 0;
if (!"1111".equals(parameter.getPhone()) || !"1234".equals(parameter.getPassword())) {
throw new CustomizeException(1002, "参数错误");
}
return "登录成功";
}
}
```
其中Parameter是要用户传过来的参数;
StringUtils.isAnyBlank(CharSequence... css)依赖于:
```xml
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.7</version>
</dependency>
```
任意一个值为空都返回true,
**接下来我们进行测试**
当有空参的时候:

当参数值不正确时:

当发生代码有异常时:
我们把 `int i = 1 / 0` 注解打开,

================================================
FILE: global-exception/pom.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.hxy</groupId>
<artifactId>springboot-examples</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>global-exception</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.15</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.7</version>
</dependency>
</dependencies>
</project>
================================================
FILE: global-exception/src/main/java/cn/haoxiaoyong/ex/ExceptionApp.java
================================================
package cn.haoxiaoyong.ex;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* Created by haoxy on 2019/3/11.
* E-mail:hxyHelloWorld@163.com
* github:https://github.com/haoxiaoyong1014
*/
@SpringBootApplication
public class ExceptionApp {
public static void main(String[] args) {
SpringApplication.run(ExceptionApp.class,args);
}
}
================================================
FILE: global-exception/src/main/java/cn/haoxiaoyong/ex/common/Parameter.java
================================================
package cn.haoxiaoyong.ex.common;
/**
* Created by haoxy on 2019/3/11.
* E-mail:hxyHelloWorld@163.com
* github:https://github.com/haoxiaoyong1014
*/
public class Parameter {
private String phone;
private String password;
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
================================================
FILE: global-exception/src/main/java/cn/haoxiaoyong/ex/common/RespInfo.java
================================================
package cn.haoxiaoyong.ex.common;
/**
* Created by haoxy on 2019/3/11.
* E-mail:hxyHelloWorld@163.com
* github:https://github.com/haoxiaoyong1014
*/
public class RespInfo {
public int code;
public String msg;
public Object data;
public RespInfo(int code, String msg, Object data) {
this.code = code;
this.msg = msg;
this.data = data;
}
public RespInfo() {
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
}
================================================
FILE: global-exception/src/main/java/cn/haoxiaoyong/ex/controller/LoginController.java
================================================
package cn.haoxiaoyong.ex.controller;
import cn.haoxiaoyong.ex.common.Parameter;
import cn.haoxiaoyong.ex.exception.CustomizeException;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* Created by haoxy on 2019/3/11.
* E-mail:hxyHelloWorld@163.com
* github:https://github.com/haoxiaoyong1014
*/
@RestController
@RequestMapping(value = "login")
public class LoginController {
@RequestMapping(value = "in")
public String login(@RequestBody Parameter parameter) {
if (StringUtils.isAnyBlank(parameter.getPassword(), parameter.getPhone())) {
throw new CustomizeException(1001, "必要参数不能为空");
}
int i = 1 / 0;
if (!"1111".equals(parameter.getPhone()) || !"1234".equals(parameter.getPassword())) {
throw new CustomizeException(1002, "参数错误");
}
return "登录成功";
}
}
================================================
FILE: global-exception/src/main/java/cn/haoxiaoyong/ex/exception/CustomizeException.java
================================================
package cn.haoxiaoyong.ex.exception;
import com.alibaba.fastjson.JSONObject;
/**
* Created by haoxy on 2019/3/11.
* E-mail:hxyHelloWorld@163.com
* github:https://github.com/haoxiaoyong1014
*/
public class CustomizeException extends RuntimeException {
private String content;
public CustomizeException() {
}
public CustomizeException(int code, String msg) {
JSONObject returnJson = new JSONObject();
returnJson.put("code", code);
returnJson.put("msg", msg);
this.setContent(returnJson.toJSONString());
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
}
================================================
FILE: global-exception/src/main/java/cn/haoxiaoyong/ex/global/GlobalExceptionHandler.java
================================================
package cn.haoxiaoyong.ex.global;
import cn.haoxiaoyong.ex.common.RespInfo;
import cn.haoxiaoyong.ex.exception.CustomizeException;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* Created by haoxy on 2019/3/11.
* E-mail:hxyHelloWorld@163.com
* github:https://github.com/haoxiaoyong1014
*/
@ControllerAdvice
public class GlobalExceptionHandler {
/**
* 处理系统异常
*
* @param ex
* @return
*/
@ExceptionHandler(value = Exception.class)
@ResponseBody
public String systemErrorHandler(Exception ex) {
RespInfo respInfo = new RespInfo();
respInfo.setCode(400);
respInfo.setMsg("系统异常");
respInfo.setData(ex.getMessage());
return JSONObject.toJSONString(respInfo);
}
/**
* 处理自定义异常
*/
@ExceptionHandler(value = CustomizeException.class)
@ResponseBody
public String customizeException(CustomizeException ce) {
return ce.getContent();
}
}
================================================
FILE: mybatis-plus-example/README.md
================================================
### mybatis-plus-example
plus-curd(<a href="https://github.com/haoxiaoyong1014/springboot-examples/blob/master/mybatis-plus-example/plus-curd/src/test/java/cn/haoxy/mybatis/plus/curd/SampleTest.java">CRUD接口</a>)
plus-condition(<a href="https://github.com/haoxiaoyong1014/springboot-examples/blob/master/mybatis-plus-example/plus-condition/src/test/java/cn/haoxy/mybatis/plus/condition/PlusConditionTest.java">条件构造器</a>)
plus-generator(<a href="https://github.com/haoxiaoyong1014/springboot-examples/tree/master/mybatis-plus-example/plus-generator/src/main/java/cn/haoxy/mybatis/plus/generator">代码生成器</a>)
plus-page(<a href="https://github.com/haoxiaoyong1014/springboot-examples/blob/master/mybatis-plus-example/plus-page/src/test/java/cn/haoxy/mybatis/plus/page/PlusPageTest.java">分页插件</a>)
================================================
FILE: mybatis-plus-example/plus-condition/pom.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>mybatis-plus-example</artifactId>
<groupId>cn.haoxy.mybatis.plus</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>plus-condition</artifactId>
</project>
================================================
FILE: mybatis-plus-example/plus-condition/src/main/java/cn/haoxy/mybatis/plus/condition/ConditionApp.java
================================================
package cn.haoxy.mybatis.plus.condition;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
@MapperScan(value = "cn.haoxy.mybatis.plus.condition")
public class ConditionApp {
public static void main(String[] args) {
SpringApplication.run(ConditionApp.class, args);
}
}
================================================
FILE: mybatis-plus-example/plus-condition/src/main/java/cn/haoxy/mybatis/plus/condition/mapper/RoleMapper.java
================================================
package cn.haoxy.mybatis.plus.condition.mapper;
import cn.haoxy.mybatis.plus.condition.pojo.Role;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
public interface RoleMapper extends BaseMapper<Role> {
}
================================================
FILE: mybatis-plus-example/plus-condition/src/main/java/cn/haoxy/mybatis/plus/condition/mapper/UserMapper.java
================================================
package cn.haoxy.mybatis.plus.condition.mapper;
import cn.haoxy.mybatis.plus.condition.pojo.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
public interface UserMapper extends BaseMapper<User> {
}
================================================
FILE: mybatis-plus-example/plus-condition/src/main/java/cn/haoxy/mybatis/plus/condition/pojo/Role.java
================================================
package cn.haoxy.mybatis.plus.condition.pojo;
import lombok.Data;
@Data
public class Role {
private Long id;
private String roleName;
private String roleDescribe;
}
================================================
FILE: mybatis-plus-example/plus-condition/src/main/java/cn/haoxy/mybatis/plus/condition/pojo/User.java
================================================
package cn.haoxy.mybatis.plus.condition.pojo;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
public class User {
private Long id;
private String name;
private Integer age;
private String email;
private Long roleId;
}
================================================
FILE: mybatis-plus-example/plus-condition/src/main/resources/application.yml
================================================
server:
port: 9002
spring:
datasource:
url: jdbc:mysql://localhost:3306/mybatis-plus?useUnicode=true&characterEncoding=utf8
username: root
password: yong1014
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.jdbc.Driver
mybatis-plus:
global-config:
db-config:
id-type: AUTO #可选值: UUID,id_worker,AUTO
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
================================================
FILE: mybatis-plus-example/plus-condition/src/test/java/cn/haoxy/mybatis/plus/condition/PlusConditionTest.java
================================================
package cn.haoxy.mybatis.plus.condition;
import cn.haoxy.mybatis.plus.condition.mapper.RoleMapper;
import cn.haoxy.mybatis.plus.condition.mapper.UserMapper;
import cn.haoxy.mybatis.plus.condition.pojo.User;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.List;
import java.util.function.Function;
@RunWith(SpringRunner.class)
@SpringBootTest
public class PlusConditionTest {
@Autowired
private UserMapper userMapper;
@Autowired
private RoleMapper roleMapper;
@Test
public void test() {
/* System.out.println("--------普通查询--------");
getUsers();*/
/* System.out.println("----- 带子查询(sql注入) -----");
childSql();*/
/*System.out.println("----- 带嵌套查询 -----");
nestingSelect();*/
System.out.println("----- 自定义(sql注入) -----");
List<User> users = userMapper.selectList(new QueryWrapper<User>().apply("role_id=2"));
print(users);
}
private void nestingSelect() {
List<User> users = userMapper.selectList(new QueryWrapper<User>().nested(i -> i.eq("role_id", 2L).or().eq("role_id", 3L))
.and(i -> i.eq("age", 20)));
List<User> users1 = userMapper.selectList(new QueryWrapper<User>().lambda().nested(i -> i.eq(User::getRoleId, 2L).or().eq(User::getRoleId, 3L))
.and(i -> i.eq(User::getAge, 20)));
Assert.assertEquals(users.size(), users1.size());
print(users);
}
private void childSql() {
List<User> role_id1 = userMapper.selectList(new QueryWrapper<User>().inSql("role_id", "select id from role where id =2"));
List<User> users1 = userMapper.selectList(new QueryWrapper<User>().lambda().inSql(User::getRoleId, "select id from role where id =2"));
Assert.assertEquals(role_id1.size(), users1.size());
print(users1);
}
private void getUsers() {
List<User> users = userMapper.selectList(new QueryWrapper<User>().lambda().eq(User::getRoleId, 2L));
List<User> role_id = userMapper.selectList(new QueryWrapper<User>().eq("role_id", 2L));
Assert.assertEquals(users.size(), role_id.size());
print(users);
}
private <T> void print(List<T> list) {
if (!CollectionUtils.isEmpty(list)) {
list.forEach(System.out::println);
}
}
}
================================================
FILE: mybatis-plus-example/plus-curd/pom.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>mybatis-plus-example</artifactId>
<groupId>cn.haoxy.mybatis.plus</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>plus-curd</artifactId>
</project>
================================================
FILE: mybatis-plus-example/plus-curd/src/main/java/cn/haoxy/mybatis/plus/curd/PlusApp.java
================================================
package cn.haoxy.mybatis.plus.curd;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
@MapperScan("cn.haoxy.mybatis.plus.curd.mapper")
public class PlusApp {
public static void main(String[] args) {
SpringApplication.run(PlusApp.class, args);
}
}
================================================
FILE: mybatis-plus-example/plus-curd/src/main/java/cn/haoxy/mybatis/plus/curd/mapper/UserMapper.java
================================================
package cn.haoxy.mybatis.plus.curd.mapper;
import cn.haoxy.mybatis.plus.curd.pojo.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
public interface UserMapper extends BaseMapper<User> {
}
================================================
FILE: mybatis-plus-example/plus-curd/src/main/java/cn/haoxy/mybatis/plus/curd/pojo/User.java
================================================
package cn.haoxy.mybatis.plus.curd.pojo;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
public class User {
public Long id;
public String name;
public Integer age;
public String email;
}
================================================
FILE: mybatis-plus-example/plus-curd/src/main/resources/application.yml
================================================
server:
port: 9001
spring:
datasource:
url: jdbc:mysql://localhost:3306/mybatis-plus?useUnicode=true&characterEncoding=utf8
username: root
password: yong1014
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.jdbc.Driver
mybatis-plus:
global-config:
db-config:
id-type: AUTO #可选值: UUID,id_worker,AUTO
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
logging:
level:
com.baomidou.mybatisplus.samples: debug
================================================
FILE: mybatis-plus-example/plus-curd/src/main/resources/spy.properties
================================================
module.log=com.p6spy.engine.logging.P6LogFactory,com.p6spy.engine.outage.P6OutageFactory
# 自定义日志打印
logMessageFormat=com.baomidou.mybatisplus.extension.p6spy.P6SpyLogger
#日志输出到控制台
appender=com.baomidou.mybatisplus.extension.p6spy.StdoutLogger
# 使用日志系统记录 sql
#appender=com.p6spy.engine.spy.appender.Slf4JLogger
# 设置 p6spy driver 代理
deregisterdrivers=true
# 取消JDBC URL前缀
useprefix=true
# 配置记录 Log 例外,可去掉的结果集有error,info,batch,debug,statement,commit,rollback,result,resultset.
excludecategories=info,debug,result,batch,resultset
# 日期格式
dateformat=yyyy-MM-dd HH:mm:ss
# 实际驱动可多个
#driverlist=org.h2.Driver
# 是否开启慢SQL记录
outagedetection=true
# 慢SQL记录标准 1 秒
outagedetectioninterval=1
================================================
FILE: mybatis-plus-example/plus-curd/src/test/java/cn/haoxy/mybatis/plus/curd/SampleTest.java
================================================
package cn.haoxy.mybatis.plus.curd;
import cn.haoxy.mybatis.plus.curd.mapper.UserMapper;
import cn.haoxy.mybatis.plus.curd.pojo.User;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.List;
@RunWith(SpringRunner.class)
@SpringBootTest
public class SampleTest {
@Autowired
private UserMapper userMapper;
@Test
public void testSelect() {
System.out.println(("----- selectAll method test ------"));
List<User> userList = userMapper.selectList(null);
Assert.assertEquals(5, userList.size());
userList.forEach(System.out::println);
}
@Test
public void testInsert() {
System.out.println("--------insert method test--------");
User user = new User();
user.setAge(23);
user.setEmail("test3.@123.com");
user.setName("王3");
int insert = userMapper.insert(user);
System.out.println(insert);
}
@Test
public void testDel() {
Assert.assertTrue(userMapper.deleteById(3L) > 0);
Assert.assertTrue(userMapper.delete(new QueryWrapper<User>().lambda().eq(User::getName, "Sandy")) > 0);
}
@Test
public void testUpdate() {
Assert.assertTrue(userMapper.updateById(new User().setId(1L).setEmail("ab@c.c")) > 0);
userMapper.update(new User().setName("haox").setAge(3), new UpdateWrapper<User>().lambda().eq(User::getId, 2));
}
@Test
public void dSelect() {
Assert.assertEquals("ab@c.c", userMapper.selectById(1L).getEmail());
User user = userMapper.selectOne(new QueryWrapper<User>().lambda().eq(User::getId, 2));
Assert.assertEquals("haox", user.getName());
}
@Test
public void orderBy() {
QueryWrapper<User> qw = new QueryWrapper<>();
qw.orderByAsc("age");
System.out.println(userMapper.selectList(qw));
}
@Test
public void orderByLambda() {
LambdaQueryWrapper<User> lw = new LambdaQueryWrapper<>();
lw.orderByAsc(User::getAge);
System.out.println(userMapper.selectList(lw));
}
}
================================================
FILE: mybatis-plus-example/plus-generator/pom.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>mybatis-plus-example</artifactId>
<groupId>cn.haoxy.mybatis.plus</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>plus-generator</artifactId>
<dependencies>
<!--MysqlGenerator.java 需要-->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.0.6</version>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<version>1.7</version>
</dependency>
</dependencies>
</project>
================================================
FILE: mybatis-plus-example/plus-generator/src/main/java/cn/haoxy/mybatis/plus/generator/CodeGenerator.java
================================================
package cn.haoxy.mybatis.plus.generator;
import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.generator.AutoGenerator;
import com.baomidou.mybatisplus.generator.InjectionConfig;
import com.baomidou.mybatisplus.generator.config.*;
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class CodeGenerator {
/**
* <p>
* 读取控制台内容
* </p>
*/
public static String scanner(String tip) {
Scanner scanner = new Scanner(System.in);
StringBuilder help = new StringBuilder();
help.append("请输入" + tip + ":");
System.out.println(help.toString());
if (scanner.hasNext()) {
String ipt = scanner.next();
if (StringUtils.isNotEmpty(ipt)) {
return ipt;
}
}
throw new MybatisPlusException("请输入正确的" + tip + "!");
}
public static void main(String[] args) {
// 代码生成器
AutoGenerator mpg = new AutoGenerator();
// 全局配置
GlobalConfig gc = new GlobalConfig();
String projectPath = System.getProperty("user.dir");
gc.setOutputDir(projectPath + "/src/main/java");
gc.setAuthor("haoxy");
gc.setOpen(false);
// gc.setSwagger2(true); 实体属性 Swagger2 注解
mpg.setGlobalConfig(gc);
// 数据源配置
DataSourceConfig dsc = new DataSourceConfig();
dsc.setUrl("jdbc:mysql://localhost:3306/mybatis-plus?useUnicode=true&characterEncoding=utf8");
// dsc.setSchemaName("public");
dsc.setDriverName("com.mysql.jdbc.Driver");
dsc.setUsername("root");
dsc.setPassword("yong1014");
mpg.setDataSource(dsc);
// 包配置
PackageConfig pc = new PackageConfig();
pc.setModuleName(scanner(""));
pc.setParent("cn.haoxy.mybatis.plus.generator");
mpg.setPackageInfo(pc);
// 自定义配置
InjectionConfig cfg = new InjectionConfig() {
@Override
public void initMap() {
// to do nothing
}
};
// 如果模板引擎是 freemarker
//String templatePath = "/templates/mapper.xml.ftl";
// 如果模板引擎是 velocity
String templatePath = "/templates/mapper.xml.vm";
// 自定义输出配置
List<FileOutConfig> focList = new ArrayList<>();
// 自定义配置会被优先输出
focList.add(new FileOutConfig(templatePath) {
@Override
public String outputFile(TableInfo tableInfo) {
// 自定义输出文件名 , 如果你 Entity 设置了前后缀、此处注意 xml 的名称会跟着发生变化!!
return projectPath + "/src/main/resources/mapper/" + pc.getModuleName()
+ "/" + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_XML;
}
});
cfg.setFileOutConfigList(focList);
mpg.setCfg(cfg);
// 配置模板
TemplateConfig templateConfig = new TemplateConfig();
// 配置自定义输出模板
//指定自定义模板路径,注意不要带上.ftl/.vm, 会根据使用的模板引擎自动识别
// templateConfig.setEntity("templates/entity2.java");
// templateConfig.setService();
// templateConfig.setController();
templateConfig.setXml(null);
mpg.setTemplate(templateConfig);
// 策略配置
StrategyConfig strategy = new StrategyConfig();
strategy.setNaming(NamingStrategy.underline_to_camel);
strategy.setColumnNaming(NamingStrategy.underline_to_camel);
strategy.setSuperEntityClass("cn.haoxy.mybatis.plus.generator.BaseEntity");
strategy.setEntityLombokModel(true);
strategy.setRestControllerStyle(true);
strategy.setSuperControllerClass("cn.haoxy.mybatis.plus.generator.BaseController");
strategy.setInclude(scanner("表名,多个英文逗号分割").split(","));
strategy.setSuperEntityColumns("id");
strategy.setControllerMappingHyphenStyle(true);
strategy.setTablePrefix(pc.getModuleName() + "_");
mpg.setStrategy(strategy);
mpg.setTemplateEngine(new FreemarkerTemplateEngine());
mpg.execute();
}
}
================================================
FILE: mybatis-plus-example/plus-generator/src/main/java/cn/haoxy/mybatis/plus/generator/GeneratorApplication.java
================================================
package cn.haoxy.mybatis.plus.generator;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class GeneratorApplication {
public static void main(String[] args) {
SpringApplication.run(GeneratorApplication.class, args);
}
}
================================================
FILE: mybatis-plus-example/plus-generator/src/main/java/cn/haoxy/mybatis/plus/generator/MysqlGenerator.java
================================================
package cn.haoxy.mybatis.plus.generator;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.generator.AutoGenerator;
import com.baomidou.mybatisplus.generator.InjectionConfig;
import com.baomidou.mybatisplus.generator.config.*;
import com.baomidou.mybatisplus.generator.config.po.TableFill;
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class MysqlGenerator {
/**
* 1. JDBC 相关配置
*/
private static final String DRIVER = "com.mysql.jdbc.Driver";
private static final String URL = "jdbc:mysql://localhost:3306/mybatis-plus?useUnicode=true&characterEncoding=utf8";
private static final String USER_NAME = "root";
private static final String PASSWORD = "yong1014";
/**
* 2. 需要生成的表名
*/
private static final String[] TABLE_NAME = {"sys_user", "sys_role", "sys_permission", "sys_role_permission", "sys_email", "sys_operation_log", "sys_login_log"};
/**
* 3. 包名
*/
private static final String PACKAGE_NAME = "cn.haoxy.mybatis.plus.generator";
private static final String MAPPER_NAME = "mapper";
/**
* 4. 文件生成目录
*/
private static final String JAVA_HOME = "/Users/haoxiaoyong/development/mybatis-plus";
private static final String RESOURCES_HOME = "/Users/haoxiaoyong/development/mybatis-plus/resources/mapper/";
/**
* 5. 开发人员
*/
private static final String AUTHOR = "haoxy";
/**
* 6. 代码生成
*/
public static void main(String[] args) {
// 自定义需要填充的字段
List<TableFill> tableFillList = new ArrayList<>();
TableFill createField = new TableFill("create_time", FieldFill.INSERT);
TableFill updateField = new TableFill("update_time", FieldFill.INSERT_UPDATE);
tableFillList.add(createField);
tableFillList.add(updateField);
// 自定义需要逻辑删除的字段
String logicDeleteFieldName = "del_flag";
AutoGenerator mpg = new AutoGenerator()
.setGlobalConfig(
// 全局配置
new GlobalConfig()
.setActiveRecord(false) // 需要ActiveRecord特性 改为true
.setAuthor(AUTHOR) // 开发人员
.setOutputDir(JAVA_HOME) // 文件生成的目录
.setFileOverride(true) // 是否覆盖文件
.setEnableCache(false) // XML 二级缓存
.setBaseColumnList(true) // XML ColumnList
.setBaseResultMap(true) // XML ResultMap
.setServiceName("%sService") // 自定义文件名 %s 会自动填充表名
).setDataSource(
// 数据源配置
new DataSourceConfig()
.setDbType(DbType.MYSQL) // 数据库类型
.setUrl(URL)
.setDriverName(DRIVER)
.setUsername(USER_NAME)
.setPassword(PASSWORD)
).setStrategy(
// 策略配置
new StrategyConfig()
.setCapitalMode(true) // 全局大写命名
.setEntityLombokModel(true) // 简化代码
.setNaming(NamingStrategy.underline_to_camel) // 表名生成策略
.setInclude(TABLE_NAME) // 表名
.setTableFillList(tableFillList) // 自动填充字段
.setLogicDeleteFieldName(logicDeleteFieldName) // 逻辑删除字段
).setPackageInfo(
// 包设置
new PackageConfig()
.setParent(PACKAGE_NAME) // 自定义包路径
.setMapper(MAPPER_NAME) // 自定义数据层包名
).setCfg(
// 注入自定义配置
new InjectionConfig() {
@Override
public void initMap() {
}
}.setFileOutConfigList(
Collections.singletonList(new FileOutConfig("/templates/mapper.xml.vm") {
@Override
public String outputFile(TableInfo tableInfo) {
return RESOURCES_HOME + tableInfo.getEntityName() + "Mapper.xml";
}
}))
).setTemplate(
// 关闭默认 xml 生成,调整生成 至 根目录
new TemplateConfig().setXml(null)
);
// 执行生成
mpg.execute();
}
}
================================================
FILE: mybatis-plus-example/plus-page/pom.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>mybatis-plus-example</artifactId>
<groupId>cn.haoxy.mybatis.plus</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>plus-page</artifactId>
</project>
================================================
FILE: mybatis-plus-example/plus-page/src/main/java/cn/haoxy/mybatis/plus/page/PageApp.java
================================================
package cn.haoxy.mybatis.plus.page;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
@SpringBootApplication
@MapperScan(value = "cn.haoxy.mybatis.plus.page.mapper")
public class PageApp {
public static void main(String[] args) {
SpringApplication.run(PageApp.class,args);
}
/**
* 分页插件
*/
@Bean
public PaginationInterceptor paginationInterceptor() {
return new PaginationInterceptor();
}
}
================================================
FILE: mybatis-plus-example/plus-page/src/main/java/cn/haoxy/mybatis/plus/page/mapper/UserMapper.java
================================================
package cn.haoxy.mybatis.plus.page.mapper;
import cn.haoxy.mybatis.plus.page.pojo.MyPage;
import cn.haoxy.mybatis.plus.page.pojo.ParamSome;
import cn.haoxy.mybatis.plus.page.pojo.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
public interface UserMapper extends BaseMapper<User> {
MyPage<User> mySelectPageAndPs(@Param("pg") MyPage<User> myPage,@Param("ps") ParamSome paramSome);//
MyPage<User> mySelectPage(@Param("pg") MyPage<User> myPage);
}
================================================
FILE: mybatis-plus-example/plus-page/src/main/java/cn/haoxy/mybatis/plus/page/pojo/MyPage.java
================================================
package cn.haoxy.mybatis.plus.page.pojo;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
public class MyPage<T> extends Page<T> {
public Integer selectInt;
public String selectStr;
public MyPage(long current, long size) {
super(current, size);
}
}
================================================
FILE: mybatis-plus-example/plus-page/src/main/java/cn/haoxy/mybatis/plus/page/pojo/ParamSome.java
================================================
package cn.haoxy.mybatis.plus.page.pojo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ParamSome {
private Integer yihao;
private String erhao;
}
================================================
FILE: mybatis-plus-example/plus-page/src/main/java/cn/haoxy/mybatis/plus/page/pojo/User.java
================================================
package cn.haoxy.mybatis.plus.page.pojo;
import lombok.Data;
@Data
public class User {
private Long id;
private String name;
private Integer age;
private String email;
}
================================================
FILE: mybatis-plus-example/plus-page/src/main/resources/application.yml
================================================
server:
port: 9002
spring:
datasource:
url: jdbc:mysql://localhost:3306/mybatis-plus?useUnicode=true&characterEncoding=utf8
username: root
password: yong1014
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.jdbc.Driver
mybatis-plus:
global-config:
db-config:
id-type: AUTO #可选值: UUID,id_worker,AUTO
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
mapper-locations: classpath:/mapper/*Mapper.xml
================================================
FILE: mybatis-plus-example/plus-page/src/main/resources/mapper/UserMapper.xml
================================================
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="cn.haoxy.mybatis.plus.page.mapper.UserMapper">
<select id="mySelectPage" resultType="cn.haoxy.mybatis.plus.page.pojo.User">
SELECT
*
FROM
USER
WHERE
(
age = #{pg.selectInt} and name = #{pg.selectStr})
</select>
<select id="mySelectPageAndPs" resultType="cn.haoxy.mybatis.plus.page.pojo.User">
SELECT
*
FROM
USER
WHERE
(
age = #{pg.selectInt} and name = #{pg.selectStr})
OR(
age = #{ps.yihao} and email = #{ps.erhao})
</select>
</mapper>
================================================
FILE: mybatis-plus-example/plus-page/src/test/java/cn/haoxy/mybatis/plus/page/PlusPageTest.java
================================================
package cn.haoxy.mybatis.plus.page;
import cn.haoxy.mybatis.plus.page.mapper.UserMapper;
import cn.haoxy.mybatis.plus.page.pojo.MyPage;
import cn.haoxy.mybatis.plus.page.pojo.ParamSome;
import cn.haoxy.mybatis.plus.page.pojo.User;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.List;
@SpringBootTest
@RunWith(SpringRunner.class)
public class PlusPageTest {
@Autowired
private UserMapper userMapper;
@Test
public void pageTest() {
/*System.out.println("----- baseMapper 自带分页 -----");
iPage();*/
/*System.out.println("----- 自定义 XML 分页 -----");
MyPage();*/
MyPage<User> myPage = new MyPage<User>(1, 5).setSelectInt(20).setSelectStr("Jack");
ParamSome paramSome = new ParamSome(20, "test2@baomidou.com");
MyPage<User> userMyPage = userMapper.mySelectPageAndPs(myPage,paramSome);
System.out.println("总条数 -----> " + userMyPage.getTotal());
System.out.println("当前页数 -----> " + userMyPage.getCurrent());
System.out.println("当前每页显示数 -----> " + userMyPage.getSize());
print(userMyPage.getRecords());
}
private void MyPage() {
MyPage<User> myPage = new MyPage<User>(1, 5).setSelectInt(20).setSelectStr("Jack");
MyPage<User> userMyPage = userMapper.mySelectPage(myPage);
System.out.println("总条数 -----> " + userMyPage.getTotal());
System.out.println("当前页数 -----> " + userMyPage.getCurrent());
System.out.println("当前每页显示数 -----> " + userMyPage.getSize());
print(userMyPage.getRecords());
}
private void iPage() {
Page<User> page = new Page<>(1, 5);
IPage<User> userIPage = userMapper.selectPage(page, new QueryWrapper<User>().lambda().eq(User::getAge, 20).eq(User::getName, "Jack"));
System.out.println("总条数------>" + userIPage.getTotal());
System.out.println("当前页数 -----> " + userIPage.getCurrent());
System.out.println("当前每页显示数 -----> " + userIPage.getSize());
/*import ikidou.reflect.TypeBuilder;
System.out.println("json 正反序列化 begin");
String json = JSON.toJSONString(page);
Page<User> page1 = JSON.parseObject(json, TypeBuilder.newInstance(Page.class).addTypeParam(User.class).build());
print(page1.getRecords());
System.out.println("json 正反序列化 end");*/
System.out.println("-------------------");
System.out.println("总条数------>" + page.getTotal());
System.out.println("当前页数 -----> " + page.getCurrent());
System.out.println("当前每页显示数 -----> " + page.getSize());
print(userIPage.getRecords());
}
private <T> void print(List<T> list) {
if (!CollectionUtils.isEmpty(list)) {
list.forEach(System.out::println);
}
}
}
================================================
FILE: mybatis-plus-example/plus-page-ui/pom.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>mybatis-plus-example</artifactId>
<groupId>cn.haoxy.mybatis.plus</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>plus-page-ui</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
</dependencies>
</project>
================================================
FILE: mybatis-plus-example/plus-page-ui/src/main/java/cn/haoxy/mybatis/plus/page/ui/PageUiApplication.java
================================================
package cn.haoxy.mybatis.plus.page.ui;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
@SpringBootApplication
@MapperScan(value = "cn.haoxy.mybatis.plus.page.ui")
public class PageUiApplication {
public static void main(String[] args) {
SpringApplication.run(PageUiApplication.class, args);
}
/**
* 分页插件
*/
@Bean
public PaginationInterceptor paginationInterceptor() {
return new PaginationInterceptor();
}
}
================================================
FILE: mybatis-plus-example/plus-page-ui/src/main/resources/application.yml
================================================
server:
port: 9002
spring:
datasource:
url: jdbc:mysql://localhost:3306/mybatis-plus?useUnicode=true&characterEncoding=utf8
username: root
password: yong1014
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.jdbc.Driver
thymeleaf:
cache: false
mybatis-plus:
global-config:
db-config:
id-type: AUTO #可选值: UUID,id_worker,AUTO
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
mapper-locations: classpath:/mapper/*Mapper.xml
================================================
FILE: mybatis-plus-example/pom.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.2.RELEASE</version>
</parent>
<groupId>cn.haoxy.mybatis.plus</groupId>
<artifactId>mybatis-plus-example</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<modules>
<module>plus-curd</module>
<module>plus-page</module>
<module>plus-condition</module>
<module>plus-generator</module>
<!--<module>plus-page-ui</module>-->
</modules>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.0.11</version>
</dependency>
</dependencies>
</project>
================================================
FILE: okay-spring-boot-starter/README.md
================================================
### 从SpringBoot源码到自己封装一个Starter
这篇博客主要讲述一下springboot怎么给我们简化了大量的配置,然后跟着源码自己封装一个Starter,首先我们需要从两个地方来说,第一就是springboot的起步依赖,第二就是springboot自动装配;
#### 起步依赖
我们在创建一个springboot工程时需要引入`spring-boot-starter-web`这个依赖;
```xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
```
这个依赖我们点进去可以看到其实这个起步依赖集成了常用的web依赖,例如`spring-web`,`spring-webmvc`
```xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>2.1.4.RELEASE</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-json</artifactId>
<version>2.1.4.RELEASE</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<version>2.1.4.RELEASE</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<version>6.0.16.Final</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.1.6.RELEASE</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>5.1.6.RELEASE</version>
<scope>compile</scope>
</dependency>
```
Spring Boot的起步依赖说白了就是对常用的依赖进行再一次封装,方便我们引入,简化了 pom.xml 配置,但是更重要的是将依赖的管理交给了 Spring Boot,我们无需关注不同的依赖的不同版本是否存在冲突的问题,Spring Boot 都帮我们考虑好了,我们拿来用即可!
在使用 Spring Boot 的起步依赖之前,我们需要在`pom.xml`中添加配置:
```xml
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
```
即让`pom.xml`继承 Spring Boot 的`pom.xml`,而 Spring Boot 的`pom.xml`里面定义了常用的框架的依赖以及相应的版本号,我们无需担心版本冲突问题;
#### 自动装配
首先我们知道springboot启动需要一个启动引导类,这个类除了是应用的入口之外,还发挥着配置的 Spring Boot 的重要作用。
```java
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
```
可以看到`@SpringBootApplication`这个注解,我们点击进去这个注解,发现它发挥着多个注解的作用,这也体现了注解的派生性和层次性;
```java
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
@SpringBootConfiguration
@EnableAutoConfiguration
@ComponentScan(
excludeFilters = {@Filter(
type = FilterType.CUSTOM,
classes = {TypeExcludeFilter.class}
), @Filter(
type = FilterType.CUSTOM,
classes = {AutoConfigurationExcludeFilter.class}
)}
)
public @interface SpringBootApplication {
@AliasFor(
annotation = EnableAutoConfiguration.class
)
Class<?>[] exclude() default {};
//........
}
```
这里的`@SpringBootConfiguration`和`@ComponentScan`注解,前者其实就是`@Configuration`注解,就是起到声明这个类为配置类的作用,而后者起到开启自动扫描组件的作用。
我们重点分析一下`@EnableAutoConfiguration`这个注解,这个注解的作用就是开启Spring Boot 的自动装配功能,我们点进行看下:
```java
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
@AutoConfigurationPackage
@Import({AutoConfigurationImportSelector.class})
public @interface EnableAutoConfiguration {
String ENABLED_OVERRIDE_PROPERTY = "spring.boot.enableautoconfiguration";
Class<?>[] exclude() default {};
String[] excludeName() default {};
}
```
我们重点分析一下`@Import({AutoConfigurationImportSelector.class})`这个注解,我们知道`@Import`的作用是将组件添加到 Spring 容器中,而在这里即是将`AutoConfigurationImportSelector`这个组件添加到 Spring 容器中。也就是将`AutoConfigurationImportSelector`声明成一个Bean;
我们重点分析一下`@Import`注解中的`AutoConfigurationImportSelector`类;
```java
protected AutoConfigurationEntry getAutoConfigurationEntry(AutoConfigurationMetadata autoConfigurationMetadata,
AnnotationMetadata annotationMetadata) {
if (!isEnabled(annotationMetadata)) {
return EMPTY_ENTRY;
}
AnnotationAttributes attributes = getAttributes(annotationMetadata);
List<String> configurations = getCandidateConfigurations(annotationMetadata, attributes);
configurations = removeDuplicates(configurations);
Set<String> exclusions = getExclusions(annotationMetadata, attributes);
checkExcludedClasses(configurations, exclusions);
configurations.removeAll(exclusions);
configurations = filter(configurations, autoConfigurationMetadata);
fireAutoConfigurationImportEvents(configurations, exclusions);
return new AutoConfigurationEntry(configurations, exclusions);
}
protected List<String> getCandidateConfigurations(AnnotationMetadata metadata, AnnotationAttributes attributes) {
List<String> configurations = SpringFactoriesLoader.loadFactoryNames(getSpringFactoriesLoaderFactoryClass(),
getBeanClassLoader());
Assert.notEmpty(configurations, "No auto configuration classes found in META-INF/spring.factories. If you "
+ "are using a custom packaging, make sure that file is correct.");
return configurations;
}
```
在`getAutoConfigurationEntry`方法中扫描`ClassPath`下的所有`jar`包的`spring.factories`文件,将`spring.factories`文件`key`为`EnableAutoConfiguration`的所有值取出,然后这些值其实是类的全限定名,**也就是自动配置类的全限定名**,然后 Spring Boot 通过这些全限定名进行类加载(反射),将这些自动配置类添加到 Spring 容器中。
我们找到一个名为`spring-boot-autoconfigure-2.1.4.RELEASE.jar`的 jar 包,打开它的`spring.factories`文件,发现这个文件有`key`为`EnableAutoConfiguration`的键值对
<img src="https://upload-images.jianshu.io/upload_images/15181329-6cc01c6a6d313cbe.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="image.png" style="zoom:67%;" />
也就是这个`jar`包有自动配置类,可以发现这些自动配置配都是以`xxxAutoConfiguration`的命名规则来取名的,这些自动配置类包含我了们常用的框架的自动配置类,比如`aop`、`mongo`、`redis`和`web`等等,基本能满足我们日常开发的需求。例如我们程序中需要用到aop,直接引入相应的依赖即可!
```xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
```
我们取一个较为简单的配置类进行分析,看看是怎么发挥它的配置作用的;我们以`HttpEncodingAutoConfiguration`为例;部分代码如下:
```java
//声明这个类为配置类
@Configuration
//开启ConfigurationProperties功能,同时将配置文件和HttpProperties.class绑定起来
@EnableConfigurationProperties({HttpProperties.class})
//只有在web应用下自动配置类才生效
@ConditionalOnWebApplication(
type = Type.SERVLET
)
//只有存在CharacterEncodingFilter.class情况下 自动配置类才生效
@ConditionalOnClass({CharacterEncodingFilter.class})
//判断配置文件是否存在某个配置spring.http.encoding,如果存在其值为enabled才生效,如果不存在这个配置类也生效。
@ConditionalOnProperty(
prefix = "spring.http.encoding",
value = {"enabled"},
matchIfMissing = true
)
public class HttpEncodingAutoConfiguration {
private final Encoding properties;
public HttpEncodingAutoConfiguration(HttpProperties properties) {
this.properties = properties.getEncoding();
}
//将字符编码过滤器组件添加到 Spring 容器中
@Bean
//仅在该注解规定的类不存在于 spring容器中时,使用该注解的config或者bean声明才会被实例化到容器中
@ConditionalOnMissingBean
public CharacterEncodingFilter characterEncodingFilter() {
CharacterEncodingFilter filter = new OrderedCharacterEncodingFilter();
filter.setEncoding(this.properties.getCharset().name());
filter.setForceRequestEncoding(this.properties.shouldForce(org.springframework.boot.autoconfigure.http.HttpProperties.Encoding.Type.REQUEST));
filter.setForceResponseEncoding(this.properties.shouldForce(org.springframework.boot.autoconfigure.http.HttpProperties.Encoding.Type.RESPONSE));
return filter;
}
@Bean
public HttpEncodingAutoConfiguration.LocaleCharsetMappingsCustomizer localeCharsetMappingsCustomizer() {
return new HttpEncodingAutoConfiguration.LocaleCharsetMappingsCustomizer(this.properties);
}
```
Configuration:这个注解声明了这个类为配置类(和我们平时写的配置类一样,同样是在类上加这个注解)。
EnableConfigurationProperties:开启`ConfigurationProperties`功能,也就是将配置文件和`HttpProperties.class`这个类绑定起来,将配置文件的相应的值和`HttpProperties.class`的变量关联起来,可以点击`HttpProperties.class`进去看看,
```java
@ConfigurationProperties(
prefix = "spring.http"
)
public static final Charset DEFAULT_CHARSET;
private Charset charset;
private Boolean force;
private Boolean forceRequest;
private Boolean forceResponse;
private Map<Locale, Charset> mapping;
```
通过`ConfigurationProperties`指定前缀,将配置文件`application.properties`前缀为`spring.http`的值和`HttpProperties.class`的变量关联起来,通过类的变量可以发现,我们可以设置的属性是`charset`、`force`、`forceRequest`、`forceResponse`和`mapping`。另外`ConfigurationProperties`注解将`HttpProperties`类注入到Spring容器成为一个bean对象,因为一般来说,像springboot默认的包扫描路径为`xxxxxxApplication.java`所在包以及其所有子包,但是一些第三方的jar中的bean很明显不能被扫描到,此时该注解就派上了用场,当然,你可能会说,我使用`@ComponentScan`不就行了,这两个注解的区别是:`@ComponentScan`前提是你要的bean已经存在bean容器中了,而`@EnableConfigurationProperties`是要让容器自动去发现你要类并注册成为bean。也就是我们除了使用 Spring Boot 默认提供的配置信息之外,我们还可以通过配置文件指定配置信息。
- `ConditionalOnWebApplication:`这个注解的作用是自动配置类在 Web 应用中才生效。
- `ConditionalOnClass:`只有在存在`CharacterEncodingFilter`这个类的情况下自动配置类才会生效。
- `ConditionalOnProperty:`判断配置文件是否存在某个配置 spring.http.encoding ,如果存在其值为 enabled 才生效,如果不存在这个配置类也生效。
- `@ConditionalOnMissingBean: `仅在该注解规定的类不存在于 spring容器中时,使用该注解的config或者bean声明才会被实例化到容器中
可以发现后面几个注解都是`ConditionalXXXX`的命名规则,这些注解是 Spring 制定的条件注解,只有在符合条件的情况下自动配置类才会生效。
接下来的`characterEncodingFilter`方法,创建一个`CharacterEncodingFilter`的对象,也就是字符编码过滤器,同时设置相关属性,然后将对象返回,通过`@Bean`注解,将返回的对象添加到 Spring 容器中。这样字符编码过滤器组件配置好了,而平时的话,我们需要在 web.xml 进行如下配置:
```xml
<filter>
<filter-name>springUtf8Encoding</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>utf-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>springUtf8Encoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
```
到这里原理我们已经分析完了,下面我们动手自己封装一个类似上面的`spring-boot-starter-aop`
#### 封装一个Starter
**1,SpringBoot Starter开发规范**
- 1、命名使用`spring-boot-starter-xxx`,其中`xxx`是我们具体的包名称,如果集成`Spring Cloud`则使用`spring-cloud-starter-xxx`
- 2、通常需要准备两个`jar`文件,其中一个不包含任何代码,只用于负责引入相关以来的jar文件,另外一个则包含核心的代码
如`nacos`与Spring Cloud集成的starter如下图:
<img src="https://user-gold-cdn.xitu.io/2019/8/23/16cbea9d2ead5e22?imageView2/0/w/1280/h/960/format/webp/ignore-error/1" style="zoom:80%;" />
更多`Starter`制作规范,我们可以查看[官网文档](https://docs.spring.io/spring-boot/docs/2.1.0.RELEASE/reference/htmlsingle/#boot-features-custom-starter)
**2,Starter开发步骤**
我们创建一个名字为`okay-spring-boot-starter`的工程,并引入相关依赖:
```xml
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
<dependencyManagement>
<!-- 我们是基于Springboot的应用 -->
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.1.4.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
```
因为我们需要用到Springboot提供的相关注解,并且使用springboot提供的自动配置功能,我们不得不引入`spring-boot-autoconfigure`和`spring-boot-dependencies`两个依赖。
**3,创建自动配置类**
一般来说,我们可能想在springboot启动的时候就预先注入自己的一些bean,此时,我们要新建自己的自动配置类,一般采用`xxxxAutoConfiguration`。这里就类似于上面的`HttpEncodingAutoConfiguration`,下面我们模仿`HttpEncodingAutoConfiguration`新建一个`OkayStarterAutoConfiguration`配置类;
```java
@Configuration
@EnableConfigurationProperties(OkayProperties.class)
@ConditionalOnClass(Okay.class)
@ConditionalOnWebApplication
public class OkayStarterAutoConfiguration {
@Bean
@ConditionalOnMissingBean
/**
* 当存在okay.config.enable=true的配置时,这个Okay bean才生效
*/
@ConditionalOnProperty(prefix = "okay.config", name = "enable", havingValue = "true")
public Okay defaultStudent(OkayProperties okayProperties) {
Okay okay = new Okay();
okay.setPlatform(okayProperties.getPlatform());
okay.setChannel(okayProperties.getChannel());
okay.setEnable(okayProperties.getEnable());
return okay;
}
}
```
这里每个注解的含义上面已经解释过了,这里就不做过多的解释;
新建一个`OkayProperties`,声明该starter的使用者可以配置哪些配置项。
```java
@ConfigurationProperties(prefix = "okay.config")
public class OkayProperties {
private String platform;
private String channel;
private Boolean enable;
public String getPlatform() {
return platform;
}
public void setPlatform(String platform) {
this.platform = platform;
}
public String getChannel() {
return channel;
}
public void setChannel(String channel) {
this.channel = channel;
}
public Boolean getEnable() {
return enable;
}
public void setEnable(Boolean enable) {
this.enable = enable;
}
@Override
public String toString() {
return "OkayProperties{" +
"platform='" + platform + '\'' +
", channel='" + channel + '\'' +
", enable=" + enable +
'}';
}
}
```
在`resources`目录下新建一个`META-INF`目录并且创建一个`spring.factories`文件
```json
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
cn.haoxiaoyong.okay.starter.config.OkayStarterAutoConfiguration
```
到这里是不是和上面我们讲解的源码基本一致!
#### 使用我们自己的Starter
新创建一个springboot工程,引入我们自己maven依赖:
```xml
<dependency>
<groupId>cn.haoxiaoyong.okay</groupId>
<artifactId>okay-spring-boot-starter</artifactId>
<version>0.0.2-SNAPSHO</version>
</dependency>
```
并在配置文件appliaction.yml中配置

你看多智能还会自动提示!
```yml
okay:
config:
platform: pdd
channel: ws
enable: true
```
```java
@RestController
@Slf4j
public class OkController {
@Autowired
Okay okay;
@RequestMapping("okay")
public String testOkay() {
log.info(okay.getChannel() + " " + okay.getPlatform() + " " + okay.getEnable());
return okay.getChannel() + " " + okay.getPlatform() + " " + okay.getEnable();
}
}
```
浏览器输入:localhost:8082/okay,控制台打印:
<img src="https://upload-images.jianshu.io/upload_images/15181329-9defb376b159b72a.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="image.png" style="zoom:80%;" />
这个例子只是展示一下逻辑效果,这篇[使用自定义Starter 并制作一个简单的图床](https://juejin.im/post/5e84a2fa51882573793e6ae6)
================================================
FILE: okay-spring-boot-starter/pom.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<!-- <parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.4.RELEASE</version>
<relativePath/>
</parent>-->
<modelVersion>4.0.0</modelVersion>
<groupId>cn.haoxiaoyong.okay</groupId>
<artifactId>okay-spring-boot-starter</artifactId>
<version>0.0.2-SNAPSHO</version>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
<version>2.1.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
<dependencyManagement>
<!-- 我们是基于Springboot的应用 -->
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.1.4.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.1.4.RELEASE</version>
<configuration>
<!-- <mainClass>${start-class}</mainClass>-->
<layout>NONE</layout>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal><!--可以把依赖的包都打包到生成的Jar包中-->
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
================================================
FILE: okay-spring-boot-starter/src/main/java/cn/haoxiaoyong/okay/starter/annotation/EnableOkay.java
================================================
package cn.haoxiaoyong.okay.starter.annotation;
import cn.haoxiaoyong.okay.starter.config.OkayProperties;
import cn.haoxiaoyong.okay.starter.config.OkayStarterAutoConfiguration;
import cn.haoxiaoyong.okay.starter.model.Okay;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Import;
import java.lang.annotation.*;
/**
* @author haoxiaoyong on 2020/3/20 下午 4:05
* e-mail: hxyHelloWorld@163.com
* github: https://github.com/haoxiaoyong1014
* Blog: www.haoxiaoyong.cn
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@EnableConfigurationProperties(OkayProperties.class)
@ConditionalOnWebApplication
@Import(OkayStarterAutoConfiguration.class)
public @interface EnableOkay {
}
================================================
FILE: okay-spring-boot-starter/src/main/java/cn/haoxiaoyong/okay/starter/config/OkayProperties.java
================================================
package cn.haoxiaoyong.okay.starter.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* @author haoxiaoyong on 2020/3/20 上午 11:04
* e-mail: hxyHelloWorld@163.com
* github: https://github.com/haoxiaoyong1014
* Blog: www.haoxiaoyong.cn
*/
@ConfigurationProperties(prefix = "okay.config")
public class OkayProperties {
private String platform;
private String channel;
private Boolean enable;
public String getPlatform() {
return platform;
}
public void setPlatform(String platform) {
this.platform = platform;
}
public String getChannel() {
return channel;
}
public void setChannel(String channel) {
this.channel = channel;
}
public Boolean getEnable() {
return enable;
}
public void setEnable(Boolean enable) {
this.enable = enable;
}
@Override
public String toString() {
return "OkayProperties{" +
"platform='" + platform + '\'' +
", channel='" + channel + '\'' +
", enable=" + enable +
'}';
}
}
================================================
FILE: okay-spring-boot-starter/src/main/java/cn/haoxiaoyong/okay/starter/config/OkayStarterAutoConfiguration.java
================================================
package cn.haoxiaoyong.okay.starter.config;
import cn.haoxiaoyong.okay.starter.model.Okay;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @author haoxiaoyong on 2020/3/20 上午 10:48
* e-mail: hxyHelloWorld@163.com
* github: https://github.com/haoxiaoyong1014
* Blog: www.haoxiaoyong.cn
*/
@Configuration
@EnableConfigurationProperties(OkayProperties.class)
@ConditionalOnClass(Okay.class)
@ConditionalOnWebApplication
public class OkayStarterAutoConfiguration {
/**
* 当存在okay.config.enable=true的配置时,这个Okay bean才生效
*/
@Bean
@ConditionalOnMissingBean
@ConditionalOnProperty(prefix = "okay.config", name = "enable", havingValue = "true")
public Okay defaultStudent(OkayProperties okayProperties) {
Okay okay = new Okay();
okay.setPlatform(okayProperties.getPlatform());
okay.setChannel(okayProperties.getChannel());
okay.setEnable(okayProperties.getEnable());
return okay;
}
}
================================================
FILE: okay-spring-boot-starter/src/main/java/cn/haoxiaoyong/okay/starter/model/Okay.java
================================================
package cn.haoxiaoyong.okay.starter.model;
/**
* @author haoxiaoyong on 2020/3/20 下午 1:27
* e-mail: hxyHelloWorld@163.com
* github: https://github.com/haoxiaoyong1014
* Blog: www.haoxiaoyong.cn
*/
public class Okay {
private String platform;
private String channel;
private Boolean enable;
public String getPlatform() {
return platform;
}
public void setPlatform(String platform) {
this.platform = platform;
}
public String getChannel() {
return channel;
}
public void setChannel(String channel) {
this.channel = channel;
}
public Boolean getEnable() {
return enable;
}
public void setEnable(Boolean enable) {
this.enable = enable;
}
@Override
public String toString() {
return "Okay{" +
"platform='" + platform + '\'' +
", channel='" + channel + '\'' +
", enable=" + enable +
'}';
}
}
================================================
FILE: okay-spring-boot-starter/src/main/resources/META-INF/spring.factories
================================================
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
cn.haoxiaoyong.okay.starter.config.OkayStarterAutoConfiguration
================================================
FILE: pom.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.6.RELEASE</version>
<!--<relativePath/> -->
</parent>
<groupId>com.hxy</groupId>
<artifactId>springboot-examples</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<modules>
<module>springboot-rabbitmq</module>
<module>springboot-redis-docker</module>
<module>springboot-web-thymeleaf</module>
<module>springboot-oauth2-authorization-server</module>
<module>springboot-oauth2-resource-server</module>
<module>springboot-rabbitmq-ack</module>
<module>springboot-websocket</module>
<module>springboot2-redis</module>
<module>springboot-mybatis-myehcache</module>
<module>springboot-fastDFS</module>
<module>global-exception</module>
<module>springboot-mongodb</module>
<module>springboot-login-Interceptor</module>
<module>springboot-druid</module>
<module>springboot-easyexcel-encapsulation</module>
<module>springboot-idempotent</module>
<module>distributed-job</module>
<module>mybatis-plus-example</module>
<module>okay-spring-boot-starter</module>
<module>springboot-threadpool</module>
<module>springboot-swagger-enhance</module>
<module>springboot-admin-monitor</module>
<module>springboot-elk</module>
</modules>
</project>
================================================
FILE: springboot-admin-monitor/README.md
================================================
#### springBoot-admin 日志,系统监控
**springboot-admin-server**
```xml
<dependencies>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-server</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
</dependencies>
```
```yaml
spring:
application:
name: admin-server
security:
user:
name: admin
password: admin
server:
port: 8000
```
**springboot-admin-client**
```xml
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
```
```yaml
spring:
application:
name: admin-client
boot:
admin:
client:
url: http://localhost:8000
username: admin
password: admin
server:
port: 8001
management:
endpoints:
web:
exposure:
include: '*'
endpoint:
health:
show-details: ALWAYS
logging:
file: ./logs/admin-client.log #添加开启admin的日志监控
```
springboot-admin-client2和springboot-admin-client一样,只需要更改端口号,这里只是看下多个服务的效果
分别启动springboot-admin-server和两个client
输入:localhost:8000

输入账户admin 密码admin,也就是上面在yml文件中配置的username和password
打开Wallboard

打开springboot-admin-client

堆,栈,线程信息,以及内存使用情况

这里我们着重看下日志

到这里我们就看到了实时日志;
================================================
FILE: springboot-admin-monitor/pom.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.hxy</groupId>
<version>1.0-SNAPSHOT</version>
<artifactId>springboot-admin-monitor</artifactId>
<modules>
<module>springboot-admin-server</module>
<module>springboot-admin-client</module>
<module>springboot-admin-client2</module>
</modules>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.22</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Finchley.SR2</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project>
================================================
FILE: springboot-admin-monitor/springboot-admin-client/pom.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>springboot-admin-monitor</artifactId>
<groupId>com.hxy</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>springboot-admin-client</artifactId>
<dependencies>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
</dependencies>
</project>
================================================
FILE: springboot-admin-monitor/springboot-admin-client/src/main/java/cn/haoxiaoyong/sba/client/AdminClientApplication.java
================================================
package cn.haoxiaoyong.sba.client;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* @author haoxiaoyong
* @date created at 下午5:18 on 2020/9/7
* @github https://github.com/haoxiaoyong1014
* @blog www.haoxiaoyong.cn
*/
@SpringBootApplication
public class AdminClientApplication {
public static void main(String[] args) {
SpringApplication.run(AdminClientApplication.class, args);
}
}
================================================
FILE: springboot-admin-monitor/springboot-admin-client/src/main/java/cn/haoxiaoyong/sba/client/controller/UserController.java
================================================
package cn.haoxiaoyong.sba.client.controller;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author haoxiaoyong
* @date created at 下午6:48 on 2020/9/8
* @github https://github.com/haoxiaoyong1014
* @blog www.haoxiaoyong.cn
*/
@RestController
@Slf4j
public class UserController {
@RequestMapping("sba")
public String testSba(String params) {
log.info("接口入参 {}", params);
params = "Hello World";
log.error("error message {}", params);
return params;
}
}
================================================
FILE: springboot-admin-monitor/springboot-admin-client/src/main/resources/application.yml
================================================
spring:
application:
name: admin-client
boot:
admin:
client:
url: http://localhost:8000
username: admin
password: admin
server:
port: 8001
management:
endpoints:
web:
exposure:
include: '*'
endpoint:
health:
show-details: ALWAYS
logging:
file: ./logs/admin-client.log #添加开启admin的日志监控
================================================
FILE: springboot-admin-monitor/springboot-admin-client2/pom.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>springboot-admin-monitor</artifactId>
<groupId>com.hxy</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>springboot-admin-client2</artifactId>
<dependencies>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
</dependencies>
</project>
================================================
FILE: springboot-admin-monitor/springboot-admin-client2/src/main/java/cn/haoxiaoyong/sba/client/AdminClientApplication.java
================================================
package cn.haoxiaoyong.sba.client;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* @author haoxiaoyong
* @date created at 下午5:18 on 2020/9/7
* @github https://github.com/haoxiaoyong1014
* @blog www.haoxiaoyong.cn
*/
@SpringBootApplication
public class AdminClientApplication {
public static void main(String[] args) {
SpringApplication.run(AdminClientApplication.class, args);
}
}
================================================
FILE: springboot-admin-monitor/springboot-admin-client2/src/main/java/cn/haoxiaoyong/sba/client/controller/UserController.java
================================================
package cn.haoxiaoyong.sba.client.controller;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author haoxiaoyong
* @date created at 下午6:48 on 2020/9/8
* @github https://github.com/haoxiaoyong1014
* @blog www.haoxiaoyong.cn
*/
@RestController
@Slf4j
public class UserController {
@RequestMapping("sba")
public String testSba(String params) {
log.info("接口入参 {}", params);
params = "Hello World";
log.error("error message {}", params);
int i = 1 / 0;
return params;
}
}
================================================
FILE: springboot-admin-monitor/springboot-admin-client2/src/main/resources/application.yml
================================================
spring:
application:
name: admin-client2
boot:
admin:
client:
url: http://localhost:8000
username: admin
password: admin
server:
port: 8003
management:
endpoints:
web:
exposure:
include: '*'
endpoint:
health:
show-details: ALWAYS
logging:
file: ./logs/admin-client2.log #添加开启admin的日志监控
================================================
FILE: springboot-admin-monitor/springboot-admin-server/pom.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>springboot-admin-monitor</artifactId>
<groupId>com.hxy</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>springboot-admin-server</artifactId>
<dependencies>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-server</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
</dependencies>
</project>
================================================
FILE: springboot-admin-monitor/springboot-admin-server/src/main/java/cn/haoxiaoyong/sba/server/AdminServerApplication.java
================================================
package cn.haoxiaoyong.sba.server;
import de.codecentric.boot.admin.server.config.EnableAdminServer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* @author haoxiaoyong
* @date created at 下午5:18 on 2020/9/7
* @github https://github.com/haoxiaoyong1014
* @blog www.haoxiaoyong.cn
*/
@SpringBootApplication
@EnableAdminServer
public class AdminServerApplication {
public static void main(String[] args) {
SpringApplication.run(AdminServerApplication.class, args);
}
}
================================================
FILE: springboot-admin-monitor/springboot-admin-server/src/main/java/cn/haoxiaoyong/sba/server/config/SecuritySecureConfig.java
================================================
package cn.haoxiaoyong.sba.server.config;
import de.codecentric.boot.admin.server.config.AdminServerProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;
import org.springframework.security.web.csrf.CookieCsrfTokenRepository;
/**
* @author haoxiaoyong
* @date created at 下午7:04 on 2020/9/8
* @github https://github.com/haoxiaoyong1014
* @blog www.haoxiaoyong.cn
*/
@Configuration
public class SecuritySecureConfig extends WebSecurityConfigurerAdapter {
private final String adminContextPath;
public SecuritySecureConfig(AdminServerProperties adminServerProperties) {
this.adminContextPath = adminServerProperties.getContextPath();
}
@Override
protected void configure(HttpSecurity http) throws Exception {
SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler();
successHandler.setTargetUrlParameter("redirectTo");
successHandler.setDefaultTargetUrl(adminContextPath + "/");
http.authorizeRequests()
//1.配置所有静态资源和登录页可以公开访问
.antMatchers(adminContextPath + "/assets/**").permitAll()
.antMatchers(adminContextPath + "/login").permitAll()
.anyRequest().authenticated()
.and()
//2.配置登录和登出路径
.formLogin().loginPage(adminContextPath + "/login").successHandler(successHandler).and()
.logout().logoutUrl(adminContextPath + "/logout").and()
//3.开启http basic支持,admin-client注册时需要使用
.httpBasic().and()
.csrf()
//4.开启基于cookie的csrf保护
.csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse())
//5.忽略这些路径的csrf保护以便admin-client注册
.ignoringAntMatchers(
adminContextPath + "/instances",
adminContextPath + "/actuator/**"
);
}
}
================================================
FILE: springboot-admin-monitor/springboot-admin-server/src/main/resources/application.yml
================================================
spring:
application:
name: admin-server
security:
user:
name: admin
password: admin
server:
port: 8000
================================================
FILE: springboot-druid/README.md
================================================
#### 使用阿里巴巴提供的springboot整合druid包管理连接池
**引入依赖:**
```xml
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.9</version>
</dependency>
```
**数据源配置:**
```yml
## 数据源配置
#spring.datasource.url=jdbc:mysql://localhost:3306/springboot?useUnicode=true&characterEncoding=utf-8&useSSL=false
#spring.datasource.username=root
#spring.datasource.password=root
#spring.datasource.driver-class-name=com.mysql.jdbc.Driver
# 这4个参数key里不带druid也可以,即可以还用上面的这个4个参数
spring.datasource.druid.url=jdbc:mysql://localhost:3306/springboot?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.druid.username=root
spring.datasource.druid.password=root
spring.datasource.druid.driver-class-name=com.mysql.jdbc.Driver
# 初始化时建立物理连接的个数
spring.datasource.druid.initial-size=5
# 最大连接池数量
spring.datasource.druid.max-active=30
# 最小连接池数量
spring.datasource.druid.min-idle=5
# 获取连接时最大等待时间,单位毫秒
spring.datasource.druid.max-wait=60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
spring.datasource.druid.time-between-eviction-runs-millis=60000
# 连接保持空闲而不被驱逐的最小时间
spring.datasource.druid.min-evictable-idle-time-millis=300000
# 用来检测连接是否有效的sql,要求是一个查询语句
spring.datasource.druid.validation-query=SELECT 1 FROM DUAL
# 建议配置为true,不影响性能,并且保证安全性。申请连接的时候检测,如果空闲时间大于timeBetweenEvictionRunsMillis,执行validationQuery检测连接是否有效。
spring.datasource.druid.test-while-idle=true
# 申请连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。
spring.datasource.druid.test-on-borrow=false
# 归还连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。
spring.datasource.druid.test-on-return=false
# 是否缓存preparedStatement,也就是PSCache。PSCache对支持游标的数据库性能提升巨大,比如说oracle。在mysql下建议关闭。
spring.datasource.druid.pool-prepared-statements=true
# 要启用PSCache,必须配置大于0,当大于0时,poolPreparedStatements自动触发修改为true。
spring.datasource.druid.max-pool-prepared-statement-per-connection-size=50
# 配置监控统计拦截的filters,去掉后监控界面sql无法统计
spring.datasource.druid.filters=stat,wall
# 通过connectProperties属性来打开mergeSql功能;慢SQL记录
spring.datasource.druid.connection-properties=druid.stat.mergeSql=true;druid.stat.slowSqlMillis=500
# 合并多个DruidDataSource的监控数据
spring.datasource.druid.use-global-data-source-stat=true
```
**测试:**
启动服务,浏览器输入http://localhost:8091/users ,界面如下:

浏览器输入http://localhost:8091/druid ,界面如下:

**druid监控**
在步骤四我们可以看到,浏览器输入http://localhost:8091/druid直接就能看到druid控制台界面,
在这里面可以看到很多项目信息,如果任凭用户随意访问,非常危险。我们可以通过配置,设置只有通过登录认证才可以访问。
在application.properties配置文件中增加:
```yml
# druid连接池监控
spring.datasource.druid.stat-view-servlet.login-username=admin
spring.datasource.druid.stat-view-servlet.login-password=123
# 排除一些静态资源,以提高效率
spring.datasource.druid.web-stat-filter.exclusions=*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*
```
只需要配置用户名和密码,重启服务器后再次访问就需要登录才能访问。浏览器输入http://localhost:8091/druid ,界面如下:

输入刚才配置文件里配置的用户名admin和密码123,登录之后便可以正常访问了。
================================================
FILE: springboot-druid/pom.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>spring-boot-druid</artifactId>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<!-- Spring Boot web启动器 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- mybatis -->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.2</version>
</dependency>
<!-- mysql -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- druid -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.9</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
================================================
FILE: springboot-druid/src/main/java/cn/haoxiaoyong/druid/DruidApplication.java
================================================
package cn.haoxiaoyong.druid;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* Created by Haoxy on 2019-06-25.
* E-mail:hxyHelloWorld@163.com
* github:https://github.com/haoxiaoyong1014
*/
@SpringBootApplication
@MapperScan("cn.haoxiaoyong.druid.mapper")
public class DruidApplication {
public static void main(String[] args) {
SpringApplication.run(DruidApplication.class, args);
}
}
================================================
FILE: springboot-druid/src/main/java/cn/haoxiaoyong/druid/controller/UserController.java
================================================
package cn.haoxiaoyong.druid.controller;
import cn.haoxiaoyong.druid.entity.User;
import cn.haoxiaoyong.druid.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* Created by Haoxy on 2019-06-25.
* E-mail:hxyHelloWorld@163.com
* github:https://github.com/haoxiaoyong1014
*/
@RestController
public class UserController {
@Autowired
private UserService userService;
@GetMapping("/users")
public List<User> lists() {
return userService.getUsers();
}
}
================================================
FILE: springboot-druid/src/main/java/cn/haoxiaoyong/druid/entity/User.java
================================================
package cn.haoxiaoyong.druid.entity;
/**
* Created by Haoxy on 2019-06-25.
* E-mail:hxyHelloWorld@163.com
* github:https://github.com/haoxiaoyong1014
*/
public class User {
private Long userId;
private String userName;
private Integer userAge;
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public Integer getUserAge() {
return userAge;
}
public void setUserAge(Integer userAge) {
this.userAge = userAge;
}
}
================================================
FILE: springboot-druid/src/main/java/cn/haoxiaoyong/druid/mapper/UserMapper.java
================================================
package cn.haoxiaoyong.druid.mapper;
import cn.haoxiaoyong.druid.entity.User;
import java.util.List;
/**
* Created by Haoxy on 2019-06-25.
* E-mail:hxyHelloWorld@163.com
* github:https://github.com/haoxiaoyong1014
*/
public interface UserMapper {
List<User> getUsers();
}
================================================
FILE: springboot-druid/src/main/java/cn/haoxiaoyong/druid/service/UserService.java
================================================
package cn.haoxiaoyong.druid.service;
import cn.haoxiaoyong.druid.entity.User;
import cn.haoxiaoyong.druid.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Created by Haoxy on 2019-06-25.
* E-mail:hxyHelloWorld@163.com
* github:https://github.com/haoxiaoyong1014
*/
@Service
public class UserService {
@Autowired
private UserMapper userMapper;
public List<User> getUsers() {
return userMapper.getUsers();
}
}
================================================
FILE: springboot-druid/src/main/resources/application.properties
================================================
server.port=8091
## 数据源配置
#spring.datasource.url=jdbc:mysql://localhost:3306/springboot_druid?useUnicode=true&characterEncoding=utf-8&useSSL=false
#spring.datasource.username=root
#spring.datasource.password=yong1014
#spring.datasource.driver-class-name=com.mysql.jdbc.Driver
# 这4个参数key里不带druid也可以,即可以还用上面的这个4个参数
spring.datasource.druid.url=jdbc:mysql://localhost:3306/springboot_druid?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.druid.username=root
spring.datasource.druid.password=yong1014
spring.datasource.druid.driver-class-name=com.mysql.jdbc.Driver
# 初始化时建立物理连接的个数
spring.datasource.druid.initial-size=5
# 最大连接池数量
spring.datasource.druid.max-active=30
# 最小连接池数量
spring.datasource.druid.min-idle=5
# 获取连接时最大等待时间,单位毫秒
spring.datasource.druid.max-wait=60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
spring.datasource.druid.time-between-eviction-runs-millis=60000
# 连接保持空闲而不被驱逐的最小时间
spring.datasource.druid.min-evictable-idle-time-millis=300000
# 用来检测连接是否有效的sql,要求是一个查询语句
spring.datasource.druid.validation-query=SELECT 1 FROM DUAL
# 建议配置为true,不影响性能,并且保证安全性。申请连接的时候检测,如果空闲时间大于timeBetweenEvictionRunsMillis,执行validationQuery检测连接是否有效。
spring.datasource.druid.test-while-idle=true
# 申请连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。
spring.datasource.druid.test-on-borrow=false
# 归还连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。
spring.datasource.druid.test-on-return=false
# 是否缓存preparedStatement,也就是PSCache。PSCache对支持游标的数据库性能提升巨大,比如说oracle。在mysql下建议关闭。
spring.datasource.druid.pool-prepared-statements=true
# 要启用PSCache,必须配置大于0,当大于0时,poolPreparedStatements自动触发修改为true。
spring.datasource.druid.max-pool-prepared-statement-per-connection-size=50
# 配置监控统计拦截的filters,去掉后监控界面sql无法统计
spring.datasource.druid.filters=stat,wall
# 通过connectProperties属性来打开mergeSql功能;慢SQL记录
spring.datasource.druid.connection-properties=druid.stat.mergeSql=true;druid.stat.slowSqlMillis=500
# 合并多个DruidDataSource的监控数据
spring.datasource.druid.use-global-data-source-stat=true
#配置慢查询
spring.datasource.druid.filter.stat.slow-sql-millis=200
spring.datasource.druid.filter.stat.log-slow-sql=true
#spring.datasource.druid.filter.slf4j.data-source-log-enabled=true
spring.datasource.druid.filter.log4j.data-source-log-enabled=true
spring.datasource.druid.filter.log4j.statement-executable-sql-log-enable=true
# mybatis
mybatis.type-aliases-package=cn.haoxiaoyong.druid.entity
mybatis.mapper-locations=classpath:mapper/*.xml
mybatis.configuration.map-underscore-to-camel-case=true
# druid连接池监控
spring.datasource.druid.stat-view-servlet.login-username=admin
spring.datasource.druid.stat-view-servlet.login-password=123
# 排除一些静态资源,以提高效率
spring.datasource.druid.web-stat-filter.exclusions=*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*
================================================
FILE: springboot-druid/src/main/resources/mapper/UserMapper.xml
================================================
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="cn.haoxiaoyong.druid.mapper.UserMapper">
<select id="getUsers" resultType="User">
SELECT * FROM tbl_user
</select>
</mapper>
================================================
FILE: springboot-easyexcel-encapsulation/README.md
================================================
# springboot-easyexcel-encapsulation
easyexcel 项目地址 :https://github.com/alibaba/easyexcel
#### 对 easyexcel 进行了方法的封装,可以做到一个函数完成简单的读取和导出
#### 原项目目前仍存在一些BUG:
- ~~XLSX 类型的 EXCEL 在读取的时候,序号为 1 的 sheet 为最后一个 sheet(即 sheet 的顺序为倒序);~~
~~XLS 类型的 EXCEL 在读取的时候,序号为 1 的 sheet 为第一个 sheet(即 sheet 的顺序为顺序);~~
- ~~将导出类型为 XLSX 的 excel 导入时,会报错~~
~~而将导出类型为 XLS 的 excel 导入时,则不会~~
#### 目前 easyexcel 版本已经更新至 1.0.2,修复了一些 BUG
---
# 一. 依赖
首先是添加该项目的依赖,目前的版本是 1.0.2
```
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>1.0.2</version>
</dependency>
```
# 二. 需要的类

## 1. ExcelUtil
工具类,可以直接调用该工具类的方法完成 Excel 的读或者写
## 2. ExcelListener
监听类,可以根据需要,自定义处理获取到的数据
```
public class ExcelListener extends AnalysisEventListener {
//自定义用于暂时存储data。
//可以通过实例获取该值
private List<Object> datas = new ArrayList<>();
/**
* 通过 AnalysisContext 对象还可以获取当前 sheet,当前行等数据
*/
@Override
public void invoke(Object object, AnalysisContext context) {
//数据存储到list,供批量处理,或后续自己业务逻辑处理。
datas.add(object);
//根据自己业务做处理
doSomething(object);
}
private void doSomething(Object object) {
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
/*
datas.clear();
解析结束销毁不用的资源
*/
}
public List<Object> getDatas() {
return datas;
}
public void setDatas(List<Object> datas) {
this.datas = datas;
}
}
```
## 3. ExcelWriterFactroy
用于导出多个 sheet 的 Excel,通过多次调用 write 方法写入多个 sheet
## 4. ExcelException
捕获相关 Exception
# 三. 读取 Excel
读取 Excel 时只需要调用 ```ExcelUtil.readExcel()``` 方法
```
@RequestMapping(value = "readExcel", method = RequestMethod.POST)
public Object readExcel(MultipartFile excel) {
return ExcelUtil.readExcel(excel, new ImportInfo());
}
```
其中 excel 是 MultipartFile 类型的文件对象,而 new ImportInfo() 是该 Excel 所映射的实体对象,需要继承 **BaseRowModel** 类,如:
```
public class ImportInfo extends BaseRowModel {
@ExcelProperty(index = 0)
private String name;
@ExcelProperty(index = 1)
private String age;
@ExcelProperty(index = 2)
private String email;
/*
作为 excel 的模型映射,需要 setter 方法
*/
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAge() {
return age;
}
public void setAge(String age) {
this.age = age;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
}
```
作为映射实体类,通过 @ExcelProperty 注解与 index 变量可以标注成员变量所映射的列,同时不可缺少 setter 方法
# 四. 导出 Excel
### 1. 导出的 Excel 只拥有一个 sheet
只需要调用 ```ExcelUtil.writeExcelWithSheets()``` 方法:
```
@RequestMapping(value = "writeExcel", method = RequestMethod.GET)
public void writeExcel(HttpServletResponse response) throws IOException {
List<ExportInfo> list = getList();
String fileName = "一个 Excel 文件";
String sheetName = "第一个 sheet";
ExcelUtil.writeExcelWithSheets(response, list, fileName, sheetName, new ExportInfo());
}
```
fileName,sheetName 分别是导出文件的文件名和 sheet 名,new ExportInfo() 为导出数据的映射实体对象,list 为导出数据。
对于映射实体类,可以根据需要通过 @ExcelProperty 注解自定义表头,当然同样需要继承 BaseRowModel 类,如:
```
public class ExportInfo extends BaseRowModel {
@ExcelProperty(value = "姓名" ,index = 0)
private String name;
@ExcelProperty(value = "年龄",index = 1)
private String age;
@ExcelProperty(value = "邮箱",index = 2)
private String email;
@ExcelProperty(value = "地址",index = 3)
private String address;
}
```
value 为列名,index 为列的序号
如果需要复杂一点,可以实现如下图的效果:

对应的实体类写法如下:
```
public class MultiLineHeadExcelModel extends BaseRowModel {
@ExcelProperty(value = {"表头1","表头1","表头31"},index = 0)
private String p1;
@ExcelProperty(value = {"表头1","表头1","表头32"},index = 1)
private String p2;
@ExcelProperty(value = {"表头3","表头3","表头3"},index = 2)
private int p3;
@ExcelProperty(value = {"表头4","表头4","表头4"},index = 3)
private long p4;
@ExcelProperty(value = {"表头5","表头51","表头52"},index = 4)
private String p5;
@ExcelProperty(value = {"表头6","表头61","表头611"},index = 5)
private String p6;
@ExcelProperty(value = {"表头6","表头61","表头612"},index = 6)
private String p7;
@ExcelProperty(value = {"表头6","表头62","表头621"},index = 7)
private String p8;
@ExcelProperty(value = {"表头6","表头62","表头622"},index = 8)
private String p9;
}
```
### 2. 导出的 Excel 拥有多个 sheet
调用 ```ExcelUtil.writeExcelWithSheets()``` 处理第一个 sheet,之后调用 ```write()``` 方法依次处理之后的 sheet,最后使用 ```finish()``` 方法结束
```
public void writeExcelWithSheets(HttpServletResponse response) throws IOException {
List<ExportInfo> list = getList();
String fileName = "一个 Excel 文件";
String sheetName1 = "第一个 sheet";
String sheetName2 = "第二个 sheet";
String sheetName3 = "第三个 sheet";
ExcelUtil.writeExcelWithSheets(response, list, fileName, sheetName1, new ExportInfo())
.write(list, sheetName2, new ExportInfo())
.write(list, sheetName3, new ExportInfo())
.finish();
}
```
write 方法的参数为当前 sheet 的 list 数据,当前 sheet 名以及对应的映射类
**注意:**
1,在测试导出方法时,不要使用postman测试,尽量再浏览器中输入;
2,easyexcel好像是跟 springboot-admin 有些冲突,在生成环境中使用时,我们的项目使用了springboot-admin,在导出时浏览器会打印很多乱码;去掉 springboot-admin
需要一些依赖又可以直接下载;如果两者都想继续保留,就要将文件上传到文件服务器然后下载;
在`ExcelUtil`类中的`writeExcel`方法:
```java
File dbfFile = new File(filePath);
if (!dbfFile.exists() || dbfFile.isDirectory()) {
dbfFile.createNewFile();
}
```
去掉注释,
将下面这个这句改为:
`OutputStream out = response.getOutputStream();`
改为:
`OutputStream outputStream=new FileOutputStream(dbfFile);`
================================================
FILE: springboot-easyexcel-encapsulation/pom.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>springboot-examples</artifactId>
<groupId>com.hxy</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>springboot-easyexcel-encapsulation</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>1.0.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
================================================
FILE: springboot-easyexcel-encapsulation/src/main/java/cn/haoxy/easyexcel/EasyexcelMethodEncapsulationApplication.java
================================================
package cn.haoxy.easyexcel;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* @author Haoxy
* Created in 2019-08-02.
* E-mail:hxyHelloWorld@163.com
* github:https://github.com/haoxiaoyong1014
*/
@SpringBootApplication
public class EasyexcelMethodEncapsulationApplication {
public static void main(String[] args) {
SpringApplication.run(EasyexcelMethodEncapsulationApplication.class, args);
}
}
================================================
FILE: springboot-easyexcel-encapsulation/src/main/java/cn/haoxy/easyexcel/controller/ExcelController.java
================================================
package cn.haoxy.easyexcel.controller;
import cn.haoxy.easyexcel.excel.ExcelUtil;
import cn.haoxy.easyexcel.model.ExportInfo;
import cn.haoxy.easyexcel.model.ImportInfo;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
* @author Haoxy
* Created in 2019-08-02.
* E-mail:hxyHelloWorld@163.com
* github:https://github.com/haoxiaoyong1014
*/
@RestController
public class ExcelController {
/**
* 读取 Excel(允许多个 sheet)
*/
@RequestMapping(value = "readExcel", method = RequestMethod.POST)
public Object readExcel(MultipartFile excel) {
return ExcelUtil.readExcel(excel, new ImportInfo());
}
/**
* 导出 Excel(一个 sheet)
*/
@RequestMapping(value = "writeExcel", method = RequestMethod.GET)
public void writeExcel(HttpServletResponse response) throws IOException {
List<ExportInfo> list = getList();
String fileName = "一个 Excel 文件";
String sheetName = "第一个 sheet";
ExcelUtil.writeExcel(response, list, fileName, sheetName, new ExportInfo());
}
/**
* 导出 Excel(多个 sheet)
*/
@RequestMapping(value = "writeExcelWithSheets", method = RequestMethod.GET)
public void writeExcelWithSheets(HttpServletResponse response) throws IOException {
List<ExportInfo> list = getList();
String fileName = "一个 Excel 文件";
String sheetName1 = "第一个 sheet";
String sheetName2 = "第二个 sheet";
String sheetName3 = "第三个 sheet";
ExcelUtil.writeExcelWithSheets(response, list, fileName, sheetName1, new ExportInfo())
.write(list, sheetName2, new ExportInfo())
.write(list, sheetName3, new ExportInfo())
.finish();
}
private List<ExportInfo> getList() {
List<ExportInfo> list = new ArrayList<>();
ExportInfo model1 = new ExportInfo();
model1.setName("haoxy");
model1.setAge("19");
model1.setAddress("123456789");
model1.setEmail("123456789@gmail.com");
list.add(model1);
ExportInfo model2 = new ExportInfo();
model2.setName("haoxy1");
model2.setAge("20");
model2.setAddress("1104536510");
model2.setEmail("1104536510@gmail.com");
list.add(model2);
return list;
}
}
================================================
FILE: springboot-easyexcel-encapsulation/src/main/java/cn/haoxy/easyexcel/excel/ExcelException.java
================================================
package cn.haoxy.easyexcel.excel;
/**
* @author Haoxy
* Created in 2019-08-02.
* E-mail:hxyHelloWorld@163.com
* github:https://github.com/haoxiaoyong1014
*/
public class ExcelException extends RuntimeException {
public ExcelException(String message) {
super(message);
}
}
================================================
FILE: springboot-easyexcel-encapsulation/src/main/java/cn/haoxy/easyexcel/excel/ExcelListener.java
================================================
package cn.haoxy.easyexcel.excel;
import com.alibaba.excel.read.context.AnalysisContext;
import com.alibaba.excel.read.event.AnalysisEventListener;
import java.util.ArrayList;
import java.util.List;
/**
* @author Haoxy
* Created in 2019-08-02.
* E-mail:hxyHelloWorld@163.com
* github:https://github.com/haoxiaoyong1014
*/
public class ExcelListener extends AnalysisEventListener {
//自定义用于暂时存储data。
//可以通过实例获取该值
private List<Object> datas = new ArrayList<>();
/**
* 通过 AnalysisContext 对象还可以获取当前 sheet,当前行等数据
*/
@Override
public void invoke(Object object, AnalysisContext context) {
//数据存储到list,供批量处理,或后续自己业务逻辑处理。
datas.add(object);
//根据自己业务做处理
doSomething(object);
}
private void doSomething(Object object) {
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
/*
datas.clear();
解析结束销毁不用的资源
*/
}
public List<Object> getDatas() {
return datas;
}
public void setDatas(List<Object> datas) {
this.datas = datas;
}
}
================================================
FILE: springboot-easyexcel-encapsulation/src/main/java/cn/haoxy/easyexcel/excel/ExcelUtil.java
================================================
package cn.haoxy.easyexcel.excel;
import com.alibaba.excel.ExcelReader;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.metadata.BaseRowModel;
import com.alibaba.excel.metadata.Font;
import com.alibaba.excel.metadata.Sheet;
import com.alibaba.excel.metadata.TableStyle;
import com.alibaba.excel.support.ExcelTypeEnum;
import org.apache.poi.ss.usermodel.IndexedColors;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.List;
/**
* @author Haoxy
* Created in 2019-08-02.
* E-mail:hxyHelloWorld@163.com
* github:https://github.com/haoxiaoyong1014
*/
public class ExcelUtil {
/**
* 读取 Excel(多个 sheet)
*
* @param excel 文件
* @param object 实体类映射,继承 BaseRowModel 类
* @return Excel 数据 list
*/
public static List<Object> readExcel(MultipartFile excel, BaseRowModel object) {
ExcelListener excelListener = new ExcelListener();
ExcelReader reader = getReader(excel, excelListener);
if (reader == null) {
return null;
}
for (Sheet sheet : reader.getSheets()) {
if (object != null) {
sheet.setClazz(object.getClass());
}
reader.read(sheet);
}
return excelListener.getDatas();
}
/**
* 读取某个 sheet 的 Excel
*
* @param excel 文件
* @param object 实体类映射,继承 BaseRowModel 类
* @param sheetNo sheet 的序号
* 当前版本中:
* XLS 类型文件 sheet 序号为顺序,第一个 sheet 序号为 1
* XLSX 类型 sheet 序号顺序为倒序,即最后一个 sheet 序号为 1
* @return Excel 数据 list
*/
public static List<Object> readExcel(MultipartFile excel, BaseRowModel object, int sheetNo) {
ExcelListener excelListener = new ExcelListener();
ExcelReader reader = getReader(excel, excelListener);
if (reader == null) {
return null;
}
Sheet sheet = new Sheet(sheetNo);
sheet.setClazz(object.getClass());
reader.read(sheet);
return excelListener.getDatas();
}
/**
* 导出 Excel :一个 sheet,带表头
*
* @param response HttpServletResponse
* @param list 数据 list,每个元素为一个 BaseRowModel
* @param fileName 导出的文件名
* @param sheetName 导入文件的 sheet 名
* @param object 映射实体类,Excel 模型
*/
public static void writeExcel(HttpServletResponse response, List<? extends BaseRowModel> list,
String fileName, String sheetName, BaseRowModel object) throws IOException {
//创建本地文件
String filePath = fileName + ".xlsx";
//这里不需要创建文件,在浏览器输入项目地址会直接下载
/*File dbfFile = new File(filePath);
if (!dbfFile.exists() || dbfFile.isDirectory()) {
dbfFile.createNewFile();
}*/
fileName = new String(filePath.getBytes(), "ISO-8859-1");
response.addHeader("Content-Disposition", "filename=" + fileName);
OutputStream out = response.getOutputStream();
try {
ExcelWriter writer = new ExcelWriter(out, ExcelTypeEnum.XLSX);
Sheet sheet = new Sheet(1, 0, object.getClass());
sheet.setSheetName(sheetName);
TableStyle tableStyle=new TableStyle();
/*tableStyle.setTableHeadBackGroundColor(IndexedColors.BLUE);*/
tableStyle.setTableContentBackGroundColor(IndexedColors.WHITE);
//如果不需要设置字体或字体大小,就注释掉
/*Font font = new Font();
font.setFontName("宋体");
font.setFontHeightInPoints((short) 9);
tableStyle.setTableContentFont(font);*/
sheet.setTableStyle(tableStyle);
writer.write(list, sheet);
writer.finish();
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
/**
* 导出 Excel :多个 sheet,带表头
*
* @param response HttpServletResponse
* @param list 数据 list,每个元素为一个 BaseRowModel
* @param fileName 导出的文件名
* @param sheetName 导入文件的 sheet 名
* @param object 映射实体类,Excel 模型
*/
public static ExcelWriterFactroy writeExcelWithSheets(HttpServletResponse response, List<? extends BaseRowModel> list,
String fileName, String sheetName, BaseRowModel object) throws IOException {
//创建本地文件
String filePath = fileName + ".xlsx";
File dbfFile = new File(filePath);
if (!dbfFile.exists() || dbfFile.isDirectory()) {
dbfFile.createNewFile();
}
fileName = new String(filePath.getBytes(), "ISO-8859-1");
response.addHeader("Content-Disposition", "filename=" + fileName);
OutputStream out = response.getOutputStream();
ExcelWriterFactroy writer = new ExcelWriterFactroy(out, ExcelTypeEnum.XLSX
);
try {
Sheet sheet = new Sheet(1, 0, object.getClass());
sheet.setSheetName(sheetName);
writer.write(list, sheet);
return writer;
} catch (Exception e) {
e.printStackTrace();
try {
out.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
return writer;
}
/**
* 返回 ExcelReader
*
* @param excel 需要解析的 Excel 文件
* @param excelListener new ExcelListener()
*/
private static ExcelReader getReader(MultipartFile excel,
ExcelListener excelListener) {
String filename = excel.getOriginalFilename();
if (filename == null || (!filename.toLowerCase().endsWith(".xls") && !filename.toLowerCase().endsWith(".xlsx"))) {
throw new ExcelException("文件格式错误!");
}
ExcelTypeEnum excelTypeEnum = ExcelTypeEnum.XLSX;
if (filename.toLowerCase().endsWith(".xls")) {
excelTypeEnum = ExcelTypeEnum.XLS;
}
InputStream inputStream;
try {
inputStream = excel.getInputStream();
return new ExcelReader(inputStream, excelTypeEnum,
null, excelListener);
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
}
================================================
FILE: springboot-easyexcel-encapsulation/src/main/java/cn/haoxy/easyexcel/excel/ExcelWriterFactroy.java
================================================
package cn.haoxy.easyexcel.excel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.metadata.BaseRowModel;
import com.alibaba.excel.metadata.Sheet;
import com.alibaba.excel.support.ExcelTypeEnum;
import java.io.IOException;
import java.io.OutputStream;
import java.util.List;
/**
* @author Haoxy
* Created in 2019-08-02.
* E-mail:hxyHelloWorld@163.com
* github:https://github.com/haoxiaoyong1014
*/
public class ExcelWriterFactroy extends ExcelWriter {
private OutputStream outputStream;
private int sheetNo = 1;
public ExcelWriterFactroy(OutputStream outputStream, ExcelTypeEnum typeEnum) {
super(outputStream, typeEnum);
this.outputStream = outputStream;
}
public ExcelWriterFactroy write(List<? extends BaseRowModel> list, String sheetName,
BaseRowModel object) {
this.sheetNo++;
try {
Sheet sheet = new Sheet(sheetNo, 0, object.getClass());
sheet.setSheetName(sheetName);
this.write(list, sheet);
} catch (Exception ex) {
ex.printStackTrace();
try {
outputStream.flush();
} catch (IOException e) {
e.printStackTrace();
}
}
return this;
}
@Override
public void finish() {
super.finish();
try {
outputStream.flush();
} catch (IOException e) {
e.printStackTrace();
}
}
}
================================================
FILE: springboot-easyexcel-encapsulation/src/main/java/cn/haoxy/easyexcel/model/ExportInfo.java
================================================
package cn.haoxy.easyexcel.model;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.metadata.BaseRowModel;
/**
* @author Haoxy
* Created in 2019-08-02.
* E-mail:hxyHelloWorld@163.com
* github:https://github.com/haoxiaoyong1014
* 导出 Excel 时使用的映射实体类,Excel 模型
*/
public class ExportInfo extends BaseRowModel {
@ExcelProperty(value = "姓名" ,index = 0)
private String name;
@ExcelProperty(value = "年龄",index = 1)
private String age;
@ExcelProperty(value = "邮箱",index = 2)
private String email;
@ExcelProperty(value = "地址",index = 3)
private String address;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAge() {
return age;
}
public void setAge(String age) {
this.age = age;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
}
================================================
FILE: springboot-easyexcel-encapsulation/src/main/java/cn/haoxy/easyexcel/model/ImportInfo.java
================================================
package cn.haoxy.easyexcel.model;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.metadata.BaseRowModel;
/**
* @author Haoxy
* Created in 2019-08-02.
* E-mail:hxyHelloWorld@163.com
* github:https://github.com/haoxiaoyong1014
* 导入 Excel 时使用的映射实体类,Excel 模型
*/
public class ImportInfo extends BaseRowModel {
@ExcelProperty(index = 0)
private String name;
@ExcelProperty(index = 1)
private String age;
@ExcelProperty(index = 2)
private String email;
/*
作为 excel 的模型映射,需要 setter 方法
*/
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAge() {
return age;
}
public void setAge(String age) {
this.age = age;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
@Override
public String toString() {
return "Info{" +
"name='" + name + '\'' +
", age='" + age + '\'' +
", email='" + email + '\'' +
'}';
}
}
================================================
FILE: springboot-easyexcel-encapsulation/src/main/resources/application.properties
================================================
spring.http.multipart.max-file-size=100MB
spring.http.multipart.max-request-size=100MB
spring.http.multipart.maxFileSize=100MB
spring.http.multipart.maxRequestSize=1000MB
server.port=9999
================================================
FILE: springboot-elk/ELK安装时错误记录.md
================================================
### ELK安装时错误记录
#### 错误1:`error='Cannot allocate memory' (errno=12)`
**解决方法:**
由于`elasticsearch`默认分配`jvm`空间大小为`2g`,需要改小一点
```shell
vim config/jvm.options
-Xms2g → -Xms512m
-Xmx2g → -Xmx512m
```
#### 错误2:`can not run elasticsearch as root`
**解决方法:**
在 Linux 环境中,elasticsearch 不允许以 root 权限来运行!所以需要创建一个非root用户,以非root用户来起es
```sh
#这里创建的用户名为haoxy,可以随意
useradd haoxy
#为新创建的用户设置密码
passwd haoxy
#将安装权限归新用户所有
chown -R haoxy:haoxy /usr/local/elk/elasticsearch-7.7.0
```
#### 错误3:`错误: 找不到或无法加载主类 org.elasticsearch.tools.java_version_checker.JavaVersionChecker`
**解决方法:**
我出现这个问题的原因是因为:我是使用root用户登录的开发机,ES默认安装在了root目录下。使用su命令切换用户后,执行`./elasticsearch`时找不到启动类导致。 解决方案:使用`elastic`用户,将`<ElasticSearch>`安装包copy到`elastic`用户的`home`目录下,然后去`home`目录下执行启动操作
```sh
cp <ElasticSearch>/ ~/home/elasticsearch
cd ~/home/elasticsearch
./bin/elasticsearch
```
#### 错误4:`max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]`
一开始我是用我的1核2G的阿里云服务器搭建的ES,出现这个问题的原因是当前服务器的内存不够用;(因为我的阿里云服务器上跑这其他的程序)果断在自己的机子上搭建一个虚拟机给了4G的运行内存;
================================================
FILE: springboot-elk/ELK安装步骤.md
================================================
### ELK安装步骤
#### 简单介绍
- ElasticSearch:用于存储日志信息。
- Logstash:用于收集、处理和转发日志信息。
- Kibana:提供可搜索的Web可视化界面。
#### 准备工作安装JDK
- Elasticsearch7 自带jdk11,如果没有安装jdk, es7使用缺省jdk11
- 如果已安装,使用已安装的jdk,低于11有警告,但不影响使用。
- 但是在安装Logstash还是需要java环境,所以建议还是安装一下jdk11
* 安装jdk过程省略
#### 安装Elasticsearch
```shell
#下载elasticsearch安装包
wget https://mirrors.huaweicloud.com/elasticsearch/7.7.0/elasticsearch-7.7.0-linux-x86_64.tar.gz
#解压
tar -xvf elasticsearch-7.7.0-linux-x86_64.tar.gz
```
为Elasticsearch创建专属用户(Elasticsearch要求不能以root账户来运行)
```powershell
#这里创建的用户名为haoxy
useradd haoxy
#为新创建的用户设置密码
passwd haoxy
#将安装权限归新用户所有
chown -R haoxy:haoxy /usr/local/elk/elasticsearch-7.7.0
#为elasticsearch运行准备修改系统配置文件
echo 'vm.max_map_count=262144' >> /etc/sysctl.conf
echo 'haoxy hard nofile 65536' >> /etc/security/limits.conf
echo 'haoxy soft nofile 65536' >> /etc/security/limits.conf
```
修改配置文件
```shell
#进入elasticsearch文件目录
cd elasticsearch-7.7.0/config
vi elasticsearch.yml
#打开这些配置的注释 ,然后填上对应的值
network.host: 你自己的服务器ip
http.port: 9200
discovery.seed_hosts: ["ip地址"]
#打开这个配置项
node-name
#node-1这个值是node-name配置的值,默认就是node-1
cluster.initial_master_nodes: ["node-1"]
```
启动Easticsearch
```shell
#切换角色
[root@localhost elasticsearch-7.7.0]# su suyu
#启动,建议第一次启动的时候先不要使用 -d 参数,因为第一次启动很有可能会有报错,如果你很自信就可以加上-d
[haoxy@localhost elasticsearch-7.7.0]$ bin/elasticsearch -d
```
启动只有输出日志大致是这个样子:
```verilog
a43f33) Copyright (c) 2020 Elasticsearch BV
[2020-09-04T15:16:13,769][INFO ][o.e.d.DiscoveryModule ] [node-1] using discovery type [zen] and seed hosts providers [settings]
[2020-09-04T15:16:15,269][INFO ][o.e.n.Node ] [node-1] initialized
[2020-09-04T15:16:15,270][INFO ][o.e.n.Node ] [node-1] starting ...
[2020-09-04T15:16:15,484][INFO ][o.e.t.TransportService ] [node-1] publish_address {10.1.56.75:9300}, bound_addresses {10.1.56.75:9300}
[2020-09-04T15:16:15,911][INFO ][o.e.b.BootstrapChecks ] [node-1] bound or publishing to a non-loopback address, enforcing bootstrap checks
[2020-09-04T15:16:15,944][INFO ][o.e.c.c.Coordinator ] [node-1] cluster UUID [aY5lgyvbRuqb61LQ8A6hKA]
[2020-09-04T15:16:16,304][INFO ][o.e.c.s.MasterService ] [node-1] elected-as-master ([1] nodes joined)[{node-1}{ALYnSqgTTM2yRFGOvHhA_A}{zyCxSJGsS8y2ODCmZHJQNA}{10.1.56.75}{10.1.56.75:9300}{dilmrt}{ml.machine_memory=3974909952, xpack.installed=true, transform.node=true, ml.max_open_jobs=20} elect leader, _BECOME_MASTER_TASK_, _FINISH_ELECTION_], term: 2, version: 28, delta: master node changed {previous [], current [{node-1}{ALYnSqgTTM2yRFGOvHhA_A}{zyCxSJGsS8y2ODCmZHJQNA}{10.1.56.75}{10.1.56.75:9300}{dilmrt}{ml.machine_memory=3974909952, xpack.installed=true, transform.node=true, ml.max_open_jobs=20}]}
[2020-09-04T15:16:16,432][INFO ][o.e.c.s.ClusterApplierService] [node-1] master node changed {previous [], current [{node-1}{ALYnSqgTTM2yRFGOvHhA_A}{zyCxSJGsS8y2ODCmZHJQNA}{10.1.56.75}{10.1.56.75:9300}{dilmrt}{ml.machine_memory=3974909952, xpack.installed=true, transform.node=true, ml.max_open_jobs=20}]}, term: 2, version: 28, reason: Publication{term=2, version=28}
[2020-09-04T15:16:16,539][INFO ][o.e.h.AbstractHttpServerTransport] [node-1] publish_address {10.1.56.75:9200}, bound_addresses {10.1.56.75:9200}
[2020-09-04T15:16:16,540][INFO ][o.e.n.Node ] [node-1] started
[2020-09-04T15:16:16,860][INFO ][o.e.l.LicenseService ] [node-1] license [091daa59-1347-45db-8b02-b3e8b570315b] mode [basic] - valid
[2020-09-04T15:16:16,862][INFO ][o.e.x.s.s.SecurityStatusChangeListener] [node-1] Active license is now [BASIC]; Security is disabled
[2020-09-04T15:16:16,877][INFO ][o.e.g.GatewayService ] [node-1] recovered [0] indices into cluster_state
```
然后在浏览器键入 ip:9200
<img src="http://cg-mall.oss-cn-shanghai.aliyuncs.com/blog/img001.png" alt="image-20200904162234030" style="zoom:50%;"/>
至此Easticsearch就安装完成了;
#### 安装Logstash
```shell
#下载logstash安装包
wget https://mirrors.huaweicloud.com/logstash/7.7.0/logstash-7.7.0.tar.gz
#解压logstash
tar -xvf logstash-7.7.0.tar.gz
#进入logstash配置文件夹下
cd logstash-7.7.0/config/
#文件中加入下面这段内
vim logstash.conf
##################################################
input {
tcp {
mode => "server"
host => "10.1.56.75" #安装logstash的ip
port => 4560 #设置logstash的端口
codec => json_lines
}
}
output {
elasticsearch {
hosts => ["10.1.56.75:9200"] #es的ip和端口(本次logstash和es是同一个服务器)
index => "java-logstash-%{+YYYY.MM.dd}" #es的index名称
#user => "haoxy" #es的账号
#password => "haoxy" #es的密码
}
}
##################################################
#进入logstash-7.7.0/目录下启动,启动成功之后 win:crtl+c,mac:control+c 即可
bin/logstash -f config/logstash.conf &
```
#### 安装Kibana
```shell
#切换到root角色下载kibana包
wget https://mirrors.huaweicloud.com/kibana/7.7.0/kibana-7.7.0-linux-x86_64.tar.gz
#解压
tar -xvf kibana-7.7.0-linux-x86_64.tar.gz
#让这个文件夹可写
chmod 777 kibana-7.7.0-linux-x86_64
#将目录权限归我们创建新用户所有,这里也不能以root角色启动
chown -R haoxy:haoxy /usr/local/elk/kibana-7.7.0-linux-x86_64
#进入kibana目录
cd kibana-7.7.0-linux-x86_64
#修改配置文件
vim ./config/kibana.yml
#将这行配置打开,将值配置为elasticsearch服务器的ip地址
elasticsearch.hosts: ["http://10.1.56.75:9200"]
#打开这行配置,默认为localhost,改为0.0.0.0不改外网访问不了
server.host: "0.0.0.0"
#进入bin目录启动
cd bin/
#切换角色启动,这里也不准用root启动
su haoxy
#以后台形式启动 默认占用端口2601
./kibana &
```
启动成功日志大致如下:
<img src="http://cg-mall.oss-cn-shanghai.aliyuncs.com/blog/img002.png" style="zoom:50%;" />
到此我们的ELK就搭建完成了,登录到kibana可视化界面 http://10.1.56.75:5601
<img src="http://cg-mall.oss-cn-shanghai.aliyuncs.com/blog/img003.png" style="zoom:50%;" />
#### springboot集成ELK系统
然后启动springboot项目,在pom文件中依赖logstash插件,将日志文件发送到logstash中,logstash会将日志文件传到elasticsearch中,kibana拉取elasticsearch中的日志,我们就能看到日志啦
```xml
<dependency>
<groupId>net.logstash.logback</groupId>
<artifactId>logstash-logback-encoder</artifactId>
<version>5.3</version>
</dependency>
```
在resourcet目录中添加日志的配置文件`logback-spring.xml`,修改`destination`为你自己的logstash的ip和端口就行
```xml
<?xml version="1.0" encoding="UTF-8"?>
<!--该日志将日志级别不同的log信息保存到不同的文件中 -->
<configuration>
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
<springProperty scope="context" name="springAppName"
source="spring.application.name"/>
<springProperty scope="context" name="serverPort"
source="server.port"/>
<!-- 日志在工程中的输出位置 -->
<property name="LOG_FILE" value="${BUILD_FOLDER:-build}/${springAppName}"/>
<!-- 控制台的日志输出样式 -->
<property name="CONSOLE_LOG_PATTERN"
value="%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter>
<!-- 日志输出编码 -->
<encoder>
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
<charset>utf8</charset>
</encoder>
</appender>
<!-- 为logstash输出的JSON格式的Appender -->
<appender name="logstash"
class="net.logstash.logback.appender.LogstashTcpSocketAppender">
<destination>10.1.56.75:4560</destination>
<!-- 日志输出编码 -->
<encoder
class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
<providers>
<timestamp>
<timeZone>UTC</timeZone>
</timestamp>
<pattern>
<pattern>
{
"severity": "%level",
"service": "${springAppName:-}",
"port": "${serverPort:-}",
"trace": "%X{X-B3-TraceId:-}",
"span": "%X{X-B3-SpanId:-}",
"exportable": "%X{X-Span-Export:-}",
"pid": "${PID:-}",
"thread": "%thread",
"class": "%logger{40}",
"rest": "%message"
}
</pattern>
</pattern>
</providers>
</encoder>
</appender>
<!-- 日志输出级别 -->
<root level="INFO">
<appender-ref ref="console"/>
<appender-ref ref="logstash"/>
</root>
</configuration>
```
编写一个Controller
```java
@RestController
@Slf4j
public class ElkController {
@RequestMapping("elk")
public String testElk(String params) {
log.info("接口入参 {}", params);
params = "Hello World";
log.error("error message {}", params);
return params;
}
}
```
我们访问一下这个ElkController并让日志打印到控制台:
<img src="http://cg-mall.oss-cn-shanghai.aliyuncs.com/blog/img004.png" style="zoom:50%;" />
这时我们去`kibana`配置索引信息,创建搜索规则就能将日志显示到`Discover`啦!
<img src="http://cg-mall.oss-cn-shanghai.aliyuncs.com/blog/img005.png" style="zoom:50%;" />
创建索引信息,这里的索引是我们当初配置logstash配置文件时候写好的
<img src="http://cg-mall.oss-cn-shanghai.aliyuncs.com/blog/image-20200905145710709.png" alt="image-20200905145710709" style="zoom:50%;" />
点击create
<img src="http://cg-mall.oss-cn-shanghai.aliyuncs.com/blog/image-20200905150007090.png" style="zoom:50%;" />
<img src="http://cg-mall.oss-cn-shanghai.aliyuncs.com/blog/image-20200905150230663.png" alt="image-20200905150230663" style="zoom:50%;" />
<img src="http://cg-mall.oss-cn-shanghai.aliyuncs.com/blog/image-20200905150331417.png" alt="image-20200905150331417" style="zoom:50%;" />
<img src="http://cg-mall.oss-cn-shanghai.aliyuncs.com/blog/001.png" style="zoom:50%;" />
到此我们ELK日志分析系统就已经搭建完成了,springboot日志也发到了日志系统中了;
================================================
FILE: springboot-elk/pom.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>springboot-elk</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.22</version>
</dependency>
<dependency>
<groupId>net.logstash.logback</groupId>
<artifactId>logstash-logback-encoder</artifactId>
<version>5.3</version>
</dependency>
</dependencies>
</project>
================================================
FILE: springboot-elk/src/main/java/cn/haoxxiaoyong/elk/ElkApplication.java
================================================
package cn.haoxxiaoyong.elk;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* @author haoxiaoyong
* @date created at 下午5:04 on 2020/9/4
* @github https://github.com/haoxiaoyong1014
* @blog www.haoxiaoyong.cn
*/
@SpringBootApplication
public class ElkApplication {
public static void main(String[] args) {
SpringApplication.run(ElkApplication.class,args);
}
}
================================================
FILE: springboot-elk/src/main/java/cn/haoxxiaoyong/elk/controller/ElkController.java
================================================
package cn.haoxxiaoyong.elk.controller;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author haoxiaoyong
* @date created at 下午5:05 on 2020/9/4
* @github https://github.com/haoxiaoyong1014
* @blog www.haoxiaoyong.cn
*/
@RestController
@Slf4j
public class ElkController {
@RequestMapping("elk")
public String testElk(String params) {
log.info("接口入参 {}", params);
params = "Hello World";
log.error("error message {}", params);
//int i = 1 / 0;
return params;
}
}
================================================
FILE: springboot-elk/src/main/resources/logback-spring.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!--该日志将日志级别不同的log信息保存到不同的文件中 -->
<configuration>
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
<springProperty scope="context" name="springAppName"
source="spring.application.name"/>
<springProperty scope="context" name="serverPort"
source="server.port"/>
<!-- 日志在工程中的输出位置 -->
<property name="LOG_FILE" value="${BUILD_FOLDER:-build}/${springAppName}"/>
<!-- 控制台的日志输出样式 -->
<property name="CONSOLE_LOG_PATTERN"
value="%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter>
<!-- 日志输出编码 -->
<encoder>
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
<charset>utf8</charset>
</encoder>
</appender>
<!-- 为logstash输出的JSON格式的Appender -->
<appender name="logstash"
class="net.logstash.logback.appender.LogstashTcpSocketAppender">
<destination>10.1.56.28:4560</destination>
<!-- 日志输出编码 -->
<encoder
class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
<providers>
<timestamp>
<timeZone>UTC</timeZone>
</timestamp>
<pattern>
<pattern>
{
"severity": "%level",
"service": "${springAppName:-}",
"port": "${serverPort:-}",
"trace": "%X{X-B3-TraceId:-}",
"span": "%X{X-B3-SpanId:-}",
"exportable": "%X{X-Span-Export:-}",
"pid": "${PID:-}",
"thread": "%thread",
"class": "%logger{40}",
"rest": "%message"
}
</pattern>
</pattern>
</providers>
</encoder>
</appender>
<!-- 日志输出级别 -->
<root level="INFO">
<appender-ref ref="console"/>
<appender-ref ref="logstash"/>
</root>
</configuration>
================================================
FILE: springboot-fastDFS/README.md
================================================
## springboot-fastDFS
### FastDFS 安装和配置
**如果你已经安装好了**
<a href="https://github.com/haoxiaoyong1014/springboot-examples/blob/master/springboot-fastDFS/README2.md">使用FastDFSClient上传文件</a>
## FastDFS 介绍
- FastDFS 介绍:<http://www.oschina.net/p/fastdfs>
- 官网下载 1:<https://github.com/happyfish100/fastdfs/releases>
- 官网下载 2:<https://sourceforge.net/projects/fastdfs/files/>
- 官网下载 3:<http://code.google.com/p/fastdfs/downloads/list>
- 主要场景:
- 小图片
- 音频、小视频
- 其他类型小文件
- 更加复杂的文件存储场景可以选择:[Ceph](https://ceph.com/)
- 支持对象存储、块存储和文件存储
- 高性能、高可靠性和高扩展
### 单机安装部署(CentOS 6.7 环境)
- 环境准备:
- 已经安装好 Nginx
- 软件准备:
- **FastDFS_v5.05.tar.gz**
- **fastdfs-nginx-module_v1.16.tar.gz**
- **libfastcommon-1.0.7.tar.gz**
- 安装依赖包:`yum install -y libevent`
- 安装 **libfastcommon-1.0.7.tar.gz**
- 解压:`tar zxvf libfastcommon-1.0.7.tar.gz`
- 进入解压后目录:`cd libfastcommon-1.0.7/`
- 编译:`./make.sh`
- 安装:`./make.sh install`
- 设置几个软链接:`ln -s /usr/lib64/libfastcommon.so /usr/local/lib/libfastcommon.so`
- 设置几个软链接:`ln -s /usr/lib64/libfastcommon.so /usr/lib/libfastcommon.so`
- 设置几个软链接:`ln -s /usr/lib64/libfdfsclient.so /usr/local/lib/libfdfsclient.so`
- 设置几个软链接:`ln -s /usr/lib64/libfdfsclient.so /usr/lib/libfdfsclient.so`
- 安装 tracker (跟踪器)服务 **FastDFS_v5.08.tar.gz**
- 解压:`tar zxvf FastDFS_v5.05.tar.gz`
- 进入解压后目录:`cd FastDFS/`
- 编译:`./make.sh`
- 安装:`./make.sh install`
- 安装结果:
``` ini
/usr/bin 存放有编译出来的文件
/etc/fdfs 存放有配置文件
```
- 配置 tracker 服务
- 复制一份配置文件:`cp /etc/fdfs/tracker.conf.sample /etc/fdfs/tracker.conf`
- 编辑:`vim /etc/fdfs/tracker.conf`,编辑内容看下面中文注释
``` ini
disabled=false
bind_addr=
port=22122
connect_timeout=30
network_timeout=60
# 下面这个路径是保存 store data 和 log 的地方,需要我们改下,指向我们一个存在的目录
# 创建目录:mkdir -p /opt/fastdfs/tracker/data-and-log
base_path=/opt/fastdfs/tracker/data-and-log
max_connections=256
accept_threads=1
work_threads=4
store_lookup=2
store_group=group2
store_server=0
store_path=0
download_server=0
reserved_storage_space = 10%
log_level=info
run_by_group=
run_by_user=
allow_hosts=*
sync_log_buff_interval = 10
check_active_interval = 120
thread_stack_size = 64KB
storage_ip_changed_auto_adjust = true
storage_sync_file_max_delay = 86400
storage_sync_file_max_time = 300
use_trunk_file = false
slot_min_size = 256
slot_max_size = 16MB
trunk_file_size = 64MB
trunk_create_file_advance = false
trunk_create_file_time_base = 02:00
trunk_create_file_interval = 86400
trunk_create_file_space_threshold = 20G
trunk_init_check_occupying = false
trunk_init_reload_from_binlog = false
trunk_compress_binlog_min_interval = 0
use_storage_id = false
storage_ids_filename = storage_ids.conf
id_type_in_filename = ip
store_slave_file_use_link = false
rotate_error_log = false
error_log_rotate_time=00:00
rotate_error_log_size = 0
log_file_keep_days = 0
use_connection_pool = false
connection_pool_max_idle_time = 3600
http.server_port=8080
http.check_alive_interval=30
http.check_alive_type=tcp
http.check_alive_uri=/status.html
```
- 启动 tracker 服务:`/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf`
- 重启 tracker 服务:`/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart`
- 查看是否有 tracker 进程:`ps aux | grep tracker`
- storage (存储节点)服务部署
- 一般 storage 服务我们会单独装一台机子,但是这里为了方便我们安装在同一台。
- 如果 storage 单独安装的话,那上面安装的步骤都要在走一遍,只是到了编辑配置文件的时候,编辑的是 storage.conf 而已
- 复制一份配置文件:`cp /etc/fdfs/storage.conf.sample /etc/fdfs/storage.conf`
- 编辑:`vim /etc/fdfs/storage.conf`,编辑内容看下面中文注释
``` ini
disabled=false
group_name=group1
bind_addr=
client_bind=true
port=23000
connect_timeout=30
network_timeout=60
heart_beat_interval=30
stat_report_interval=60
# 下面这个路径是保存 store data 和 log 的地方,需要我们改下,指向我们一个存在的目录
# 创建目录:mkdir -p /opt/fastdfs/storage/data-and-log
base_path=/opt/fastdfs/storage/data-and-log
max_connections=256
buff_size = 256KB
accept_threads=1
work_threads=4
disk_rw_separated = true
disk_reader_threads = 1
disk_writer_threads = 1
sync_wait_msec=50
sync_interval=0
sync_start_time=00:00
sync_end_time=23:59
write_mark_file_freq=500
store_path_count=1
# 图片实际存放路径,如果有多个,这里可以有多行:
# store_path0=/opt/fastdfs/storage/images-data0
# store_path1=/opt/fastdfs/storage/images-data1
# store_path2=/opt/fastdfs/storage/images-data2
# 创建目录:mkdir -p /opt/fastdfs/storage/images-data
store_path0=/opt/fastdfs/storage/images-data
subdir_count_per_path=256
# 指定 tracker 服务器的 IP 和端口
tracker_server=192.168.1.114:22122
log_level=info
run_by_group=
run_by_user=
allow_hosts=*
file_distribute_path_mode=0
file_distribute_rotate_count=100
fsync_after_written_bytes=0
sync_log_buff_interval=10
sync_binlog_buff_interval=10
sync_stat_file_interval=300
thread_stack_size=512KB
upload_priority=10
if_alias_prefix=
check_file_duplicate=0
file_signature_method=hash
key_namespace=FastDFS
keep_alive=0
use_access_log = false
rotate_access_log = false
access_log_rotate_time=00:00
rotate_error_log = false
error_log_rotate_time=00:00
rotate_access_log_size = 0
rotate_error_log_size = 0
log_file_keep_days = 0
file_sync_skip_invalid_record=false
use_connection_pool = false
connection_pool_max_idle_time = 3600
http.domain_name=
http.server_port=8888
```
- 启动 storage 服务:`/usr/bin/fdfs_storaged /etc/fdfs/storage.conf`,首次启动会很慢,因为它在创建预设存储文件的目录
- 重启 storage 服务:`/usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart`
- 查看是否有 storage 进程:`ps aux | grep storage`
- 测试是否部署成功
- 利用自带的 client 进行测试
- 复制一份配置文件:`cp /etc/fdfs/client.conf.sample /etc/fdfs/client.conf`
- 编辑:`vim /etc/fdfs/client.conf`,编辑内容看下面中文注释
``` ini
connect_timeout=30
network_timeout=60
# 下面这个路径是保存 store log 的地方,需要我们改下,指向我们一个存在的目录
# 创建目录:mkdir -p /opt/fastdfs/client/data-and-log
base_path=/opt/fastdfs/client/data-and-log
# 指定 tracker 服务器的 IP 和端口
tracker_server=192.168.1.114:22122
log_level=info
use_connection_pool = false
connection_pool_max_idle_time = 3600
load_fdfs_parameters_from_tracker=false
use_storage_id = false
storage_ids_filename = storage_ids.conf
http.tracker_server_port=80
```
- 在终端中通过 shell 上传 opt 目录下的一张图片:`/usr/bin/fdfs_test /etc/fdfs/client.conf upload /opt/test.jpg`
- 如下图箭头所示,生成的图片地址为:`http://192.168.1.114/group1/M00/00/00/wKgBclb0aqWAbVNrAAAjn7_h9gM813_big.jpg`
- 
- 即使我们现在知道图片的访问地址我们也访问不了,因为我们还没装 FastDFS 的 Nginx 模块
- 安装 **fastdfs-nginx-module_v1.16.tar.gz**,安装 Nginx 第三方模块相当于这个 Nginx 都是要重新安装一遍的
- 解压 Nginx 模块:`tar zxvf fastdfs-nginx-module_v1.16.tar.gz`,得到目录地址:**/opt/setups/FastDFS/fastdfs-nginx-module**
- 编辑 Nginx 模块的配置文件:`vim /opt/setups/FastDFS/fastdfs-nginx-module/src/config`
- 找到下面一行包含有 `local` 字眼去掉,因为这三个路径根本不是在 local 目录下的。
``` nginx
CORE_INCS="$CORE_INCS /usr/local/include/fastdfs /usr/local/include/fastcommon/"
```
- 改为如下:
``` nginx
CORE_INCS="$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/"
```
- 复制文件:`cp /opt/setups/FastDFS/FastDFS/conf/http.conf /etc/fdfs`
- 复制文件:`cp /opt/setups/FastDFS/FastDFS/conf/mime.types /etc/fdfs`
- 安装 Nginx 和 Nginx 第三方模块
- 安装 Nginx 依赖包:`yum install -y gcc gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel`
- 预设几个文件夹,方便等下安装的时候有些文件可以进行存放:
- `mkdir -p /usr/local/nginx /var/log/nginx /var/temp/nginx /var/lock/nginx`
- 解压 Nginx:`tar zxvf /opt/setups/nginx-1.8.1.tar.gz`
- 进入解压后目录:`cd /opt/setups/nginx-1.8.1/`
- 编译配置:(注意最后一行)
``` ini
./configure \
--prefix=/usr/local/nginx \
--pid-path=/var/local/nginx/nginx.pid \
--lock-path=/var/lock/nginx/nginx.lock \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--with-http_gzip_static_module \
--http-client-body-temp-path=/var/temp/nginx/client \
--http-proxy-temp-path=/var/temp/nginx/proxy \
--http-fastcgi-temp-path=/var/temp/nginx/fastcgi \
--http-uwsgi-temp-path=/var/temp/nginx/uwsgi \
--http-scgi-temp-path=/var/temp/nginx/scgi \
--add-module=/opt/setups/FastDFS/fastdfs-nginx-module/src
```
- 编译:`make`
- 安装:`make install`
- 复制 Nginx 模块的配置文件:`cp /opt/setups/FastDFS/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs`
- 编辑 Nginx 模块的配置文件:`vim /etc/fdfs/mod_fastdfs.conf`,编辑内容看下面中文注释
- 如果在已经启动 Nginx 的情况下修改下面内容记得要重启 Nginx。
``` ini
connect_timeout=2
network_timeout=30
# 下面这个路径是保存 log 的地方,需要我们改下,指向我们一个存在的目录
# 创建目录:mkdir -p /opt/fastdfs/fastdfs-nginx-module/data-and-log
base_path=/opt/fastdfs/fastdfs-nginx-module/data-and-log
load_fdfs_parameters_from_tracker=true
storage_sync_file_max_delay = 86400
use_storage_id = false
storage_ids_filename = storage_ids.conf
# 指定 tracker 服务器的 IP 和端口
tracker_server=192.168.1.114:22122
storage_server_port=23000
group_name=group1
# 因为我们访问图片的地址是:http://192.168.1.114/group1/M00/00/00/wKgBclb0aqWAbVNrAAAjn7_h9gM813_big.jpg
# 该地址前面是带有 /group1/M00,所以我们这里要使用 true,不然访问不到(原值是 false)
url_have_group_name = true
store_path_count=1
# 图片实际存放路径,如果有多个,这里可以有多行:
# store_path0=/opt/fastdfs/storage/images-data0
# store_path1=/opt/fastdfs/storage/images-data1
# store_path2=/opt/fastdfs/storage/images-data2
store_path0=/opt/fastdfs/storage/images-data
log_level=info
log_filename=
response_mode=proxy
if_alias_prefix=
flv_support = true
flv_extension = flv
group_count = 0
```
- 编辑 Nginx 配置文件
``` nginx
# 注意这一行行,我特别加上了使用 root 用户去执行,不然有些日记目录没有权限访问
user root;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
# 访问本机
server_name 192.168.1.114;
# 拦截包含 /group1/M00 请求,使用 fastdfs 这个 Nginx 模块进行转发
location /group1/M00 {
ngx_fastdfs_module;
}
}
}
```
- 启动 Nginx
- 停掉防火墙:`service iptables stop`
- 启动:`/usr/local/nginx/sbin/nginx`,启动完成 shell 是不会有输出的
- 访问:`192.168.1.114`,如果能看到:`Welcome to nginx!`,即可表示安装成功
- 检查 时候有 Nginx 进程:`ps aux | grep nginx`,正常是显示 3 个结果出来
- 刷新 Nginx 配置后重启:`/usr/local/nginx/sbin/nginx -s reload`
- 停止 Nginx:`/usr/local/nginx/sbin/nginx -s stop`
- 如果访问不了,或是出现其他信息看下错误立即:`vim /var/log/nginx/error.log`
### 多机安装部署(CentOS 6.7 环境)
http://blog.csdn.net/ricciozhang/article/details/49402273
## 资料
- [fastdfs+nginx安装配置](http://blog.csdn.net/ricciozhang/article/details/49402273)
================================================
FILE: springboot-fastDFS/README2.md
================================================
### 使用FastDFSClient上传文件
**引入依赖**
```xml
<dependency>
<groupId>com.github.tobato</groupId>
<artifactId>fastdfs-client</artifactId>
<version>1.26.5</version>
</dependency>
```
此依赖仅支持springboot2x版本以上,如果你使用的是 springboot1x版本请使用以下依赖:
```xml
<dependency>
<groupId>com.github.tobato</groupId>
<artifactId>fastdfs-client</artifactId>
<version>1.25.4-RELEASE</version>
</dependency>
```
**FastDFSClient 工具类:**
```java
package cn.haoxiaoyong.fastdfs.util;
import com.github.tobato.fastdfs.domain.fdfs.StorePath;
import com.github.tobato.fastdfs.exception.FdfsUnsupportStorePathException;
import com.github.tobato.fastdfs.service.DefaultFastFileStorageClient;
import com.github.tobato.fastdfs.service.FastFileStorageClient;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.charset.Charset;
/**
* Created by haoxy on 2019/1/7.
* E-mail:hxyHelloWorld@163.com
* github:https://github.com/haoxiaoyong1014
*/
@Component
public class FastDFSClient {
@Autowired
private FastFileStorageClient storageClient;
// @Autowired
// private AppConfig appConfig; // 项目参数配置
/**
* 上传文件
*
* @param file
* 文件对象
* @return 文件访问地址
* @throws IOException
*/
public String uploadFile(MultipartFile file) throws IOException {
StorePath storePath = storageClient.uploadFile(file.getInputStream(), file.getSize(),
FilenameUtils.getExtension(file.getOriginalFilename()), null);
return storePath.getGroup() + "/" + storePath.getPath();
}
public String uploadFile(File file) throws IOException {
StorePath storePath = storageClient.uploadFile(new FileInputStream(file), FileUtils.sizeOf(file),
FilenameUtils.getExtension(file.getName()), null);
return storePath.getGroup() + "/" + storePath.getPath();
}
public String uploadFile2(MultipartFile file) throws IOException {
StorePath storePath = storageClient.uploadImageAndCrtThumbImage(file.getInputStream(), file.getSize(),
FilenameUtils.getExtension(file.getOriginalFilename()), null);
return storePath.getGroup() + "/" + storePath.getPath();
}
public String uploadQRCode(MultipartFile file) throws IOException {
StorePath storePath = storageClient.uploadFile(file.getInputStream(), file.getSize(),
"png", null);
return storePath.getGroup() + "/" + storePath.getPath();
}
public String uploadFace(MultipartFile file) throws IOException {
StorePath storePath = storageClient.uploadImageAndCrtThumbImage(file.getInputStream(), file.getSize(),
"png", null);
return storePath.getGroup() + "/" + storePath.getPath();
}
public String uploadBase64(MultipartFile file) throws IOException {
StorePath storePath = storageClient.uploadImageAndCrtThumbImage(file.getInputStream(), file.getSize(),
"png", null);
return storePath.getGroup() + "/" + storePath.getPath();
}
/**
* 将一段字符串生成一个文件上传
*
* @param content
* 文件内容
* @param fileExtension
* @return
*/
public String uploadFile(String content, String fileExtension) {
byte[] buff = content.getBytes(Charset.forName("UTF-8"));
ByteArrayInputStream stream = new ByteArrayInputStream(buff);
StorePath storePath = storageClient.uploadFile(stream, buff.length, fileExtension, null);
return storePath.getGroup() + "/" + storePath.getPath();
}
// 封装图片完整URL地址
// private String getResAccessUrl(StorePath storePath) {
// String fileUrl = AppConstants.HTTP_PRODOCOL + appConfig.getResHost() + ":" + appConfig.getFdfsStoragePort()
// + "/" + storePath.getFullPath();
// return fileUrl;
// }
/**
* 删除文件
*
* @param fileUrl
* 文件访问地址
* @return
*/
public void deleteFile(String fileUrl) {
if (StringUtils.isEmpty(fileUrl)) {
return;
}
try {
StorePath storePath = praseFromUrl(fileUrl);
storageClient.deleteFile(storePath.getGroup(), storePath.getPath());
} catch (FdfsUnsupportStorePathException e) {
e.getMessage();
}
}
public static StorePath praseFromUrl(String filePath) {
Validate.notNull(filePath, "解析文件路径不能为空", new Object[0]);
int groupStartPos = getGroupStartPos(filePath);
String groupAndPath = filePath.substring(groupStartPos);
int pos = groupAndPath.indexOf("/");
if (pos > 0 && pos != groupAndPath.length() - 1) {
String group = groupAndPath.substring(0, pos);
String path = groupAndPath.substring(pos + 1);
return new StorePath(group, path);
} else {
throw new FdfsUnsupportStorePathException("解析文件路径错误,有效的路径样式为(group/path) 而当前解析路径为".concat(filePath));
}
}
private static int getGroupStartPos(String filePath) {
int pos = filePath.indexOf("group");
if (pos == -1) {
throw new FdfsUnsupportStorePathException("解析文件路径错误,被解析路径url没有group,当前解析路径为".concat(filePath));
} else {
return pos;
}
}
}
```
**测试使用方式:**
```java
@Autowired
private FastDFSClient fastDFSClient;
private String httpUrl = "http://www.haoxiaoyong.cn/";
//上传File类型
@Test
public void uploadFileTest() throws IOException {
String url = fastDFSClient.uploadFile(new File("/Users/haoxiaoyong/Desktop/server.xml"));
System.out.println(url); // 打印地址: group1/M00/00/00/rBAuwFxsuv2ATek5AAAdV0CoZsM414.xml
//然后拼接上域名:
System.out.println(httpUrl + url);
}
//上传MultipartFile类型
@Test
public void uploadMulTest() throws IOException {
//将文件转换成MultipartFile类型
MultipartFile file = FiletoMuit.file2Muit("/Users/haoxiaoyong/Desktop/server.xml");
String url = fastDFSClient.uploadFile(file);
System.out.println(url);// group1/M00/00/00/rBAuwFxsvOOAT9DFAAAdV0CoZsM460.xml
}
//上传图片同时生成缩略图
@Test
public void uploadImgTest() throws IOException {
MultipartFile file = FiletoMuit.file2Muit("/Users/haoxiaoyong/Desktop/meinv.png");
String url = fastDFSClient.uploadFace(file);
//拼接上域名,大图片
System.out.println(httpUrl + url);
//在FastDFS上传的时候,会自动生成一个缩略图
String[] fileNameList = url.split("\\.");
String fileName = fileNameList[0];
String ext = fileNameList[1];
String picSmallUrl = fileName + "_150x150." + ext;//缩略图地址
//拼接上域名-缩略图地址
System.out.println(httpUrl + picSmallUrl);
}
```
**测试上传图片结果**
原始图片:
<img src="http://www.haoxiaoyong.cn/group1/M00/00/00/rBAuwFxs1ACAaxYsAAGy54qn7gE929.png"/>
缩略图:
<img src="http://www.haoxiaoyong.cn/group1/M00/00/00/rBAuwFxs1ACAaxYsAAGy54qn7gE929_150x150.png"/>
================================================
FILE: springboot-fastDFS/pom.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.2.RELEASE</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>springboot-fastdfs</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boo
gitextract_bgd7uglu/
├── .gitignore
├── README.md
├── distributed-job/
│ ├── README.md
│ ├── pom.xml
│ └── src/
│ └── main/
│ ├── java/
│ │ └── cn/
│ │ └── haoxy/
│ │ └── distributed/
│ │ ├── JobApplication.java
│ │ ├── config/
│ │ │ ├── JobConfig.java
│ │ │ └── XxlJobProps.java
│ │ ├── controller/
│ │ │ └── ManualOperateController.java
│ │ ├── handler/
│ │ │ └── TestJobHandler.java
│ │ └── service/
│ │ └── InService.java
│ └── resources/
│ ├── application.properties-out
│ ├── application.yml
│ └── logback.xml
├── global-exception/
│ ├── README.md
│ ├── pom.xml
│ └── src/
│ └── main/
│ └── java/
│ └── cn/
│ └── haoxiaoyong/
│ └── ex/
│ ├── ExceptionApp.java
│ ├── common/
│ │ ├── Parameter.java
│ │ └── RespInfo.java
│ ├── controller/
│ │ └── LoginController.java
│ ├── exception/
│ │ └── CustomizeException.java
│ └── global/
│ └── GlobalExceptionHandler.java
├── mybatis-plus-example/
│ ├── README.md
│ ├── plus-condition/
│ │ ├── pom.xml
│ │ └── src/
│ │ ├── main/
│ │ │ ├── java/
│ │ │ │ └── cn/
│ │ │ │ └── haoxy/
│ │ │ │ └── mybatis/
│ │ │ │ └── plus/
│ │ │ │ └── condition/
│ │ │ │ ├── ConditionApp.java
│ │ │ │ ├── mapper/
│ │ │ │ │ ├── RoleMapper.java
│ │ │ │ │ └── UserMapper.java
│ │ │ │ └── pojo/
│ │ │ │ ├── Role.java
│ │ │ │ └── User.java
│ │ │ └── resources/
│ │ │ └── application.yml
│ │ └── test/
│ │ └── java/
│ │ └── cn/
│ │ └── haoxy/
│ │ └── mybatis/
│ │ └── plus/
│ │ └── condition/
│ │ └── PlusConditionTest.java
│ ├── plus-curd/
│ │ ├── pom.xml
│ │ └── src/
│ │ ├── main/
│ │ │ ├── java/
│ │ │ │ └── cn/
│ │ │ │ └── haoxy/
│ │ │ │ └── mybatis/
│ │ │ │ └── plus/
│ │ │ │ └── curd/
│ │ │ │ ├── PlusApp.java
│ │ │ │ ├── mapper/
│ │ │ │ │ └── UserMapper.java
│ │ │ │ └── pojo/
│ │ │ │ └── User.java
│ │ │ └── resources/
│ │ │ ├── application.yml
│ │ │ └── spy.properties
│ │ └── test/
│ │ └── java/
│ │ └── cn/
│ │ └── haoxy/
│ │ └── mybatis/
│ │ └── plus/
│ │ └── curd/
│ │ └── SampleTest.java
│ ├── plus-generator/
│ │ ├── pom.xml
│ │ └── src/
│ │ └── main/
│ │ └── java/
│ │ └── cn/
│ │ └── haoxy/
│ │ └── mybatis/
│ │ └── plus/
│ │ └── generator/
│ │ ├── CodeGenerator.java
│ │ ├── GeneratorApplication.java
│ │ └── MysqlGenerator.java
│ ├── plus-page/
│ │ ├── pom.xml
│ │ └── src/
│ │ ├── main/
│ │ │ ├── java/
│ │ │ │ └── cn/
│ │ │ │ └── haoxy/
│ │ │ │ └── mybatis/
│ │ │ │ └── plus/
│ │ │ │ └── page/
│ │ │ │ ├── PageApp.java
│ │ │ │ ├── mapper/
│ │ │ │ │ └── UserMapper.java
│ │ │ │ └── pojo/
│ │ │ │ ├── MyPage.java
│ │ │ │ ├── ParamSome.java
│ │ │ │ └── User.java
│ │ │ └── resources/
│ │ │ ├── application.yml
│ │ │ └── mapper/
│ │ │ └── UserMapper.xml
│ │ └── test/
│ │ └── java/
│ │ └── cn/
│ │ └── haoxy/
│ │ └── mybatis/
│ │ └── plus/
│ │ └── page/
│ │ └── PlusPageTest.java
│ ├── plus-page-ui/
│ │ ├── pom.xml
│ │ └── src/
│ │ └── main/
│ │ ├── java/
│ │ │ └── cn/
│ │ │ └── haoxy/
│ │ │ └── mybatis/
│ │ │ └── plus/
│ │ │ └── page/
│ │ │ └── ui/
│ │ │ └── PageUiApplication.java
│ │ └── resources/
│ │ └── application.yml
│ └── pom.xml
├── okay-spring-boot-starter/
│ ├── README.md
│ ├── pom.xml
│ └── src/
│ └── main/
│ ├── java/
│ │ └── cn/
│ │ └── haoxiaoyong/
│ │ └── okay/
│ │ └── starter/
│ │ ├── annotation/
│ │ │ └── EnableOkay.java
│ │ ├── config/
│ │ │ ├── OkayProperties.java
│ │ │ └── OkayStarterAutoConfiguration.java
│ │ └── model/
│ │ └── Okay.java
│ └── resources/
│ └── META-INF/
│ └── spring.factories
├── pom.xml
├── springboot-admin-monitor/
│ ├── README.md
│ ├── pom.xml
│ ├── springboot-admin-client/
│ │ ├── pom.xml
│ │ └── src/
│ │ └── main/
│ │ ├── java/
│ │ │ └── cn/
│ │ │ └── haoxiaoyong/
│ │ │ └── sba/
│ │ │ └── client/
│ │ │ ├── AdminClientApplication.java
│ │ │ └── controller/
│ │ │ └── UserController.java
│ │ └── resources/
│ │ └── application.yml
│ ├── springboot-admin-client2/
│ │ ├── pom.xml
│ │ └── src/
│ │ └── main/
│ │ ├── java/
│ │ │ └── cn/
│ │ │ └── haoxiaoyong/
│ │ │ └── sba/
│ │ │ └── client/
│ │ │ ├── AdminClientApplication.java
│ │ │ └── controller/
│ │ │ └── UserController.java
│ │ └── resources/
│ │ └── application.yml
│ └── springboot-admin-server/
│ ├── pom.xml
│ └── src/
│ └── main/
│ ├── java/
│ │ └── cn/
│ │ └── haoxiaoyong/
│ │ └── sba/
│ │ └── server/
│ │ ├── AdminServerApplication.java
│ │ └── config/
│ │ └── SecuritySecureConfig.java
│ └── resources/
│ └── application.yml
├── springboot-druid/
│ ├── README.md
│ ├── pom.xml
│ └── src/
│ └── main/
│ ├── java/
│ │ └── cn/
│ │ └── haoxiaoyong/
│ │ └── druid/
│ │ ├── DruidApplication.java
│ │ ├── controller/
│ │ │ └── UserController.java
│ │ ├── entity/
│ │ │ └── User.java
│ │ ├── mapper/
│ │ │ └── UserMapper.java
│ │ └── service/
│ │ └── UserService.java
│ └── resources/
│ ├── application.properties
│ └── mapper/
│ └── UserMapper.xml
├── springboot-easyexcel-encapsulation/
│ ├── README.md
│ ├── pom.xml
│ └── src/
│ └── main/
│ ├── java/
│ │ └── cn/
│ │ └── haoxy/
│ │ └── easyexcel/
│ │ ├── EasyexcelMethodEncapsulationApplication.java
│ │ ├── controller/
│ │ │ └── ExcelController.java
│ │ ├── excel/
│ │ │ ├── ExcelException.java
│ │ │ ├── ExcelListener.java
│ │ │ ├── ExcelUtil.java
│ │ │ └── ExcelWriterFactroy.java
│ │ └── model/
│ │ ├── ExportInfo.java
│ │ └── ImportInfo.java
│ └── resources/
│ └── application.properties
├── springboot-elk/
│ ├── ELK安装时错误记录.md
│ ├── ELK安装步骤.md
│ ├── pom.xml
│ └── src/
│ └── main/
│ ├── java/
│ │ └── cn/
│ │ └── haoxxiaoyong/
│ │ └── elk/
│ │ ├── ElkApplication.java
│ │ └── controller/
│ │ └── ElkController.java
│ └── resources/
│ └── logback-spring.xml
├── springboot-fastDFS/
│ ├── README.md
│ ├── README2.md
│ ├── pom.xml
│ └── src/
│ ├── main/
│ │ ├── java/
│ │ │ └── cn/
│ │ │ └── haoxiaoyong/
│ │ │ └── fastdfs/
│ │ │ ├── Main.java
│ │ │ └── util/
│ │ │ ├── FastDFSClient.java
│ │ │ └── FiletoMuit.java
│ │ └── resources/
│ │ └── application.properties
│ └── test/
│ └── java/
│ └── cn/
│ └── haoxiaoyong/
│ └── fastdfs/
│ └── TestFastDFSClient.java
├── springboot-idempotent/
│ ├── README.md
│ ├── pom.xml
│ └── src/
│ └── main/
│ ├── java/
│ │ └── cn/
│ │ └── haoxy/
│ │ └── redis/
│ │ └── token/
│ │ ├── TokenApplication.java
│ │ ├── annotation/
│ │ │ └── ApiIdempotent.java
│ │ ├── common/
│ │ │ ├── Constant.java
│ │ │ ├── ResponseCode.java
│ │ │ └── ServerResponse.java
│ │ ├── config/
│ │ │ └── JedisConfig.java
│ │ ├── controller/
│ │ │ ├── TestController.java
│ │ │ └── TokenController.java
│ │ ├── exception/
│ │ │ ├── MyControllerAdvice.java
│ │ │ └── ServiceException.java
│ │ ├── interceptor/
│ │ │ └── ApiIdempotentInterceptor.java
│ │ ├── service/
│ │ │ ├── TestService.java
│ │ │ ├── TokenService.java
│ │ │ └── impl/
│ │ │ ├── TestServiceImpl.java
│ │ │ └── TokenServiceImpl.java
│ │ └── utils/
│ │ ├── JedisUtil.java
│ │ └── RandomUtil.java
│ └── resources/
│ └── application.properties
├── springboot-login-Interceptor/
│ ├── pom.xml
│ └── src/
│ └── main/
│ ├── java/
│ │ └── cn/
│ │ └── haoxy/
│ │ └── interceptor/
│ │ ├── InterApplication.java
│ │ ├── annotation/
│ │ │ └── LoginRequired.java
│ │ ├── config/
│ │ │ ├── AuthenticationInterceptor.java
│ │ │ └── MvcConfigurer.java
│ │ ├── controller/
│ │ │ ├── LoginController.java
│ │ │ └── UserController.java
│ │ ├── model/
│ │ │ └── User.java
│ │ ├── service/
│ │ │ └── UserService.java
│ │ └── utils/
│ │ ├── CacheCollection.java
│ │ └── TokenUtils.java
│ └── resources/
│ └── application.yml
├── springboot-mongodb/
│ ├── README.md
│ ├── pom.xml
│ └── src/
│ ├── main/
│ │ ├── java/
│ │ │ └── cn/
│ │ │ └── haoxy/
│ │ │ └── mongodb/
│ │ │ ├── MongodbApplication.java
│ │ │ ├── controller/
│ │ │ │ └── CmsPageController.java
│ │ │ ├── dao/
│ │ │ │ └── CmsPageRepository.java
│ │ │ ├── domain/
│ │ │ │ ├── CmsPage.java
│ │ │ │ └── CmsPageParam.java
│ │ │ ├── request/
│ │ │ │ └── QueryPageRequest.java
│ │ │ ├── response/
│ │ │ │ ├── CommonCode.java
│ │ │ │ ├── QueryResponseResult.java
│ │ │ │ ├── QueryResult.java
│ │ │ │ ├── Response.java
│ │ │ │ ├── ResponseResult.java
│ │ │ │ └── ResultCode.java
│ │ │ └── service/
│ │ │ └── PageService.java
│ │ └── resources/
│ │ ├── application.yml
│ │ └── sql/
│ │ ├── cms_config.json
│ │ ├── cms_page.json
│ │ ├── cms_site.json
│ │ ├── cms_site_server.json
│ │ ├── cms_template.json
│ │ ├── filesystem.json
│ │ ├── fs.chunks.json
│ │ ├── fs.files.json
│ │ ├── sys_dictionary.json
│ │ └── user_test.json
│ └── test/
│ └── java/
│ └── cn/
│ └── haoxy/
│ └── mongodb/
│ └── CmsPageRepositoryTest.java
├── springboot-mybatis-myehcache/
│ ├── pom.xml
│ └── src/
│ ├── main/
│ │ ├── java/
│ │ │ └── com/
│ │ │ └── haoxy/
│ │ │ └── example/
│ │ │ ├── AppEhcache.java
│ │ │ ├── controller/
│ │ │ │ └── PersonController.java
│ │ │ ├── mapper/
│ │ │ │ └── PersonMapper.java
│ │ │ ├── model/
│ │ │ │ └── Person.java
│ │ │ ├── page/
│ │ │ │ └── PageInfo.java
│ │ │ └── service/
│ │ │ ├── PersonService.java
│ │ │ └── impl/
│ │ │ └── PersonServiceImpl.java
│ │ └── resources/
│ │ ├── application.properties
│ │ ├── ehcache.xml
│ │ └── mappers/
│ │ └── PersonMapper.xml
│ └── test/
│ └── java/
│ └── com/
│ └── haoxy/
│ └── test/
│ ├── DataSourceTests.java
│ └── PersonMapperTests.java
├── springboot-oauth2-authorization-server/
│ ├── README.md
│ ├── pom.xml
│ └── src/
│ ├── main/
│ │ ├── java/
│ │ │ └── cn/
│ │ │ └── merryyou/
│ │ │ └── security/
│ │ │ ├── SpringBoot2Oauth2Application.java
│ │ │ ├── config/
│ │ │ │ └── TokenStoreConfig.java
│ │ │ ├── handler/
│ │ │ │ └── AppLoginInSuccessHandler.java
│ │ │ ├── properties/
│ │ │ │ ├── OAuth2ClientProperties.java
│ │ │ │ ├── OAuth2CoreConfig.java
│ │ │ │ └── OAuth2Properties.java
│ │ │ ├── security/
│ │ │ │ ├── MyUserDetailsService.java
│ │ │ │ ├── SecurityConfig.java
│ │ │ │ └── jwt/
│ │ │ │ └── MerryyouJwtTokenEnhancer.java
│ │ │ ├── server/
│ │ │ │ ├── MerryyouAuthorizationServerConfig.java
│ │ │ │ └── MerryyouResourceServerConfig.java
│ │ │ └── utils/
│ │ │ └── JsonUtil.java
│ │ └── resources/
│ │ └── application.yml
│ └── test/
│ └── java/
│ └── cn/
│ └── merryyou/
│ └── security/
│ └── SpringBoot2Oauth2Test.java
├── springboot-oauth2-resource-server/
│ ├── pom.xml
│ └── src/
│ └── main/
│ ├── java/
│ │ └── cn/
│ │ └── merryyou/
│ │ └── security/
│ │ ├── SpringBoot2Oauth2ResourceApplication.java
│ │ ├── config/
│ │ │ └── TokenStoreConfig.java
│ │ └── resource/
│ │ └── MerryyouResourceServerConfiguration.java
│ └── resources/
│ └── application.yml
├── springboot-rabbitmq/
│ ├── README.md
│ ├── pom.xml
│ └── src/
│ ├── main/
│ │ ├── java/
│ │ │ └── com/
│ │ │ └── hxy/
│ │ │ └── rabbitmq/
│ │ │ ├── RabbitmqApp.java
│ │ │ ├── config/
│ │ │ │ ├── FanoutRabbitConfig.java
│ │ │ │ ├── RabbitConfig.java
│ │ │ │ └── TopicRabbitConfig.java
│ │ │ ├── fanout/
│ │ │ │ ├── FanoutReceiverA.java
│ │ │ │ ├── FanoutReceiverB.java
│ │ │ │ ├── FanoutReceiverC.java
│ │ │ │ └── FanoutSender.java
│ │ │ ├── hello/
│ │ │ │ ├── HelloReceiver.java
│ │ │ │ └── HelloSender.java
│ │ │ ├── many/
│ │ │ │ ├── NeoReceiver1.java
│ │ │ │ ├── NeoReceiver2.java
│ │ │ │ ├── NeoSender1.java
│ │ │ │ └── NeoSender2.java
│ │ │ ├── model/
│ │ │ │ └── User.java
│ │ │ ├── object/
│ │ │ │ ├── ObjectReceiver.java
│ │ │ │ └── ObjectSender.java
│ │ │ └── topic/
│ │ │ ├── TopicReceiver1.java
│ │ │ ├── TopicReceiver2.java
│ │ │ └── TopicSender.java
│ │ └── resources/
│ │ └── application.yml
│ └── test/
│ └── java/
│ └── com/
│ └── hxy/
│ └── rabbitmq/
│ ├── FanoutTest.java
│ ├── HelloTest.java
│ ├── ManyTest.java
│ ├── ObjectTest.java
│ └── TopicTest.java
├── springboot-rabbitmq-ack/
│ ├── pom.xml
│ └── src/
│ └── main/
│ ├── java/
│ │ └── com/
│ │ └── haoxy/
│ │ └── rabbitmq/
│ │ ├── RabbitmqApp.java
│ │ ├── comsumer/
│ │ │ └── Receiver.java
│ │ ├── config/
│ │ │ └── RabbitConfig.java
│ │ ├── controller/
│ │ │ └── SendController.java
│ │ └── model/
│ │ └── ResponseEntity.java
│ └── resources/
│ ├── application.yml
│ └── logback.xml
├── springboot-redis-docker/
│ ├── README.md
│ ├── pom.xml
│ └── src/
│ └── main/
│ ├── java/
│ │ └── com/
│ │ └── haoxy/
│ │ └── example/
│ │ └── SpringBootDemoApplication.java
│ └── resources/
│ ├── Dockerfile
│ ├── application.properties
│ └── static/
│ ├── fonts/
│ │ └── FontAwesome.otf
│ ├── index.html
│ ├── js/
│ │ ├── countdown.js
│ │ ├── custom.js
│ │ ├── init.js
│ │ ├── jquery.js
│ │ └── typed.js
│ └── templatemo-style.css
├── springboot-swagger-enhance/
│ ├── README.md
│ ├── pom.xml
│ └── src/
│ └── main/
│ ├── java/
│ │ └── cn/
│ │ └── haoxiaoyong/
│ │ └── swagger/
│ │ └── enhance/
│ │ ├── ApiApplication.java
│ │ ├── common/
│ │ │ └── ApiResponse.java
│ │ ├── config/
│ │ │ └── SwaggerConfiguration.java
│ │ ├── controller/
│ │ │ └── UserController.java
│ │ └── entity/
│ │ └── User.java
│ └── resources/
│ └── application.yml
├── springboot-threadpool/
│ ├── README.md
│ ├── pom.xml
│ └── src/
│ └── main/
│ ├── java/
│ │ └── cn/
│ │ └── haoxiaoyong/
│ │ └── thread/
│ │ └── pool/
│ │ ├── Application.java
│ │ └── boot/
│ │ ├── OrderQueueThread.java
│ │ ├── TestController.java
│ │ ├── ThreadPoolConfig.java
│ │ ├── ThreadService.java
│ │ └── ThreadServiceImpl.java
│ └── resources/
│ └── application.yml
├── springboot-web-thymeleaf/
│ ├── pom.xml
│ └── src/
│ └── main/
│ ├── java/
│ │ └── com/
│ │ └── haoxy/
│ │ └── thymeleaf/
│ │ ├── ThymeleafApplication.java
│ │ ├── controller/
│ │ │ └── MessageController.java
│ │ ├── model/
│ │ │ └── Message.java
│ │ └── repository/
│ │ ├── InMemoryMessageRepository.java
│ │ └── MessageRepository.java
│ └── resources/
│ ├── application.properties
│ ├── logback.xml
│ └── templates/
│ ├── fragments.html
│ └── messages/
│ ├── form.html
│ ├── list.html
│ └── view.html
├── springboot-websocket/
│ ├── .gitattributes
│ ├── .gitignore
│ ├── README.md
│ ├── buile_image.sh
│ ├── docker-compose.yml
│ ├── pom.xml
│ ├── rm_images.sh
│ └── src/
│ └── main/
│ ├── java/
│ │ └── com/
│ │ └── suyu/
│ │ └── websocket/
│ │ ├── Application.java
│ │ ├── config/
│ │ │ └── WebSocketConfig.java
│ │ ├── controller/
│ │ │ └── WebSocketController.java
│ │ └── server/
│ │ └── SocketServer.java
│ └── resources/
│ ├── application.yml
│ ├── static/
│ │ ├── js/
│ │ │ └── request.js
│ │ ├── layui/
│ │ │ ├── css/
│ │ │ │ ├── layui.css
│ │ │ │ ├── layui.mobile.css
│ │ │ │ └── modules/
│ │ │ │ ├── code.css
│ │ │ │ ├── laydate/
│ │ │ │ │ └── default/
│ │ │ │ │ └── laydate.css
│ │ │ │ └── layer/
│ │ │ │ └── default/
│ │ │ │ └── layer.css
│ │ │ ├── lay/
│ │ │ │ └── modules/
│ │ │ │ ├── carousel.js
│ │ │ │ ├── code.js
│ │ │ │ ├── element.js
│ │ │ │ ├── flow.js
│ │ │ │ ├── form.js
│ │ │ │ ├── jquery.js
│ │ │ │ ├── laydate.js
│ │ │ │ ├── layedit.js
│ │ │ │ ├── layer.js
│ │ │ │ ├── laypage.js
│ │ │ │ ├── laytpl.js
│ │ │ │ ├── mobile.js
│ │ │ │ ├── rate.js
│ │ │ │ ├── table.js
│ │ │ │ ├── tree.js
│ │ │ │ ├── upload.js
│ │ │ │ └── util.js
│ │ │ ├── layui.all.js
│ │ │ └── layui.js
│ │ ├── layui.all.js
│ │ ├── layui.css
│ │ └── layui.js
│ └── templates/
│ ├── admin.html
│ └── index.html
├── springboot2-redis/
│ ├── README.md
│ ├── pom.xml
│ └── src/
│ ├── main/
│ │ ├── java/
│ │ │ └── cn/
│ │ │ └── haoxy/
│ │ │ └── redis/
│ │ │ └── example/
│ │ │ ├── RedisMain.java
│ │ │ ├── bean/
│ │ │ │ └── RedisConnector.java
│ │ │ ├── common/
│ │ │ │ └── User.java
│ │ │ ├── config/
│ │ │ │ └── RedisConfig.java
│ │ │ └── tool/
│ │ │ ├── HashUtil.java
│ │ │ ├── ListUtil.java
│ │ │ ├── SetUtil.java
│ │ │ └── StringUtil.java
│ │ └── resources/
│ │ └── redis.properties
│ └── test/
│ ├── java/
│ │ └── cn/
│ │ └── haoxy/
│ │ └── redis/
│ │ └── exampl/
│ │ ├── TestRedisListUtil.java
│ │ └── TestRedisStringUtil.java
│ └── resources/
│ └── application.yml
└── strategy-aop/
├── README.md
├── pom.xml
└── src/
└── main/
├── java/
│ └── cn/
│ └── haoxy/
│ └── strategy/
│ └── aop/
│ ├── StrategApplication.java
│ ├── annotation/
│ │ └── MessageLog.java
│ ├── constant/
│ │ └── MessageCodeEnum.java
│ ├── controller/
│ │ └── UserController.java
│ ├── handler/
│ │ ├── DataSourceContextAware.java
│ │ ├── MessageInitHandler.java
│ │ └── MessageMonitorHandler.java
│ ├── pojo/
│ │ ├── AnalysisMessage.java
│ │ ├── AnalysisRole.java
│ │ └── AnalysisUser.java
│ ├── service/
│ │ ├── AnalysisMessageService.java
│ │ ├── AnalysisRoleService.java
│ │ ├── AnalysisUserService.java
│ │ └── MessageStrategyService.java
│ ├── strategys/
│ │ ├── MessageAddUserStrategy.java
│ │ ├── MessageDelUserStrategy.java
│ │ ├── MessageIsLockStrategy.java
│ │ └── StrategyBase.java
│ └── utils/
│ ├── MapCacheUtils.java
│ └── ReturnUtils.java
└── resources/
├── application.yml
└── test.json
SYMBOL INDEX (1147 symbols across 213 files)
FILE: distributed-job/src/main/java/cn/haoxy/distributed/JobApplication.java
class JobApplication (line 12) | @SpringBootApplication
method main (line 14) | public static void main(String[] args) {
FILE: distributed-job/src/main/java/cn/haoxy/distributed/config/JobConfig.java
class JobConfig (line 20) | @Slf4j
method xxlJobExecutor (line 52) | @Bean
FILE: distributed-job/src/main/java/cn/haoxy/distributed/config/XxlJobProps.java
class XxlJobProps (line 12) | @Data
class XxlJobAdminProps (line 31) | @Data
class XxlJobExecutorProps (line 38) | @Data
FILE: distributed-job/src/main/java/cn/haoxy/distributed/controller/ManualOperateController.java
class ManualOperateController (line 24) | @Slf4j
method xxlJobGroup (line 36) | @GetMapping("/group")
method xxlJobList (line 50) | @GetMapping("/list")
method xxlJobAdd (line 66) | @GetMapping("/add")
method xxlJobTrigger (line 87) | @GetMapping("/trigger")
method xxlJobRemove (line 101) | @GetMapping("/remove")
method xxlJobStop (line 114) | @GetMapping("/stop")
method xxlJobStart (line 127) | @GetMapping("/start")
FILE: distributed-job/src/main/java/cn/haoxy/distributed/handler/TestJobHandler.java
class TestJobHandler (line 21) | @Component
method execute (line 27) | @XxlJob("jobHandler")
FILE: distributed-job/src/main/java/cn/haoxy/distributed/service/InService.java
class InService (line 11) | @Service
method xxl (line 14) | public void xxl(){
FILE: global-exception/src/main/java/cn/haoxiaoyong/ex/ExceptionApp.java
class ExceptionApp (line 11) | @SpringBootApplication
method main (line 13) | public static void main(String[] args) {
FILE: global-exception/src/main/java/cn/haoxiaoyong/ex/common/Parameter.java
class Parameter (line 8) | public class Parameter {
method getPhone (line 14) | public String getPhone() {
method setPhone (line 18) | public void setPhone(String phone) {
method getPassword (line 22) | public String getPassword() {
method setPassword (line 26) | public void setPassword(String password) {
FILE: global-exception/src/main/java/cn/haoxiaoyong/ex/common/RespInfo.java
class RespInfo (line 8) | public class RespInfo {
method RespInfo (line 16) | public RespInfo(int code, String msg, Object data) {
method RespInfo (line 22) | public RespInfo() {
method getCode (line 25) | public int getCode() {
method setCode (line 29) | public void setCode(int code) {
method getMsg (line 33) | public String getMsg() {
method setMsg (line 37) | public void setMsg(String msg) {
method getData (line 41) | public Object getData() {
method setData (line 45) | public void setData(Object data) {
FILE: global-exception/src/main/java/cn/haoxiaoyong/ex/controller/LoginController.java
class LoginController (line 16) | @RestController
method login (line 20) | @RequestMapping(value = "in")
FILE: global-exception/src/main/java/cn/haoxiaoyong/ex/exception/CustomizeException.java
class CustomizeException (line 10) | public class CustomizeException extends RuntimeException {
method CustomizeException (line 16) | public CustomizeException() {
method CustomizeException (line 20) | public CustomizeException(int code, String msg) {
method getContent (line 27) | public String getContent() {
method setContent (line 31) | public void setContent(String content) {
FILE: global-exception/src/main/java/cn/haoxiaoyong/ex/global/GlobalExceptionHandler.java
class GlobalExceptionHandler (line 15) | @ControllerAdvice
method systemErrorHandler (line 24) | @ExceptionHandler(value = Exception.class)
method customizeException (line 37) | @ExceptionHandler(value = CustomizeException.class)
FILE: mybatis-plus-example/plus-condition/src/main/java/cn/haoxy/mybatis/plus/condition/ConditionApp.java
class ConditionApp (line 7) | @SpringBootApplication
method main (line 10) | public static void main(String[] args) {
FILE: mybatis-plus-example/plus-condition/src/main/java/cn/haoxy/mybatis/plus/condition/mapper/RoleMapper.java
type RoleMapper (line 6) | public interface RoleMapper extends BaseMapper<Role> {
FILE: mybatis-plus-example/plus-condition/src/main/java/cn/haoxy/mybatis/plus/condition/mapper/UserMapper.java
type UserMapper (line 6) | public interface UserMapper extends BaseMapper<User> {
FILE: mybatis-plus-example/plus-condition/src/main/java/cn/haoxy/mybatis/plus/condition/pojo/Role.java
class Role (line 5) | @Data
FILE: mybatis-plus-example/plus-condition/src/main/java/cn/haoxy/mybatis/plus/condition/pojo/User.java
class User (line 6) | @Data
FILE: mybatis-plus-example/plus-condition/src/test/java/cn/haoxy/mybatis/plus/condition/PlusConditionTest.java
class PlusConditionTest (line 18) | @RunWith(SpringRunner.class)
method test (line 28) | @Test
method nestingSelect (line 44) | private void nestingSelect() {
method childSql (line 53) | private void childSql() {
method getUsers (line 60) | private void getUsers() {
method print (line 68) | private <T> void print(List<T> list) {
FILE: mybatis-plus-example/plus-curd/src/main/java/cn/haoxy/mybatis/plus/curd/PlusApp.java
class PlusApp (line 7) | @SpringBootApplication
method main (line 10) | public static void main(String[] args) {
FILE: mybatis-plus-example/plus-curd/src/main/java/cn/haoxy/mybatis/plus/curd/mapper/UserMapper.java
type UserMapper (line 6) | public interface UserMapper extends BaseMapper<User> {
FILE: mybatis-plus-example/plus-curd/src/main/java/cn/haoxy/mybatis/plus/curd/pojo/User.java
class User (line 6) | @Data
FILE: mybatis-plus-example/plus-curd/src/test/java/cn/haoxy/mybatis/plus/curd/SampleTest.java
class SampleTest (line 17) | @RunWith(SpringRunner.class)
method testSelect (line 23) | @Test
method testInsert (line 31) | @Test
method testDel (line 42) | @Test
method testUpdate (line 48) | @Test
method dSelect (line 54) | @Test
method orderBy (line 61) | @Test
method orderByLambda (line 67) | @Test
FILE: mybatis-plus-example/plus-generator/src/main/java/cn/haoxy/mybatis/plus/generator/CodeGenerator.java
class CodeGenerator (line 17) | public class CodeGenerator {
method scanner (line 24) | public static String scanner(String tip) {
method main (line 38) | public static void main(String[] args) {
FILE: mybatis-plus-example/plus-generator/src/main/java/cn/haoxy/mybatis/plus/generator/GeneratorApplication.java
class GeneratorApplication (line 6) | @SpringBootApplication
method main (line 9) | public static void main(String[] args) {
FILE: mybatis-plus-example/plus-generator/src/main/java/cn/haoxy/mybatis/plus/generator/MysqlGenerator.java
class MysqlGenerator (line 16) | public class MysqlGenerator {
method main (line 51) | public static void main(String[] args) {
FILE: mybatis-plus-example/plus-page-ui/src/main/java/cn/haoxy/mybatis/plus/page/ui/PageUiApplication.java
class PageUiApplication (line 9) | @SpringBootApplication
method main (line 12) | public static void main(String[] args) {
method paginationInterceptor (line 19) | @Bean
FILE: mybatis-plus-example/plus-page/src/main/java/cn/haoxy/mybatis/plus/page/PageApp.java
class PageApp (line 9) | @SpringBootApplication
method main (line 12) | public static void main(String[] args) {
method paginationInterceptor (line 19) | @Bean
FILE: mybatis-plus-example/plus-page/src/main/java/cn/haoxy/mybatis/plus/page/mapper/UserMapper.java
type UserMapper (line 9) | public interface UserMapper extends BaseMapper<User> {
method mySelectPageAndPs (line 11) | MyPage<User> mySelectPageAndPs(@Param("pg") MyPage<User> myPage,@Param...
method mySelectPage (line 13) | MyPage<User> mySelectPage(@Param("pg") MyPage<User> myPage);
FILE: mybatis-plus-example/plus-page/src/main/java/cn/haoxy/mybatis/plus/page/pojo/MyPage.java
class MyPage (line 8) | @Data
method MyPage (line 17) | public MyPage(long current, long size) {
FILE: mybatis-plus-example/plus-page/src/main/java/cn/haoxy/mybatis/plus/page/pojo/ParamSome.java
class ParamSome (line 7) | @Data
FILE: mybatis-plus-example/plus-page/src/main/java/cn/haoxy/mybatis/plus/page/pojo/User.java
class User (line 5) | @Data
FILE: mybatis-plus-example/plus-page/src/test/java/cn/haoxy/mybatis/plus/page/PlusPageTest.java
class PlusPageTest (line 19) | @SpringBootTest
method pageTest (line 27) | @Test
method MyPage (line 43) | private void MyPage() {
method iPage (line 53) | private void iPage() {
method print (line 74) | private <T> void print(List<T> list) {
FILE: okay-spring-boot-starter/src/main/java/cn/haoxiaoyong/okay/starter/config/OkayProperties.java
class OkayProperties (line 11) | @ConfigurationProperties(prefix = "okay.config")
method getPlatform (line 20) | public String getPlatform() {
method setPlatform (line 24) | public void setPlatform(String platform) {
method getChannel (line 28) | public String getChannel() {
method setChannel (line 32) | public void setChannel(String channel) {
method getEnable (line 36) | public Boolean getEnable() {
method setEnable (line 40) | public void setEnable(Boolean enable) {
method toString (line 44) | @Override
FILE: okay-spring-boot-starter/src/main/java/cn/haoxiaoyong/okay/starter/config/OkayStarterAutoConfiguration.java
class OkayStarterAutoConfiguration (line 18) | @Configuration
method defaultStudent (line 27) | @Bean
FILE: okay-spring-boot-starter/src/main/java/cn/haoxiaoyong/okay/starter/model/Okay.java
class Okay (line 9) | public class Okay {
method getPlatform (line 17) | public String getPlatform() {
method setPlatform (line 21) | public void setPlatform(String platform) {
method getChannel (line 25) | public String getChannel() {
method setChannel (line 29) | public void setChannel(String channel) {
method getEnable (line 33) | public Boolean getEnable() {
method setEnable (line 37) | public void setEnable(Boolean enable) {
method toString (line 41) | @Override
FILE: springboot-admin-monitor/springboot-admin-client/src/main/java/cn/haoxiaoyong/sba/client/AdminClientApplication.java
class AdminClientApplication (line 12) | @SpringBootApplication
method main (line 15) | public static void main(String[] args) {
FILE: springboot-admin-monitor/springboot-admin-client/src/main/java/cn/haoxiaoyong/sba/client/controller/UserController.java
class UserController (line 13) | @RestController
method testSba (line 17) | @RequestMapping("sba")
FILE: springboot-admin-monitor/springboot-admin-client2/src/main/java/cn/haoxiaoyong/sba/client/AdminClientApplication.java
class AdminClientApplication (line 12) | @SpringBootApplication
method main (line 15) | public static void main(String[] args) {
FILE: springboot-admin-monitor/springboot-admin-client2/src/main/java/cn/haoxiaoyong/sba/client/controller/UserController.java
class UserController (line 13) | @RestController
method testSba (line 17) | @RequestMapping("sba")
FILE: springboot-admin-monitor/springboot-admin-server/src/main/java/cn/haoxiaoyong/sba/server/AdminServerApplication.java
class AdminServerApplication (line 13) | @SpringBootApplication
method main (line 17) | public static void main(String[] args) {
FILE: springboot-admin-monitor/springboot-admin-server/src/main/java/cn/haoxiaoyong/sba/server/config/SecuritySecureConfig.java
class SecuritySecureConfig (line 18) | @Configuration
method SecuritySecureConfig (line 23) | public SecuritySecureConfig(AdminServerProperties adminServerPropertie...
method configure (line 27) | @Override
FILE: springboot-druid/src/main/java/cn/haoxiaoyong/druid/DruidApplication.java
class DruidApplication (line 12) | @SpringBootApplication
method main (line 16) | public static void main(String[] args) {
FILE: springboot-druid/src/main/java/cn/haoxiaoyong/druid/controller/UserController.java
class UserController (line 16) | @RestController
method lists (line 22) | @GetMapping("/users")
FILE: springboot-druid/src/main/java/cn/haoxiaoyong/druid/entity/User.java
class User (line 8) | public class User {
method getUserId (line 14) | public Long getUserId() {
method setUserId (line 18) | public void setUserId(Long userId) {
method getUserName (line 22) | public String getUserName() {
method setUserName (line 26) | public void setUserName(String userName) {
method getUserAge (line 30) | public Integer getUserAge() {
method setUserAge (line 34) | public void setUserAge(Integer userAge) {
FILE: springboot-druid/src/main/java/cn/haoxiaoyong/druid/mapper/UserMapper.java
type UserMapper (line 12) | public interface UserMapper {
method getUsers (line 14) | List<User> getUsers();
FILE: springboot-druid/src/main/java/cn/haoxiaoyong/druid/service/UserService.java
class UserService (line 15) | @Service
method getUsers (line 21) | public List<User> getUsers() {
FILE: springboot-easyexcel-encapsulation/src/main/java/cn/haoxy/easyexcel/EasyexcelMethodEncapsulationApplication.java
class EasyexcelMethodEncapsulationApplication (line 12) | @SpringBootApplication
method main (line 15) | public static void main(String[] args) {
FILE: springboot-easyexcel-encapsulation/src/main/java/cn/haoxy/easyexcel/controller/ExcelController.java
class ExcelController (line 22) | @RestController
method readExcel (line 27) | @RequestMapping(value = "readExcel", method = RequestMethod.POST)
method writeExcel (line 35) | @RequestMapping(value = "writeExcel", method = RequestMethod.GET)
method writeExcelWithSheets (line 47) | @RequestMapping(value = "writeExcelWithSheets", method = RequestMethod...
method getList (line 61) | private List<ExportInfo> getList() {
FILE: springboot-easyexcel-encapsulation/src/main/java/cn/haoxy/easyexcel/excel/ExcelException.java
class ExcelException (line 9) | public class ExcelException extends RuntimeException {
method ExcelException (line 10) | public ExcelException(String message) {
FILE: springboot-easyexcel-encapsulation/src/main/java/cn/haoxy/easyexcel/excel/ExcelListener.java
class ExcelListener (line 15) | public class ExcelListener extends AnalysisEventListener {
method invoke (line 24) | @Override
method doSomething (line 32) | private void doSomething(Object object) {
method doAfterAllAnalysed (line 35) | @Override
method getDatas (line 43) | public List<Object> getDatas() {
method setDatas (line 47) | public void setDatas(List<Object> datas) {
FILE: springboot-easyexcel-encapsulation/src/main/java/cn/haoxy/easyexcel/excel/ExcelUtil.java
class ExcelUtil (line 26) | public class ExcelUtil {
method readExcel (line 34) | public static List<Object> readExcel(MultipartFile excel, BaseRowModel...
method readExcel (line 60) | public static List<Object> readExcel(MultipartFile excel, BaseRowModel...
method writeExcel (line 81) | public static void writeExcel(HttpServletResponse response, List<? ext...
method writeExcelWithSheets (line 128) | public static ExcelWriterFactroy writeExcelWithSheets(HttpServletRespo...
method getReader (line 163) | private static ExcelReader getReader(MultipartFile excel,
FILE: springboot-easyexcel-encapsulation/src/main/java/cn/haoxy/easyexcel/excel/ExcelWriterFactroy.java
class ExcelWriterFactroy (line 18) | public class ExcelWriterFactroy extends ExcelWriter {
method ExcelWriterFactroy (line 22) | public ExcelWriterFactroy(OutputStream outputStream, ExcelTypeEnum typ...
method write (line 27) | public ExcelWriterFactroy write(List<? extends BaseRowModel> list, Str...
method finish (line 45) | @Override
FILE: springboot-easyexcel-encapsulation/src/main/java/cn/haoxy/easyexcel/model/ExportInfo.java
class ExportInfo (line 14) | public class ExportInfo extends BaseRowModel {
method getName (line 29) | public String getName() {
method setName (line 33) | public void setName(String name) {
method getAge (line 37) | public String getAge() {
method setAge (line 41) | public void setAge(String age) {
method getEmail (line 45) | public String getEmail() {
method setEmail (line 49) | public void setEmail(String email) {
method getAddress (line 53) | public String getAddress() {
method setAddress (line 57) | public void setAddress(String address) {
FILE: springboot-easyexcel-encapsulation/src/main/java/cn/haoxy/easyexcel/model/ImportInfo.java
class ImportInfo (line 13) | public class ImportInfo extends BaseRowModel {
method getName (line 26) | public String getName() {
method setName (line 30) | public void setName(String name) {
method getAge (line 34) | public String getAge() {
method setAge (line 38) | public void setAge(String age) {
method getEmail (line 42) | public String getEmail() {
method setEmail (line 46) | public void setEmail(String email) {
method toString (line 50) | @Override
FILE: springboot-elk/src/main/java/cn/haoxxiaoyong/elk/ElkApplication.java
class ElkApplication (line 12) | @SpringBootApplication
method main (line 14) | public static void main(String[] args) {
FILE: springboot-elk/src/main/java/cn/haoxxiaoyong/elk/controller/ElkController.java
class ElkController (line 13) | @RestController
method testElk (line 17) | @RequestMapping("elk")
FILE: springboot-fastDFS/src/main/java/cn/haoxiaoyong/fastdfs/Main.java
class Main (line 17) | @SpringBootApplication
method main (line 20) | public static void main(String[] args) {
method multipartConfigElement (line 23) | @Bean
FILE: springboot-fastDFS/src/main/java/cn/haoxiaoyong/fastdfs/util/FastDFSClient.java
class FastDFSClient (line 26) | @Component
method uploadFile (line 44) | public String uploadFile(MultipartFile file) throws IOException {
method uploadFile (line 51) | public String uploadFile(File file) throws IOException {
method uploadFile2 (line 58) | public String uploadFile2(MultipartFile file) throws IOException {
method uploadQRCode (line 65) | public String uploadQRCode(MultipartFile file) throws IOException {
method uploadFace (line 72) | public String uploadFace(MultipartFile file) throws IOException {
method uploadBase64 (line 79) | public String uploadBase64(MultipartFile file) throws IOException {
method uploadFile (line 94) | public String uploadFile(String content, String fileExtension) {
method deleteFile (line 115) | public void deleteFile(String fileUrl) {
method praseFromUrl (line 127) | public static StorePath praseFromUrl(String filePath) {
method getGroupStartPos (line 141) | private static int getGroupStartPos(String filePath) {
FILE: springboot-fastDFS/src/main/java/cn/haoxiaoyong/fastdfs/util/FiletoMuit.java
class FiletoMuit (line 16) | public class FiletoMuit {
method file2Muit (line 18) | public static MultipartFile file2Muit(String pdfPath) throws IOExcepti...
FILE: springboot-fastDFS/src/test/java/cn/haoxiaoyong/fastdfs/TestFastDFSClient.java
class TestFastDFSClient (line 21) | @SpringBootTest(classes = Main.class)
method uploadFileTest (line 32) | @Test
method uploadMulTest (line 42) | @Test
method uploadImgTest (line 52) | @Test
FILE: springboot-idempotent/src/main/java/cn/haoxy/redis/token/TokenApplication.java
class TokenApplication (line 16) | @SpringBootApplication
method main (line 19) | public static void main(String[] args) {
method addInterceptors (line 24) | @Override
method apiIdempotentInterceptor (line 31) | @Bean
FILE: springboot-idempotent/src/main/java/cn/haoxy/redis/token/common/Constant.java
class Constant (line 9) | public class Constant {
type Redis (line 11) | public interface Redis {
type LogType (line 21) | public interface LogType {
type MsgLogStatus (line 26) | public interface MsgLogStatus {
FILE: springboot-idempotent/src/main/java/cn/haoxy/redis/token/common/ResponseCode.java
type ResponseCode (line 12) | public enum ResponseCode {
method ResponseCode (line 32) | ResponseCode(Integer code, String msg) {
method getCode (line 39) | public Integer getCode() {
method setCode (line 43) | public void setCode(Integer code) {
method getMsg (line 47) | public String getMsg() {
method setMsg (line 51) | public void setMsg(String msg) {
FILE: springboot-idempotent/src/main/java/cn/haoxy/redis/token/common/ServerResponse.java
class ServerResponse (line 13) | public class ServerResponse implements Serializable {
method ServerResponse (line 23) | public ServerResponse() {
method ServerResponse (line 26) | public ServerResponse(Integer status, String msg, Object data) {
method isSuccess (line 32) | @JsonIgnore
method success (line 37) | public static ServerResponse success() {
method success (line 41) | public static ServerResponse success(String msg) {
method success (line 45) | public static ServerResponse success(Object data) {
method success (line 49) | public static ServerResponse success(String msg, Object data) {
method error (line 53) | public static ServerResponse error(String msg) {
method error (line 57) | public static ServerResponse error(Object data) {
method error (line 61) | public static ServerResponse error(String msg, Object data) {
method getStatus (line 65) | public Integer getStatus() {
method setStatus (line 69) | public void setStatus(Integer status) {
method getMsg (line 73) | public String getMsg() {
method setMsg (line 77) | public void setMsg(String msg) {
method getData (line 81) | public Object getData() {
method setData (line 85) | public void setData(Object data) {
FILE: springboot-idempotent/src/main/java/cn/haoxy/redis/token/config/JedisConfig.java
class JedisConfig (line 15) | @Configuration
method redisPoolFactory (line 39) | @Bean
FILE: springboot-idempotent/src/main/java/cn/haoxy/redis/token/controller/TestController.java
class TestController (line 17) | @RestController
method testIdempotence (line 24) | @ApiIdempotent
FILE: springboot-idempotent/src/main/java/cn/haoxy/redis/token/controller/TokenController.java
class TokenController (line 16) | @RestController
method token (line 22) | @GetMapping("token")
FILE: springboot-idempotent/src/main/java/cn/haoxy/redis/token/exception/MyControllerAdvice.java
class MyControllerAdvice (line 17) | @ControllerAdvice
method serviceExceptionHandler (line 21) | @ResponseBody
method exceptionHandler (line 27) | @ResponseBody
FILE: springboot-idempotent/src/main/java/cn/haoxy/redis/token/exception/ServiceException.java
class ServiceException (line 9) | public class ServiceException extends RuntimeException{
method ServiceException (line 14) | public ServiceException() {
method ServiceException (line 17) | public ServiceException(String msg) {
method ServiceException (line 21) | public ServiceException(String code, String msg) {
method getCode (line 26) | public String getCode() {
method setCode (line 30) | public void setCode(String code) {
method getMsg (line 34) | public String getMsg() {
method setMsg (line 38) | public void setMsg(String msg) {
FILE: springboot-idempotent/src/main/java/cn/haoxy/redis/token/interceptor/ApiIdempotentInterceptor.java
class ApiIdempotentInterceptor (line 20) | public class ApiIdempotentInterceptor implements HandlerInterceptor {
method preHandle (line 25) | @Override
method check (line 42) | private void check(HttpServletRequest request) {
FILE: springboot-idempotent/src/main/java/cn/haoxy/redis/token/service/TestService.java
type TestService (line 11) | public interface TestService {
method testIdempotence (line 13) | ServerResponse testIdempotence();
FILE: springboot-idempotent/src/main/java/cn/haoxy/redis/token/service/TokenService.java
type TokenService (line 13) | public interface TokenService {
method createToken (line 15) | ServerResponse createToken();
method checkToken (line 17) | void checkToken(HttpServletRequest request);
FILE: springboot-idempotent/src/main/java/cn/haoxy/redis/token/service/impl/TestServiceImpl.java
class TestServiceImpl (line 16) | @Service
method testIdempotence (line 21) | @Override
FILE: springboot-idempotent/src/main/java/cn/haoxy/redis/token/service/impl/TokenServiceImpl.java
class TokenServiceImpl (line 24) | @Service
method createToken (line 33) | @Override
method checkToken (line 44) | @Override
FILE: springboot-idempotent/src/main/java/cn/haoxy/redis/token/utils/JedisUtil.java
class JedisUtil (line 16) | @Component
method getJedis (line 23) | private Jedis getJedis() {
method set (line 34) | public String set(String key, String value) {
method set (line 55) | public String set(String key, String value, int expireTime) {
method setnx (line 75) | public Long setnx(String key, String value) {
method get (line 94) | public String get(String key) {
method del (line 113) | public Long del(String key) {
method exists (line 132) | public Boolean exists(String key) {
method expire (line 152) | public Long expire(String key, int expireTime) {
method ttl (line 171) | public Long ttl(String key) {
method close (line 184) | private void close(Jedis jedis) {
FILE: springboot-idempotent/src/main/java/cn/haoxy/redis/token/utils/RandomUtil.java
class RandomUtil (line 12) | public class RandomUtil {
method UUID32 (line 20) | public static String UUID32() {
method UUID36 (line 25) | public static String UUID36() {
method generateStr (line 35) | public static String generateStr(int length) {
method generateDigitalStr (line 50) | public static String generateDigitalStr(int length) {
method generateLetterStr (line 65) | public static String generateLetterStr(int length) {
method generateLowerStr (line 80) | public static String generateLowerStr(int length) {
method generateUpperStr (line 90) | public static String generateUpperStr(int length) {
method generateZeroStr (line 100) | public static String generateZeroStr(int length) {
method generateStrWithZero (line 115) | public static String generateStrWithZero(int num, int strLength) {
FILE: springboot-login-Interceptor/src/main/java/cn/haoxy/interceptor/InterApplication.java
class InterApplication (line 13) | @SpringBootApplication
method main (line 17) | public static void main(String[] args) {
FILE: springboot-login-Interceptor/src/main/java/cn/haoxy/interceptor/config/AuthenticationInterceptor.java
class AuthenticationInterceptor (line 34) | public class AuthenticationInterceptor implements HandlerInterceptor {
method preHandle (line 45) | @Override
method postHandle (line 138) | @Override
method afterCompletion (line 143) | @Override
method shutdownResponse (line 153) | private void shutdownResponse(HttpServletResponse response) throws IOE...
FILE: springboot-login-Interceptor/src/main/java/cn/haoxy/interceptor/config/MvcConfigurer.java
class MvcConfigurer (line 13) | @Configuration
method addInterceptors (line 16) | @Override
method authenticationInterceptor (line 22) | @Bean
FILE: springboot-login-Interceptor/src/main/java/cn/haoxy/interceptor/controller/LoginController.java
class LoginController (line 21) | @RestController
method login (line 31) | @PostMapping("login")
FILE: springboot-login-Interceptor/src/main/java/cn/haoxy/interceptor/controller/UserController.java
class UserController (line 17) | @RestController
method findByUserId (line 21) | @LoginRequired
FILE: springboot-login-Interceptor/src/main/java/cn/haoxy/interceptor/model/User.java
class User (line 5) | @Data
method User (line 14) | public User(String id, String name, String password) {
FILE: springboot-login-Interceptor/src/main/java/cn/haoxy/interceptor/service/UserService.java
class UserService (line 12) | @Service
method findById (line 15) | public User findById(String id) {
method findByName (line 22) | public User findByName(String name,String password) {
FILE: springboot-login-Interceptor/src/main/java/cn/haoxy/interceptor/utils/CacheCollection.java
class CacheCollection (line 16) | @Component
method getUser (line 28) | public static User getUser(String id) {
method getUserByName (line 40) | public static User getUserByName(String name, String password) {
method getSize (line 57) | public static Integer getSize() {
FILE: springboot-login-Interceptor/src/main/java/cn/haoxy/interceptor/utils/TokenUtils.java
class TokenUtils (line 17) | public class TokenUtils {
method createJwtToken (line 30) | public static String createJwtToken(String id) {
method createJwtrToken (line 43) | public static String createJwtrToken(String id) {
method createJwtToken (line 59) | public static String createJwtToken(String id, String issuer, String s...
method parseJWT (line 95) | public static Claims parseJWT(String jwt) {
method main (line 104) | public static void main(String[] args) {
FILE: springboot-mongodb/src/main/java/cn/haoxy/mongodb/MongodbApplication.java
class MongodbApplication (line 11) | @SpringBootApplication
method main (line 13) | public static void main(String[] args) {
FILE: springboot-mongodb/src/main/java/cn/haoxy/mongodb/controller/CmsPageController.java
class CmsPageController (line 17) | @RestController
method findList (line 24) | @GetMapping("/list/{page}/{size}")
FILE: springboot-mongodb/src/main/java/cn/haoxy/mongodb/dao/CmsPageRepository.java
type CmsPageRepository (line 13) | public interface CmsPageRepository extends MongoRepository<CmsPage, Stri...
method findByPageName (line 22) | CmsPage findByPageName(String pageName);
method findByPageNameAndPageType (line 26) | CmsPage findByPageNameAndPageType(String pageName, String pageType);
method countBySiteIdAndPageType (line 30) | int countBySiteIdAndPageType(String siteId, String pageType);
method findBySiteIdAndPageType (line 34) | Page<CmsPage> findBySiteIdAndPageType(String siteId, String pageType, ...
method findAll (line 36) | Page<CmsPage> findAll(Pageable pageable);
FILE: springboot-mongodb/src/main/java/cn/haoxy/mongodb/domain/CmsPage.java
class CmsPage (line 17) | @Data
FILE: springboot-mongodb/src/main/java/cn/haoxy/mongodb/domain/CmsPageParam.java
class CmsPageParam (line 12) | @Data
FILE: springboot-mongodb/src/main/java/cn/haoxy/mongodb/request/QueryPageRequest.java
class QueryPageRequest (line 11) | @Data
FILE: springboot-mongodb/src/main/java/cn/haoxy/mongodb/response/CommonCode.java
type CommonCode (line 12) | @ToString
method CommonCode (line 27) | private CommonCode(boolean success,int code, String message){
method success (line 33) | @Override
method code (line 37) | @Override
method message (line 42) | @Override
FILE: springboot-mongodb/src/main/java/cn/haoxy/mongodb/response/QueryResponseResult.java
class QueryResponseResult (line 6) | @Data
method QueryResponseResult (line 12) | public QueryResponseResult(ResultCode resultCode,QueryResult queryResu...
FILE: springboot-mongodb/src/main/java/cn/haoxy/mongodb/response/QueryResult.java
class QueryResult (line 14) | @Data
FILE: springboot-mongodb/src/main/java/cn/haoxy/mongodb/response/Response.java
type Response (line 6) | public interface Response {
FILE: springboot-mongodb/src/main/java/cn/haoxy/mongodb/response/ResponseResult.java
class ResponseResult (line 13) | @Data
method ResponseResult (line 27) | public ResponseResult(ResultCode resultCode){
method SUCCESS (line 33) | public static ResponseResult SUCCESS(){
method FAIL (line 36) | public static ResponseResult FAIL(){
FILE: springboot-mongodb/src/main/java/cn/haoxy/mongodb/response/ResultCode.java
type ResultCode (line 11) | public interface ResultCode {
method success (line 13) | boolean success();
method code (line 15) | int code();
method message (line 17) | String message();
FILE: springboot-mongodb/src/main/java/cn/haoxy/mongodb/service/PageService.java
class PageService (line 20) | @Service
method findList (line 27) | public QueryResponseResult findList(int page, int size, QueryPageReque...
FILE: springboot-mongodb/src/test/java/cn/haoxy/mongodb/CmsPageRepositoryTest.java
class CmsPageRepositoryTest (line 25) | @SpringBootTest(classes = MongodbApplication.class)
method testFindPage (line 34) | @Test
method testSave (line 43) | @Test
method testUpdate (line 61) | @Test
FILE: springboot-mybatis-myehcache/src/main/java/com/haoxy/example/AppEhcache.java
class AppEhcache (line 13) | @SpringBootApplication
method main (line 16) | public static void main(String[] args) {
FILE: springboot-mybatis-myehcache/src/main/java/com/haoxy/example/controller/PersonController.java
class PersonController (line 22) | @RestController
method insert (line 28) | @RequestMapping("/add")
method update (line 39) | @RequestMapping("/update")
method findAll (line 51) | @RequestMapping("/findAll")
method findAllPerson (line 60) | @RequestMapping("/findAllPerson")
method findByPage (line 69) | @RequestMapping("/findPage")
method cacheByFindAll (line 77) | @RequestMapping("/cacheFindAll")
method cacheFindAllPerson (line 89) | @RequestMapping("/cacheFindAllPerson")
FILE: springboot-mybatis-myehcache/src/main/java/com/haoxy/example/mapper/PersonMapper.java
type PersonMapper (line 14) | @Mapper
method deleteByPrimaryKey (line 17) | int deleteByPrimaryKey(Long id);
method insert (line 19) | int insert(Person record);
method insertSelective (line 21) | int insertSelective(Person record);
method selectByPrimaryKey (line 23) | Person selectByPrimaryKey(Long id);
method updateByPrimaryKeySelective (line 25) | int updateByPrimaryKeySelective(Person record);
method updateByPrimaryKey (line 27) | int updateByPrimaryKey(Person record);
method findAll (line 34) | List<Person> findAll();
method findByPage (line 41) | Page<Person> findByPage();
method findAllPerson (line 43) | List<Person> findAllPerson();
FILE: springboot-mybatis-myehcache/src/main/java/com/haoxy/example/model/Person.java
class Person (line 10) | public class Person implements Serializable {
method getId (line 29) | public Long getId() {
method setId (line 33) | public void setId(Long id) {
method getName (line 37) | public String getName() {
method setName (line 41) | public void setName(String name) {
method getAge (line 45) | public Integer getAge() {
method setAge (line 49) | public void setAge(Integer age) {
method getAddress (line 53) | public String getAddress() {
method setAddress (line 57) | public void setAddress(String address) {
FILE: springboot-mybatis-myehcache/src/main/java/com/haoxy/example/page/PageInfo.java
class PageInfo (line 18) | @SuppressWarnings({"rawtypes", "unchecked"})
method PageInfo (line 37) | public PageInfo() {
method PageInfo (line 45) | public PageInfo(List<T> list) {
method judgePageBoudary (line 71) | private void judgePageBoudary() {
method getPageNum (line 76) | public int getPageNum() {
method setPageNum (line 80) | public void setPageNum(int pageNum) {
method getPageSize (line 84) | public int getPageSize() {
method setPageSize (line 88) | public void setPageSize(int pageSize) {
method getTotal (line 92) | public long getTotal() {
method setTotal (line 96) | public void setTotal(long total) {
method getPages (line 100) | public int getPages() {
method setPages (line 104) | public void setPages(int pages) {
method getList (line 108) | public List<T> getList() {
method setList (line 112) | public void setList(List<T> list) {
method isIsFirstPage (line 116) | public boolean isIsFirstPage() {
method setIsFirstPage (line 120) | public void setIsFirstPage(boolean isFirstPage) {
method isIsLastPage (line 124) | public boolean isIsLastPage() {
method setIsLastPage (line 128) | public void setIsLastPage(boolean isLastPage) {
method toString (line 132) | @Override
FILE: springboot-mybatis-myehcache/src/main/java/com/haoxy/example/service/PersonService.java
type PersonService (line 13) | public interface PersonService {
method findAll (line 15) | List<Person> findAll();
method findByPage (line 23) | Page<Person> findByPage(int pageNo, int pageSize);
method insert (line 25) | void insert(Person person);
method uptate (line 28) | void uptate(Long id);
method findById (line 30) | Person findById(Long id);
method uptatePerson (line 32) | int uptatePerson(Person person1);
method findAllPerson (line 34) | List<Person> findAllPerson();
FILE: springboot-mybatis-myehcache/src/main/java/com/haoxy/example/service/impl/PersonServiceImpl.java
class PersonServiceImpl (line 19) | @Service
method findAll (line 23) | @Override
method findByPage (line 28) | @Override
method insert (line 34) | @Override
method uptate (line 40) | @Override
method findById (line 45) | @Override
method uptatePerson (line 51) | @Override
method findAllPerson (line 57) | @Override
FILE: springboot-mybatis-myehcache/src/test/java/com/haoxy/test/DataSourceTests.java
class DataSourceTests (line 18) | @RunWith(SpringRunner.class)
method testDataSource (line 27) | @Test
FILE: springboot-mybatis-myehcache/src/test/java/com/haoxy/test/PersonMapperTests.java
class PersonMapperTests (line 25) | @RunWith(SpringRunner.class)
method testInsert (line 34) | @Before
method testFindAll (line 46) | @Test
method testFindByPage (line 54) | @Test
method testCacheByPage (line 64) | @Test
FILE: springboot-oauth2-authorization-server/src/main/java/cn/merryyou/security/SpringBoot2Oauth2Application.java
class SpringBoot2Oauth2Application (line 27) | @RestController
method main (line 38) | public static void main(String[] args) {
method getCurrentUserJwt (line 42) | @GetMapping("/userJwt")
method getCurrentUserRedis (line 56) | @GetMapping("/userRedis")
FILE: springboot-oauth2-authorization-server/src/main/java/cn/merryyou/security/config/TokenStoreConfig.java
class TokenStoreConfig (line 22) | @Configuration
method redisTokenStore (line 36) | @Bean
class JwtTokenCofnig (line 45) | @Configuration
method jwtTokenStore (line 57) | @Bean
method jwtAccessTokenConverter (line 67) | @Bean
method jwtTokenEnhancer (line 79) | @Bean
FILE: springboot-oauth2-authorization-server/src/main/java/cn/merryyou/security/handler/AppLoginInSuccessHandler.java
class AppLoginInSuccessHandler (line 33) | @Slf4j
method onAuthenticationSuccess (line 49) | @Override
method extractAndDecodeHeader (line 96) | private String[] extractAndDecodeHeader(String header, HttpServletRequ...
FILE: springboot-oauth2-authorization-server/src/main/java/cn/merryyou/security/properties/OAuth2ClientProperties.java
class OAuth2ClientProperties (line 10) | @Data
method getClientId (line 19) | public String getClientId() {
method setClientId (line 23) | public void setClientId(String clientId) {
method getClientSecret (line 27) | public String getClientSecret() {
method setClientSecret (line 31) | public void setClientSecret(String clientSecret) {
method getAccessTokenValiditySeconds (line 35) | public Integer getAccessTokenValiditySeconds() {
method setAccessTokenValiditySeconds (line 39) | public void setAccessTokenValiditySeconds(Integer accessTokenValidityS...
FILE: springboot-oauth2-authorization-server/src/main/java/cn/merryyou/security/properties/OAuth2CoreConfig.java
class OAuth2CoreConfig (line 11) | @Configuration
FILE: springboot-oauth2-authorization-server/src/main/java/cn/merryyou/security/properties/OAuth2Properties.java
class OAuth2Properties (line 11) | @Data
method getJwtSigningKey (line 19) | public String getJwtSigningKey() {
method setJwtSigningKey (line 23) | public void setJwtSigningKey(String jwtSigningKey) {
method getClients (line 27) | public OAuth2ClientProperties[] getClients() {
method setClients (line 31) | public void setClients(OAuth2ClientProperties[] clients) {
FILE: springboot-oauth2-authorization-server/src/main/java/cn/merryyou/security/security/MyUserDetailsService.java
class MyUserDetailsService (line 20) | @Component
method loadUserByUsername (line 26) | public UserDetails loadUserByUsername(String username) throws Username...
FILE: springboot-oauth2-authorization-server/src/main/java/cn/merryyou/security/security/SecurityConfig.java
class SecurityConfig (line 17) | @Configuration
method authenticationManagerBean (line 20) | @Bean
method passwordEncoder (line 27) | @Bean
method configure (line 32) | @Override
FILE: springboot-oauth2-authorization-server/src/main/java/cn/merryyou/security/security/jwt/MerryyouJwtTokenEnhancer.java
class MerryyouJwtTokenEnhancer (line 16) | public class MerryyouJwtTokenEnhancer implements TokenEnhancer {
method enhance (line 18) | public OAuth2AccessToken enhance(OAuth2AccessToken accessToken, OAuth2...
FILE: springboot-oauth2-authorization-server/src/main/java/cn/merryyou/security/server/MerryyouAuthorizationServerConfig.java
class MerryyouAuthorizationServerConfig (line 30) | @Configuration
method configure (line 55) | @Override
method configure (line 79) | @Override
FILE: springboot-oauth2-authorization-server/src/main/java/cn/merryyou/security/server/MerryyouResourceServerConfig.java
class MerryyouResourceServerConfig (line 15) | @Configuration
method configure (line 25) | @Override
FILE: springboot-oauth2-authorization-server/src/main/java/cn/merryyou/security/utils/JsonUtil.java
class JsonUtil (line 11) | public class JsonUtil {
method toJson (line 12) | public static String toJson(Object object){
FILE: springboot-oauth2-authorization-server/src/test/java/cn/merryyou/security/SpringBoot2Oauth2Test.java
class SpringBoot2Oauth2Test (line 22) | @RunWith(SpringRunner.class)
method getUserInfo (line 44) | @Test
method signInTest (line 59) | @Test
method getAccessToken (line 81) | private String getAccessToken() {
method getBasicAuthHeader (line 104) | private String getBasicAuthHeader() {
FILE: springboot-oauth2-resource-server/src/main/java/cn/merryyou/security/SpringBoot2Oauth2ResourceApplication.java
class SpringBoot2Oauth2ResourceApplication (line 15) | @SpringBootApplication
method main (line 19) | public static void main(String[] args) {
method success (line 23) | @RequestMapping(value = "/api")
FILE: springboot-oauth2-resource-server/src/main/java/cn/merryyou/security/config/TokenStoreConfig.java
class TokenStoreConfig (line 18) | @Configuration
method redisTokenStore (line 31) | @Bean
class JwtTokenCofnig (line 40) | @Configuration
method jwtTokenStore (line 49) | @Bean
method jwtAccessTokenConverter (line 58) | @Bean
FILE: springboot-oauth2-resource-server/src/main/java/cn/merryyou/security/resource/MerryyouResourceServerConfiguration.java
class MerryyouResourceServerConfiguration (line 17) | @Configuration
method configure (line 24) | @Override
method configure (line 31) | @Override
FILE: springboot-rabbitmq-ack/src/main/java/com/haoxy/rabbitmq/RabbitmqApp.java
class RabbitmqApp (line 11) | @SpringBootApplication
method main (line 13) | public static void main(String[] args) {
FILE: springboot-rabbitmq-ack/src/main/java/com/haoxy/rabbitmq/comsumer/Receiver.java
class Receiver (line 17) | @Component
method message (line 29) | @RabbitListener(queues = {"DIRECT_QUEUE"})
method on (line 42) | @RabbitListener(queues = {"FANOUT_QUEUE_A"})
method t (line 55) | @RabbitListener(queues = {"FANOUT_QUEUE_B"})
FILE: springboot-rabbitmq-ack/src/main/java/com/haoxy/rabbitmq/config/RabbitConfig.java
class RabbitConfig (line 19) | @Configuration
method amqpTemplate (line 35) | @Bean
method directExchange (line 65) | @Bean("directExchange")
method directQueue (line 75) | @Bean("directQueue")
method directBinding (line 87) | @Bean
method fanoutExchange (line 99) | @Bean("fanoutExchange")
method fanoutQueueA (line 109) | @Bean("fanoutQueueA")
method fanoutQueueB (line 119) | @Bean("fanoutQueueB")
method bindingA (line 131) | @Bean
method bindingB (line 143) | @Bean
FILE: springboot-rabbitmq-ack/src/main/java/com/haoxy/rabbitmq/controller/SendController.java
class SendController (line 16) | @RestController
method direct (line 28) | @RequestMapping("/direct")
method send (line 41) | @RequestMapping("/fanout")
FILE: springboot-rabbitmq-ack/src/main/java/com/haoxy/rabbitmq/model/ResponseEntity.java
class ResponseEntity (line 10) | public class ResponseEntity implements Serializable {
method ResponseEntity (line 18) | private ResponseEntity(int statusCode, String msg, Object object) {
method getStatusCode (line 24) | public int getStatusCode() {
method getMsg (line 28) | public String getMsg() {
method getObject (line 32) | public Object getObject() {
method ok (line 36) | public static ResponseEntity ok() {
method toString (line 41) | @Override
FILE: springboot-rabbitmq/src/main/java/com/hxy/rabbitmq/RabbitmqApp.java
class RabbitmqApp (line 12) | @SpringBootApplication
method main (line 15) | public static void main(String[] args) {
FILE: springboot-rabbitmq/src/main/java/com/hxy/rabbitmq/config/FanoutRabbitConfig.java
class FanoutRabbitConfig (line 14) | @Configuration
method AMessage (line 17) | @Bean
method BMessage (line 22) | @Bean
method CMessage (line 27) | @Bean
method fanoutExchange (line 32) | @Bean
method bindingExchangeA (line 37) | @Bean
method bindingExchangeB (line 42) | @Bean
method bindingExchangeC (line 47) | @Bean
FILE: springboot-rabbitmq/src/main/java/com/hxy/rabbitmq/config/RabbitConfig.java
class RabbitConfig (line 12) | @Configuration
method helloQueue (line 14) | @Bean
method hxyQueue (line 19) | @Bean
method ObjectQueue (line 24) | @Bean
FILE: springboot-rabbitmq/src/main/java/com/hxy/rabbitmq/config/TopicRabbitConfig.java
class TopicRabbitConfig (line 15) | @Configuration
method queueMessage (line 22) | @Bean
method queueMessages (line 27) | @Bean
method exchange (line 32) | @Bean
method bindingExchangeMessage (line 37) | @Bean
method bindingExchangeMessages (line 42) | @Bean
FILE: springboot-rabbitmq/src/main/java/com/hxy/rabbitmq/fanout/FanoutReceiverA.java
class FanoutReceiverA (line 12) | @Component
method process (line 15) | @RabbitHandler
FILE: springboot-rabbitmq/src/main/java/com/hxy/rabbitmq/fanout/FanoutReceiverB.java
class FanoutReceiverB (line 12) | @Component
method process (line 16) | @RabbitHandler
FILE: springboot-rabbitmq/src/main/java/com/hxy/rabbitmq/fanout/FanoutReceiverC.java
class FanoutReceiverC (line 12) | @Component
method process (line 15) | @RabbitHandler
FILE: springboot-rabbitmq/src/main/java/com/hxy/rabbitmq/fanout/FanoutSender.java
class FanoutSender (line 12) | @Component
method send (line 17) | public void send() {
FILE: springboot-rabbitmq/src/main/java/com/hxy/rabbitmq/hello/HelloReceiver.java
class HelloReceiver (line 14) | @Component
method process (line 18) | @RabbitHandler
FILE: springboot-rabbitmq/src/main/java/com/hxy/rabbitmq/hello/HelloSender.java
class HelloSender (line 14) | @Component
method send (line 20) | public void send() {
FILE: springboot-rabbitmq/src/main/java/com/hxy/rabbitmq/many/NeoReceiver1.java
class NeoReceiver1 (line 12) | @Component
method process (line 16) | @RabbitHandler
FILE: springboot-rabbitmq/src/main/java/com/hxy/rabbitmq/many/NeoReceiver2.java
class NeoReceiver2 (line 12) | @Component
method process (line 16) | @RabbitHandler
FILE: springboot-rabbitmq/src/main/java/com/hxy/rabbitmq/many/NeoSender1.java
class NeoSender1 (line 12) | @Component
method send (line 18) | public void send(int i) {
FILE: springboot-rabbitmq/src/main/java/com/hxy/rabbitmq/many/NeoSender2.java
class NeoSender2 (line 12) | @Component
method send (line 17) | public void send(int i) {
FILE: springboot-rabbitmq/src/main/java/com/hxy/rabbitmq/model/User.java
class User (line 13) | public class User implements Serializable {
method getName (line 19) | public String getName() {
method setName (line 23) | public void setName(String name) {
method getPass (line 27) | public String getPass() {
method setPass (line 31) | public void setPass(String pass) {
method toString (line 35) | @Override
FILE: springboot-rabbitmq/src/main/java/com/hxy/rabbitmq/object/ObjectReceiver.java
class ObjectReceiver (line 13) | @Component
method process (line 17) | @RabbitHandler
FILE: springboot-rabbitmq/src/main/java/com/hxy/rabbitmq/object/ObjectSender.java
class ObjectSender (line 14) | @Component
method send (line 19) | public void send(User user) {
FILE: springboot-rabbitmq/src/main/java/com/hxy/rabbitmq/topic/TopicReceiver1.java
class TopicReceiver1 (line 12) | @Component
method process (line 15) | @RabbitHandler
FILE: springboot-rabbitmq/src/main/java/com/hxy/rabbitmq/topic/TopicReceiver2.java
class TopicReceiver2 (line 12) | @Component
method process (line 16) | @RabbitHandler
FILE: springboot-rabbitmq/src/main/java/com/hxy/rabbitmq/topic/TopicSender.java
class TopicSender (line 12) | @Component
method send (line 18) | public void send() {
method send1 (line 25) | public void send1() {
method send2 (line 31) | public void send2() {
FILE: springboot-rabbitmq/src/test/java/com/hxy/rabbitmq/FanoutTest.java
class FanoutTest (line 15) | @RunWith(SpringRunner.class)
method fanoutSender (line 22) | @Test
FILE: springboot-rabbitmq/src/test/java/com/hxy/rabbitmq/HelloTest.java
class HelloTest (line 15) | @RunWith(SpringRunner.class)
method hello (line 22) | @Test
FILE: springboot-rabbitmq/src/test/java/com/hxy/rabbitmq/ManyTest.java
class ManyTest (line 16) | @RunWith(SpringRunner.class)
method oneToMany (line 26) | @Test
method manyToMany (line 33) | @Test
FILE: springboot-rabbitmq/src/test/java/com/hxy/rabbitmq/ObjectTest.java
class ObjectTest (line 16) | @RunWith(SpringRunner.class)
method sendOject (line 23) | @Test
FILE: springboot-rabbitmq/src/test/java/com/hxy/rabbitmq/TopicTest.java
class TopicTest (line 15) | @RunWith(SpringRunner.class)
method topic (line 22) | @Test
method topic1 (line 27) | @Test
method topic2 (line 32) | @Test
FILE: springboot-redis-docker/src/main/java/com/haoxy/example/SpringBootDemoApplication.java
class SpringBootDemoApplication (line 16) | @RestController
method getCount (line 24) | @GetMapping("/count")
method main (line 34) | public static void main(String[] args) {
FILE: springboot-redis-docker/src/main/resources/static/js/countdown.js
function countdown_proc (line 19) | function countdown_proc() {
FILE: springboot-redis-docker/src/main/resources/static/js/jquery.js
function M (line 4) | function M(e){var t=e.length,n=x.type(e);return x.isWindow(e)?!1:1===e.n...
function at (line 4) | function at(e,t,n,i){var o,a,s,l,u,c,d,m,y,x;if((t?t.ownerDocument||t:w)...
function st (line 4) | function st(){var e=[];function t(n,r){return e.push(n+=" ")>o.cacheLeng...
function lt (line 4) | function lt(e){return e[b]=!0,e}
function ut (line 4) | function ut(e){var t=f.createElement("div");try{return!!e(t)}catch(n){re...
function ct (line 4) | function ct(e,t){var n=e.split("|"),r=e.length;while(r--)o.attrHandle[n[...
function pt (line 4) | function pt(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sou...
function ft (line 4) | function ft(e){return function(t){var n=t.nodeName.toLowerCase();return"...
function dt (line 4) | function dt(e){return function(t){var n=t.nodeName.toLowerCase();return(...
function ht (line 4) | function ht(e){return lt(function(t){return t=+t,lt(function(n,r){var i,...
function gt (line 4) | function gt(){}
function mt (line 4) | function mt(e,t){var n,r,i,a,s,l,u,c=k[e+" "];if(c)return t?0:c.slice(0)...
function yt (line 4) | function yt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}
function vt (line 4) | function vt(e,t,n){var r=t.dir,o=n&&"parentNode"===r,a=C++;return t.firs...
function bt (line 4) | function bt(e){return e.length>1?function(t,n,r){var i=e.length;while(i-...
function xt (line 4) | function xt(e,t,n,r,i){var o,a=[],s=0,l=e.length,u=null!=t;for(;l>s;s++)...
function wt (line 4) | function wt(e,t,n,r,i,o){return r&&!r[b]&&(r=wt(r)),i&&!i[b]&&(i=wt(i,o)...
function Tt (line 4) | function Tt(e){var t,n,r,i=e.length,a=o.relative[e[0].type],s=a||o.relat...
function Ct (line 4) | function Ct(e,t){var n=0,r=t.length>0,a=e.length>0,s=function(s,l,c,p,d)...
function Nt (line 4) | function Nt(e,t,n){var r=0,i=t.length;for(;i>r;r++)at(e,t[r],n);return n}
function kt (line 4) | function kt(e,t,n,i){var a,s,u,c,p,f=mt(e);if(!i&&1===f.length){if(s=f[0...
function F (line 4) | function F(e){var t=O[e]={};return x.each(e.match(T)||[],function(e,n){t...
function R (line 5) | function R(e,n,r,i){if(x.acceptData(e)){var o,a,s=x.expando,l=e.nodeType...
function W (line 5) | function W(e,t,n){if(x.acceptData(e)){var r,i,o=e.nodeType,a=o?x.cache:e...
function $ (line 5) | function $(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(P,"-...
function I (line 5) | function I(e){var t;for(t in e)if(("data"!==t||!x.isEmptyObject(e[t]))&&...
function it (line 5) | function it(){return!0}
function ot (line 5) | function ot(){return!1}
function at (line 5) | function at(){try{return a.activeElement}catch(e){}}
function pt (line 5) | function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}
function ft (line 5) | function ft(e,t,n){if(x.isFunction(t))return x.grep(e,function(e,r){retu...
function dt (line 5) | function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.cre...
function Lt (line 5) | function Lt(e,t){return x.nodeName(e,"table")&&x.nodeName(1===t.nodeType...
function Ht (line 5) | function Ht(e){return e.type=(null!==x.find.attr(e,"type"))+"/"+e.type,e}
function qt (line 5) | function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttrib...
function _t (line 5) | function _t(e,t){var n,r=0;for(;null!=(n=e[r]);r++)x._data(n,"globalEval...
function Mt (line 5) | function Mt(e,t){if(1===t.nodeType&&x.hasData(e)){var n,r,i,o=x._data(e)...
function Ot (line 5) | function Ot(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCas...
function Ft (line 5) | function Ft(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getEl...
function Bt (line 5) | function Bt(e){Ct.test(e.type)&&(e.defaultChecked=e.checked)}
function tn (line 6) | function tn(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.sl...
function nn (line 6) | function nn(e,t){return e=t||e,"none"===x.css(e,"display")||!x.contains(...
function rn (line 6) | function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.sty...
function on (line 6) | function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[...
function an (line 6) | function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:...
function sn (line 6) | function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o...
function ln (line 6) | function ln(e){var t=a,n=Gt[e];return n||(n=un(e,t),"none"!==n&&n||(Pt=(...
function un (line 6) | function un(e,t){var n=x(t.createElement(e)).appendTo(t.body),r=x.css(n[...
function gn (line 6) | function gn(e,t,n,r){var i;if(x.isArray(t))x.each(t,function(t,i){n||pn....
function Hn (line 6) | function Hn(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var ...
function qn (line 6) | function qn(e,n,r,i){var o={},a=e===jn;function s(l){var u;return o[l]=!...
function _n (line 6) | function _n(e,n){var r,i,o=x.ajaxSettings.flatOptions||{};for(i in n)n[i...
function k (line 6) | function k(e,n,r,i){var c,y,v,w,T,N=n;2!==b&&(b=2,s&&clearTimeout(s),u=t...
function Mn (line 6) | function Mn(e,n,r){var i,o,a,s,l=e.contents,u=e.dataTypes;while("*"===u[...
function On (line 6) | function On(e,t,n,r){var i,o,a,s,l,u={},c=e.dataTypes.slice();if(c[1])fo...
function In (line 6) | function In(){try{return new e.XMLHttpRequest}catch(t){}}
function zn (line 6) | function zn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(...
function Kn (line 6) | function Kn(){return setTimeout(function(){Xn=t}),Xn=x.now()}
function Zn (line 6) | function Zn(e,t,n){var r,i=(Qn[t]||[]).concat(Qn["*"]),o=0,a=i.length;fo...
function er (line 6) | function er(e,t,n){var r,i,o=0,a=Gn.length,s=x.Deferred().always(functio...
function tr (line 6) | function tr(e,t){var n,r,i,o,a;for(n in e)if(r=x.camelCase(n),i=t[r],o=e...
function nr (line 6) | function nr(e,t,n){var r,i,o,a,s,l,u=this,c={},p=e.style,f=e.nodeType&&n...
function rr (line 6) | function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}
function ir (line 6) | function ir(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=Zt[i],r...
function or (line 6) | function or(e){return x.isWindow(e)?e:9===e.nodeType?e.defaultView||e.pa...
FILE: springboot-swagger-enhance/src/main/java/cn/haoxiaoyong/swagger/enhance/ApiApplication.java
class ApiApplication (line 12) | @SpringBootApplication
method main (line 15) | public static void main(String[] args) {
FILE: springboot-swagger-enhance/src/main/java/cn/haoxiaoyong/swagger/enhance/common/ApiResponse.java
class ApiResponse (line 18) | @Data
FILE: springboot-swagger-enhance/src/main/java/cn/haoxiaoyong/swagger/enhance/config/SwaggerConfiguration.java
class SwaggerConfiguration (line 19) | @Configuration
method createRestApi (line 23) | @Bean
method apiInfo (line 33) | private ApiInfo apiInfo() {
FILE: springboot-swagger-enhance/src/main/java/cn/haoxiaoyong/swagger/enhance/controller/UserController.java
class UserController (line 21) | @RestController
method getByUserName (line 27) | @GetMapping
method get (line 35) | @GetMapping("/{id}")
method delete (line 43) | @DeleteMapping("/{id}")
method post (line 50) | @PostMapping
method multipar (line 57) | @PostMapping("/multipar")
method array (line 65) | @PostMapping("/array")
method put (line 72) | @PutMapping("/{id}")
method file (line 78) | @PostMapping("/{id}/file")
FILE: springboot-swagger-enhance/src/main/java/cn/haoxiaoyong/swagger/enhance/entity/User.java
class User (line 16) | @Data
FILE: springboot-threadpool/src/main/java/cn/haoxiaoyong/thread/pool/Application.java
class Application (line 12) | @SpringBootApplication
method main (line 15) | public static void main(String[] args) {
FILE: springboot-threadpool/src/main/java/cn/haoxiaoyong/thread/pool/boot/OrderQueueThread.java
class OrderQueueThread (line 13) | public class OrderQueueThread implements Runnable {
method run (line 17) | @Override
FILE: springboot-threadpool/src/main/java/cn/haoxiaoyong/thread/pool/boot/TestController.java
class TestController (line 15) | @RestController
method submitUser (line 24) | @RequestMapping("user")
method submitOrder (line 36) | @RequestMapping("order")
FILE: springboot-threadpool/src/main/java/cn/haoxiaoyong/thread/pool/boot/ThreadPoolConfig.java
class ThreadPoolConfig (line 16) | @Configuration
method buildUserQueueThreadPool (line 24) | @Bean(value = "userThreadPool")
method buildOrderQueueThreadPool (line 39) | @Bean(value = "orderThreadPool")
FILE: springboot-threadpool/src/main/java/cn/haoxiaoyong/thread/pool/boot/ThreadService.java
type ThreadService (line 9) | public interface ThreadService {
method executeAsync (line 14) | void executeAsync();
method executeAsyncByOrder (line 19) | void executeAsyncByOrder();
FILE: springboot-threadpool/src/main/java/cn/haoxiaoyong/thread/pool/boot/ThreadServiceImpl.java
class ThreadServiceImpl (line 18) | @Service
method executeAsync (line 29) | @Override
method executeAsyncByOrder (line 41) | @Override
FILE: springboot-web-thymeleaf/src/main/java/com/haoxy/thymeleaf/ThymeleafApplication.java
class ThymeleafApplication (line 16) | @SpringBootApplication
method messageRepository (line 18) | @Bean
method messageConverter (line 23) | @Bean
method main (line 33) | public static void main(String[] args) {
FILE: springboot-web-thymeleaf/src/main/java/com/haoxy/thymeleaf/controller/MessageController.java
class MessageController (line 18) | @Controller
method MessageController (line 24) | public MessageController(MessageRepository messageRepository) {
method list (line 28) | @GetMapping
method view (line 34) | @GetMapping("{id}")
method createForm (line 39) | @GetMapping(params = "form")
method create (line 44) | @PostMapping(value = "add")
method foo (line 55) | @RequestMapping("foo")
method delete (line 60) | @GetMapping(value = "delete/{id}")
method modifyForm (line 67) | @GetMapping(value = "modify/{id}")
FILE: springboot-web-thymeleaf/src/main/java/com/haoxy/thymeleaf/model/Message.java
class Message (line 12) | public class Message {
method isEnableFlag (line 25) | public boolean isEnableFlag() {
method setEnableFlag (line 29) | public void setEnableFlag(boolean enableFlag) {
method getGender (line 33) | public String getGender() {
method setGender (line 37) | public void setGender(String gender) {
method getId (line 43) | public Long getId() {
method setId (line 47) | public void setId(Long id) {
method getCreated (line 51) | public Calendar getCreated() {
method setCreated (line 55) | public void setCreated(Calendar created) {
method getText (line 59) | public String getText() {
method setText (line 63) | public void setText(String text) {
method getSummary (line 67) | public String getSummary() {
method setSummary (line 71) | public void setSummary(String summary) {
FILE: springboot-web-thymeleaf/src/main/java/com/haoxy/thymeleaf/repository/InMemoryMessageRepository.java
class InMemoryMessageRepository (line 14) | public class InMemoryMessageRepository implements MessageRepository {
method findAll (line 20) | @Override
method save (line 25) | @Override
method findMessage (line 36) | @Override
method deleteMessage (line 41) | @Override
FILE: springboot-web-thymeleaf/src/main/java/com/haoxy/thymeleaf/repository/MessageRepository.java
type MessageRepository (line 10) | public interface MessageRepository {
method findAll (line 12) | Iterable<Message> findAll();
method save (line 14) | Message save(Message message);
method findMessage (line 16) | Message findMessage(Long id);
method deleteMessage (line 18) | void deleteMessage(Long id);
FILE: springboot-websocket/src/main/java/com/suyu/websocket/Application.java
class Application (line 6) | @SpringBootApplication(scanBasePackages = "com.suyu.websocket")
method main (line 8) | public static void main(String[] args) {
FILE: springboot-websocket/src/main/java/com/suyu/websocket/config/WebSocketConfig.java
class WebSocketConfig (line 7) | @Configuration
method serverEndpointExporter (line 9) | @Bean
FILE: springboot-websocket/src/main/java/com/suyu/websocket/controller/WebSocketController.java
class WebSocketController (line 17) | @Controller
method idnex (line 22) | @RequestMapping(value = "/index")
method admin (line 27) | @RequestMapping(value = "/admin")
method sendmsg (line 50) | @RequestMapping("sendmsg")
method sendAll (line 64) | @RequestMapping("sendAll")
method webstatus (line 75) | @RequestMapping("webstatus")
FILE: springboot-websocket/src/main/java/com/suyu/websocket/server/SocketServer.java
class SocketServer (line 14) | @ServerEndpoint(value = "/socketServer/{userid}")// websocket
method open (line 29) | @OnOpen
method onMessage (line 41) | @OnMessage
method onClose (line 51) | @OnClose
method onError (line 63) | @OnError
method sendMessage (line 74) | public static void sendMessage(String message, String userId) {
method getOnlineNum (line 90) | public static int getOnlineNum() {
method getOnlineUsers (line 103) | public static String getOnlineUsers() {
method sendAll (line 118) | public static void sendAll(String msg) {
method SendMany (line 133) | public static void SendMany(String msg, String[] persons) {
FILE: springboot-websocket/src/main/resources/static/layui.all.js
function s (line 2) | function s(e,t){var o="PLaySTATION 3"===navigator.platform?/^complete$/:...
function c (line 2) | function c(){l.push(layui[d]),e.length>1?y.use(e.slice(1),o,l):"function...
function n (line 2) | function n(e){var t=!!e&&"length"in e&&e.length,n=pe.type(e);return"func...
function r (line 2) | function r(e,t,n){if(pe.isFunction(t))return pe.grep(e,function(e,r){ret...
function i (line 2) | function i(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}
function o (line 2) | function o(e){var t={};return pe.each(e.match(De)||[],function(e,n){t[n]...
function a (line 2) | function a(){re.addEventListener?(re.removeEventListener("DOMContentLoad...
function s (line 2) | function s(){(re.addEventListener||"load"===e.event.type||"complete"===r...
function u (line 2) | function u(e,t,n){if(void 0===n&&1===e.nodeType){var r="data-"+t.replace...
function l (line 2) | function l(e){var t;for(t in e)if(("data"!==t||!pe.isEmptyObject(e[t]))&...
function c (line 2) | function c(e,t,n,r){if(He(e)){var i,o,a=pe.expando,s=e.nodeType,u=s?pe.c...
function f (line 2) | function f(e,t,n){if(He(e)){var r,i,o=e.nodeType,a=o?pe.cache:e,s=o?e[pe...
function d (line 2) | function d(e,t,n,r){var i,o=1,a=20,s=r?function(){return r.cur()}:functi...
function p (line 2) | function p(e){var t=ze.split("|"),n=e.createDocumentFragment();if(n.crea...
function h (line 2) | function h(e,t){var n,r,i=0,o="undefined"!=typeof e.getElementsByTagName...
function g (line 2) | function g(e,t){for(var n,r=0;null!=(n=e[r]);r++)pe._data(n,"globalEval"...
function m (line 2) | function m(e){Be.test(e.type)&&(e.defaultChecked=e.checked)}
function y (line 2) | function y(e,t,n,r,i){for(var o,a,s,u,l,c,f,d=e.length,y=p(t),v=[],x=0;x...
function v (line 2) | function v(){return!0}
function x (line 2) | function x(){return!1}
function b (line 2) | function b(){try{return re.activeElement}catch(e){}}
function w (line 2) | function w(e,t,n,r,i,o){var a,s;if("object"==typeof t){"string"!=typeof ...
function T (line 2) | function T(e,t){return pe.nodeName(e,"table")&&pe.nodeName(11!==t.nodeTy...
function C (line 2) | function C(e){return e.type=(null!==pe.find.attr(e,"type"))+"/"+e.type,e}
function E (line 2) | function E(e){var t=it.exec(e.type);return t?e.type=t[1]:e.removeAttribu...
function N (line 2) | function N(e,t){if(1===t.nodeType&&pe.hasData(e)){var n,r,i,o=pe._data(e...
function k (line 2) | function k(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase...
function S (line 2) | function S(e,t,n,r){t=oe.apply([],t);var i,o,a,s,u,l,c=0,f=e.length,d=f-...
function A (line 2) | function A(e,t,n){for(var r,i=t?pe.filter(t,e):e,o=0;null!=(r=i[o]);o++)...
function D (line 2) | function D(e,t){var n=pe(t.createElement(e)).appendTo(t.body),r=pe.css(n...
function j (line 2) | function j(e){var t=re,n=lt[e];return n||(n=D(e,t),"none"!==n&&n||(ut=(u...
function L (line 2) | function L(e,t){return{get:function(){return e()?void delete this.get:(t...
function H (line 2) | function H(e){if(e in Et)return e;for(var t=e.charAt(0).toUpperCase()+e....
function q (line 2) | function q(e,t){for(var n,r,i,o=[],a=0,s=e.length;a<s;a++)r=e[a],r.style...
function _ (line 2) | function _(e,t,n){var r=bt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2...
function F (line 2) | function F(e,t,n,r,i){for(var o=n===(r?"border":"content")?4:"width"===t...
function M (line 2) | function M(t,n,r){var i=!0,o="width"===n?t.offsetWidth:t.offsetHeight,a=...
function O (line 2) | function O(e,t,n,r,i){return new O.prototype.init(e,t,n,r,i)}
function R (line 2) | function R(){return e.setTimeout(function(){Nt=void 0}),Nt=pe.now()}
function P (line 2) | function P(e,t){var n,r={height:e},i=0;for(t=t?1:0;i<4;i+=2-t)n=Oe[i],r[...
function B (line 2) | function B(e,t,n){for(var r,i=($.tweeners[t]||[]).concat($.tweeners["*"]...
function W (line 2) | function W(e,t,n){var r,i,o,a,s,u,l,c,f=this,d={},p=e.style,h=e.nodeType...
function I (line 2) | function I(e,t){var n,r,i,o,a;for(n in e)if(r=pe.camelCase(n),i=t[r],o=e...
function $ (line 2) | function $(e,t,n){var r,i,o=0,a=$.prefilters.length,s=pe.Deferred().alwa...
function z (line 2) | function z(e){return pe.attr(e,"class")||""}
function X (line 2) | function X(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r...
function U (line 2) | function U(e,t,n,r){function i(s){var u;return o[s]=!0,pe.each(e[s]||[],...
function V (line 2) | function V(e,t){var n,r,i=pe.ajaxSettings.flatOptions||{};for(r in t)voi...
function Y (line 2) | function Y(e,t,n){for(var r,i,o,a,s=e.contents,u=e.dataTypes;"*"===u[0];...
function J (line 2) | function J(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for...
function G (line 2) | function G(e){return e.style&&e.style.display||pe.css(e,"display")}
function K (line 2) | function K(e){for(;e&&1===e.nodeType;){if("none"===G(e)||"hidden"===e.ty...
function Q (line 2) | function Q(e,t,n,r){var i;if(pe.isArray(t))pe.each(t,function(t,i){n||rn...
function Z (line 2) | function Z(){try{return new e.XMLHttpRequest}catch(t){}}
function ee (line 2) | function ee(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(...
function te (line 2) | function te(e){return pe.isWindow(e)?e:9===e.nodeType&&(e.defaultView||e...
function t (line 2) | function t(e,t,n,r){var i,o,a,s,u,l,f,p,h=t&&t.ownerDocument,g=t?t.nodeT...
function n (line 2) | function n(){function e(n,r){return t.push(n+" ")>T.cacheLength&&delete ...
function r (line 2) | function r(e){return e[P]=!0,e}
function i (line 2) | function i(e){var t=H.createElement("div");try{return!!e(t)}catch(n){ret...
function o (line 2) | function o(e,t){for(var n=e.split("|"),r=n.length;r--;)T.attrHandle[n[r]...
function a (line 2) | function a(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sour...
function s (line 2) | function s(e){return function(t){var n=t.nodeName.toLowerCase();return"i...
function u (line 2) | function u(e){return function(t){var n=t.nodeName.toLowerCase();return("...
function l (line 2) | function l(e){return r(function(t){return t=+t,r(function(n,r){for(var i...
function c (line 2) | function c(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}
function f (line 2) | function f(){}
function d (line 2) | function d(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}
function p (line 2) | function p(e,t,n){var r=t.dir,i=n&&"parentNode"===r,o=I++;return t.first...
function h (line 2) | function h(e){return e.length>1?function(t,n,r){for(var i=e.length;i--;)...
function g (line 2) | function g(e,n,r){for(var i=0,o=n.length;i<o;i++)t(e,n[i],r);return r}
function m (line 2) | function m(e,t,n,r,i){for(var o,a=[],s=0,u=e.length,l=null!=t;s<u;s++)(o...
function y (line 2) | function y(e,t,n,i,o,a){return i&&!i[P]&&(i=y(i)),o&&!o[P]&&(o=y(o,a)),r...
function v (line 2) | function v(e){for(var t,n,r,i=e.length,o=T.relative[e[0].type],a=o||T.re...
function x (line 2) | function x(e,n){var i=n.length>0,o=e.length>0,a=function(r,a,s,u,l){var ...
function t (line 4) | function t(){var t,c,f=re.documentElement;f.appendChild(u),l.style.cssTe...
function r (line 4) | function r(t,n,r,i){var o,f,v,x,w,C=n;2!==b&&(b=2,u&&e.clearTimeout(u),c...
function e (line 5) | function e(){var e=a.cancel&&a.cancel(t.index,n);e===!1||r.close(t.index)}
function o (line 5) | function o(e,t,i){var n=new Image;return n.src=e,n.complete?t(n):(n.onlo...
FILE: springboot-websocket/src/main/resources/static/layui.js
function s (line 2) | function s(e,t){var o="PLaySTATION 3"===navigator.platform?/^complete$/:...
function c (line 2) | function c(){l.push(layui[d]),e.length>1?y.use(e.slice(1),o,l):"function...
FILE: springboot-websocket/src/main/resources/static/layui/lay/modules/jquery.js
function n (line 2) | function n(e){var t=!!e&&"length"in e&&e.length,n=pe.type(e);return"func...
function r (line 2) | function r(e,t,n){if(pe.isFunction(t))return pe.grep(e,function(e,r){ret...
function i (line 2) | function i(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}
function o (line 2) | function o(e){var t={};return pe.each(e.match(De)||[],function(e,n){t[n]...
function a (line 2) | function a(){re.addEventListener?(re.removeEventListener("DOMContentLoad...
function s (line 2) | function s(){(re.addEventListener||"load"===e.event.type||"complete"===r...
function u (line 2) | function u(e,t,n){if(void 0===n&&1===e.nodeType){var r="data-"+t.replace...
function l (line 2) | function l(e){var t;for(t in e)if(("data"!==t||!pe.isEmptyObject(e[t]))&...
function c (line 2) | function c(e,t,n,r){if(He(e)){var i,o,a=pe.expando,s=e.nodeType,u=s?pe.c...
function f (line 2) | function f(e,t,n){if(He(e)){var r,i,o=e.nodeType,a=o?pe.cache:e,s=o?e[pe...
function d (line 2) | function d(e,t,n,r){var i,o=1,a=20,s=r?function(){return r.cur()}:functi...
function p (line 2) | function p(e){var t=ze.split("|"),n=e.createDocumentFragment();if(n.crea...
function h (line 2) | function h(e,t){var n,r,i=0,o="undefined"!=typeof e.getElementsByTagName...
function g (line 2) | function g(e,t){for(var n,r=0;null!=(n=e[r]);r++)pe._data(n,"globalEval"...
function m (line 2) | function m(e){Be.test(e.type)&&(e.defaultChecked=e.checked)}
function y (line 2) | function y(e,t,n,r,i){for(var o,a,s,u,l,c,f,d=e.length,y=p(t),v=[],x=0;x...
function v (line 2) | function v(){return!0}
function x (line 2) | function x(){return!1}
function b (line 2) | function b(){try{return re.activeElement}catch(e){}}
function w (line 2) | function w(e,t,n,r,i,o){var a,s;if("object"==typeof t){"string"!=typeof ...
function T (line 2) | function T(e,t){return pe.nodeName(e,"table")&&pe.nodeName(11!==t.nodeTy...
function C (line 2) | function C(e){return e.type=(null!==pe.find.attr(e,"type"))+"/"+e.type,e}
function E (line 2) | function E(e){var t=it.exec(e.type);return t?e.type=t[1]:e.removeAttribu...
function N (line 2) | function N(e,t){if(1===t.nodeType&&pe.hasData(e)){var n,r,i,o=pe._data(e...
function k (line 2) | function k(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase...
function S (line 2) | function S(e,t,n,r){t=oe.apply([],t);var i,o,a,s,u,l,c=0,f=e.length,d=f-...
function A (line 2) | function A(e,t,n){for(var r,i=t?pe.filter(t,e):e,o=0;null!=(r=i[o]);o++)...
function D (line 2) | function D(e,t){var n=pe(t.createElement(e)).appendTo(t.body),r=pe.css(n...
function j (line 2) | function j(e){var t=re,n=lt[e];return n||(n=D(e,t),"none"!==n&&n||(ut=(u...
function L (line 2) | function L(e,t){return{get:function(){return e()?void delete this.get:(t...
function H (line 2) | function H(e){if(e in Et)return e;for(var t=e.charAt(0).toUpperCase()+e....
function q (line 2) | function q(e,t){for(var n,r,i,o=[],a=0,s=e.length;a<s;a++)r=e[a],r.style...
function _ (line 2) | function _(e,t,n){var r=bt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2...
function F (line 2) | function F(e,t,n,r,i){for(var o=n===(r?"border":"content")?4:"width"===t...
function M (line 2) | function M(t,n,r){var i=!0,o="width"===n?t.offsetWidth:t.offsetHeight,a=...
function O (line 2) | function O(e,t,n,r,i){return new O.prototype.init(e,t,n,r,i)}
function R (line 2) | function R(){return e.setTimeout(function(){Nt=void 0}),Nt=pe.now()}
function P (line 2) | function P(e,t){var n,r={height:e},i=0;for(t=t?1:0;i<4;i+=2-t)n=Oe[i],r[...
function B (line 2) | function B(e,t,n){for(var r,i=($.tweeners[t]||[]).concat($.tweeners["*"]...
function W (line 2) | function W(e,t,n){var r,i,o,a,s,u,l,c,f=this,d={},p=e.style,h=e.nodeType...
function I (line 2) | function I(e,t){var n,r,i,o,a;for(n in e)if(r=pe.camelCase(n),i=t[r],o=e...
function $ (line 2) | function $(e,t,n){var r,i,o=0,a=$.prefilters.length,s=pe.Deferred().alwa...
function z (line 2) | function z(e){return pe.attr(e,"class")||""}
function X (line 2) | function X(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r...
function U (line 2) | function U(e,t,n,r){function i(s){var u;return o[s]=!0,pe.each(e[s]||[],...
function V (line 2) | function V(e,t){var n,r,i=pe.ajaxSettings.flatOptions||{};for(r in t)voi...
function Y (line 2) | function Y(e,t,n){for(var r,i,o,a,s=e.contents,u=e.dataTypes;"*"===u[0];...
function J (line 2) | function J(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for...
function G (line 2) | function G(e){return e.style&&e.style.display||pe.css(e,"display")}
function K (line 2) | function K(e){for(;e&&1===e.nodeType;){if("none"===G(e)||"hidden"===e.ty...
function Q (line 2) | function Q(e,t,n,r){var i;if(pe.isArray(t))pe.each(t,function(t,i){n||rn...
function Z (line 2) | function Z(){try{return new e.XMLHttpRequest}catch(t){}}
function ee (line 2) | function ee(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(...
function te (line 2) | function te(e){return pe.isWindow(e)?e:9===e.nodeType&&(e.defaultView||e...
function t (line 2) | function t(e,t,n,r){var i,o,a,s,u,l,f,p,h=t&&t.ownerDocument,g=t?t.nodeT...
function n (line 2) | function n(){function e(n,r){return t.push(n+" ")>T.cacheLength&&delete ...
function r (line 2) | function r(e){return e[P]=!0,e}
function i (line 2) | function i(e){var t=H.createElement("div");try{return!!e(t)}catch(n){ret...
function o (line 2) | function o(e,t){for(var n=e.split("|"),r=n.length;r--;)T.attrHandle[n[r]...
function a (line 2) | function a(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sour...
function s (line 2) | function s(e){return function(t){var n=t.nodeName.toLowerCase();return"i...
function u (line 2) | function u(e){return function(t){var n=t.nodeName.toLowerCase();return("...
function l (line 2) | function l(e){return r(function(t){return t=+t,r(function(n,r){for(var i...
function c (line 2) | function c(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}
function f (line 2) | function f(){}
function d (line 2) | function d(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}
function p (line 2) | function p(e,t,n){var r=t.dir,i=n&&"parentNode"===r,o=I++;return t.first...
function h (line 2) | function h(e){return e.length>1?function(t,n,r){for(var i=e.length;i--;)...
function g (line 2) | function g(e,n,r){for(var i=0,o=n.length;i<o;i++)t(e,n[i],r);return r}
function m (line 2) | function m(e,t,n,r,i){for(var o,a=[],s=0,u=e.length,l=null!=t;s<u;s++)(o...
function y (line 2) | function y(e,t,n,i,o,a){return i&&!i[P]&&(i=y(i)),o&&!o[P]&&(o=y(o,a)),r...
function v (line 2) | function v(e){for(var t,n,r,i=e.length,o=T.relative[e[0].type],a=o||T.re...
function x (line 2) | function x(e,n){var i=n.length>0,o=e.length>0,a=function(r,a,s,u,l){var ...
function t (line 4) | function t(){var t,c,f=re.documentElement;f.appendChild(u),l.style.cssTe...
function r (line 4) | function r(t,n,r,i){var o,f,v,x,w,C=n;2!==b&&(b=2,u&&e.clearTimeout(u),c...
FILE: springboot-websocket/src/main/resources/static/layui/lay/modules/layer.js
function e (line 2) | function e(){var e=a.cancel&&a.cancel(t.index,n);e===!1||r.close(t.index)}
function o (line 2) | function o(e,t,i){var n=new Image;return n.src=e,n.complete?t(n):(n.onlo...
FILE: springboot-websocket/src/main/resources/static/layui/lay/modules/mobile.js
function t (line 2) | function t(t){return null==t?String(t):J[W.call(t)]||"object"}
function e (line 2) | function e(e){return"function"==t(e)}
function n (line 2) | function n(t){return null!=t&&t==t.window}
function r (line 2) | function r(t){return null!=t&&t.nodeType==t.DOCUMENT_NODE}
function i (line 2) | function i(e){return"object"==t(e)}
function o (line 2) | function o(t){return i(t)&&!n(t)&&Object.getPrototypeOf(t)==Object.proto...
function a (line 2) | function a(t){var e=!!t&&"length"in t&&t.length,r=T.type(t);return"funct...
function s (line 2) | function s(t){return A.call(t,function(t){return null!=t})}
function u (line 2) | function u(t){return t.length>0?T.fn.concat.apply([],t):t}
function c (line 2) | function c(t){return t.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/...
function l (line 2) | function l(t){return t in F?F[t]:F[t]=new RegExp("(^|\\s)"+t+"(\\s|$)")}
function f (line 2) | function f(t,e){return"number"!=typeof e||k[c(t)]?e:e+"px"}
function h (line 2) | function h(t){var e,n;return $[t]||(e=L.createElement(t),L.body.appendCh...
function p (line 2) | function p(t){return"children"in t?D.call(t.children):T.map(t.childNodes...
function d (line 2) | function d(t,e){var n,r=t?t.length:0;for(n=0;n<r;n++)this[n]=t[n];this.l...
function m (line 2) | function m(t,e,n){for(j in e)n&&(o(e[j])||Q(e[j]))?(o(e[j])&&!o(t[j])&&(...
function v (line 2) | function v(t,e){return null==e?T(t):T(t).filter(e)}
function g (line 2) | function g(t,n,r,i){return e(n)?n.call(t,r,i):n}
function y (line 2) | function y(t,e,n){null==n?t.removeAttribute(e):t.setAttribute(e,n)}
function x (line 2) | function x(t,e){var n=t.className||"",r=n&&n.baseVal!==E;return e===E?r?...
function b (line 2) | function b(t){try{return t?"true"==t||"false"!=t&&("null"==t?null:+t+""=...
function w (line 2) | function w(t,e){e(t);for(var n=0,r=t.childNodes.length;n<r;n++)w(t.child...
function e (line 2) | function e(t){return t._zid||(t._zid=h++)}
function n (line 2) | function n(t,n,o,a){if(n=r(n),n.ns)var s=i(n.ns);return(v[e(t)]||[]).fil...
function r (line 2) | function r(t){var e=(""+t).split(".");return{e:e[0],ns:e.slice(1).sort()...
function i (line 2) | function i(t){return new RegExp("(?:^| )"+t.replace(" "," .* ?")+"(?: |$...
function o (line 2) | function o(t,e){return t.del&&!y&&t.e in x||!!e}
function a (line 2) | function a(t){return b[t]||y&&x[t]||t}
function s (line 2) | function s(n,i,s,u,l,h,p){var d=e(n),m=v[d]||(v[d]=[]);i.split(/\s/).for...
function u (line 2) | function u(t,r,i,s,u){var c=e(t);(r||"").split(/\s/).forEach(function(e)...
function c (line 2) | function c(e,n){return!n&&e.isDefaultPrevented||(n||(n=e),t.each(T,funct...
function l (line 2) | function l(t){var e,n={originalEvent:t};for(e in t)j.test(e)||t[e]===f||...
function e (line 2) | function e(e,n,r){var i=t.Event(n);return t(e).trigger(i,r),!i.isDefault...
function n (line 2) | function n(t,n,r,i){if(t.global)return e(n||x,r,i)}
function r (line 2) | function r(e){e.global&&0===t.active++&&n(e,null,"ajaxStart")}
function i (line 2) | function i(e){e.global&&!--t.active&&n(e,null,"ajaxStop")}
function o (line 2) | function o(t,e){var r=e.context;return e.beforeSend.call(r,t,e)!==!1&&n(...
function a (line 2) | function a(t,e,r,i){var o=r.context,a="success";r.success.call(o,t,a,e),...
function s (line 2) | function s(t,e,r,i,o){var a=i.context;i.error.call(a,r,e,t),o&&o.rejectW...
function u (line 2) | function u(t,e,r){var o=r.context;r.complete.call(o,e,t),n(r,o,"ajaxComp...
function c (line 2) | function c(t,e,n){if(n.dataFilter==l)return t;var r=n.context;return n.d...
function l (line 2) | function l(){}
function f (line 2) | function f(t){return t&&(t=t.split(";",2)[0]),t&&(t==T?"html":t==j?"json...
function h (line 2) | function h(t,e){return""==e?t:(t+"&"+e).replace(/[&?]{1,2}/,"?")}
function p (line 2) | function p(e){e.processData&&e.data&&"string"!=t.type(e.data)&&(e.data=t...
function d (line 2) | function d(e,n,r,i){return t.isFunction(n)&&(i=r,r=n,n=void 0),t.isFunct...
function m (line 2) | function m(e,n,r,i){var o,a=t.isArray(n),s=t.isPlainObject(n);t.each(n,f...
FILE: springboot-websocket/src/main/resources/static/layui/layui.all.js
function s (line 2) | function s(e,t){var o="PLaySTATION 3"===navigator.platform?/^complete$/:...
function c (line 2) | function c(){l.push(layui[d]),e.length>1?y.use(e.slice(1),o,l):"function...
function n (line 2) | function n(e){var t=!!e&&"length"in e&&e.length,n=pe.type(e);return"func...
function r (line 2) | function r(e,t,n){if(pe.isFunction(t))return pe.grep(e,function(e,r){ret...
function i (line 2) | function i(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}
function o (line 2) | function o(e){var t={};return pe.each(e.match(De)||[],function(e,n){t[n]...
function a (line 2) | function a(){re.addEventListener?(re.removeEventListener("DOMContentLoad...
function s (line 2) | function s(){(re.addEventListener||"load"===e.event.type||"complete"===r...
function u (line 2) | function u(e,t,n){if(void 0===n&&1===e.nodeType){var r="data-"+t.replace...
function l (line 2) | function l(e){var t;for(t in e)if(("data"!==t||!pe.isEmptyObject(e[t]))&...
function c (line 2) | function c(e,t,n,r){if(He(e)){var i,o,a=pe.expando,s=e.nodeType,u=s?pe.c...
function f (line 2) | function f(e,t,n){if(He(e)){var r,i,o=e.nodeType,a=o?pe.cache:e,s=o?e[pe...
function d (line 2) | function d(e,t,n,r){var i,o=1,a=20,s=r?function(){return r.cur()}:functi...
function p (line 2) | function p(e){var t=ze.split("|"),n=e.createDocumentFragment();if(n.crea...
function h (line 2) | function h(e,t){var n,r,i=0,o="undefined"!=typeof e.getElementsByTagName...
function g (line 2) | function g(e,t){for(var n,r=0;null!=(n=e[r]);r++)pe._data(n,"globalEval"...
function m (line 2) | function m(e){Be.test(e.type)&&(e.defaultChecked=e.checked)}
function y (line 2) | function y(e,t,n,r,i){for(var o,a,s,u,l,c,f,d=e.length,y=p(t),v=[],x=0;x...
function v (line 2) | function v(){return!0}
function x (line 2) | function x(){return!1}
function b (line 2) | function b(){try{return re.activeElement}catch(e){}}
function w (line 2) | function w(e,t,n,r,i,o){var a,s;if("object"==typeof t){"string"!=typeof ...
function T (line 2) | function T(e,t){return pe.nodeName(e,"table")&&pe.nodeName(11!==t.nodeTy...
function C (line 2) | function C(e){return e.type=(null!==pe.find.attr(e,"type"))+"/"+e.type,e}
function E (line 2) | function E(e){var t=it.exec(e.type);return t?e.type=t[1]:e.removeAttribu...
function N (line 2) | function N(e,t){if(1===t.nodeType&&pe.hasData(e)){var n,r,i,o=pe._data(e...
function k (line 2) | function k(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase...
function S (line 2) | function S(e,t,n,r){t=oe.apply([],t);var i,o,a,s,u,l,c=0,f=e.length,d=f-...
function A (line 2) | function A(e,t,n){for(var r,i=t?pe.filter(t,e):e,o=0;null!=(r=i[o]);o++)...
function D (line 2) | function D(e,t){var n=pe(t.createElement(e)).appendTo(t.body),r=pe.css(n...
function j (line 2) | function j(e){var t=re,n=lt[e];return n||(n=D(e,t),"none"!==n&&n||(ut=(u...
function L (line 2) | function L(e,t){return{get:function(){return e()?void delete this.get:(t...
function H (line 2) | function H(e){if(e in Et)return e;for(var t=e.charAt(0).toUpperCase()+e....
function q (line 2) | function q(e,t){for(var n,r,i,o=[],a=0,s=e.length;a<s;a++)r=e[a],r.style...
function _ (line 2) | function _(e,t,n){var r=bt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2...
function F (line 2) | function F(e,t,n,r,i){for(var o=n===(r?"border":"content")?4:"width"===t...
function M (line 2) | function M(t,n,r){var i=!0,o="width"===n?t.offsetWidth:t.offsetHeight,a=...
function O (line 2) | function O(e,t,n,r,i){return new O.prototype.init(e,t,n,r,i)}
function R (line 2) | function R(){return e.setTimeout(function(){Nt=void 0}),Nt=pe.now()}
function P (line 2) | function P(e,t){var n,r={height:e},i=0;for(t=t?1:0;i<4;i+=2-t)n=Oe[i],r[...
function B (line 2) | function B(e,t,n){for(var r,i=($.tweeners[t]||[]).concat($.tweeners["*"]...
function W (line 2) | function W(e,t,n){var r,i,o,a,s,u,l,c,f=this,d={},p=e.style,h=e.nodeType...
function I (line 2) | function I(e,t){var n,r,i,o,a;for(n in e)if(r=pe.camelCase(n),i=t[r],o=e...
function $ (line 2) | function $(e,t,n){var r,i,o=0,a=$.prefilters.length,s=pe.Deferred().alwa...
function z (line 2) | function z(e){return pe.attr(e,"class")||""}
function X (line 2) | function X(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r...
function U (line 2) | function U(e,t,n,r){function i(s){var u;return o[s]=!0,pe.each(e[s]||[],...
function V (line 2) | function V(e,t){var n,r,i=pe.ajaxSettings.flatOptions||{};for(r in t)voi...
function Y (line 2) | function Y(e,t,n){for(var r,i,o,a,s=e.contents,u=e.dataTypes;"*"===u[0];...
function J (line 2) | function J(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for...
function G (line 2) | function G(e){return e.style&&e.style.display||pe.css(e,"display")}
function K (line 2) | function K(e){for(;e&&1===e.nodeType;){if("none"===G(e)||"hidden"===e.ty...
function Q (line 2) | function Q(e,t,n,r){var i;if(pe.isArray(t))pe.each(t,function(t,i){n||rn...
function Z (line 2) | function Z(){try{return new e.XMLHttpRequest}catch(t){}}
function ee (line 2) | function ee(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(...
function te (line 2) | function te(e){return pe.isWindow(e)?e:9===e.nodeType&&(e.defaultView||e...
function t (line 2) | function t(e,t,n,r){var i,o,a,s,u,l,f,p,h=t&&t.ownerDocument,g=t?t.nodeT...
function n (line 2) | function n(){function e(n,r){return t.push(n+" ")>T.cacheLength&&delete ...
function r (line 2) | function r(e){return e[P]=!0,e}
function i (line 2) | function i(e){var t=H.createElement("div");try{return!!e(t)}catch(n){ret...
function o (line 2) | function o(e,t){for(var n=e.split("|"),r=n.length;r--;)T.attrHandle[n[r]...
function a (line 2) | function a(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sour...
function s (line 2) | function s(e){return function(t){var n=t.nodeName.toLowerCase();return"i...
function u (line 2) | function u(e){return function(t){var n=t.nodeName.toLowerCase();return("...
function l (line 2) | function l(e){return r(function(t){return t=+t,r(function(n,r){for(var i...
function c (line 2) | function c(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}
function f (line 2) | function f(){}
function d (line 2) | function d(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}
function p (line 2) | function p(e,t,n){var r=t.dir,i=n&&"parentNode"===r,o=I++;return t.first...
function h (line 2) | function h(e){return e.length>1?function(t,n,r){for(var i=e.length;i--;)...
function g (line 2) | function g(e,n,r){for(var i=0,o=n.length;i<o;i++)t(e,n[i],r);return r}
function m (line 2) | function m(e,t,n,r,i){for(var o,a=[],s=0,u=e.length,l=null!=t;s<u;s++)(o...
function y (line 2) | function y(e,t,n,i,o,a){return i&&!i[P]&&(i=y(i)),o&&!o[P]&&(o=y(o,a)),r...
function v (line 2) | function v(e){for(var t,n,r,i=e.length,o=T.relative[e[0].type],a=o||T.re...
function x (line 2) | function x(e,n){var i=n.length>0,o=e.length>0,a=function(r,a,s,u,l){var ...
function t (line 4) | function t(){var t,c,f=re.documentElement;f.appendChild(u),l.style.cssTe...
function r (line 4) | function r(t,n,r,i){var o,f,v,x,w,C=n;2!==b&&(b=2,u&&e.clearTimeout(u),c...
function e (line 5) | function e(){var e=a.cancel&&a.cancel(t.index,n);e===!1||r.close(t.index)}
function o (line 5) | function o(e,t,i){var n=new Image;return n.src=e,n.complete?t(n):(n.onlo...
FILE: springboot-websocket/src/main/resources/static/layui/layui.js
function s (line 2) | function s(e,t){var o="PLaySTATION 3"===navigator.platform?/^complete$/:...
function c (line 2) | function c(){l.push(layui[d]),e.length>1?y.use(e.slice(1),o,l):"function...
FILE: springboot2-redis/src/main/java/cn/haoxy/redis/example/RedisMain.java
class RedisMain (line 18) | @Configuration
method stringUtil (line 23) | @Bean
method listUtil (line 28) | @Bean
method hashUtil (line 33) | @Bean
method setUtil (line 37) | @Bean
FILE: springboot2-redis/src/main/java/cn/haoxy/redis/example/bean/RedisConnector.java
class RedisConnector (line 10) | @Component
method getHostName (line 21) | public String getHostName() {
method setHostName (line 25) | public void setHostName(String hostName) {
method getPort (line 29) | public Integer getPort() {
method setPort (line 33) | public void setPort(Integer port) {
method getPassword (line 37) | public String getPassword() {
method setPassword (line 41) | public void setPassword(String password) {
method getDbIndex (line 45) | public Integer getDbIndex() {
method setDbIndex (line 49) | public void setDbIndex(Integer dbIndex) {
method toString (line 53) | @Override
FILE: springboot2-redis/src/main/java/cn/haoxy/redis/example/common/User.java
class User (line 10) | public class User implements Serializable{
method getUsername (line 16) | public String getUsername() {
method setUsername (line 20) | public void setUsername(String username) {
method getAge (line 24) | public Integer getAge() {
method setAge (line 28) | public void setAge(Integer age) {
method User (line 32) | public User() {
method User (line 35) | public User(String username, Integer age) {
method toString (line 40) | @Override
FILE: springboot2-redis/src/main/java/cn/haoxy/redis/example/config/RedisConfig.java
class RedisConfig (line 26) | @Configuration
method redisConnector (line 31) | @Bean
method redisTemplate (line 42) | @Bean
method lettuceConnectionFactory (line 60) | @Bean
FILE: springboot2-redis/src/main/java/cn/haoxy/redis/example/tool/HashUtil.java
class HashUtil (line 18) | @Component
method put (line 24) | public void put(String key, String hashKey, String hashValue) {
method putAll (line 29) | public void putAll(String key, Map<String, Object> map) {
method delete (line 33) | public void delete(String key, String hashKey) {
method entries (line 37) | public Map<String, Object> entries(String key) {
method get (line 42) | public Object get(String key, String hashKey) {
method multiGet (line 46) | public List<Object> multiGet(String key, Collection<Object> hashKey) {
method keys (line 50) | public Set<Object> keys(String key) {
method size (line 55) | public long size(String key){
method hashValues (line 58) | public List<Object> hashValues(String key){
FILE: springboot2-redis/src/main/java/cn/haoxy/redis/example/tool/ListUtil.java
class ListUtil (line 15) | @Component
method leftPushAll (line 27) | public long leftPushAll(String key, Collection<Object> value) {
method leftPushAll (line 38) | public long leftPushAll(String key, Object... value) {
method leftPush (line 49) | public void leftPush(String key, Object value) {
method rightPush (line 59) | public void rightPush(String key, Object value){
method size (line 70) | public long size(String key) {
method range (line 82) | public List<Object> range(String key,long start,long end) {
method index (line 93) | public Object index(String key,long index){
method leftPop (line 101) | public void leftPop(String key){
method rightPop (line 105) | public void rightPop(String key){
FILE: springboot2-redis/src/main/java/cn/haoxy/redis/example/tool/SetUtil.java
class SetUtil (line 12) | @Component
method add (line 18) | public void add(String key, Object... value) {
method remove (line 22) | public void remove(String key, Object... value) {
method pop (line 32) | public Object pop(String key) {
method move (line 39) | public void move(String key, Object value, String destKey) {
FILE: springboot2-redis/src/main/java/cn/haoxy/redis/example/tool/StringUtil.java
class StringUtil (line 16) | @Component
method set (line 28) | public void set(String key, String value) {
method setObj (line 38) | public void setObj(String key, Object value) {
method set (line 50) | public void set(String key, String value, long timeout, TimeUnit unit) {
method setIfAbsent (line 62) | public boolean setIfAbsent(String key, String value) {
method multiSet (line 71) | public void multiSet(Map<String, Object> map) {
method multiGet (line 81) | public List<Object> multiGet(List<String> list) {
method multiSetIfAbsent (line 92) | public boolean multiSetIfAbsent(Map<String, Object> map) {
method getAndSet (line 103) | public Object getAndSet(String key, String value) {
method increment (line 114) | public long increment(String key, long value) {
method increment (line 125) | public double increment(String key, double value) {
method size (line 135) | public long size(String key) {
method get (line 144) | public Object get(String key) {
method del (line 153) | public Object del(String key) {
FILE: springboot2-redis/src/test/java/cn/haoxy/redis/exampl/TestRedisListUtil.java
class TestRedisListUtil (line 19) | @RunWith(SpringRunner.class)
method leftPushAll (line 26) | @Test
method range (line 36) | @Test
method index (line 41) | @Test
method leftPop (line 46) | @Test
FILE: springboot2-redis/src/test/java/cn/haoxy/redis/exampl/TestRedisStringUtil.java
class TestRedisStringUtil (line 22) | @RunWith(SpringRunner.class)
method setTest (line 32) | @Test
method setObj (line 40) | @Test
method setTest_timeout (line 48) | @Test
method setIfAbsent (line 56) | @Test
method multiSet (line 65) | @Test
method multiGet (line 77) | @Test
method multiSetIfAbsent (line 91) | @Test
method getAndSet (line 104) | @Test
method increment (line 113) | @Test
method incrementDouble (line 122) | @Test
method getTest (line 129) | @Test
FILE: strategy-aop/src/main/java/cn/haoxy/strategy/aop/StrategApplication.java
class StrategApplication (line 12) | @SpringBootApplication
method main (line 15) | public static void main(String[] args) {
FILE: strategy-aop/src/main/java/cn/haoxy/strategy/aop/constant/MessageCodeEnum.java
type MessageCodeEnum (line 13) | @Getter
FILE: strategy-aop/src/main/java/cn/haoxy/strategy/aop/controller/UserController.java
class UserController (line 19) | @RestController
method addUser (line 29) | @RequestMapping("addUser")
method delUser (line 40) | @RequestMapping("delUser")
FILE: strategy-aop/src/main/java/cn/haoxy/strategy/aop/handler/DataSourceContextAware.java
class DataSourceContextAware (line 15) | @Component
method getStrategyInstance (line 21) | public StrategyBase getStrategyInstance(String dsType) {
FILE: strategy-aop/src/main/java/cn/haoxy/strategy/aop/handler/MessageInitHandler.java
class MessageInitHandler (line 30) | @Component
method run (line 50) | @Override
method loadingJSONFile (line 65) | private JSONObject loadingJSONFile() {
method getClassLoader (line 89) | private static ClassLoader getClassLoader() {
FILE: strategy-aop/src/main/java/cn/haoxy/strategy/aop/handler/MessageMonitorHandler.java
class MessageMonitorHandler (line 39) | @Aspect
method checkMessageHandler (line 59) | @Pointcut("@annotation(cn.haoxy.strategy.aop.annotation.MessageLog)")
method doAround (line 64) | @Around("checkMessageHandler()")
method processOutPutObj (line 81) | private void processOutPutObj(ProceedingJoinPoint proceedingJoinPoint) {
method getHttpServletRequest (line 110) | private HttpServletRequest getHttpServletRequest() {
method getHttpServletResponse (line 119) | private HttpServletResponse getHttpServletResponse() {
method shutdownResponse (line 130) | private void shutdownResponse(HttpServletResponse response) throws IOE...
FILE: strategy-aop/src/main/java/cn/haoxy/strategy/aop/pojo/AnalysisMessage.java
class AnalysisMessage (line 13) | @Data
FILE: strategy-aop/src/main/java/cn/haoxy/strategy/aop/pojo/AnalysisRole.java
class AnalysisRole (line 13) | @Data
FILE: strategy-aop/src/main/java/cn/haoxy/strategy/aop/pojo/AnalysisUser.java
class AnalysisUser (line 13) | @Data
FILE: strategy-aop/src/main/java/cn/haoxy/strategy/aop/service/AnalysisMessageService.java
class AnalysisMessageService (line 12) | @Service
method insert (line 15) | public void insert(AnalysisMessage analysisMessage) {
FILE: strategy-aop/src/main/java/cn/haoxy/strategy/aop/service/AnalysisRoleService.java
class AnalysisRoleService (line 15) | @Service
method findByRoleId (line 30) | public AnalysisRole findByRoleId(Long roleId) {
FILE: strategy-aop/src/main/java/cn/haoxy/strategy/aop/service/AnalysisUserService.java
class AnalysisUserService (line 15) | @Service
method selectById (line 20) | public AnalysisUser selectById(Long id) {
method addUser (line 26) | public String addUser(Long roleId, AnalysisUser user) {
method delUser (line 34) | public String delUser(Long id) {
FILE: strategy-aop/src/main/java/cn/haoxy/strategy/aop/service/MessageStrategyService.java
class MessageStrategyService (line 14) | @Component
method run (line 20) | public StrategyBase run(String dsType) {
FILE: strategy-aop/src/main/java/cn/haoxy/strategy/aop/strategys/MessageAddUserStrategy.java
class MessageAddUserStrategy (line 16) | @Component("/user/addUser")
method run (line 21) | @Override
FILE: strategy-aop/src/main/java/cn/haoxy/strategy/aop/strategys/MessageDelUserStrategy.java
class MessageDelUserStrategy (line 13) | @Component("/user/delUser")
method run (line 16) | @Override
FILE: strategy-aop/src/main/java/cn/haoxy/strategy/aop/strategys/MessageIsLockStrategy.java
class MessageIsLockStrategy (line 15) | @Component("/user/isLock")
method run (line 21) | @Override
FILE: strategy-aop/src/main/java/cn/haoxy/strategy/aop/strategys/StrategyBase.java
type StrategyBase (line 10) | public interface StrategyBase {
method run (line 12) | String run(Object[] args);
FILE: strategy-aop/src/main/java/cn/haoxy/strategy/aop/utils/MapCacheUtils.java
class MapCacheUtils (line 13) | public class MapCacheUtils {
FILE: strategy-aop/src/main/java/cn/haoxy/strategy/aop/utils/ReturnUtils.java
class ReturnUtils (line 15) | public class ReturnUtils {
method infoReturn (line 17) | public static void infoReturn(HttpServletResponse response, Object obj) {
Condensed preview — 361 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (5,507K chars).
[
{
"path": ".gitignore",
"chars": 106,
"preview": ".idea\n\nvendor\n\ncomposer.lock\n\ncomposer.phar\n\n*.iml\n\ntarget\n\n.DS_Store\n\n*.bak\n\nnode_modules\n\n*.log\n\n*.gz\n\n\n"
},
{
"path": "README.md",
"chars": 6663,
"preview": "# springboot-examples\nspring boot 集成各技术案例 <img src=\"https://camo.githubusercontent.com/95c3d7ef0b5da8445087e462514063675"
},
{
"path": "distributed-job/README.md",
"chars": 11948,
"preview": "### distribute-job\n\n> 此 demo 主要演示了 Spring Boot 如何集成 XXL-JOB 实现分布式定时任务,并提供绕过 xxl-job-admin 对定时任务的管理的方法,包括定时任务列表,触发器列表,新增定"
},
{
"path": "distributed-job/pom.xml",
"chars": 2620,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n xmlns:xsi=\"http://www"
},
{
"path": "distributed-job/src/main/java/cn/haoxy/distributed/JobApplication.java",
"chars": 479,
"preview": "package cn.haoxy.distributed;\n\nimport org.springframework.boot.SpringApplication;\nimport org.springframework.boot.autoco"
},
{
"path": "distributed-job/src/main/java/cn/haoxy/distributed/config/JobConfig.java",
"chars": 3392,
"preview": "package cn.haoxy.distributed.config;\n\nimport com.xxl.job.core.executor.impl.XxlJobSpringExecutor;\nimport lombok.Required"
},
{
"path": "distributed-job/src/main/java/cn/haoxy/distributed/config/XxlJobProps.java",
"chars": 1157,
"preview": "package cn.haoxy.distributed.config;\n\nimport lombok.Data;\nimport org.springframework.boot.context.properties.Configurati"
},
{
"path": "distributed-job/src/main/java/cn/haoxy/distributed/controller/ManualOperateController.java",
"chars": 4433,
"preview": "package cn.haoxy.distributed.controller;\n\nimport cn.hutool.http.HttpResponse;\nimport cn.hutool.http.HttpUtil;\nimport cn."
},
{
"path": "distributed-job/src/main/java/cn/haoxy/distributed/handler/TestJobHandler.java",
"chars": 1031,
"preview": "package cn.haoxy.distributed.handler;\n\nimport cn.haoxy.distributed.service.InService;\nimport com.xxl.job.core.biz.model."
},
{
"path": "distributed-job/src/main/java/cn/haoxy/distributed/service/InService.java",
"chars": 365,
"preview": "package cn.haoxy.distributed.service;\n\nimport org.springframework.stereotype.Service;\n\n/**\n * Created by haoxiaoyong on "
},
{
"path": "distributed-job/src/main/resources/application.properties-out",
"chars": 627,
"preview": "# web port\nserver.port=8082\n\n# log config\n#logging.config=classpath:logback.xml\n\n\n### xxl-job admin address list, such a"
},
{
"path": "distributed-job/src/main/resources/application.yml",
"chars": 560,
"preview": "# web port\nserver:\n port: 8082\n\n# log config\n#logging:\n# config: classpath:logback.xml\n### xxl-job admin address list,"
},
{
"path": "distributed-job/src/main/resources/logback.xml",
"chars": 1029,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<configuration debug=\"false\" scan=\"true\" scanPeriod=\"1 seconds\">\n\n <contextNam"
},
{
"path": "global-exception/README.md",
"chars": 3248,
"preview": "### Spring,Spring Boot 实战,- 全局异常处理\n\n#### 异常处理\n当我们开发过程中或者说一个web程序在运行中,由于用户操作不当,或者说程序中存在的bug,有大量的异常需要处理,有些异常要告知开发人员,有些异常要提"
},
{
"path": "global-exception/pom.xml",
"chars": 1061,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n xmlns:xsi=\"http://www"
},
{
"path": "global-exception/src/main/java/cn/haoxiaoyong/ex/ExceptionApp.java",
"chars": 428,
"preview": "package cn.haoxiaoyong.ex;\n\nimport org.springframework.boot.SpringApplication;\nimport org.springframework.boot.autoconfi"
},
{
"path": "global-exception/src/main/java/cn/haoxiaoyong/ex/common/Parameter.java",
"chars": 528,
"preview": "package cn.haoxiaoyong.ex.common;\n\n/**\n * Created by haoxy on 2019/3/11.\n * E-mail:hxyHelloWorld@163.com\n * github:https"
},
{
"path": "global-exception/src/main/java/cn/haoxiaoyong/ex/common/RespInfo.java",
"chars": 800,
"preview": "package cn.haoxiaoyong.ex.common;\n\n/**\n * Created by haoxy on 2019/3/11.\n * E-mail:hxyHelloWorld@163.com\n * github:https"
},
{
"path": "global-exception/src/main/java/cn/haoxiaoyong/ex/controller/LoginController.java",
"chars": 1036,
"preview": "package cn.haoxiaoyong.ex.controller;\n\nimport cn.haoxiaoyong.ex.common.Parameter;\nimport cn.haoxiaoyong.ex.exception.Cus"
},
{
"path": "global-exception/src/main/java/cn/haoxiaoyong/ex/exception/CustomizeException.java",
"chars": 717,
"preview": "package cn.haoxiaoyong.ex.exception;\n\nimport com.alibaba.fastjson.JSONObject;\n\n/**\n * Created by haoxy on 2019/3/11.\n * "
},
{
"path": "global-exception/src/main/java/cn/haoxiaoyong/ex/global/GlobalExceptionHandler.java",
"chars": 1142,
"preview": "package cn.haoxiaoyong.ex.global;\n\nimport cn.haoxiaoyong.ex.common.RespInfo;\nimport cn.haoxiaoyong.ex.exception.Customiz"
},
{
"path": "mybatis-plus-example/README.md",
"chars": 796,
"preview": "### mybatis-plus-example\n\nplus-curd(<a href=\"https://github.com/haoxiaoyong1014/springboot-examples/blob/master/mybatis-"
},
{
"path": "mybatis-plus-example/plus-condition/pom.xml",
"chars": 527,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n xmlns:xsi=\"http://www"
},
{
"path": "mybatis-plus-example/plus-condition/src/main/java/cn/haoxy/mybatis/plus/condition/ConditionApp.java",
"chars": 428,
"preview": "package cn.haoxy.mybatis.plus.condition;\n\nimport org.mybatis.spring.annotation.MapperScan;\nimport org.springframework.bo"
},
{
"path": "mybatis-plus-example/plus-condition/src/main/java/cn/haoxy/mybatis/plus/condition/mapper/RoleMapper.java",
"chars": 214,
"preview": "package cn.haoxy.mybatis.plus.condition.mapper;\n\nimport cn.haoxy.mybatis.plus.condition.pojo.Role;\nimport com.baomidou.m"
},
{
"path": "mybatis-plus-example/plus-condition/src/main/java/cn/haoxy/mybatis/plus/condition/mapper/UserMapper.java",
"chars": 213,
"preview": "package cn.haoxy.mybatis.plus.condition.mapper;\n\nimport cn.haoxy.mybatis.plus.condition.pojo.User;\nimport com.baomidou.m"
},
{
"path": "mybatis-plus-example/plus-condition/src/main/java/cn/haoxy/mybatis/plus/condition/pojo/Role.java",
"chars": 179,
"preview": "package cn.haoxy.mybatis.plus.condition.pojo;\n\nimport lombok.Data;\n\n@Data\npublic class Role {\n private Long id;\n p"
},
{
"path": "mybatis-plus-example/plus-condition/src/main/java/cn/haoxy/mybatis/plus/condition/pojo/User.java",
"chars": 282,
"preview": "package cn.haoxy.mybatis.plus.condition.pojo;\n\nimport lombok.Data;\nimport lombok.experimental.Accessors;\n\n@Data\n@Accesso"
},
{
"path": "mybatis-plus-example/plus-condition/src/main/resources/application.yml",
"chars": 435,
"preview": "server:\n port: 9002\n\nspring:\n datasource:\n url: jdbc:mysql://localhost:3306/mybatis-plus?useUnicode=true&characterE"
},
{
"path": "mybatis-plus-example/plus-condition/src/test/java/cn/haoxy/mybatis/plus/condition/PlusConditionTest.java",
"chars": 2671,
"preview": "package cn.haoxy.mybatis.plus.condition;\n\nimport cn.haoxy.mybatis.plus.condition.mapper.RoleMapper;\nimport cn.haoxy.myba"
},
{
"path": "mybatis-plus-example/plus-curd/pom.xml",
"chars": 521,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n xmlns:xsi=\"http://www"
},
{
"path": "mybatis-plus-example/plus-curd/src/main/java/cn/haoxy/mybatis/plus/curd/PlusApp.java",
"chars": 407,
"preview": "package cn.haoxy.mybatis.plus.curd;\n\nimport org.mybatis.spring.annotation.MapperScan;\nimport org.springframework.boot.Sp"
},
{
"path": "mybatis-plus-example/plus-curd/src/main/java/cn/haoxy/mybatis/plus/curd/mapper/UserMapper.java",
"chars": 204,
"preview": "package cn.haoxy.mybatis.plus.curd.mapper;\n\nimport cn.haoxy.mybatis.plus.curd.pojo.User;\nimport com.baomidou.mybatisplus"
},
{
"path": "mybatis-plus-example/plus-curd/src/main/java/cn/haoxy/mybatis/plus/curd/pojo/User.java",
"chars": 247,
"preview": "package cn.haoxy.mybatis.plus.curd.pojo;\n\nimport lombok.Data;\nimport lombok.experimental.Accessors;\n\n@Data\n@Accessors(ch"
},
{
"path": "mybatis-plus-example/plus-curd/src/main/resources/application.yml",
"chars": 497,
"preview": "server:\n port: 9001\n\nspring:\n datasource:\n url: jdbc:mysql://localhost:3306/mybatis-plus?useUnicode=true&characterE"
},
{
"path": "mybatis-plus-example/plus-curd/src/main/resources/spy.properties",
"chars": 672,
"preview": "module.log=com.p6spy.engine.logging.P6LogFactory,com.p6spy.engine.outage.P6OutageFactory\n# 自定义日志打印\nlogMessageFormat=com."
},
{
"path": "mybatis-plus-example/plus-curd/src/test/java/cn/haoxy/mybatis/plus/curd/SampleTest.java",
"chars": 2495,
"preview": "package cn.haoxy.mybatis.plus.curd;\n\nimport cn.haoxy.mybatis.plus.curd.mapper.UserMapper;\nimport cn.haoxy.mybatis.plus.c"
},
{
"path": "mybatis-plus-example/plus-generator/pom.xml",
"chars": 914,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n xmlns:xsi=\"http://www"
},
{
"path": "mybatis-plus-example/plus-generator/src/main/java/cn/haoxy/mybatis/plus/generator/CodeGenerator.java",
"chars": 4387,
"preview": "package cn.haoxy.mybatis.plus.generator;\n\nimport com.baomidou.mybatisplus.core.exceptions.MybatisPlusException;\nimport c"
},
{
"path": "mybatis-plus-example/plus-generator/src/main/java/cn/haoxy/mybatis/plus/generator/GeneratorApplication.java",
"chars": 342,
"preview": "package cn.haoxy.mybatis.plus.generator;\n\nimport org.springframework.boot.SpringApplication;\nimport org.springframework."
},
{
"path": "mybatis-plus-example/plus-generator/src/main/java/cn/haoxy/mybatis/plus/generator/MysqlGenerator.java",
"chars": 4943,
"preview": "package cn.haoxy.mybatis.plus.generator;\n\nimport com.baomidou.mybatisplus.annotation.DbType;\nimport com.baomidou.mybatis"
},
{
"path": "mybatis-plus-example/plus-page/pom.xml",
"chars": 521,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n xmlns:xsi=\"http://www"
},
{
"path": "mybatis-plus-example/plus-page/src/main/java/cn/haoxy/mybatis/plus/page/PageApp.java",
"chars": 687,
"preview": "package cn.haoxy.mybatis.plus.page;\n\nimport com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;\nimport org"
},
{
"path": "mybatis-plus-example/plus-page/src/main/java/cn/haoxy/mybatis/plus/page/mapper/UserMapper.java",
"chars": 516,
"preview": "package cn.haoxy.mybatis.plus.page.mapper;\n\nimport cn.haoxy.mybatis.plus.page.pojo.MyPage;\nimport cn.haoxy.mybatis.plus."
},
{
"path": "mybatis-plus-example/plus-page/src/main/java/cn/haoxy/mybatis/plus/page/pojo/MyPage.java",
"chars": 455,
"preview": "package cn.haoxy.mybatis.plus.page.pojo;\n\nimport com.baomidou.mybatisplus.extension.plugins.pagination.Page;\nimport lomb"
},
{
"path": "mybatis-plus-example/plus-page/src/main/java/cn/haoxy/mybatis/plus/page/pojo/ParamSome.java",
"chars": 256,
"preview": "package cn.haoxy.mybatis.plus.page.pojo;\n\nimport lombok.AllArgsConstructor;\nimport lombok.Data;\nimport lombok.NoArgsCons"
},
{
"path": "mybatis-plus-example/plus-page/src/main/java/cn/haoxy/mybatis/plus/page/pojo/User.java",
"chars": 189,
"preview": "package cn.haoxy.mybatis.plus.page.pojo;\n\nimport lombok.Data;\n\n@Data\npublic class User {\n\n private Long id;\n priva"
},
{
"path": "mybatis-plus-example/plus-page/src/main/resources/application.yml",
"chars": 486,
"preview": "server:\n port: 9002\n\nspring:\n datasource:\n url: jdbc:mysql://localhost:3306/mybatis-plus?useUnicode=true&characterE"
},
{
"path": "mybatis-plus-example/plus-page/src/main/resources/mapper/UserMapper.xml",
"chars": 652,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!DOCTYPE mapper PUBLIC \"-//mybatis.org//DTD Mapper 3.0//EN\" \"http://mybatis.org"
},
{
"path": "mybatis-plus-example/plus-page/src/test/java/cn/haoxy/mybatis/plus/page/PlusPageTest.java",
"chars": 3213,
"preview": "package cn.haoxy.mybatis.plus.page;\n\nimport cn.haoxy.mybatis.plus.page.mapper.UserMapper;\nimport cn.haoxy.mybatis.plus.p"
},
{
"path": "mybatis-plus-example/plus-page-ui/pom.xml",
"chars": 730,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n xmlns:xsi=\"http://www"
},
{
"path": "mybatis-plus-example/plus-page-ui/src/main/java/cn/haoxy/mybatis/plus/page/ui/PageUiApplication.java",
"chars": 707,
"preview": "package cn.haoxy.mybatis.plus.page.ui;\n\nimport com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;\nimport "
},
{
"path": "mybatis-plus-example/plus-page-ui/src/main/resources/application.yml",
"chars": 517,
"preview": "server:\n port: 9002\n\nspring:\n datasource:\n url: jdbc:mysql://localhost:3306/mybatis-plus?useUnicode=true&characterE"
},
{
"path": "mybatis-plus-example/pom.xml",
"chars": 2091,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n xmlns:xsi=\"http://www"
},
{
"path": "okay-spring-boot-starter/README.md",
"chars": 14503,
"preview": "### \t\t\t\t\t从SpringBoot源码到自己封装一个Starter\n\n\n\n这篇博客主要讲述一下springboot怎么给我们简化了大量的配置,然后跟着源码自己封装一个Starter,首先我们需要从两个地方来说,第一就是springbo"
},
{
"path": "okay-spring-boot-starter/pom.xml",
"chars": 2267,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n xmlns:xsi=\"http://www"
},
{
"path": "okay-spring-boot-starter/src/main/java/cn/haoxiaoyong/okay/starter/annotation/EnableOkay.java",
"chars": 949,
"preview": "package cn.haoxiaoyong.okay.starter.annotation;\n\nimport cn.haoxiaoyong.okay.starter.config.OkayProperties;\nimport cn.hao"
},
{
"path": "okay-spring-boot-starter/src/main/java/cn/haoxiaoyong/okay/starter/config/OkayProperties.java",
"chars": 1142,
"preview": "package cn.haoxiaoyong.okay.starter.config;\n\nimport org.springframework.boot.context.properties.ConfigurationProperties;"
},
{
"path": "okay-spring-boot-starter/src/main/java/cn/haoxiaoyong/okay/starter/config/OkayStarterAutoConfiguration.java",
"chars": 1430,
"preview": "package cn.haoxiaoyong.okay.starter.config;\n\nimport cn.haoxiaoyong.okay.starter.model.Okay;\nimport org.springframework.b"
},
{
"path": "okay-spring-boot-starter/src/main/java/cn/haoxiaoyong/okay/starter/model/Okay.java",
"chars": 994,
"preview": "package cn.haoxiaoyong.okay.starter.model;\n\n/**\n * @author haoxiaoyong on 2020/3/20 下午 1:27\n * e-mail: hxyHelloWorld@163"
},
{
"path": "okay-spring-boot-starter/src/main/resources/META-INF/spring.factories",
"chars": 130,
"preview": "org.springframework.boot.autoconfigure.EnableAutoConfiguration=\\\n cn.haoxiaoyong.okay.starter.config.OkayStarterAutoCon"
},
{
"path": "pom.xml",
"chars": 1817,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n xmlns:xsi=\"http://www"
},
{
"path": "springboot-admin-monitor/README.md",
"chars": 3139,
"preview": "#### springBoot-admin 日志,系统监控\n\n**springboot-admin-server**\n```xml\n<dependencies>\n <dependency>\n <group"
},
{
"path": "springboot-admin-monitor/pom.xml",
"chars": 1470,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n xmlns:xsi=\"http://www"
},
{
"path": "springboot-admin-monitor/springboot-admin-client/pom.xml",
"chars": 1327,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n xmlns:xsi=\"http://www"
},
{
"path": "springboot-admin-monitor/springboot-admin-client/src/main/java/cn/haoxiaoyong/sba/client/AdminClientApplication.java",
"chars": 483,
"preview": "package cn.haoxiaoyong.sba.client;\n\nimport org.springframework.boot.SpringApplication;\nimport org.springframework.boot.a"
},
{
"path": "springboot-admin-monitor/springboot-admin-client/src/main/java/cn/haoxiaoyong/sba/client/controller/UserController.java",
"chars": 628,
"preview": "package cn.haoxiaoyong.sba.client.controller;\n\nimport lombok.extern.slf4j.Slf4j;\nimport org.springframework.web.bind.ann"
},
{
"path": "springboot-admin-monitor/springboot-admin-client/src/main/resources/application.yml",
"chars": 441,
"preview": "spring:\n application:\n name: admin-client\n boot:\n admin:\n client:\n url: ht"
},
{
"path": "springboot-admin-monitor/springboot-admin-client2/pom.xml",
"chars": 1328,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n xmlns:xsi=\"http://www"
},
{
"path": "springboot-admin-monitor/springboot-admin-client2/src/main/java/cn/haoxiaoyong/sba/client/AdminClientApplication.java",
"chars": 483,
"preview": "package cn.haoxiaoyong.sba.client;\n\nimport org.springframework.boot.SpringApplication;\nimport org.springframework.boot.a"
},
{
"path": "springboot-admin-monitor/springboot-admin-client2/src/main/java/cn/haoxiaoyong/sba/client/controller/UserController.java",
"chars": 651,
"preview": "package cn.haoxiaoyong.sba.client.controller;\n\nimport lombok.extern.slf4j.Slf4j;\nimport org.springframework.web.bind.ann"
},
{
"path": "springboot-admin-monitor/springboot-admin-client2/src/main/resources/application.yml",
"chars": 443,
"preview": "spring:\n application:\n name: admin-client2\n boot:\n admin:\n client:\n url: h"
},
{
"path": "springboot-admin-monitor/springboot-admin-server/pom.xml",
"chars": 1493,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n xmlns:xsi=\"http://www"
},
{
"path": "springboot-admin-monitor/springboot-admin-server/src/main/java/cn/haoxiaoyong/sba/server/AdminServerApplication.java",
"chars": 568,
"preview": "package cn.haoxiaoyong.sba.server;\n\nimport de.codecentric.boot.admin.server.config.EnableAdminServer;\nimport org.springf"
},
{
"path": "springboot-admin-monitor/springboot-admin-server/src/main/java/cn/haoxiaoyong/sba/server/config/SecuritySecureConfig.java",
"chars": 2261,
"preview": "package cn.haoxiaoyong.sba.server.config;\n\nimport de.codecentric.boot.admin.server.config.AdminServerProperties;\nimport "
},
{
"path": "springboot-admin-monitor/springboot-admin-server/src/main/resources/application.yml",
"chars": 155,
"preview": "spring:\n application:\n name: admin-server\n security:\n user:\n name: admin\n pass"
},
{
"path": "springboot-druid/README.md",
"chars": 3222,
"preview": "#### 使用阿里巴巴提供的springboot整合druid包管理连接池\n\n**引入依赖:**\n\n```xml\n<dependency>\n <groupId>com.alibaba</groupId>\n <artifactI"
},
{
"path": "springboot-druid/pom.xml",
"chars": 1900,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n xmlns:xsi=\"http://www"
},
{
"path": "springboot-druid/src/main/java/cn/haoxiaoyong/druid/DruidApplication.java",
"chars": 534,
"preview": "package cn.haoxiaoyong.druid;\n\nimport org.mybatis.spring.annotation.MapperScan;\nimport org.springframework.boot.SpringAp"
},
{
"path": "springboot-druid/src/main/java/cn/haoxiaoyong/druid/controller/UserController.java",
"chars": 667,
"preview": "package cn.haoxiaoyong.druid.controller;\n\nimport cn.haoxiaoyong.druid.entity.User;\nimport cn.haoxiaoyong.druid.service.U"
},
{
"path": "springboot-druid/src/main/java/cn/haoxiaoyong/druid/entity/User.java",
"chars": 706,
"preview": "package cn.haoxiaoyong.druid.entity;\n\n/**\n * Created by Haoxy on 2019-06-25.\n * E-mail:hxyHelloWorld@163.com\n * github:h"
},
{
"path": "springboot-druid/src/main/java/cn/haoxiaoyong/druid/mapper/UserMapper.java",
"chars": 284,
"preview": "package cn.haoxiaoyong.druid.mapper;\n\nimport cn.haoxiaoyong.druid.entity.User;\n\nimport java.util.List;\n\n/**\n * Created b"
},
{
"path": "springboot-druid/src/main/java/cn/haoxiaoyong/druid/service/UserService.java",
"chars": 551,
"preview": "package cn.haoxiaoyong.druid.service;\n\nimport cn.haoxiaoyong.druid.entity.User;\nimport cn.haoxiaoyong.druid.mapper.UserM"
},
{
"path": "springboot-druid/src/main/resources/application.properties",
"chars": 2712,
"preview": "server.port=8091\n## 数据源配置\n#spring.datasource.url=jdbc:mysql://localhost:3306/springboot_druid?useUnicode=true&characterE"
},
{
"path": "springboot-druid/src/main/resources/mapper/UserMapper.xml",
"chars": 311,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!DOCTYPE mapper PUBLIC \"-//mybatis.org//DTD Mapper 3.0//EN\" \"http://mybatis.org"
},
{
"path": "springboot-easyexcel-encapsulation/README.md",
"chars": 5961,
"preview": "\n# springboot-easyexcel-encapsulation\n\neasyexcel 项目地址 :https://github.com/alibaba/easyexcel\n\n#### 对 easyexcel 进行了方法的封装,可"
},
{
"path": "springboot-easyexcel-encapsulation/pom.xml",
"chars": 1329,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n xmlns:xsi=\"http://www"
},
{
"path": "springboot-easyexcel-encapsulation/src/main/java/cn/haoxy/easyexcel/EasyexcelMethodEncapsulationApplication.java",
"chars": 494,
"preview": "package cn.haoxy.easyexcel;\n\nimport org.springframework.boot.SpringApplication;\nimport org.springframework.boot.autoconf"
},
{
"path": "springboot-easyexcel-encapsulation/src/main/java/cn/haoxy/easyexcel/controller/ExcelController.java",
"chars": 2591,
"preview": "package cn.haoxy.easyexcel.controller;\n\nimport cn.haoxy.easyexcel.excel.ExcelUtil;\nimport cn.haoxy.easyexcel.model.Expor"
},
{
"path": "springboot-easyexcel-encapsulation/src/main/java/cn/haoxy/easyexcel/excel/ExcelException.java",
"chars": 294,
"preview": "package cn.haoxy.easyexcel.excel;\n\n/**\n * @author Haoxy\n * Created in 2019-08-02.\n * E-mail:hxyHelloWorld@163.com\n * git"
},
{
"path": "springboot-easyexcel-encapsulation/src/main/java/cn/haoxy/easyexcel/excel/ExcelListener.java",
"chars": 1105,
"preview": "package cn.haoxy.easyexcel.excel;\n\nimport com.alibaba.excel.read.context.AnalysisContext;\nimport com.alibaba.excel.read."
},
{
"path": "springboot-easyexcel-encapsulation/src/main/java/cn/haoxy/easyexcel/excel/ExcelUtil.java",
"chars": 6508,
"preview": "package cn.haoxy.easyexcel.excel;\n\nimport com.alibaba.excel.ExcelReader;\nimport com.alibaba.excel.ExcelWriter;\nimport co"
},
{
"path": "springboot-easyexcel-encapsulation/src/main/java/cn/haoxy/easyexcel/excel/ExcelWriterFactroy.java",
"chars": 1496,
"preview": "package cn.haoxy.easyexcel.excel;\n\nimport com.alibaba.excel.ExcelWriter;\nimport com.alibaba.excel.metadata.BaseRowModel;"
},
{
"path": "springboot-easyexcel-encapsulation/src/main/java/cn/haoxy/easyexcel/model/ExportInfo.java",
"chars": 1163,
"preview": "package cn.haoxy.easyexcel.model;\n\nimport com.alibaba.excel.annotation.ExcelProperty;\nimport com.alibaba.excel.metadata."
},
{
"path": "springboot-easyexcel-encapsulation/src/main/java/cn/haoxy/easyexcel/model/ImportInfo.java",
"chars": 1176,
"preview": "package cn.haoxy.easyexcel.model;\n\nimport com.alibaba.excel.annotation.ExcelProperty;\nimport com.alibaba.excel.metadata."
},
{
"path": "springboot-easyexcel-encapsulation/src/main/resources/application.properties",
"chars": 188,
"preview": "spring.http.multipart.max-file-size=100MB\nspring.http.multipart.max-request-size=100MB\nspring.http.multipart.maxFileSize"
},
{
"path": "springboot-elk/ELK安装时错误记录.md",
"chars": 1045,
"preview": "### ELK安装时错误记录\n\n#### 错误1:`error='Cannot allocate memory' (errno=12)`\n\n**解决方法:**\n\n由于`elasticsearch`默认分配`jvm`空间大小为`2g`,需要改"
},
{
"path": "springboot-elk/ELK安装步骤.md",
"chars": 9732,
"preview": "### ELK安装步骤\n\n#### 简单介绍\n\n- ElasticSearch:用于存储日志信息。\n- Logstash:用于收集、处理和转发日志信息。\n- Kibana:提供可搜索的Web可视化界面。\n\n#### 准备工作安装JDK\n\n-"
},
{
"path": "springboot-elk/pom.xml",
"chars": 1166,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n xmlns:xsi=\"http://www"
},
{
"path": "springboot-elk/src/main/java/cn/haoxxiaoyong/elk/ElkApplication.java",
"chars": 459,
"preview": "package cn.haoxxiaoyong.elk;\n\nimport org.springframework.boot.SpringApplication;\nimport org.springframework.boot.autocon"
},
{
"path": "springboot-elk/src/main/java/cn/haoxxiaoyong/elk/controller/ElkController.java",
"chars": 646,
"preview": "package cn.haoxxiaoyong.elk.controller;\n\nimport lombok.extern.slf4j.Slf4j;\nimport org.springframework.web.bind.annotatio"
},
{
"path": "springboot-elk/src/main/resources/logback-spring.xml",
"chars": 2473,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--该日志将日志级别不同的log信息保存到不同的文件中 -->\n<configuration>\n <include resource=\"org/spri"
},
{
"path": "springboot-fastDFS/README.md",
"chars": 11131,
"preview": "## springboot-fastDFS\n\n### FastDFS 安装和配置\n\n**如果你已经安装好了**\n\n<a href=\"https://github.com/haoxiaoyong1014/springboot-examples"
},
{
"path": "springboot-fastDFS/README2.md",
"chars": 7004,
"preview": "### 使用FastDFSClient上传文件\n\n**引入依赖**\n\n```xml\n<dependency>\n <groupId>com.github.tobato</groupId>\n <artifactId>fastdfs-"
},
{
"path": "springboot-fastDFS/pom.xml",
"chars": 1121,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n xmlns:xsi=\"http://www"
},
{
"path": "springboot-fastDFS/src/main/java/cn/haoxiaoyong/fastdfs/Main.java",
"chars": 1049,
"preview": "package cn.haoxiaoyong.fastdfs;\n\nimport com.github.tobato.fastdfs.FdfsClientConfig;\nimport org.springframework.boot.Spri"
},
{
"path": "springboot-fastDFS/src/main/java/cn/haoxiaoyong/fastdfs/util/FastDFSClient.java",
"chars": 4710,
"preview": "package cn.haoxiaoyong.fastdfs.util;\n\nimport com.github.tobato.fastdfs.domain.fdfs.StorePath;\nimport com.github.tobato.f"
},
{
"path": "springboot-fastDFS/src/main/java/cn/haoxiaoyong/fastdfs/util/FiletoMuit.java",
"chars": 758,
"preview": "package cn.haoxiaoyong.fastdfs.util;\n\nimport org.apache.commons.io.IOUtils;\nimport org.springframework.mock.web.MockMult"
},
{
"path": "springboot-fastDFS/src/main/resources/application.properties",
"chars": 205,
"preview": "server.port=9000\n\nfdfs.soTimeout=1501\n\nfdfs.connectTimeout=1601\n\nfdfs.thumbImage.width=150\n\nfdfs.thumbImage.height=150\n\n"
},
{
"path": "springboot-fastDFS/src/test/java/cn/haoxiaoyong/fastdfs/TestFastDFSClient.java",
"chars": 2178,
"preview": "package cn.haoxiaoyong.fastdfs;\n\nimport cn.haoxiaoyong.fastdfs.util.FastDFSClient;\nimport cn.haoxiaoyong.fastdfs.util.Fi"
},
{
"path": "springboot-idempotent/README.md",
"chars": 10296,
"preview": "### springboot + redis + 注解 + 拦截器 实现接口幂等性校验\n\n#### 一、概念\n幂等性, 通俗的说就是一个接口, 多次发起同一个请求, 必须保证操作只能执行一次\n比如:\n\n* 订单接口, 不能多次创建订单\n\n*"
},
{
"path": "springboot-idempotent/pom.xml",
"chars": 1329,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n xmlns:xsi=\"http://www"
},
{
"path": "springboot-idempotent/src/main/java/cn/haoxy/redis/token/TokenApplication.java",
"chars": 1088,
"preview": "package cn.haoxy.redis.token;\n\nimport cn.haoxy.redis.token.interceptor.ApiIdempotentInterceptor;\nimport org.springframew"
},
{
"path": "springboot-idempotent/src/main/java/cn/haoxy/redis/token/annotation/ApiIdempotent.java",
"chars": 470,
"preview": "package cn.haoxy.redis.token.annotation;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention"
},
{
"path": "springboot-idempotent/src/main/java/cn/haoxy/redis/token/common/Constant.java",
"chars": 885,
"preview": "package cn.haoxy.redis.token.common;\n\n/**\n * @author Haoxy\n * Created in 2019-08-15.\n * E-mail:hxyHelloWorld@163.com\n * "
},
{
"path": "springboot-idempotent/src/main/java/cn/haoxy/redis/token/common/ResponseCode.java",
"chars": 1124,
"preview": "package cn.haoxy.redis.token.common;\n\nimport lombok.Data;\n\n/**\n * @author Haoxy\n * Created in 2019-08-15.\n * E-mail:hxyH"
},
{
"path": "springboot-idempotent/src/main/java/cn/haoxy/redis/token/common/ServerResponse.java",
"chars": 2155,
"preview": "package cn.haoxy.redis.token.common;\n\nimport com.fasterxml.jackson.annotation.JsonIgnore;\n\nimport java.io.Serializable;\n"
},
{
"path": "springboot-idempotent/src/main/java/cn/haoxy/redis/token/config/JedisConfig.java",
"chars": 1333,
"preview": "package cn.haoxy.redis.token.config;\n\nimport org.springframework.beans.factory.annotation.Value;\nimport org.springframew"
},
{
"path": "springboot-idempotent/src/main/java/cn/haoxy/redis/token/controller/TestController.java",
"chars": 852,
"preview": "package cn.haoxy.redis.token.controller;\n\nimport cn.haoxy.redis.token.annotation.ApiIdempotent;\nimport cn.haoxy.redis.to"
},
{
"path": "springboot-idempotent/src/main/java/cn/haoxy/redis/token/controller/TokenController.java",
"chars": 689,
"preview": "package cn.haoxy.redis.token.controller;\n\nimport cn.haoxy.redis.token.common.ServerResponse;\nimport cn.haoxy.redis.token"
},
{
"path": "springboot-idempotent/src/main/java/cn/haoxy/redis/token/exception/MyControllerAdvice.java",
"chars": 983,
"preview": "package cn.haoxy.redis.token.exception;\n\nimport cn.haoxy.redis.token.common.ResponseCode;\nimport cn.haoxy.redis.token.co"
},
{
"path": "springboot-idempotent/src/main/java/cn/haoxy/redis/token/exception/ServiceException.java",
"chars": 755,
"preview": "package cn.haoxy.redis.token.exception;\n\n/**\n * @author Haoxy\n * Created in 2019-08-15.\n * E-mail:hxyHelloWorld@163.com\n"
},
{
"path": "springboot-idempotent/src/main/java/cn/haoxy/redis/token/interceptor/ApiIdempotentInterceptor.java",
"chars": 1420,
"preview": "package cn.haoxy.redis.token.interceptor;\n\nimport cn.haoxy.redis.token.annotation.ApiIdempotent;\nimport cn.haoxy.redis.t"
},
{
"path": "springboot-idempotent/src/main/java/cn/haoxy/redis/token/service/TestService.java",
"chars": 291,
"preview": "package cn.haoxy.redis.token.service;\n\nimport cn.haoxy.redis.token.common.ServerResponse;\n\n/**\n * @author Haoxy\n * Creat"
},
{
"path": "springboot-idempotent/src/main/java/cn/haoxy/redis/token/service/TokenService.java",
"chars": 385,
"preview": "package cn.haoxy.redis.token.service;\n\nimport cn.haoxy.redis.token.common.ServerResponse;\n\nimport javax.servlet.http.Htt"
},
{
"path": "springboot-idempotent/src/main/java/cn/haoxy/redis/token/service/impl/TestServiceImpl.java",
"chars": 777,
"preview": "package cn.haoxy.redis.token.service.impl;\n\nimport cn.haoxy.redis.token.common.ServerResponse;\nimport cn.haoxy.redis.tok"
},
{
"path": "springboot-idempotent/src/main/java/cn/haoxy/redis/token/service/impl/TokenServiceImpl.java",
"chars": 2097,
"preview": "package cn.haoxy.redis.token.service.impl;\n\nimport cn.haoxy.redis.token.common.Constant;\nimport cn.haoxy.redis.token.com"
},
{
"path": "springboot-idempotent/src/main/java/cn/haoxy/redis/token/utils/JedisUtil.java",
"chars": 4125,
"preview": "package cn.haoxy.redis.token.utils;\n\nimport lombok.extern.slf4j.Slf4j;\nimport org.springframework.beans.factory.annotati"
},
{
"path": "springboot-idempotent/src/main/java/cn/haoxy/redis/token/utils/RandomUtil.java",
"chars": 3243,
"preview": "package cn.haoxy.redis.token.utils;\n\nimport java.util.Random;\nimport java.util.UUID;\n\n/**\n * @author Haoxy\n * Created in"
},
{
"path": "springboot-idempotent/src/main/resources/application.properties",
"chars": 242,
"preview": "server.port=11111\n\n# redis\nspring.redis.host=47.96.127.51\nspring.redis.port=6379\nspring.redis.password=adminadmin\nspring"
},
{
"path": "springboot-login-Interceptor/pom.xml",
"chars": 1992,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n xmlns:xsi=\"http://www"
},
{
"path": "springboot-login-Interceptor/src/main/java/cn/haoxy/interceptor/InterApplication.java",
"chars": 557,
"preview": "package cn.haoxy.interceptor;\n\nimport cn.haoxy.redis.example.RedisMain;\nimport org.springframework.boot.SpringApplicatio"
},
{
"path": "springboot-login-Interceptor/src/main/java/cn/haoxy/interceptor/annotation/LoginRequired.java",
"chars": 454,
"preview": "package cn.haoxy.interceptor.annotation;\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;"
},
{
"path": "springboot-login-Interceptor/src/main/java/cn/haoxy/interceptor/config/AuthenticationInterceptor.java",
"chars": 6447,
"preview": "package cn.haoxy.interceptor.config;\n\nimport cn.haoxy.interceptor.annotation.LoginRequired;\nimport cn.haoxy.interceptor."
},
{
"path": "springboot-login-Interceptor/src/main/java/cn/haoxy/interceptor/config/MvcConfigurer.java",
"chars": 866,
"preview": "package cn.haoxy.interceptor.config;\n\nimport org.springframework.context.annotation.Bean;\nimport org.springframework.con"
},
{
"path": "springboot-login-Interceptor/src/main/java/cn/haoxy/interceptor/controller/LoginController.java",
"chars": 1515,
"preview": "package cn.haoxy.interceptor.controller;\n\nimport cn.haoxy.interceptor.model.User;\nimport cn.haoxy.interceptor.service.Us"
},
{
"path": "springboot-login-Interceptor/src/main/java/cn/haoxy/interceptor/controller/UserController.java",
"chars": 877,
"preview": "package cn.haoxy.interceptor.controller;\n\nimport cn.haoxy.interceptor.annotation.LoginRequired;\nimport cn.haoxy.intercep"
},
{
"path": "springboot-login-Interceptor/src/main/java/cn/haoxy/interceptor/model/User.java",
"chars": 314,
"preview": "package cn.haoxy.interceptor.model;\n\nimport lombok.Data;\n\n@Data\npublic class User {\n\n private String id;\n\n private"
},
{
"path": "springboot-login-Interceptor/src/main/java/cn/haoxy/interceptor/service/UserService.java",
"chars": 729,
"preview": "package cn.haoxy.interceptor.service;\n\nimport cn.haoxy.interceptor.model.User;\nimport cn.haoxy.interceptor.utils.CacheCo"
},
{
"path": "springboot-login-Interceptor/src/main/java/cn/haoxy/interceptor/utils/CacheCollection.java",
"chars": 1593,
"preview": "package cn.haoxy.interceptor.utils;\n\nimport cn.haoxy.interceptor.model.User;\nimport org.springframework.stereotype.Compo"
},
{
"path": "springboot-login-Interceptor/src/main/java/cn/haoxy/interceptor/utils/TokenUtils.java",
"chars": 3793,
"preview": "package cn.haoxy.interceptor.utils;\n\nimport io.jsonwebtoken.*;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n"
},
{
"path": "springboot-login-Interceptor/src/main/resources/application.yml",
"chars": 91,
"preview": "server:\n port: 9999\nredis:\n hostName: 120.78.149.247\n password: adminadmin\n dbIndex: 0\n"
},
{
"path": "springboot-mongodb/README.md",
"chars": 1993,
"preview": "**win安装及使用**\n\n<a href=\"https://github.com/haoxiaoyong1014/springboot-examples/tree/master/springboot-mongodb/src/main/re"
},
{
"path": "springboot-mongodb/pom.xml",
"chars": 1468,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n xmlns:xsi=\"http://www"
},
{
"path": "springboot-mongodb/src/main/java/cn/haoxy/mongodb/MongodbApplication.java",
"chars": 435,
"preview": "package cn.haoxy.mongodb;\n\nimport org.springframework.boot.SpringApplication;\nimport org.springframework.boot.autoconfig"
},
{
"path": "springboot-mongodb/src/main/java/cn/haoxy/mongodb/controller/CmsPageController.java",
"chars": 1001,
"preview": "package cn.haoxy.mongodb.controller;\n\nimport cn.haoxy.mongodb.request.QueryPageRequest;\nimport cn.haoxy.mongodb.response"
},
{
"path": "springboot-mongodb/src/main/java/cn/haoxy/mongodb/dao/CmsPageRepository.java",
"chars": 935,
"preview": "package cn.haoxy.mongodb.dao;\n\nimport cn.haoxy.mongodb.domain.CmsPage;\nimport org.springframework.data.domain.Page;\nimpo"
},
{
"path": "springboot-mongodb/src/main/java/cn/haoxy/mongodb/domain/CmsPage.java",
"chars": 1207,
"preview": "package cn.haoxy.mongodb.domain;\n\nimport lombok.Data;\nimport lombok.ToString;\nimport org.springframework.data.annotation"
},
{
"path": "springboot-mongodb/src/main/java/cn/haoxy/mongodb/domain/CmsPageParam.java",
"chars": 311,
"preview": "package cn.haoxy.mongodb.domain;\n\nimport lombok.Data;\nimport lombok.ToString;\n\n/**\n * @Author: mrt.\n * @Description:\n * "
},
{
"path": "springboot-mongodb/src/main/java/cn/haoxy/mongodb/request/QueryPageRequest.java",
"chars": 419,
"preview": "package cn.haoxy.mongodb.request;\n\nimport lombok.Data;\n\n/**\n * Created by Haoxy on 2019-05-09.\n * E-mail:hxyHelloWorld@1"
},
{
"path": "springboot-mongodb/src/main/java/cn/haoxy/mongodb/response/CommonCode.java",
"chars": 952,
"preview": "package cn.haoxy.mongodb.response;\n\nimport lombok.ToString;\n\n/**\n * @Author: mrt.\n * @Description:\n * @Date:Created in 2"
},
{
"path": "springboot-mongodb/src/main/java/cn/haoxy/mongodb/response/QueryResponseResult.java",
"chars": 340,
"preview": "package cn.haoxy.mongodb.response;\n\nimport lombok.Data;\nimport lombok.ToString;\n\n@Data\n@ToString\npublic class QueryRespo"
},
{
"path": "springboot-mongodb/src/main/java/cn/haoxy/mongodb/response/QueryResult.java",
"chars": 321,
"preview": "package cn.haoxy.mongodb.response;\n\nimport lombok.Data;\nimport lombok.ToString;\n\nimport java.util.List;\n\n/**\n * @Author:"
},
{
"path": "springboot-mongodb/src/main/java/cn/haoxy/mongodb/response/Response.java",
"chars": 205,
"preview": "package cn.haoxy.mongodb.response;\n\n/**\n * Created by admin on 2019/3/5.\n */\npublic interface Response {\n public stat"
},
{
"path": "springboot-mongodb/src/main/java/cn/haoxy/mongodb/response/ResponseResult.java",
"chars": 807,
"preview": "package cn.haoxy.mongodb.response;\n\nimport lombok.Data;\nimport lombok.NoArgsConstructor;\nimport lombok.ToString;\n\n/**\n *"
},
{
"path": "springboot-mongodb/src/main/java/cn/haoxy/mongodb/response/ResultCode.java",
"chars": 313,
"preview": "package cn.haoxy.mongodb.response;\n\n/**\n * Created by mrt on 2019/3/5.\n * 10000-- 通用错误代码\n * 22000-- 媒资错误代码\n * 23000-- 用户"
},
{
"path": "springboot-mongodb/src/main/java/cn/haoxy/mongodb/service/PageService.java",
"chars": 1551,
"preview": "package cn.haoxy.mongodb.service;\n\nimport cn.haoxy.mongodb.dao.CmsPageRepository;\nimport cn.haoxy.mongodb.domain.CmsPage"
},
{
"path": "springboot-mongodb/src/main/resources/application.yml",
"chars": 158,
"preview": "server:\n port: 31001\nspring:\n application:\n name: xc-service-manage-cms\n data:\n mongodb:\n uri: mongodb://"
},
{
"path": "springboot-mongodb/src/main/resources/sql/cms_config.json",
"chars": 8614,
"preview": "{ \"_id\" : { \"$oid\" : \"5a791725dd573c3574ee333f\" }, \"_class\" : \"com.xuecheng.framework.domain.cms.CmsConfig\", \"name\" : \"轮"
},
{
"path": "springboot-mongodb/src/main/resources/sql/cms_page.json",
"chars": 12274,
"preview": "{ \"_id\" : { \"$oid\" : \"5a754adf6abb500ad05688d9\" }, \"_class\" : \"com.xuecheng.framework.domain.cms.CmsPage\", \"siteId\" : \"5"
},
{
"path": "springboot-mongodb/src/main/resources/sql/cms_site.json",
"chars": 269,
"preview": "{ \"_id\" : { \"$oid\" : \"5a751fab6abb5044e0d19ea1\" }, \"_class\" : \"com.xuecheng.framework.domain.cms.CmsSite\", \"siteName\" : "
},
{
"path": "springboot-mongodb/src/main/resources/sql/cms_site_server.json",
"chars": 500,
"preview": "{ \"_id\" : { \"$oid\" : \"5a754bdb6abb500ad05688db\" }, \"_class\" : \"com.xuecheng.framework.domain.cms.CmsSiteServer\", \"ip\" : "
},
{
"path": "springboot-mongodb/src/main/resources/sql/cms_template.json",
"chars": 2013,
"preview": "{ \"_id\" : { \"$oid\" : \"5a925be7b00ffc4b3c1578b5\" }, \"_class\" : \"com.xuecheng.framework.domain.cms.CmsTemplate\", \"siteId\" "
},
{
"path": "springboot-mongodb/src/main/resources/sql/filesystem.json",
"chars": 5461,
"preview": "{ \"_id\" : \"group1/M00/00/01/wKhlQFp5fGiAUSkDAAARA0xqVgo187.png\", \"_class\" : \"com.xuecheng.framework.domain.filesystem.Fi"
},
{
"path": "springboot-mongodb/src/main/resources/sql/fs.chunks.json",
"chars": 3737668,
"preview": "{ \"_id\" : { \"$oid\" : \"5a7719d76abb5042987eec3b\" }, \"files_id\" : { \"$oid\" : \"5a7719d76abb5042987eec3a\" }, \"n\" : 0, \"data\""
},
{
"path": "springboot-mongodb/src/main/resources/sql/fs.files.json",
"chars": 62882,
"preview": "{ \"_id\" : { \"$oid\" : \"5a7719d76abb5042987eec3a\" }, \"metadata\" : { \"_class\" : \"com.xuecheng.framework.domain.cms.CmsPage\""
},
{
"path": "springboot-mongodb/src/main/resources/sql/sys_dictionary.json",
"chars": 6359,
"preview": "{ \"_id\" : { \"$oid\" : \"5a7d50bdd019f150f4ab8ef7\" }, \"d_name\" : \"文件类型\", \"d_type\" : \"100\", \"d_value\" : [ { \"sd_name\" : \"cms"
},
{
"path": "springboot-mongodb/src/main/resources/sql/user_test.json",
"chars": 376,
"preview": "{ \"_id\" : { \"$oid\" : \"5abe3b9c5b05aa218434f4cf\" }, \"_class\" : \"com.xuecheng.framework.domain.test.UserTest\", \"name\" : \"传"
},
{
"path": "springboot-mongodb/src/test/java/cn/haoxy/mongodb/CmsPageRepositoryTest.java",
"chars": 2199,
"preview": "package cn.haoxy.mongodb;\n\nimport cn.haoxy.mongodb.dao.CmsPageRepository;\nimport cn.haoxy.mongodb.domain.CmsPage;\nimport"
},
{
"path": "springboot-mybatis-myehcache/pom.xml",
"chars": 2123,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n xmlns:xsi=\"http://www"
},
{
"path": "springboot-mybatis-myehcache/src/main/java/com/haoxy/example/AppEhcache.java",
"chars": 489,
"preview": "package com.haoxy.example;\n\nimport org.springframework.boot.SpringApplication;\nimport org.springframework.boot.autoconfi"
},
{
"path": "springboot-mybatis-myehcache/src/main/java/com/haoxy/example/controller/PersonController.java",
"chars": 3549,
"preview": "package com.haoxy.example.controller;\n\nimport com.alibaba.fastjson.JSON;\nimport com.github.pagehelper.Page;\nimport com.h"
},
{
"path": "springboot-mybatis-myehcache/src/main/java/com/haoxy/example/mapper/PersonMapper.java",
"chars": 788,
"preview": "package com.haoxy.example.mapper;\n\nimport com.github.pagehelper.Page;\nimport com.haoxy.example.model.Person;\nimport org."
},
{
"path": "springboot-mybatis-myehcache/src/main/java/com/haoxy/example/model/Person.java",
"chars": 928,
"preview": "package com.haoxy.example.model;\n\nimport java.io.Serializable;\n\n/**\n * Created by hxy on 2018/6/27.\n * E-mail:hxyHelloWo"
},
{
"path": "springboot-mybatis-myehcache/src/main/java/com/haoxy/example/page/PageInfo.java",
"chars": 3205,
"preview": "package com.haoxy.example.page;\n\nimport com.github.pagehelper.Page;\n\nimport java.io.Serializable;\nimport java.util.Colle"
},
{
"path": "springboot-mybatis-myehcache/src/main/java/com/haoxy/example/service/PersonService.java",
"chars": 636,
"preview": "package com.haoxy.example.service;\n\nimport com.github.pagehelper.Page;\nimport com.haoxy.example.model.Person;\n\nimport ja"
},
{
"path": "springboot-mybatis-myehcache/src/main/java/com/haoxy/example/service/impl/PersonServiceImpl.java",
"chars": 1489,
"preview": "package com.haoxy.example.service.impl;\n\nimport com.github.pagehelper.Page;\nimport com.github.pagehelper.PageHelper;\nimp"
},
{
"path": "springboot-mybatis-myehcache/src/main/resources/application.properties",
"chars": 963,
"preview": "server.port=8084\n# \\u6570\\u636E\\u6E90\\u914D\\u7F6E\nspring.datasource.url=jdbc:mysql://localhost:3306/test?useUnicode=true"
},
{
"path": "springboot-mybatis-myehcache/src/main/resources/ehcache.xml",
"chars": 1654,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ehcache>\n <!--\n http://www.cnblogs.com/lzy1991/p/5335249.html\n "
},
{
"path": "springboot-mybatis-myehcache/src/main/resources/mappers/PersonMapper.xml",
"chars": 5595,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!DOCTYPE mapper PUBLIC \"-//mybatis.org//DTD Mapper 3.0//EN\" \"http://mybatis.org"
},
{
"path": "springboot-mybatis-myehcache/src/test/java/com/haoxy/test/DataSourceTests.java",
"chars": 1081,
"preview": "package com.haoxy.test;\n\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.springframework.beans.factor"
},
{
"path": "springboot-mybatis-myehcache/src/test/java/com/haoxy/test/PersonMapperTests.java",
"chars": 2298,
"preview": "package com.haoxy.test;\n\nimport com.alibaba.fastjson.JSON;\nimport com.github.pagehelper.Page;\nimport com.haoxy.example.m"
},
{
"path": "springboot-oauth2-authorization-server/README.md",
"chars": 1553,
"preview": "### springboot-oauth2\n\n2018/6/20 添加 springboot-oauth2\n\n* springboot-oauth2 包括: springboot-oauth2-authorization-server(认证"
},
{
"path": "springboot-oauth2-authorization-server/pom.xml",
"chars": 2940,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n xmlns:xsi=\"http://www"
},
{
"path": "springboot-oauth2-authorization-server/src/main/java/cn/merryyou/security/SpringBoot2Oauth2Application.java",
"chars": 2347,
"preview": "package cn.merryyou.security;\n\nimport cn.merryyou.security.properties.OAuth2Properties;\nimport cn.merryyou.security.util"
},
{
"path": "springboot-oauth2-authorization-server/src/main/java/cn/merryyou/security/config/TokenStoreConfig.java",
"chars": 2702,
"preview": "package cn.merryyou.security.config;\n\nimport cn.merryyou.security.properties.OAuth2Properties;\nimport cn.merryyou.securi"
},
{
"path": "springboot-oauth2-authorization-server/src/main/java/cn/merryyou/security/handler/AppLoginInSuccessHandler.java",
"chars": 4458,
"preview": "package cn.merryyou.security.handler;\n\nimport cn.merryyou.security.utils.JsonUtil;\nimport com.fasterxml.jackson.databind"
},
{
"path": "springboot-oauth2-authorization-server/src/main/java/cn/merryyou/security/properties/OAuth2ClientProperties.java",
"chars": 941,
"preview": "package cn.merryyou.security.properties;\n\nimport lombok.Data;\n\n/**\n * Created by hxy on 2018/6/20\n * E-mail:hxyHelloWorl"
},
{
"path": "springboot-oauth2-authorization-server/src/main/java/cn/merryyou/security/properties/OAuth2CoreConfig.java",
"chars": 406,
"preview": "package cn.merryyou.security.properties;\n\nimport org.springframework.boot.context.properties.EnableConfigurationProperti"
},
{
"path": "springboot-oauth2-authorization-server/src/main/java/cn/merryyou/security/properties/OAuth2Properties.java",
"chars": 825,
"preview": "package cn.merryyou.security.properties;\n\nimport lombok.Data;\nimport org.springframework.boot.context.properties.Configu"
},
{
"path": "springboot-oauth2-authorization-server/src/main/java/cn/merryyou/security/security/MyUserDetailsService.java",
"chars": 1211,
"preview": "package cn.merryyou.security.security;\n\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.spring"
},
{
"path": "springboot-oauth2-authorization-server/src/main/java/cn/merryyou/security/security/SecurityConfig.java",
"chars": 1383,
"preview": "package cn.merryyou.security.security;//package cn.merryyou.security.security;\n\n\nimport org.springframework.context.anno"
},
{
"path": "springboot-oauth2-authorization-server/src/main/java/cn/merryyou/security/security/jwt/MerryyouJwtTokenEnhancer.java",
"chars": 925,
"preview": "package cn.merryyou.security.security.jwt;\n\nimport org.springframework.security.oauth2.common.DefaultOAuth2AccessToken;\n"
},
{
"path": "springboot-oauth2-authorization-server/src/main/java/cn/merryyou/security/server/MerryyouAuthorizationServerConfig.java",
"chars": 4458,
"preview": "package cn.merryyou.security.server;\n\nimport cn.merryyou.security.properties.OAuth2ClientProperties;\nimport cn.merryyou."
},
{
"path": "springboot-oauth2-authorization-server/src/main/java/cn/merryyou/security/server/MerryyouResourceServerConfig.java",
"chars": 1319,
"preview": "package cn.merryyou.security.server;\n\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springfr"
},
{
"path": "springboot-oauth2-authorization-server/src/main/java/cn/merryyou/security/utils/JsonUtil.java",
"chars": 471,
"preview": "package cn.merryyou.security.utils;\n\nimport com.google.gson.Gson;\nimport com.google.gson.GsonBuilder;\n\n/**\n * Created by"
},
{
"path": "springboot-oauth2-authorization-server/src/main/resources/application.yml",
"chars": 504,
"preview": "server:\n port: 8888\nspring:\n redis:\n host: 47.96.127.51\n port: 6379\n password: adminadmin\n jedis:\n po"
},
{
"path": "springboot-oauth2-authorization-server/src/test/java/cn/merryyou/security/SpringBoot2Oauth2Test.java",
"chars": 4487,
"preview": "package cn.merryyou.security;\n\nimport cn.merryyou.security.utils.JsonUtil;\nimport lombok.extern.slf4j.Slf4j;\nimport org."
},
{
"path": "springboot-oauth2-resource-server/pom.xml",
"chars": 1774,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n xmlns:xsi=\"http://www"
},
{
"path": "springboot-oauth2-resource-server/src/main/java/cn/merryyou/security/SpringBoot2Oauth2ResourceApplication.java",
"chars": 978,
"preview": "package cn.merryyou.security;\n\nimport org.springframework.boot.SpringApplication;\nimport org.springframework.boot.autoco"
}
]
// ... and 161 more files (download for full content)
About this extraction
This page contains the full source code of the haoxiaoyong1014/springboot-examples GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 361 files (5.1 MB), approximately 1.4M tokens, and a symbol index with 1147 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.