├── .gitignore ├── README.md ├── dubbo-annotation-sample ├── README.md ├── dubbo-annotation-consumer │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── MavenWrapperDownloader.java │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── ipman │ │ │ │ └── sample │ │ │ │ └── dubbo │ │ │ │ └── annotation │ │ │ │ ├── DubboAnntationConsumerApplication.java │ │ │ │ ├── action │ │ │ │ └── AnnotationAction.java │ │ │ │ ├── config │ │ │ │ └── ConsumerConfiguration.java │ │ │ │ └── service │ │ │ │ ├── AnnotationConstants.java │ │ │ │ ├── IHelloService.java │ │ │ │ └── impl │ │ │ │ └── HelloServiceImpl.java │ │ └── resources │ │ │ ├── application.properties │ │ │ └── spring │ │ │ └── dubbo-consumer.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── ipman │ │ └── sample │ │ └── dubbo │ │ └── annotation │ │ └── DubboAnntationConsumerApplicationTests.java └── dubbo-annotation-provider │ ├── .gitignore │ ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── ipman │ │ │ └── sample │ │ │ └── dubbo │ │ │ └── annotation │ │ │ ├── DubboAnnotationProviderApplication.java │ │ │ ├── config │ │ │ └── ProviderConfiguration.java │ │ │ └── service │ │ │ ├── AnnotationConstants.java │ │ │ ├── IHelloService.java │ │ │ └── impl │ │ │ └── HelloServiceImpl.java │ └── resources │ │ ├── application.properties │ │ └── spring │ │ └── dubbo-provider.properties │ └── test │ └── java │ └── com │ └── ipman │ └── sample │ └── dubbo │ └── annotation │ └── DubboAnnotationProviderApplicationTests.java ├── dubbo-async-sample ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── README.md ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── ipman │ │ └── dubbo │ │ └── async │ │ └── sample │ │ ├── AsyncConsumer.java │ │ ├── AsyncProvider.java │ │ ├── api │ │ └── AsyncService.java │ │ └── impl │ │ └── AsyncServiceImpl.java │ └── resources │ └── spring │ ├── async-consumer.xml │ └── async-provider.xml ├── dubbo-attachment-sample ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── README.md ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── ipman │ │ │ └── dubbo │ │ │ └── attachment │ │ │ └── sample │ │ │ ├── AttachmentConsumer.java │ │ │ ├── AttachmentProvider.java │ │ │ ├── api │ │ │ └── AttachmentService.java │ │ │ └── impl │ │ │ └── AttachmentServiceImpl.java │ └── resources │ │ └── spring │ │ ├── attachment-consumer.xml │ │ └── attachment-provider.xml │ └── test │ └── java │ └── com │ └── ipman │ └── dubbo │ └── attachment │ └── sample │ └── DubboAttachmentSampleApplicationTests.java ├── dubbo-cache-sample ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── README.md ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── ipman │ │ │ └── dubbo │ │ │ └── cache │ │ │ └── sample │ │ │ ├── CacheConsumer.java │ │ │ ├── CacheProvider.java │ │ │ └── service │ │ │ ├── CacheService.java │ │ │ └── impl │ │ │ └── CacheServiceImpl.java │ └── resources │ │ └── spring │ │ ├── cache-consumer.xml │ │ └── cache-provider.xml │ └── test │ └── java │ └── com │ └── ipman │ └── dubbo │ └── cache │ └── sample │ └── DubboCacheSampleApplicationTests.java ├── dubbo-callback-sample ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── README.md ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── ipman │ │ └── dubbo │ │ └── callback │ │ └── sample │ │ ├── CallbackConsumer.java │ │ ├── CallbackProvider.java │ │ ├── api │ │ ├── CallbackListener.java │ │ └── CallbackService.java │ │ └── impl │ │ └── CallbackServiceImpl.java │ └── resources │ └── spring │ ├── callback-consumer.xml │ └── callback-provider.xml ├── dubbo-consul-sample ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── README.md ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── ipman │ │ │ └── dubbo │ │ │ └── consul │ │ │ └── sample │ │ │ ├── ConsulConsumer.java │ │ │ ├── ConsulProvider.java │ │ │ ├── api │ │ │ └── DemoService.java │ │ │ └── impl │ │ │ └── DemoServiceImpl.java │ └── resources │ │ └── spring │ │ ├── consul-consumer.xml │ │ └── consul-provider.xml │ └── test │ └── java │ └── com │ └── ipman │ └── dubbo │ └── consul │ └── sample │ └── DubboConsulSampleApplicationTests.java ├── dubbo-http-sample ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── README.md ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── ipman │ │ │ └── dubbo │ │ │ └── http │ │ │ └── sample │ │ │ ├── HttpConsumer.java │ │ │ ├── HttpProvider.java │ │ │ ├── api │ │ │ └── DemoService.java │ │ │ └── impl │ │ │ └── DemoServiceImpl.java │ └── resources │ │ ├── application.properties │ │ ├── log4j.properties │ │ └── spring │ │ ├── http-consumer.xml │ │ └── http-provider.xml │ └── test │ └── java │ └── com │ └── ipman │ └── dubbo │ └── http │ └── sample │ └── DubboHttpSampleApplicationTests.java ├── dubbo-local-sample ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── README.md ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── ipman │ │ └── dubbo │ │ └── local │ │ └── sample │ │ ├── LocalDubbo.java │ │ ├── api │ │ └── DemoService.java │ │ └── impl │ │ └── DemoServiceImpl.java │ └── resources │ └── spring │ └── local-dubbo.xml ├── dubbo-mock-sample ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── README.md ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── ipman │ │ └── dubbo │ │ └── mock │ │ └── sample │ │ ├── MockCunsumer.java │ │ ├── MockProvider.java │ │ ├── api │ │ ├── MockService.java │ │ └── MockServiceMock.java │ │ └── impl │ │ └── MockServiceImpl.java │ └── resources │ └── spring │ ├── mock-consumer.xml │ └── mock-provider.xml ├── dubbo-nacos-sample ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── README.md ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── ipman │ │ │ └── dubbo │ │ │ └── nacos │ │ │ └── sample │ │ │ ├── NacosConsumer.java │ │ │ ├── NacosProvider.java │ │ │ ├── api │ │ │ └── DemoService.java │ │ │ └── impl │ │ │ └── DemoServiceImpl.java │ └── resources │ │ └── spring │ │ ├── nacos-consumer.xml │ │ └── nacos-provider.xml │ └── test │ └── java │ └── com │ └── ipman │ └── dubbo │ └── nacos │ └── sample │ └── DubboNacosSampleApplicationTests.java ├── dubbo-notify-sample ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── README.md ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── ipman │ │ └── dubbo │ │ └── notify │ │ └── sample │ │ ├── NotifyConsumer.java │ │ ├── NotifyProvider.java │ │ ├── api │ │ ├── DemoService.java │ │ └── Notify.java │ │ └── impl │ │ ├── DemoServiceImpl.java │ │ └── NotifyImpl.java │ └── resources │ └── spring │ ├── notify-consumer.xml │ └── notify-provider.xml ├── dubbo-spi-sample ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── README.md ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── ipman │ │ └── dubbo │ │ └── spi │ │ └── sample │ │ ├── SpiConsumer.java │ │ ├── SpiProvider.java │ │ ├── api │ │ └── DemoService.java │ │ ├── impl │ │ └── DemoServiceImpl.java │ │ └── spi │ │ ├── CustomConsumerFilter.java │ │ └── CustomConsumerLoadBalance.java │ └── resources │ ├── META-INF │ └── dubbo │ │ ├── org.apache.dubbo.rpc.Filter │ │ └── org.apache.dubbo.rpc.cluster.LoadBalance │ └── spring │ ├── spi-consumer.xml │ └── spi-provider.xml ├── dubbo-xml-sample ├── README.md ├── dubbo-xml-api │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── MavenWrapperDownloader.java │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── ipman │ │ │ └── dubbo │ │ │ └── xml │ │ │ └── api │ │ │ ├── DubboXmlApiApplication.java │ │ │ └── service │ │ │ └── IHelloService.java │ │ └── resources │ │ └── application.properties ├── dubbo-xml-consume │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── MavenWrapperDownloader.java │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── ipman │ │ │ │ └── dubbo │ │ │ │ └── xml │ │ │ │ └── consume │ │ │ │ ├── DubboXmlConsumeApplication.java │ │ │ │ └── action │ │ │ │ └── CallHelloService.java │ │ └── resources │ │ │ ├── application.properties │ │ │ └── consumer │ │ │ └── dubbo-xml-reference.xml │ │ └── test │ │ └── java │ │ └── com │ │ └── ipman │ │ └── dubbo │ │ └── xml │ │ └── consume │ │ └── DubboXmlConsumeApplicationTests.java └── dubbo-xml-provider │ ├── .gitignore │ ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── ipman │ │ │ └── dubbo │ │ │ └── xml │ │ │ └── provider │ │ │ ├── DubboXmlProviderApplication.java │ │ │ └── impl │ │ │ └── HelloServiceImpl.java │ └── resources │ │ ├── application.properties │ │ └── provider │ │ └── dubbo-hello-provider.xml │ └── test │ └── java │ └── com │ └── ipman │ └── dubbo │ └── xml │ └── provider │ └── DubboXmlProviderApplicationTests.java ├── springboot-atomikos-xa-sample ├── README.md ├── mvnw ├── mvnw.cmd ├── pom.xml ├── sql │ └── demo.sql └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── ipman │ │ │ └── atomikos │ │ │ └── xa │ │ │ └── springboot │ │ │ ├── AtomikosFrameApplication.java │ │ │ ├── config │ │ │ └── AtomikosDataSourceConfig.java │ │ │ └── service │ │ │ └── XATransactionService.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── ipman │ └── atomikos │ └── xa │ └── springboot │ └── springbootatomikosxasample │ └── SpringbootAtomikosXaSampleApplicationTests.java ├── springboot-drools-sample ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── README.md ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── ipman │ │ │ └── drools │ │ │ └── springboot │ │ │ ├── SpringbootDroolsSampleApplication.java │ │ │ ├── config │ │ │ └── DroolsConfig.java │ │ │ ├── controller │ │ │ └── HelloController.java │ │ │ └── service │ │ │ └── RuleService.java │ └── resources │ │ ├── application.properties │ │ └── rules │ │ └── helloworld.drl │ └── test │ └── java │ └── com │ └── ipman │ └── drools │ └── springboot │ └── SpringbootDroolsSampleApplicationTests.java ├── springboot-freemarker-sample ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml ├── readme.md └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── ipman │ │ │ └── freemarker │ │ │ └── sample │ │ │ ├── SpringbootFreemarkerSampleApplication.java │ │ │ ├── controller │ │ │ ├── Demo.java │ │ │ └── Demo1.java │ │ │ └── entity │ │ │ └── Student.java │ └── resources │ │ ├── application.properties │ │ └── templates │ │ ├── demo.ftl │ │ └── demo1.ftl │ └── test │ └── java │ └── com │ └── ipman │ └── freemarker │ └── sample │ └── SpringbootFreemarkerSampleApplicationTests.java ├── springboot-jedis-sample ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── README.md ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── ipman │ │ │ └── springboot │ │ │ └── redis │ │ │ └── jedis │ │ │ └── sample │ │ │ ├── SpringbootJedisSampleApplication.java │ │ │ ├── api │ │ │ └── JedisController.java │ │ │ ├── config │ │ │ └── RedisConfig.java │ │ │ └── utils │ │ │ └── JedisUtil.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── ipman │ └── springboot │ └── redis │ └── jedis │ └── sample │ └── JedisTest.java ├── springboot-kafka-sample ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── ipman │ │ │ └── springboot │ │ │ └── kafka │ │ │ └── sample │ │ │ └── SpringbootKafkaSampleApplication.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── ipman │ └── springboot │ └── kafka │ └── sample │ └── SpringbootKafkaSampleApplicationTests.java ├── springboot-lettuce-sample ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── README.md ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── ipman │ │ │ └── springboot │ │ │ └── lettuce │ │ │ └── sample │ │ │ ├── SpringbootLettuceSampleApplication.java │ │ │ ├── api │ │ │ └── LettuceController.java │ │ │ ├── config │ │ │ ├── LettuceClientConfig.java │ │ │ └── LettucePoolConfig.java │ │ │ └── utils │ │ │ ├── LettuceUtil.java │ │ │ └── SyncCommandCallback.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── ipman │ └── springboot │ └── lettuce │ └── sample │ └── SpringbootLettuceSampleApplicationTests.java ├── springboot-nacos-sample ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── README.md ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── ipman │ │ └── springboot │ │ └── nacos │ │ └── sample │ │ ├── SpringbootNacosSampleApplication.java │ │ └── api │ │ └── NacosController.java │ └── resources │ └── application.properties ├── springboot-netty-sample ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── README.md ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── ipman │ │ │ └── netty │ │ │ └── springboot │ │ │ └── sample │ │ │ ├── SpringbootNettySampleApplication.java │ │ │ ├── echo │ │ │ ├── EchoClient.java │ │ │ ├── EchoClientHandler.java │ │ │ ├── EchoServer.java │ │ │ └── EchoServerHandler.java │ │ │ └── http │ │ │ ├── HttpServer.java │ │ │ └── HttpServerHandler.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── ipman │ └── netty │ └── springboot │ └── sample │ └── SpringbootNettySampleApplicationTests.java ├── springboot-redisson-sample ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── README.md ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── ipman │ │ │ └── springboot │ │ │ └── redisson │ │ │ └── sample │ │ │ ├── SpringbootRedissonSampleApplication.java │ │ │ ├── config │ │ │ └── RedissonConfig.java │ │ │ └── examples │ │ │ └── RedissonExamples.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── ipman │ └── springboot │ └── redisson │ └── sample │ ├── SpringbootRedissonSampleApplicationTests.java │ └── examples │ └── RedissonExamplesTest.java ├── springboot-rpc-grpc-sample ├── README.md ├── springboot-rpc-grpc-consume │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── MavenWrapperDownloader.java │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── ipman │ │ │ │ └── rpc │ │ │ │ └── grpc │ │ │ │ └── springboot │ │ │ │ ├── SpringbootRpcGrpcConsumeApplication.java │ │ │ │ ├── api │ │ │ │ └── GrpcClientController.java │ │ │ │ ├── lib │ │ │ │ ├── GreeterGrpc.java │ │ │ │ └── GreeterOuterClass.java │ │ │ │ ├── proto │ │ │ │ └── greeter.proto │ │ │ │ └── service │ │ │ │ ├── IGrpcClientService.java │ │ │ │ └── impl │ │ │ │ └── GrpcClientServiceImpl.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── ipman │ │ └── rpc │ │ └── grpc │ │ └── springboot │ │ └── SpringbootRpcGrpcConsumeApplicationTests.java └── springboot-rpc-grpc-provide │ ├── .gitignore │ ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── ipman │ │ │ └── rpc │ │ │ └── grpc │ │ │ └── springboot │ │ │ ├── SpringbootRpcGrpcProvideApplication.java │ │ │ ├── lib │ │ │ ├── GreeterGrpc.java │ │ │ └── GreeterOuterClass.java │ │ │ ├── proto │ │ │ └── greeter.proto │ │ │ └── server │ │ │ └── GreeterService.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── ipman │ └── rpc │ └── grpc │ └── springboot │ └── SpringbootRpcGrpcProvideApplicationTests.java ├── springboot-rpc-thrift-sample ├── README.md ├── springboot-rpc-thrift-consume │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── MavenWrapperDownloader.java │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── ipman │ │ │ │ └── rpc │ │ │ │ └── thrift │ │ │ │ └── consume │ │ │ │ └── springboot │ │ │ │ ├── SpringbootRpcThriftConsumeApplication.java │ │ │ │ ├── api │ │ │ │ └── TestDemoController.java │ │ │ │ ├── client │ │ │ │ ├── TTSocket.java │ │ │ │ ├── ThriftClient.java │ │ │ │ ├── ThriftClientConfig.java │ │ │ │ └── ThriftClientConnectPoolFactory.java │ │ │ │ ├── dto │ │ │ │ └── DemoServiceDTO.java │ │ │ │ ├── pojo │ │ │ │ ├── DemoPOJO.java │ │ │ │ └── ExceptionPOJO.java │ │ │ │ └── service │ │ │ │ ├── TestDemoService.java │ │ │ │ └── impl │ │ │ │ └── TestDemoServiceImpl.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── ipman │ │ └── rpc │ │ └── thrift │ │ └── consume │ │ └── springboot │ │ └── SpringbootRpcThriftConsumeApplicationTests.java └── springboot-rpc-thrift-provide │ ├── .gitignore │ ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── ipman │ │ │ └── rpc │ │ │ └── thrift │ │ │ └── provide │ │ │ └── springboot │ │ │ ├── SpringbootRpcThriftProvideApplication.java │ │ │ ├── dto │ │ │ └── DemoServiceDTO.java │ │ │ ├── idl │ │ │ └── demo.thrift │ │ │ ├── impl │ │ │ └── DemoServiceImpl.java │ │ │ ├── pojo │ │ │ ├── DemoPOJO.java │ │ │ └── ExceptionPOJO.java │ │ │ └── server │ │ │ └── ThriftServer.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── ipman │ └── rpc │ └── thrift │ └── provide │ └── springboot │ └── SpringbootRpcThriftProvideApplicationTests.java ├── springboot-seata-at-sample ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── README.md ├── seata-at-account-service │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── ipman │ │ │ │ └── sb2accountservice │ │ │ │ ├── Sb2AccountServiceApplication.java │ │ │ │ ├── config │ │ │ │ ├── DataSourceConfig.java │ │ │ │ └── SeataRestTemplateAutoConfiguration.java │ │ │ │ ├── controller │ │ │ │ └── AccountController.java │ │ │ │ ├── entity │ │ │ │ └── Account.java │ │ │ │ ├── filter │ │ │ │ └── SeataFilter.java │ │ │ │ ├── interceptor │ │ │ │ └── SeataRestTemplateInterceptor.java │ │ │ │ ├── mapper │ │ │ │ └── AccountMapper.java │ │ │ │ └── service │ │ │ │ └── AccountService.java │ │ └── resources │ │ │ ├── application.properties │ │ │ └── mapper │ │ │ └── AccountMapper.xml │ │ └── test │ │ └── java │ │ └── com │ │ └── ipman │ │ └── sb2accountservice │ │ └── Sb2AccountServiceApplicationTests.java ├── seata-at-business-service │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── ipman │ │ │ │ └── sb2accountservice │ │ │ │ ├── Sb2BusinessServiceApplication.java │ │ │ │ ├── client │ │ │ │ ├── OrderClient.java │ │ │ │ └── StorageClient.java │ │ │ │ ├── config │ │ │ │ ├── DataSourceConfig.java │ │ │ │ └── SeataRestTemplateAutoConfiguration.java │ │ │ │ ├── controller │ │ │ │ └── BusinessController.java │ │ │ │ ├── filter │ │ │ │ └── SeataFilter.java │ │ │ │ ├── interceptor │ │ │ │ └── SeataRestTemplateInterceptor.java │ │ │ │ └── service │ │ │ │ └── BusinessService.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── ipman │ │ └── sb2accountservice │ │ └── Sb2AccountServiceApplicationTests.java ├── seata-at-order-service │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── ipman │ │ │ │ └── sb2accountservice │ │ │ │ ├── Sb2OrderServiceApplication.java │ │ │ │ ├── client │ │ │ │ └── AccountClient.java │ │ │ │ ├── config │ │ │ │ ├── DataSourceConfig.java │ │ │ │ └── SeataRestTemplateAutoConfiguration.java │ │ │ │ ├── controller │ │ │ │ └── OrderController.java │ │ │ │ ├── entity │ │ │ │ └── Order.java │ │ │ │ ├── filter │ │ │ │ └── SeataFilter.java │ │ │ │ ├── interceptor │ │ │ │ └── SeataRestTemplateInterceptor.java │ │ │ │ ├── mapper │ │ │ │ └── OrderMapper.java │ │ │ │ └── service │ │ │ │ └── OrderService.java │ │ └── resources │ │ │ ├── application.properties │ │ │ └── mapper │ │ │ └── OrderMapper.xml │ │ └── test │ │ └── java │ │ └── com │ │ └── ipman │ │ └── sb2accountservice │ │ └── Sb2AccountServiceApplicationTests.java ├── seata-at-storage-service │ ├── .gitignore │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── ipman │ │ │ │ └── sb2accountservice │ │ │ │ ├── Sb2StorageServiceApplication.java │ │ │ │ ├── config │ │ │ │ ├── DataSourceConfig.java │ │ │ │ └── SeataRestTemplateAutoConfiguration.java │ │ │ │ ├── controller │ │ │ │ └── StorageController.java │ │ │ │ ├── entity │ │ │ │ └── Storage.java │ │ │ │ ├── filter │ │ │ │ └── SeataFilter.java │ │ │ │ ├── interceptor │ │ │ │ └── SeataRestTemplateInterceptor.java │ │ │ │ ├── mapper │ │ │ │ └── StorageMapper.java │ │ │ │ └── service │ │ │ │ └── StorageService.java │ │ └── resources │ │ │ ├── application.properties │ │ │ └── mapper │ │ │ └── StorageMapper.xml │ │ └── test │ │ └── java │ │ └── com │ │ └── ipman │ │ └── sb2accountservice │ │ └── Sb2AccountServiceApplicationTests.java └── sql │ └── sprintboot-seata-at-sample.sql ├── springboot-seata-tcc-sample ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── README.md ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── ipman │ │ └── seata │ │ └── tcc │ │ └── springboot │ │ └── dubbo │ │ ├── action │ │ ├── ResultHolder.java │ │ ├── TccActionOne.java │ │ ├── TccActionTwo.java │ │ └── impl │ │ │ ├── TccActionOneImpl.java │ │ │ └── TccActionTwoImpl.java │ │ ├── server │ │ ├── ApplicationKeeper.java │ │ ├── SpringbootTccTransactionApplication.java │ │ ├── provider │ │ │ └── SpringbootTccProviderApplication.java │ │ └── seata │ │ │ └── SeataServerStarter.java │ │ └── service │ │ └── TccTransactionService.java │ └── resources │ ├── application.properties │ ├── file.conf │ ├── provider │ ├── seata-dubbo-provider.xml │ └── seata-tcc.xml │ ├── registry.conf │ └── spring │ ├── seata-dubbo-reference.xml │ └── seata-tcc.xml ├── springboot-shardingsphere-jdbc-sample ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml ├── sql │ └── demo.sql └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── ipman │ │ │ └── sharding │ │ │ └── jdbc │ │ │ └── springboot │ │ │ ├── SpringbootShardingsphereJdbcSampleApplication.java │ │ │ ├── config │ │ │ ├── MybatisConfig.java │ │ │ └── ShardingSphereDataSource.java │ │ │ ├── dao │ │ │ └── DemoMapper.java │ │ │ ├── model │ │ │ └── Demo.java │ │ │ └── service │ │ │ ├── IDemoService.java │ │ │ └── impl │ │ │ └── DemoService.java │ └── resources │ │ ├── application.properties │ │ └── mapper │ │ └── DemoMapper.xml │ └── test │ └── java │ └── com │ └── ipman │ └── sharding │ └── jdbc │ └── springboot │ └── springbootshardingspherejdbcsample │ └── SpringbootShardingsphereJdbcSampleApplicationTests.java ├── springboot-source-code-analysis ├── (1)框架整体启动流程.md ├── (10)XML方式配置Bean实战.md ├── (11)通过Java配置Bean的几种方式.md ├── (12)框架Refresh方法解析一.md ├── (13)框架Refresh方法解析二.md ├── (2)框架初始化器实战.md ├── (3)工厂加载机制解析.md ├── (4)系统初始化器解析.md ├── (5)监听器设计模式.md ├── (6)框架内监听器设计模式与实现.md ├── (7)事件监听器触发机制解析.md ├── (8)自定义监听器实战.md ├── (9)IoC思想.md ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── example │ │ │ └── springboot │ │ │ └── source │ │ │ └── code │ │ │ └── analysis │ │ │ ├── SpringbootSourceCodeAnalysisApplication.java │ │ │ ├── controller │ │ │ └── InitializerController.java │ │ │ ├── event │ │ │ ├── AbstractEventMulticaster.java │ │ │ ├── EventMulticaster.java │ │ │ ├── RainEvent.java │ │ │ ├── RainListener.java │ │ │ ├── SnowEvent.java │ │ │ ├── SnowListener.java │ │ │ ├── Test.java │ │ │ ├── WeatherEvent.java │ │ │ ├── WeatherEventMulticaster.java │ │ │ ├── WeatherListener.java │ │ │ └── WeatherRunListener.java │ │ │ ├── initializer │ │ │ ├── FirstInitializer.java │ │ │ ├── SecondInitializer.java │ │ │ └── ThirdInitializer.java │ │ │ ├── ioc │ │ │ ├── ann │ │ │ │ ├── MyBeanConfiguration.java │ │ │ │ ├── MyBeanDefinitionRegistry.java │ │ │ │ ├── MyBeanFacotoryPostProcessor.java │ │ │ │ ├── MyFactoryBean.java │ │ │ │ └── MyImportBeanDefinitionRegistrar.java │ │ │ ├── pojo │ │ │ │ ├── Animal.java │ │ │ │ ├── Bird.java │ │ │ │ ├── Cat.java │ │ │ │ ├── DemoBean.java │ │ │ │ ├── Dog.java │ │ │ │ └── Monkey.java │ │ │ └── service │ │ │ │ └── HelloService.java │ │ │ ├── listener │ │ │ ├── ApplicationContextContainer.java │ │ │ ├── FirstListener.java │ │ │ ├── FourthListener.java │ │ │ ├── SecondListener.java │ │ │ └── ThirdListener.java │ │ │ └── service │ │ │ └── TestFirstInitializerService.java │ └── resources │ │ ├── META-INF │ │ └── spring.factories │ │ └── application.properties │ └── test │ └── java │ └── com │ └── example │ └── springboot │ └── source │ └── code │ └── analysis │ └── SpringbootSourceCodeAnalysisApplicationTests.java ├── springboot-swagger-sample ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml ├── readme.md └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── ipman │ │ │ └── swagger │ │ │ └── sample │ │ │ ├── SpringbootSwaggerSampleApplication.java │ │ │ ├── config │ │ │ └── SwaggerConfig.java │ │ │ ├── controller │ │ │ └── UserController.java │ │ │ └── entity │ │ │ └── User.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── ipman │ └── swagger │ └── sample │ └── SpringbootSwaggerSampleApplicationTests.java ├── springboot-transactional-sample ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── README.md ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── ipman │ │ │ └── springboot │ │ │ └── transactional │ │ │ └── sample │ │ │ ├── SpringbootTransactionalSampleApplication.java │ │ │ ├── common │ │ │ └── domain │ │ │ │ └── model │ │ │ │ ├── User1.java │ │ │ │ └── User2.java │ │ │ ├── config │ │ │ └── MybatisConfig.java │ │ │ └── core │ │ │ ├── dao │ │ │ ├── User1Mapper.java │ │ │ └── User2Mapper.java │ │ │ └── service │ │ │ ├── User1Service.java │ │ │ ├── User2Service.java │ │ │ └── impl │ │ │ ├── User1ServiceImpl.java │ │ │ └── User2ServiceImpl.java │ └── resources │ │ ├── application.properties │ │ ├── generatorConfig.xml │ │ └── mapper │ │ ├── User1Mapper.xml │ │ └── User2Mapper.xml │ └── test │ └── java │ └── com │ └── ipman │ └── springboot │ └── transactional │ └── sample │ └── TransactionPropagationTest.java ├── springcloud-consul-config-sample ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── README.md ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── ipman │ │ └── springcloud │ │ └── consul │ │ └── config │ │ └── center │ │ └── sample │ │ ├── SpringcloudConsulConfigSampleApplication.java │ │ └── api │ │ └── ConsulConfigCenterController.java │ └── resources │ ├── application.properties │ └── bootstrap.properties ├── springcloud-consul-register-sample ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── README.md ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── ipman │ │ └── springcloud │ │ └── consul │ │ └── register │ │ └── sample │ │ ├── ServerConfig.java │ │ ├── SpringcloudConsulRegisterSampleApplication.java │ │ ├── api │ │ └── DemoController.java │ │ └── service │ │ ├── DemoService.java │ │ └── impl │ │ └── DemoServiceImpl.java │ └── resources │ ├── application.properties │ └── bootstrap.properties ├── springcloud-consul-ribbon-sample ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── README.md ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── ipman │ │ └── springcloud │ │ └── consul │ │ └── ribbon │ │ └── sample │ │ ├── SpringcloudConsulRibbonSampleApplication.java │ │ ├── api │ │ └── DemoController.java │ │ └── config │ │ ├── RibbonConfig.java │ │ └── XXProviderRibbonConfig.java │ └── resources │ └── application.properties ├── springcloud-nacos-config-sample ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── README.md ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── ipman │ │ └── springcloud │ │ └── nacos │ │ └── config │ │ └── sample │ │ ├── SpringcloudNacosConfigSampleApplication.java │ │ └── api │ │ └── NacosConfigController.java │ └── resources │ ├── application.properties │ └── bootstrap.properties ├── springcloud-nacos-register-sample ├── .gitignore ├── .mvn │ └── wrapper │ │ ├── MavenWrapperDownloader.java │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── README.md ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── ipman │ │ └── spirngcloud │ │ └── nacos │ │ └── register │ │ └── sample │ │ ├── ServerConfig.java │ │ ├── SpringcloudNacosRegisterSampleApplication.java │ │ ├── api │ │ └── DemoController.java │ │ └── service │ │ ├── DemoService.java │ │ └── impl │ │ └── DemoServiceImpl.java │ └── resources │ ├── application.properties │ └── bootstrap.properties └── springcloud-nacos-ribbon-sample ├── .gitignore ├── .mvn └── wrapper │ ├── MavenWrapperDownloader.java │ ├── maven-wrapper.jar │ └── maven-wrapper.properties ├── README.md ├── mvnw ├── mvnw.cmd ├── pom.xml └── src └── main ├── java └── com │ └── ipman │ └── springcloud │ └── nacos │ └── ribbon │ └── sample │ ├── SpringcloudNacosRibbonSampleApplication.java │ ├── api │ └── DemoController.java │ └── config │ ├── RibbonConfig.java │ └── XXProviderRibbonConfig.java └── resources └── application.properties /.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | /.gradle/ 35 | -------------------------------------------------------------------------------- /dubbo-annotation-sample/dubbo-annotation-consumer/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /dubbo-annotation-sample/dubbo-annotation-consumer/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/ba1fe0b303008023f0d0afef7aa0ddea2aea5306/dubbo-annotation-sample/dubbo-annotation-consumer/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /dubbo-annotation-sample/dubbo-annotation-consumer/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /dubbo-annotation-sample/dubbo-annotation-consumer/src/main/java/com/ipman/sample/dubbo/annotation/DubboAnntationConsumerApplication.java: -------------------------------------------------------------------------------- 1 | package com.ipman.sample.dubbo.annotation; 2 | 3 | import com.ipman.sample.dubbo.annotation.config.ConsumerConfiguration; 4 | import com.ipman.sample.dubbo.annotation.action.AnnotationAction; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.context.annotation.AnnotationConfigApplicationContext; 7 | 8 | @SpringBootApplication 9 | public class DubboAnntationConsumerApplication { 10 | 11 | public static void main(String[] args) { 12 | AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ConsumerConfiguration.class); 13 | context.start(); 14 | 15 | //Consumer Testing 16 | final AnnotationAction annotationAction = (AnnotationAction) context.getBean("annotationAction"); 17 | System.out.println(annotationAction.doSayHello()); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /dubbo-annotation-sample/dubbo-annotation-consumer/src/main/java/com/ipman/sample/dubbo/annotation/config/ConsumerConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.ipman.sample.dubbo.annotation.config; 2 | 3 | import org.apache.dubbo.config.spring.context.annotation.EnableDubbo; 4 | import org.springframework.context.annotation.ComponentScan; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.context.annotation.PropertySource; 7 | 8 | /** 9 | * Created by ipipman on 2020/12/17. 10 | * 11 | * @version V1.0 12 | * @Package com.ipman.sample.dubbo.anntation.consumer.config 13 | * @Description: (用一句话描述该文件做什么) 14 | * @date 2020/12/17 4:19 下午 15 | */ 16 | @Configuration 17 | @EnableDubbo(scanBasePackages = "com.ipman.sample.dubbo.annotation.action") 18 | @PropertySource("classpath:/spring/dubbo-consumer.properties") 19 | @ComponentScan(value = "com.ipman.sample.dubbo.annotation.action") 20 | public class ConsumerConfiguration { 21 | 22 | } 23 | -------------------------------------------------------------------------------- /dubbo-annotation-sample/dubbo-annotation-consumer/src/main/java/com/ipman/sample/dubbo/annotation/service/IHelloService.java: -------------------------------------------------------------------------------- 1 | package com.ipman.sample.dubbo.annotation.service; 2 | 3 | /** 4 | * Created by ipipman on 2020/12/17. 5 | * 6 | * @version V1.0 7 | * @Package com.ipman.sample.dubbo.annotation.provider.service 8 | * @Description: (用一句话描述该文件做什么) 9 | * @date 2020/12/17 3:51 下午 10 | */ 11 | public interface IHelloService { 12 | 13 | String sayHello(String name); 14 | } 15 | -------------------------------------------------------------------------------- /dubbo-annotation-sample/dubbo-annotation-consumer/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dubbo-annotation-sample/dubbo-annotation-consumer/src/main/resources/spring/dubbo-consumer.properties: -------------------------------------------------------------------------------- 1 | dubbo.application.name=dubbo-anntation-consumer 2 | dubbo.registry.address=zookeeper://${zookeeper.address:127.0.0.1}:2181 3 | dubbo.consumer.timeout=1000 -------------------------------------------------------------------------------- /dubbo-annotation-sample/dubbo-annotation-consumer/src/test/java/com/ipman/sample/dubbo/annotation/DubboAnntationConsumerApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.ipman.sample.dubbo.annotation; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class DubboAnntationConsumerApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /dubbo-annotation-sample/dubbo-annotation-provider/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /dubbo-annotation-sample/dubbo-annotation-provider/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/ba1fe0b303008023f0d0afef7aa0ddea2aea5306/dubbo-annotation-sample/dubbo-annotation-provider/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /dubbo-annotation-sample/dubbo-annotation-provider/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /dubbo-annotation-sample/dubbo-annotation-provider/src/main/java/com/ipman/sample/dubbo/annotation/service/IHelloService.java: -------------------------------------------------------------------------------- 1 | package com.ipman.sample.dubbo.annotation.service; 2 | 3 | /** 4 | * Created by ipipman on 2020/12/17. 5 | * 6 | * @version V1.0 7 | * @Package com.ipman.sample.dubbo.annotation.provider.service 8 | * @Description: (用一句话描述该文件做什么) 9 | * @date 2020/12/17 3:51 下午 10 | */ 11 | public interface IHelloService { 12 | 13 | String sayHello(String name); 14 | } 15 | -------------------------------------------------------------------------------- /dubbo-annotation-sample/dubbo-annotation-provider/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dubbo-annotation-sample/dubbo-annotation-provider/src/main/resources/spring/dubbo-provider.properties: -------------------------------------------------------------------------------- 1 | dubbo.application.name=dubbo-annotation-provider 2 | dubbo.registry.address=zookeeper://${zookeeper.address:127.0.0.1}:2181 3 | dubbo.protocol.name=dubbo 4 | dubbo.protocol.port=20880 -------------------------------------------------------------------------------- /dubbo-annotation-sample/dubbo-annotation-provider/src/test/java/com/ipman/sample/dubbo/annotation/DubboAnnotationProviderApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.ipman.sample.dubbo.annotation; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class DubboAnnotationProviderApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /dubbo-async-sample/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /dubbo-async-sample/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/ba1fe0b303008023f0d0afef7aa0ddea2aea5306/dubbo-async-sample/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /dubbo-async-sample/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /dubbo-async-sample/src/main/java/com/ipman/dubbo/async/sample/AsyncProvider.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.async.sample; 2 | 3 | import lombok.SneakyThrows; 4 | import org.apache.curator.test.TestingServer; 5 | import org.springframework.context.support.ClassPathXmlApplicationContext; 6 | 7 | /** 8 | * Created by ipipman on 2020/12/22. 9 | * 10 | * @version V1.0 11 | * @Package com.ipman.dubbo.async.sample 12 | * @Description: (用一句话描述该文件做什么) 13 | * @date 2020/12/22 12:05 下午 14 | */ 15 | public class AsyncProvider { 16 | 17 | private static TestingServer zkServer; 18 | 19 | public static void main(String[] args) { 20 | //启动ZK 21 | mockZookeeper(); 22 | 23 | ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/async-provider.xml"); 24 | context.start(); 25 | } 26 | 27 | //启动ZK 28 | @SneakyThrows 29 | public static void mockZookeeper(){ 30 | zkServer = new TestingServer(2181, true); 31 | zkServer.start(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /dubbo-async-sample/src/main/java/com/ipman/dubbo/async/sample/api/AsyncService.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.async.sample.api; 2 | 3 | import java.util.concurrent.CompletableFuture; 4 | 5 | /** 6 | * Created by ipipman on 2020/12/22. 7 | * 8 | * @version V1.0 9 | * @Package com.ipman.dubbo.async.sample.api 10 | * @Description: (用一句话描述该文件做什么) 11 | * @date 2020/12/22 11:33 上午 12 | */ 13 | public interface AsyncService { 14 | 15 | CompletableFuture sayHello(String name); 16 | } 17 | -------------------------------------------------------------------------------- /dubbo-async-sample/src/main/java/com/ipman/dubbo/async/sample/impl/AsyncServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.async.sample.impl; 2 | 3 | import com.ipman.dubbo.async.sample.api.AsyncService; 4 | 5 | import java.util.concurrent.CompletableFuture; 6 | 7 | /** 8 | * Created by ipipman on 2020/12/22. 9 | * 10 | * @version V1.0 11 | * @Package com.ipman.dubbo.async.sample.impl 12 | * @Description: (用一句话描述该文件做什么) 13 | * @date 2020/12/22 11:33 上午 14 | */ 15 | public class AsyncServiceImpl implements AsyncService { 16 | 17 | @Override 18 | public CompletableFuture sayHello(String name) { 19 | return CompletableFuture.supplyAsync(() -> { 20 | try { 21 | Thread.sleep(10000); 22 | } catch (InterruptedException e) { 23 | e.printStackTrace(); 24 | } 25 | return "hello," + name; 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /dubbo-async-sample/src/main/resources/spring/async-consumer.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /dubbo-attachment-sample/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /dubbo-attachment-sample/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/ba1fe0b303008023f0d0afef7aa0ddea2aea5306/dubbo-attachment-sample/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /dubbo-attachment-sample/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /dubbo-attachment-sample/src/main/java/com/ipman/dubbo/attachment/sample/AttachmentProvider.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.attachment.sample; 2 | 3 | import lombok.SneakyThrows; 4 | import org.apache.curator.test.TestingServer; 5 | import org.springframework.context.support.ClassPathXmlApplicationContext; 6 | 7 | /** 8 | * Created by ipipman on 2020/12/22. 9 | * 10 | * @version V1.0 11 | * @Package com.ipman.dubbo.attachment.sample 12 | * @Description: (用一句话描述该文件做什么) 13 | * @date 2020/12/22 3:49 下午 14 | */ 15 | public class AttachmentProvider { 16 | 17 | private static TestingServer zkServer; 18 | 19 | public static void main(String[] args) { 20 | //启动ZK 21 | mockZookeeper(); 22 | 23 | ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/attachment-provider.xml"); 24 | context.start(); 25 | } 26 | 27 | //启动ZK 28 | @SneakyThrows 29 | public static void mockZookeeper() { 30 | zkServer = new TestingServer(2181, true); 31 | zkServer.start(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /dubbo-attachment-sample/src/main/java/com/ipman/dubbo/attachment/sample/api/AttachmentService.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.attachment.sample.api; 2 | 3 | 4 | /** 5 | * Created by ipipman on 2020/12/22. 6 | * 7 | * @version V1.0 8 | * @Package com.ipman.dubbo.attachment.sample.api 9 | * @Description: (用一句话描述该文件做什么) 10 | * @date 2020/12/22 3:41 下午 11 | */ 12 | public interface AttachmentService { 13 | 14 | String sayHello(String name); 15 | } 16 | -------------------------------------------------------------------------------- /dubbo-attachment-sample/src/main/resources/spring/attachment-consumer.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /dubbo-attachment-sample/src/test/java/com/ipman/dubbo/attachment/sample/DubboAttachmentSampleApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.attachment.sample; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class DubboAttachmentSampleApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /dubbo-cache-sample/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /dubbo-cache-sample/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/ba1fe0b303008023f0d0afef7aa0ddea2aea5306/dubbo-cache-sample/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /dubbo-cache-sample/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /dubbo-cache-sample/src/main/java/com/ipman/dubbo/cache/sample/CacheProvider.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.cache.sample; 2 | 3 | import lombok.SneakyThrows; 4 | import org.apache.curator.test.TestingServer; 5 | import org.springframework.context.support.ClassPathXmlApplicationContext; 6 | 7 | /** 8 | * Created by ipipman on 2020/12/21. 9 | * 10 | * @version V1.0 11 | * @Package com.ipman.dubbo.cache.sample 12 | * @Description: (用一句话描述该文件做什么) 13 | * @date 2020/12/21 5:34 下午 14 | */ 15 | public class CacheProvider { 16 | 17 | private static TestingServer zkServer; 18 | 19 | public static void main(String[] args) { 20 | //启动ZK 21 | mockZookeeperServer(); 22 | 23 | //启动Dobbo生产者 24 | ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/cache-provider.xml"); 25 | context.start(); 26 | } 27 | 28 | //启动ZK 29 | @SneakyThrows 30 | public static void mockZookeeperServer() { 31 | zkServer = new TestingServer(2181, true); 32 | zkServer.start(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /dubbo-cache-sample/src/main/java/com/ipman/dubbo/cache/sample/service/CacheService.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.cache.sample.service; 2 | 3 | /** 4 | * Created by ipipman on 2020/12/21. 5 | * 6 | * @version V1.0 7 | * @Package com.ipman.dubbo.cache.sample.service 8 | * @Description: (用一句话描述该文件做什么) 9 | * @date 2020/12/21 5:25 下午 10 | */ 11 | public interface CacheService { 12 | 13 | String findCache(Integer id); 14 | } 15 | -------------------------------------------------------------------------------- /dubbo-cache-sample/src/main/java/com/ipman/dubbo/cache/sample/service/impl/CacheServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.cache.sample.service.impl; 2 | 3 | import com.ipman.dubbo.cache.sample.service.CacheService; 4 | import org.omg.PortableInterceptor.SYSTEM_EXCEPTION; 5 | 6 | import java.util.concurrent.atomic.AtomicInteger; 7 | import java.util.concurrent.atomic.LongAdder; 8 | 9 | /** 10 | * Created by ipipman on 2020/12/21. 11 | * 12 | * @version V1.0 13 | * @Package com.ipman.dubbo.cache.sample.service 14 | * @Description: (用一句话描述该文件做什么) 15 | * @date 2020/12/21 5:25 下午 16 | */ 17 | public class CacheServiceImpl implements CacheService { 18 | 19 | private final AtomicInteger i = new AtomicInteger(); 20 | 21 | @Override 22 | public String findCache(Integer id) { 23 | return "request:" + id + ", response: " + i.getAndIncrement(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /dubbo-cache-sample/src/main/resources/spring/cache-consumer.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /dubbo-cache-sample/src/test/java/com/ipman/dubbo/cache/sample/DubboCacheSampleApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.cache.sample; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class DubboCacheSampleApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /dubbo-callback-sample/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /dubbo-callback-sample/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/ba1fe0b303008023f0d0afef7aa0ddea2aea5306/dubbo-callback-sample/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /dubbo-callback-sample/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /dubbo-callback-sample/src/main/java/com/ipman/dubbo/callback/sample/CallbackProvider.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.callback.sample; 2 | 3 | import lombok.SneakyThrows; 4 | import org.apache.curator.test.TestingServer; 5 | import org.springframework.context.support.ClassPathXmlApplicationContext; 6 | 7 | /** 8 | * Created by ipipman on 2020/12/21. 9 | * 10 | * @version V1.0 11 | * @Package com.ipman.dubbo.callback.sample 12 | * @Description: (用一句话描述该文件做什么) 13 | * @date 2020/12/21 9:27 下午 14 | */ 15 | public class CallbackProvider { 16 | 17 | private static TestingServer zkServer; 18 | 19 | public static void main(String[] args) { 20 | //启动ZK 21 | mockZookeeper(); 22 | 23 | ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/callback-provider.xml"); 24 | context.start(); 25 | } 26 | 27 | //启动ZK 28 | @SneakyThrows 29 | public static void mockZookeeper(){ 30 | zkServer = new TestingServer(2181, true); 31 | zkServer.start(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /dubbo-callback-sample/src/main/java/com/ipman/dubbo/callback/sample/api/CallbackListener.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.callback.sample.api; 2 | 3 | /** 4 | * Created by ipipman on 2020/12/21. 5 | * 6 | * @version V1.0 7 | * @Package com.ipman.dubbo.callback.sample.api 8 | * @Description: (用一句话描述该文件做什么) 9 | * @date 2020/12/21 9:16 下午 10 | */ 11 | public interface CallbackListener { 12 | 13 | void changed(String msg); 14 | } 15 | -------------------------------------------------------------------------------- /dubbo-callback-sample/src/main/java/com/ipman/dubbo/callback/sample/api/CallbackService.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.callback.sample.api; 2 | 3 | /** 4 | * Created by ipipman on 2020/12/21. 5 | * 6 | * @version V1.0 7 | * @Package com.ipman.dubbo.callback.sample.api 8 | * @Description: (用一句话描述该文件做什么) 9 | * @date 2020/12/21 9:16 下午 10 | */ 11 | public interface CallbackService { 12 | 13 | void addListener(String key, CallbackListener listener); 14 | } 15 | -------------------------------------------------------------------------------- /dubbo-callback-sample/src/main/resources/spring/callback-consumer.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /dubbo-consul-sample/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /dubbo-consul-sample/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/ba1fe0b303008023f0d0afef7aa0ddea2aea5306/dubbo-consul-sample/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /dubbo-consul-sample/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /dubbo-consul-sample/src/main/java/com/ipman/dubbo/consul/sample/ConsulConsumer.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.consul.sample; 2 | 3 | import com.ipman.dubbo.consul.sample.api.DemoService; 4 | import org.omg.PortableInterceptor.SYSTEM_EXCEPTION; 5 | import org.springframework.context.support.ClassPathXmlApplicationContext; 6 | 7 | /** 8 | * Created by ipipman on 2020/12/24. 9 | * 10 | * @version V1.0 11 | * @Package com.ipman.dubbo.consul.sample 12 | * @Description: (用一句话描述该文件做什么) 13 | * @date 2020/12/24 6:25 下午 14 | */ 15 | public class ConsulConsumer { 16 | 17 | public static void main(String[] args) { 18 | ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/consul-consumer.xml"); 19 | context.start(); 20 | 21 | DemoService demoService = context.getBean("demoService", DemoService.class); 22 | System.out.println(demoService.sayHello("ipman")); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /dubbo-consul-sample/src/main/java/com/ipman/dubbo/consul/sample/ConsulProvider.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.consul.sample; 2 | 3 | import org.springframework.context.support.ClassPathXmlApplicationContext; 4 | 5 | import java.util.concurrent.CountDownLatch; 6 | 7 | /** 8 | * Created by ipipman on 2020/12/24. 9 | * 10 | * @version V1.0 11 | * @Package com.ipman.dubbo.consul.sample 12 | * @Description: (用一句话描述该文件做什么) 13 | * @date 2020/12/24 6:25 下午 14 | */ 15 | public class ConsulProvider { 16 | 17 | public static void main(String[] args) throws InterruptedException { 18 | ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/consul-provider.xml"); 19 | context.start(); 20 | 21 | new CountDownLatch(1).await(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /dubbo-consul-sample/src/main/java/com/ipman/dubbo/consul/sample/api/DemoService.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.consul.sample.api; 2 | 3 | /** 4 | * Created by ipipman on 2020/12/24. 5 | * 6 | * @version V1.0 7 | * @Package com.ipman.dubbo.consul.sample.api 8 | * @Description: (用一句话描述该文件做什么) 9 | * @date 2020/12/24 6:07 下午 10 | */ 11 | public interface DemoService { 12 | 13 | String sayHello(String name); 14 | } 15 | -------------------------------------------------------------------------------- /dubbo-consul-sample/src/main/java/com/ipman/dubbo/consul/sample/impl/DemoServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.consul.sample.impl; 2 | 3 | import com.ipman.dubbo.consul.sample.api.DemoService; 4 | import org.apache.dubbo.rpc.RpcContext; 5 | 6 | import java.text.SimpleDateFormat; 7 | import java.util.Date; 8 | 9 | /** 10 | * Created by ipipman on 2020/12/24. 11 | * 12 | * @version V1.0 13 | * @Package com.ipman.dubbo.consul.sample.impl 14 | * @Description: (用一句话描述该文件做什么) 15 | * @date 2020/12/24 6:08 下午 16 | */ 17 | public class DemoServiceImpl implements DemoService { 18 | 19 | @Override 20 | public String sayHello(String name) { 21 | System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] Hello " + name + 22 | ", request from consumer: " + RpcContext.getContext().getRemoteAddress()); 23 | return "Hello " + name + ", response from provider: " + RpcContext.getContext().getLocalAddress(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /dubbo-consul-sample/src/test/java/com/ipman/dubbo/consul/sample/DubboConsulSampleApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.consul.sample; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class DubboConsulSampleApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /dubbo-http-sample/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /dubbo-http-sample/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/ba1fe0b303008023f0d0afef7aa0ddea2aea5306/dubbo-http-sample/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /dubbo-http-sample/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /dubbo-http-sample/src/main/java/com/ipman/dubbo/http/sample/HttpConsumer.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.http.sample; 2 | 3 | import com.ipman.dubbo.http.sample.api.DemoService; 4 | import org.springframework.context.support.ClassPathXmlApplicationContext; 5 | 6 | /** 7 | * Created by ipipman on 2020/12/21. 8 | * 9 | * @version V1.0 10 | * @Package com.ipman.dubbo.http.sample 11 | * @Description: (用一句话描述该文件做什么) 12 | * @date 2020/12/21 2:25 下午 13 | */ 14 | public class HttpConsumer { 15 | 16 | public static void main(String[] args) { 17 | ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/http-consumer.xml"); 18 | context.start(); 19 | 20 | DemoService demoService = (DemoService) context.getBean("demoService"); 21 | String result = demoService.sayHello("ipman"); 22 | System.out.println(result); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /dubbo-http-sample/src/main/java/com/ipman/dubbo/http/sample/HttpProvider.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.http.sample; 2 | 3 | import lombok.SneakyThrows; 4 | import org.apache.curator.test.TestingServer; 5 | import org.springframework.context.support.ClassPathXmlApplicationContext; 6 | 7 | /** 8 | * Created by ipipman on 2020/12/21. 9 | * 10 | * @version V1.0 11 | * @Package com.ipman.dubbo.http.sample 12 | * @Description: (用一句话描述该文件做什么) 13 | * @date 2020/12/21 2:28 下午 14 | */ 15 | public class HttpProvider { 16 | 17 | private static TestingServer zkServer; 18 | 19 | @SneakyThrows 20 | public static void main(String[] args) { 21 | //启动ZK 22 | mockZookeeper(); 23 | 24 | ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/http-provider.xml"); 25 | context.start(); 26 | } 27 | 28 | //启动ZK 29 | public static void mockZookeeper() throws Exception{ 30 | zkServer = new TestingServer(2181, true); 31 | zkServer.start(); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /dubbo-http-sample/src/main/java/com/ipman/dubbo/http/sample/api/DemoService.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.http.sample.api; 2 | 3 | /** 4 | * Created by ipipman on 2020/12/21. 5 | * 6 | * @version V1.0 7 | * @Package com.ipman.dubbo.http.sample.api 8 | * @Description: (用一句话描述该文件做什么) 9 | * @date 2020/12/21 2:21 下午 10 | */ 11 | public interface DemoService { 12 | 13 | String sayHello(String name); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /dubbo-http-sample/src/main/java/com/ipman/dubbo/http/sample/impl/DemoServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.http.sample.impl; 2 | 3 | import com.ipman.dubbo.http.sample.api.DemoService; 4 | import org.apache.dubbo.rpc.RpcContext; 5 | 6 | import java.text.SimpleDateFormat; 7 | import java.util.Date; 8 | 9 | /** 10 | * Created by ipipman on 2020/12/21. 11 | * 12 | * @version V1.0 13 | * @Package com.ipman.dubbo.http.sample.impl 14 | * @Description: (用一句话描述该文件做什么) 15 | * @date 2020/12/21 2:21 下午 16 | */ 17 | public class DemoServiceImpl implements DemoService { 18 | 19 | @Override 20 | public String sayHello(String name) { 21 | System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] Hello " + name + 22 | ", request from consumer: " + RpcContext.getContext().getRemoteAddress()); 23 | return "Hello " + name + ", response from provider: " + RpcContext.getContext().getLocalAddress(); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /dubbo-http-sample/src/main/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/ba1fe0b303008023f0d0afef7aa0ddea2aea5306/dubbo-http-sample/src/main/resources/application.properties -------------------------------------------------------------------------------- /dubbo-http-sample/src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | ###set log levels### 2 | log4j.rootLogger=info, stdout 3 | ###output to the console### 4 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender 5 | log4j.appender.stdout.Target=System.out 6 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 7 | log4j.appender.stdout.layout.ConversionPattern=[%d{dd/MM/yy hh:mm:ss:sss z}] %t %5p %c{2}: %m%n -------------------------------------------------------------------------------- /dubbo-http-sample/src/test/java/com/ipman/dubbo/http/sample/DubboHttpSampleApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.http.sample; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class DubboHttpSampleApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /dubbo-local-sample/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /dubbo-local-sample/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/ba1fe0b303008023f0d0afef7aa0ddea2aea5306/dubbo-local-sample/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /dubbo-local-sample/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /dubbo-local-sample/src/main/java/com/ipman/dubbo/local/sample/api/DemoService.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.local.sample.api; 2 | 3 | /** 4 | * Created by ipipman on 2020/12/22. 5 | * 6 | * @version V1.0 7 | * @Package com.ipman.dubbo.local.sample.api 8 | * @Description: (用一句话描述该文件做什么) 9 | * @date 2020/12/22 2:38 下午 10 | */ 11 | public interface DemoService { 12 | String sayHello(String name); 13 | } 14 | -------------------------------------------------------------------------------- /dubbo-local-sample/src/main/java/com/ipman/dubbo/local/sample/impl/DemoServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.local.sample.impl; 2 | 3 | import com.ipman.dubbo.local.sample.api.DemoService; 4 | import org.apache.dubbo.rpc.RpcContext; 5 | 6 | import java.text.SimpleDateFormat; 7 | import java.util.Date; 8 | 9 | /** 10 | * Created by ipipman on 2020/12/22. 11 | * 12 | * @version V1.0 13 | * @Package com.ipman.dubbo.local.sample.impl 14 | * @Description: (用一句话描述该文件做什么) 15 | * @date 2020/12/22 2:39 下午 16 | */ 17 | public class DemoServiceImpl implements DemoService { 18 | 19 | public String sayHello(String name) { 20 | System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] Hello " + name + 21 | ", request from consumer: " + RpcContext.getContext().getRemoteAddress()); 22 | return "Hello " + name + ", response from provider: " + RpcContext.getContext().getLocalAddress(); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /dubbo-mock-sample/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /dubbo-mock-sample/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/ba1fe0b303008023f0d0afef7aa0ddea2aea5306/dubbo-mock-sample/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /dubbo-mock-sample/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /dubbo-mock-sample/src/main/java/com/ipman/dubbo/mock/sample/MockCunsumer.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.mock.sample; 2 | 3 | import com.ipman.dubbo.mock.sample.api.MockService; 4 | import org.springframework.context.support.ClassPathXmlApplicationContext; 5 | 6 | /** 7 | * Created by ipipman on 2020/12/22. 8 | * 9 | * @version V1.0 10 | * @Package com.ipman.dubbo.mock.sample 11 | * @Description: (用一句话描述该文件做什么) 12 | * @date 2020/12/22 8:35 下午 13 | */ 14 | public class MockCunsumer { 15 | 16 | public static void main(String[] args) { 17 | ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/mock-consumer.xml"); 18 | context.start(); 19 | 20 | MockService mockService = context.getBean("mockService", MockService.class); 21 | System.out.println(mockService.sayHello("ipman")); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /dubbo-mock-sample/src/main/java/com/ipman/dubbo/mock/sample/MockProvider.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.mock.sample; 2 | 3 | import lombok.SneakyThrows; 4 | import org.apache.curator.test.TestingServer; 5 | import org.springframework.context.support.ClassPathXmlApplicationContext; 6 | 7 | /** 8 | * Created by ipipman on 2020/12/22. 9 | * 10 | * @version V1.0 11 | * @Package com.ipman.dubbo.mock.sample 12 | * @Description: (用一句话描述该文件做什么) 13 | * @date 2020/12/22 8:35 下午 14 | */ 15 | public class MockProvider { 16 | 17 | private static TestingServer zkServer; 18 | 19 | public static void main(String[] args) { 20 | //启动ZK 21 | mockZookeeper(); 22 | 23 | ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/mock-provider.xml"); 24 | context.start(); 25 | } 26 | 27 | //启动ZK 28 | @SneakyThrows 29 | public static void mockZookeeper(){ 30 | zkServer = new TestingServer(2181, true); 31 | zkServer.start(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /dubbo-mock-sample/src/main/java/com/ipman/dubbo/mock/sample/api/MockService.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.mock.sample.api; 2 | 3 | /** 4 | * Created by ipipman on 2020/12/22. 5 | * 6 | * @version V1.0 7 | * @Package com.ipman.dubbo.mock.sample.api 8 | * @Description: (用一句话描述该文件做什么) 9 | * @date 2020/12/22 8:30 下午 10 | */ 11 | public interface MockService { 12 | 13 | String sayHello(String name); 14 | } 15 | -------------------------------------------------------------------------------- /dubbo-mock-sample/src/main/java/com/ipman/dubbo/mock/sample/api/MockServiceMock.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.mock.sample.api; 2 | 3 | /** 4 | * Created by ipipman on 2020/12/22. 5 | * 6 | * @version V1.0 7 | * @Package com.ipman.dubbo.mock.sample.impl 8 | * @Description: (用一句话描述该文件做什么) 9 | * @date 2020/12/22 8:33 下午 10 | */ 11 | public class MockServiceMock implements MockService { 12 | 13 | @Override 14 | public String sayHello(String name) { 15 | return "Response from Mock sayHello," + name; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /dubbo-mock-sample/src/main/java/com/ipman/dubbo/mock/sample/impl/MockServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.mock.sample.impl; 2 | 3 | import com.ipman.dubbo.mock.sample.api.MockService; 4 | 5 | /** 6 | * Created by ipipman on 2020/12/22. 7 | * 8 | * @version V1.0 9 | * @Package com.ipman.dubbo.mock.sample.impl 10 | * @Description: (用一句话描述该文件做什么) 11 | * @date 2020/12/22 8:30 下午 12 | */ 13 | public class MockServiceImpl implements MockService { 14 | 15 | @Override 16 | public String sayHello(String name) { 17 | try { 18 | // 休眠5秒会导致客户端的TimeoutException,并且会调用mock impl 19 | Thread.sleep(5000); 20 | } catch (InterruptedException e) { 21 | e.printStackTrace(); 22 | } 23 | return "hello " + name; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /dubbo-mock-sample/src/main/resources/spring/mock-consumer.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 12 | 13 | 15 | 16 | -------------------------------------------------------------------------------- /dubbo-mock-sample/src/main/resources/spring/mock-provider.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /dubbo-nacos-sample/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /dubbo-nacos-sample/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/ba1fe0b303008023f0d0afef7aa0ddea2aea5306/dubbo-nacos-sample/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /dubbo-nacos-sample/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /dubbo-nacos-sample/src/main/java/com/ipman/dubbo/nacos/sample/NacosConsumer.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.nacos.sample; 2 | 3 | import com.ipman.dubbo.nacos.sample.api.DemoService; 4 | import org.springframework.context.support.ClassPathXmlApplicationContext; 5 | 6 | /** 7 | * Created by ipipman on 2020/12/23. 8 | * 9 | * @version V1.0 10 | * @Package com.ipman.dubbo.nacos.sample 11 | * @Description: (用一句话描述该文件做什么) 12 | * @date 2020/12/23 6:51 下午 13 | */ 14 | public class NacosConsumer { 15 | 16 | public static void main(String[] args) { 17 | ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/nacos-consumer.xml"); 18 | context.start(); 19 | 20 | DemoService demoService = context.getBean("demoService", DemoService.class); 21 | System.out.println(demoService.sayHello("ipman")); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /dubbo-nacos-sample/src/main/java/com/ipman/dubbo/nacos/sample/NacosProvider.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.nacos.sample; 2 | 3 | import org.springframework.context.support.ClassPathXmlApplicationContext; 4 | 5 | import java.util.concurrent.CountDownLatch; 6 | 7 | /** 8 | * Created by ipipman on 2020/12/23. 9 | * 10 | * @version V1.0 11 | * @Package com.ipman.dubbo.nacos.sample 12 | * @Description: (用一句话描述该文件做什么) 13 | * @date 2020/12/23 6:51 下午 14 | */ 15 | public class NacosProvider { 16 | 17 | public static void main(String[] args) throws InterruptedException { 18 | ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/nacos-provider.xml"); 19 | context.start(); 20 | new CountDownLatch(1).await(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /dubbo-nacos-sample/src/main/java/com/ipman/dubbo/nacos/sample/api/DemoService.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.nacos.sample.api; 2 | 3 | /** 4 | * Created by ipipman on 2020/12/23. 5 | * 6 | * @version V1.0 7 | * @Package com.ipman.dubbo.nacos.sample.api 8 | * @Description: (用一句话描述该文件做什么) 9 | * @date 2020/12/23 6:48 下午 10 | */ 11 | public interface DemoService { 12 | 13 | String sayHello(String name); 14 | } 15 | -------------------------------------------------------------------------------- /dubbo-nacos-sample/src/main/java/com/ipman/dubbo/nacos/sample/impl/DemoServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.nacos.sample.impl; 2 | 3 | import com.ipman.dubbo.nacos.sample.api.DemoService; 4 | import org.apache.dubbo.rpc.RpcContext; 5 | 6 | import java.text.SimpleDateFormat; 7 | import java.util.Date; 8 | 9 | /** 10 | * Created by ipipman on 2020/12/23. 11 | * 12 | * @version V1.0 13 | * @Package com.ipman.dubbo.nacos.sample.impl 14 | * @Description: (用一句话描述该文件做什么) 15 | * @date 2020/12/23 6:49 下午 16 | */ 17 | public class DemoServiceImpl implements DemoService { 18 | 19 | @Override 20 | public String sayHello(String name) { 21 | System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] Hello " + name + 22 | ", request from consumer: " + RpcContext.getContext().getRemoteAddress()); 23 | return "Hello " + name + ", response from provider: " + RpcContext.getContext().getLocalAddress(); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /dubbo-nacos-sample/src/main/resources/spring/nacos-consumer.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /dubbo-nacos-sample/src/test/java/com/ipman/dubbo/nacos/sample/DubboNacosSampleApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.nacos.sample; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class DubboNacosSampleApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /dubbo-notify-sample/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /dubbo-notify-sample/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/ba1fe0b303008023f0d0afef7aa0ddea2aea5306/dubbo-notify-sample/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /dubbo-notify-sample/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /dubbo-notify-sample/src/main/java/com/ipman/dubbo/notify/sample/NotifyConsumer.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.notify.sample; 2 | 3 | import com.ipman.dubbo.notify.sample.api.DemoService; 4 | import org.springframework.context.support.ClassPathXmlApplicationContext; 5 | 6 | /** 7 | * Created by ipipman on 2020/12/22. 8 | * 9 | * @version V1.0 10 | * @Package com.ipman.dubbo.notify.sample 11 | * @Description: (用一句话描述该文件做什么) 12 | * @date 2020/12/22 10:24 上午 13 | */ 14 | public class NotifyConsumer { 15 | 16 | public static void main(String[] args) { 17 | ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/notify-consumer.xml"); 18 | 19 | DemoService demoService = context.getBean("demoService", DemoService.class); 20 | 21 | //onReturn:name=sayHello.ok,id=1 22 | demoService.sayHello(1); 23 | 24 | //onThrow:ex=java.lang.RuntimeException: runtime exception from id > 5,id=6 25 | demoService.sayHello(6); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /dubbo-notify-sample/src/main/java/com/ipman/dubbo/notify/sample/NotifyProvider.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.notify.sample; 2 | 3 | import lombok.SneakyThrows; 4 | import org.apache.curator.test.TestingServer; 5 | import org.springframework.context.support.ClassPathXmlApplicationContext; 6 | 7 | /** 8 | * Created by ipipman on 2020/12/22. 9 | * 10 | * @version V1.0 11 | * @Package com.ipman.dubbo.notify.sample 12 | * @Description: (用一句话描述该文件做什么) 13 | * @date 2020/12/22 10:24 上午 14 | */ 15 | public class NotifyProvider { 16 | 17 | private static TestingServer zkServer; 18 | 19 | public static void main(String[] args) { 20 | //开启ZK 21 | mockZookeeper(); 22 | 23 | ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/notify-provider.xml"); 24 | context.start(); 25 | } 26 | 27 | //开启ZK 28 | @SneakyThrows 29 | public static void mockZookeeper(){ 30 | zkServer = new TestingServer(2181, true); 31 | zkServer.start(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /dubbo-notify-sample/src/main/java/com/ipman/dubbo/notify/sample/api/DemoService.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.notify.sample.api; 2 | 3 | /** 4 | * Created by ipipman on 2020/12/22. 5 | * 6 | * @version V1.0 7 | * @Package com.ipman.dubbo.notify.sample.api 8 | * @Description: (用一句话描述该文件做什么) 9 | * @date 2020/12/22 10:14 上午 10 | */ 11 | public interface DemoService { 12 | 13 | String sayHello(int id); 14 | } 15 | -------------------------------------------------------------------------------- /dubbo-notify-sample/src/main/java/com/ipman/dubbo/notify/sample/api/Notify.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.notify.sample.api; 2 | 3 | /** 4 | * Created by ipipman on 2020/12/22. 5 | * 6 | * @version V1.0 7 | * @Package com.ipman.dubbo.notify.sample.api 8 | * @Description: (用一句话描述该文件做什么) 9 | * @date 2020/12/22 10:14 上午 10 | */ 11 | public interface Notify { 12 | 13 | void onReturn(String name, int id); 14 | 15 | void onThrow(Throwable ex, int id); 16 | } 17 | -------------------------------------------------------------------------------- /dubbo-notify-sample/src/main/java/com/ipman/dubbo/notify/sample/impl/DemoServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.notify.sample.impl; 2 | 3 | import com.ipman.dubbo.notify.sample.api.DemoService; 4 | 5 | /** 6 | * Created by ipipman on 2020/12/22. 7 | * 8 | * @version V1.0 9 | * @Package com.ipman.dubbo.notify.sample.impl 10 | * @Description: (用一句话描述该文件做什么) 11 | * @date 2020/12/22 10:15 上午 12 | */ 13 | public class DemoServiceImpl implements DemoService { 14 | 15 | @Override 16 | public String sayHello(int id) { 17 | if (id > 5) { 18 | throw new RuntimeException("runtime exception from id > 5"); 19 | } 20 | return "sayHello.ok" + id; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /dubbo-notify-sample/src/main/java/com/ipman/dubbo/notify/sample/impl/NotifyImpl.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.notify.sample.impl; 2 | 3 | import com.ipman.dubbo.notify.sample.api.Notify; 4 | 5 | /** 6 | * Created by ipipman on 2020/12/22. 7 | * 8 | * @version V1.0 9 | * @Package com.ipman.dubbo.notify.sample.impl 10 | * @Description: (用一句话描述该文件做什么) 11 | * @date 2020/12/22 10:17 上午 12 | */ 13 | public class NotifyImpl implements Notify { 14 | 15 | @Override 16 | public void onReturn(String name, int id) { 17 | System.out.println("onReturn:name=" + name + ",id=" + id); 18 | } 19 | 20 | @Override 21 | public void onThrow(Throwable ex, int id) { 22 | System.out.println("onThrow:ex=" + ex + ",id=" + id); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /dubbo-spi-sample/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /dubbo-spi-sample/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/ba1fe0b303008023f0d0afef7aa0ddea2aea5306/dubbo-spi-sample/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /dubbo-spi-sample/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /dubbo-spi-sample/src/main/java/com/ipman/dubbo/spi/sample/SpiConsumer.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.spi.sample; 2 | 3 | import com.ipman.dubbo.spi.sample.api.DemoService; 4 | import org.springframework.context.support.ClassPathXmlApplicationContext; 5 | 6 | /** 7 | * Created by ipipman on 2020/12/23. 8 | * 9 | * @version V1.0 10 | * @Package com.ipman.dubbo.spi.sample 11 | * @Description: (用一句话描述该文件做什么) 12 | * @date 2020/12/23 10:41 上午 13 | */ 14 | public class SpiConsumer { 15 | 16 | public static void main(String[] args) { 17 | ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/spi-consumer.xml"); 18 | context.start(); 19 | 20 | DemoService demoService = context.getBean("demoService", DemoService.class); 21 | System.out.println(demoService.sayHello("ipman")); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /dubbo-spi-sample/src/main/java/com/ipman/dubbo/spi/sample/api/DemoService.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.spi.sample.api; 2 | 3 | /** 4 | * Created by ipipman on 2020/12/23. 5 | * 6 | * @version V1.0 7 | * @Package com.ipman.dubbo.spi.sample.api 8 | * @Description: (用一句话描述该文件做什么) 9 | * @date 2020/12/23 9:59 上午 10 | */ 11 | public interface DemoService { 12 | 13 | String sayHello(String name); 14 | } 15 | -------------------------------------------------------------------------------- /dubbo-spi-sample/src/main/java/com/ipman/dubbo/spi/sample/impl/DemoServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.spi.sample.impl; 2 | 3 | import com.ipman.dubbo.spi.sample.api.DemoService; 4 | import org.apache.dubbo.rpc.RpcContext; 5 | 6 | import java.text.SimpleDateFormat; 7 | import java.util.Date; 8 | 9 | /** 10 | * Created by ipipman on 2020/12/23. 11 | * 12 | * @version V1.0 13 | * @Package com.ipman.dubbo.spi.sample.impl 14 | * @Description: (用一句话描述该文件做什么) 15 | * @date 2020/12/23 9:59 上午 16 | */ 17 | public class DemoServiceImpl implements DemoService { 18 | 19 | @Override 20 | public String sayHello(String name) { 21 | System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] Hello " + name + 22 | ", request from consumer: " + RpcContext.getContext().getRemoteAddress()); 23 | return "Hello " + name + ", response from provider: " + RpcContext.getContext().getLocalAddress(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /dubbo-spi-sample/src/main/resources/META-INF/dubbo/org.apache.dubbo.rpc.Filter: -------------------------------------------------------------------------------- 1 | consumerFilter=com.ipman.dubbo.spi.sample.spi.CustomConsumerFilter -------------------------------------------------------------------------------- /dubbo-spi-sample/src/main/resources/META-INF/dubbo/org.apache.dubbo.rpc.cluster.LoadBalance: -------------------------------------------------------------------------------- 1 | clusterLoadBalance=com.ipman.dubbo.spi.sample.spi.CustomConsumerLoadBalance -------------------------------------------------------------------------------- /dubbo-spi-sample/src/main/resources/spring/spi-consumer.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /dubbo-xml-sample/dubbo-xml-api/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /dubbo-xml-sample/dubbo-xml-api/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/ba1fe0b303008023f0d0afef7aa0ddea2aea5306/dubbo-xml-sample/dubbo-xml-api/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /dubbo-xml-sample/dubbo-xml-api/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /dubbo-xml-sample/dubbo-xml-api/src/main/java/com/ipman/dubbo/xml/api/DubboXmlApiApplication.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.xml.api; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class DubboXmlApiApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(DubboXmlApiApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /dubbo-xml-sample/dubbo-xml-api/src/main/java/com/ipman/dubbo/xml/api/service/IHelloService.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.xml.api.service; 2 | 3 | /** 4 | * Created by ipipman on 2020/12/21. 5 | * 6 | * @version V1.0 7 | * @Package com.ipman.dubbo.xml.api.service 8 | * @Description: (用一句话描述该文件做什么) 9 | * @date 2020/12/21 10:54 上午 10 | */ 11 | public interface IHelloService { 12 | 13 | String sayHello(String name); 14 | } 15 | -------------------------------------------------------------------------------- /dubbo-xml-sample/dubbo-xml-api/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dubbo-xml-sample/dubbo-xml-consume/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /dubbo-xml-sample/dubbo-xml-consume/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/ba1fe0b303008023f0d0afef7aa0ddea2aea5306/dubbo-xml-sample/dubbo-xml-consume/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /dubbo-xml-sample/dubbo-xml-consume/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /dubbo-xml-sample/dubbo-xml-consume/src/main/java/com/ipman/dubbo/xml/consume/DubboXmlConsumeApplication.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.xml.consume; 2 | 3 | import com.ipman.dubbo.xml.consume.action.CallHelloService; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.context.ApplicationContext; 7 | import org.springframework.context.annotation.ImportResource; 8 | 9 | @SpringBootApplication 10 | @ImportResource("classpath:consumer/dubbo-xml-reference.xml") 11 | public class DubboXmlConsumeApplication { 12 | 13 | public static void main(String[] args) { 14 | ApplicationContext applicationContext = SpringApplication.run(DubboXmlConsumeApplication.class, args); 15 | 16 | //Testing 17 | CallHelloService callHelloService = (CallHelloService) applicationContext.getBean("callHelloService"); 18 | callHelloService.doSayHello(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /dubbo-xml-sample/dubbo-xml-consume/src/main/java/com/ipman/dubbo/xml/consume/action/CallHelloService.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.xml.consume.action; 2 | 3 | import com.ipman.dubbo.xml.api.service.IHelloService; 4 | import org.springframework.stereotype.Component; 5 | 6 | import javax.annotation.Resource; 7 | 8 | /** 9 | * Created by ipipman on 2020/12/21. 10 | * 11 | * @version V1.0 12 | * @Package com.ipman.dubbo.xml.consume.action 13 | * @Description: (用一句话描述该文件做什么) 14 | * @date 2020/12/21 11:16 上午 15 | */ 16 | @Component 17 | public class CallHelloService { 18 | 19 | @Resource 20 | private IHelloService helloService; 21 | 22 | //调用Dubbo服务 23 | public void doSayHello(){ 24 | System.out.println(helloService.sayHello("ipman")); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /dubbo-xml-sample/dubbo-xml-consume/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dubbo-xml-sample/dubbo-xml-consume/src/test/java/com/ipman/dubbo/xml/consume/DubboXmlConsumeApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.xml.consume; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class DubboXmlConsumeApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /dubbo-xml-sample/dubbo-xml-provider/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /dubbo-xml-sample/dubbo-xml-provider/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/ba1fe0b303008023f0d0afef7aa0ddea2aea5306/dubbo-xml-sample/dubbo-xml-provider/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /dubbo-xml-sample/dubbo-xml-provider/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /dubbo-xml-sample/dubbo-xml-provider/src/main/java/com/ipman/dubbo/xml/provider/impl/HelloServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.xml.provider.impl; 2 | 3 | import com.ipman.dubbo.xml.api.service.IHelloService; 4 | import org.springframework.context.annotation.ImportResource; 5 | import org.springframework.stereotype.Service; 6 | 7 | /** 8 | * Created by ipipman on 2020/12/21. 9 | * 10 | * @version V1.0 11 | * @Package com.ipman.dubbo.xml.provider.impl 12 | * @Description: (用一句话描述该文件做什么) 13 | * @date 2020/12/21 11:02 上午 14 | */ 15 | @Service("helloServiceImpl") 16 | public class HelloServiceImpl implements IHelloService { 17 | 18 | @Override 19 | public String sayHello(String name) { 20 | return "XML," + name; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /dubbo-xml-sample/dubbo-xml-provider/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /dubbo-xml-sample/dubbo-xml-provider/src/main/resources/provider/dubbo-hello-provider.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /dubbo-xml-sample/dubbo-xml-provider/src/test/java/com/ipman/dubbo/xml/provider/DubboXmlProviderApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.ipman.dubbo.xml.provider; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class DubboXmlProviderApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springboot-atomikos-xa-sample/sql/demo.sql: -------------------------------------------------------------------------------- 1 | SET NAMES utf8mb4; 2 | SET FOREIGN_KEY_CHECKS = 0; 3 | 4 | -- ---------------------------- 5 | -- Table structure for demo 6 | -- ---------------------------- 7 | CREATE database test; 8 | use test; 9 | DROP TABLE IF EXISTS `demo`; 10 | CREATE TABLE `demo` ( 11 | `id` int NOT NULL AUTO_INCREMENT, 12 | `name` varchar(50) NOT NULL, 13 | PRIMARY KEY (`id`) 14 | ) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; 15 | 16 | SET FOREIGN_KEY_CHECKS = 1; 17 | 18 | 19 | CREATE database test1; 20 | use test1; 21 | DROP TABLE IF EXISTS `demo`; 22 | CREATE TABLE `demo` ( 23 | `id` int NOT NULL AUTO_INCREMENT, 24 | `name` varchar(50) NOT NULL, 25 | PRIMARY KEY (`id`) 26 | ) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; 27 | 28 | SET FOREIGN_KEY_CHECKS = 1; 29 | -------------------------------------------------------------------------------- /springboot-atomikos-xa-sample/src/test/java/com/ipman/atomikos/xa/springboot/springbootatomikosxasample/SpringbootAtomikosXaSampleApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.ipman.atomikos.xa.springboot.springbootatomikosxasample; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringbootAtomikosXaSampleApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springboot-drools-sample/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springboot-drools-sample/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/ba1fe0b303008023f0d0afef7aa0ddea2aea5306/springboot-drools-sample/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /springboot-drools-sample/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.1/apache-maven-3.8.1-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /springboot-drools-sample/src/main/java/com/ipman/drools/springboot/SpringbootDroolsSampleApplication.java: -------------------------------------------------------------------------------- 1 | package com.ipman.drools.springboot; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringbootDroolsSampleApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringbootDroolsSampleApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springboot-drools-sample/src/main/java/com/ipman/drools/springboot/controller/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.ipman.drools.springboot.controller; 2 | 3 | import com.ipman.drools.springboot.service.RuleService; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | import org.springframework.web.bind.annotation.RestController; 7 | 8 | @RestController 9 | @RequestMapping("/hello") 10 | public class HelloController { 11 | 12 | @Autowired 13 | private RuleService ruleService; 14 | 15 | @RequestMapping("/rule") 16 | public String rule() { 17 | ruleService.rule(); 18 | return "OK"; 19 | } 20 | } -------------------------------------------------------------------------------- /springboot-drools-sample/src/main/java/com/ipman/drools/springboot/service/RuleService.java: -------------------------------------------------------------------------------- 1 | package com.ipman.drools.springboot.service; 2 | 3 | import org.kie.api.KieBase; 4 | import org.kie.api.runtime.KieSession; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | 8 | @Service 9 | public class RuleService { 10 | 11 | @Autowired 12 | private KieBase kieBase; 13 | 14 | public void rule() { 15 | KieSession kieSession = kieBase.newKieSession(); 16 | kieSession.fireAllRules(); 17 | kieSession.dispose(); 18 | } 19 | } -------------------------------------------------------------------------------- /springboot-drools-sample/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=8080 2 | spring.application.name=drools_springboot -------------------------------------------------------------------------------- /springboot-drools-sample/src/main/resources/rules/helloworld.drl: -------------------------------------------------------------------------------- 1 | package helloworld 2 | rule "rule_helloworld" 3 | when 4 | eval(true) 5 | then 6 | System.out.println("规则:rule_helloworld触发..."); 7 | end -------------------------------------------------------------------------------- /springboot-drools-sample/src/test/java/com/ipman/drools/springboot/SpringbootDroolsSampleApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.ipman.drools.springboot; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringbootDroolsSampleApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springboot-freemarker-sample/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springboot-freemarker-sample/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/ba1fe0b303008023f0d0afef7aa0ddea2aea5306/springboot-freemarker-sample/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /springboot-freemarker-sample/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.2/apache-maven-3.8.2-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /springboot-freemarker-sample/src/main/java/com/ipman/freemarker/sample/SpringbootFreemarkerSampleApplication.java: -------------------------------------------------------------------------------- 1 | package com.ipman.freemarker.sample; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringbootFreemarkerSampleApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringbootFreemarkerSampleApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springboot-freemarker-sample/src/main/java/com/ipman/freemarker/sample/entity/Student.java: -------------------------------------------------------------------------------- 1 | package com.ipman.freemarker.sample.entity; 2 | 3 | /** 4 | * Created by ipipman on 2021/9/23. 5 | * 6 | * @version V1.0 7 | * @Package com.ipman.freemarker.sample.entity 8 | * @Description: (用一句话描述该文件做什么) 9 | * @date 2021/9/23 5:59 下午 10 | */ 11 | public class Student { 12 | 13 | private String idNo; 14 | 15 | private String name; 16 | 17 | public String getIdNo() { 18 | return idNo; 19 | } 20 | 21 | public void setIdNo(String idNo) { 22 | this.idNo = idNo; 23 | } 24 | 25 | public String getName() { 26 | return name; 27 | } 28 | 29 | public void setName(String name) { 30 | this.name = name; 31 | } 32 | 33 | @Override 34 | public String toString() { 35 | return "Student{" + 36 | "idNo='" + idNo + '\'' + 37 | ", name='" + name + '\'' + 38 | '}'; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /springboot-freemarker-sample/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | # HttpServletRequest的属性是否可以覆盖controller中model的同名项 2 | spring.freemarker.allow-request-override=false 3 | # HttpSession的属性是否可以覆盖controller中model的同名项 4 | spring.freemarker.allow-session-override=false 5 | # 是否开启缓存 6 | spring.freemarker.cache=false 7 | # 模板文件编码 8 | spring.freemarker.charset=UTF-8 9 | # 是否检查模板位置 10 | spring.freemarker.check-template-location=true 11 | # Content-Type的值 12 | spring.freemarker.content-type=text/html 13 | # 是否将HttpServletRequest中的属性添加到Model中 14 | spring.freemarker.expose-request-attributes=false 15 | # 是否将HttpSession中的属性添加到Model中 16 | spring.freemarker.expose-session-attributes=false 17 | # 模板文件后缀 18 | spring.freemarker.suffix=.ftl 19 | # 模板文件位置 20 | spring.freemarker.template-loader-path=classpath:/templates/ -------------------------------------------------------------------------------- /springboot-freemarker-sample/src/main/resources/templates/demo.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | index 4 | 5 | 6 |

你好,${userName}

7 | 8 | -------------------------------------------------------------------------------- /springboot-freemarker-sample/src/main/resources/templates/demo1.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | demo列表 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | <#list students as student> 14 | 15 | 16 | 17 | 18 | 19 |
编号名称
${student.idNo}${student.name}
20 | 21 | -------------------------------------------------------------------------------- /springboot-freemarker-sample/src/test/java/com/ipman/freemarker/sample/SpringbootFreemarkerSampleApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.ipman.freemarker.sample; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringbootFreemarkerSampleApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springboot-jedis-sample/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springboot-jedis-sample/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/ba1fe0b303008023f0d0afef7aa0ddea2aea5306/springboot-jedis-sample/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /springboot-jedis-sample/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /springboot-jedis-sample/src/main/java/com/ipman/springboot/redis/jedis/sample/SpringbootJedisSampleApplication.java: -------------------------------------------------------------------------------- 1 | package com.ipman.springboot.redis.jedis.sample; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.context.ApplicationContext; 6 | import org.springframework.context.ConfigurableApplicationContext; 7 | import redis.clients.jedis.Jedis; 8 | import redis.clients.jedis.JedisPool; 9 | 10 | import javax.annotation.processing.SupportedSourceVersion; 11 | 12 | @SpringBootApplication 13 | public class SpringbootJedisSampleApplication { 14 | 15 | public static void main(String[] args) { 16 | ApplicationContext context = SpringApplication.run(SpringbootJedisSampleApplication.class, args); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /springboot-jedis-sample/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=8081 2 | 3 | #Redis默认库 4 | spring.redis.database=0 5 | #Redis地址 6 | spring.redis.host=10.211.55.6 7 | #Redis端口 8 | spring.redis.port=6379 9 | #Redis密码 10 | spring.redis.password= 11 | #控制一个pool可分配多少个jedis实例 12 | spring.redis.jedis.pool.max-active=20 13 | #表示borrow一个jedis实例是,最大等待的时间,如果超时,直接抛出jedisConnectionException 14 | spring.redis.jedis.pool.max-wait=1000 15 | #控制一个poll最多有多少个状态为idle的jedis实例,超出这个阈值会clonse掉超出的连接 16 | spring.redis.jedis.pool.max-idle=5 17 | spring.redis.jedis.pool.min-idle=0 18 | #Jedis连接超时时间 19 | spring.redis.timeout=10000 -------------------------------------------------------------------------------- /springboot-jedis-sample/src/test/java/com/ipman/springboot/redis/jedis/sample/JedisTest.java: -------------------------------------------------------------------------------- 1 | package com.ipman.springboot.redis.jedis.sample; 2 | 3 | import com.ipman.springboot.redis.jedis.sample.utils.JedisUtil; 4 | import org.junit.jupiter.api.Test; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.boot.test.context.SpringBootTest; 7 | 8 | /** 9 | * Created by ipipman on 2021/1/6. 10 | * 11 | * @version V1.0 12 | * @Package com.ipman.springboot.redis.jedis.sample 13 | * @Description: (用一句话描述该文件做什么) 14 | * @date 2021/1/6 10:00 上午 15 | */ 16 | @SpringBootTest 17 | class JedisTest { 18 | 19 | @Autowired 20 | private JedisUtil jedisUtil; 21 | 22 | @Test 23 | public void testCmd(){ 24 | jedisUtil.set("name", "ipman", 0); 25 | jedisUtil.expire("name", 86400, 0); 26 | System.out.println(jedisUtil.get("name", 0)); 27 | System.out.println(jedisUtil.ttl("name", 0)); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /springboot-kafka-sample/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springboot-kafka-sample/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/ba1fe0b303008023f0d0afef7aa0ddea2aea5306/springboot-kafka-sample/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /springboot-kafka-sample/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /springboot-kafka-sample/src/main/java/com/ipman/springboot/kafka/sample/SpringbootKafkaSampleApplication.java: -------------------------------------------------------------------------------- 1 | package com.ipman.springboot.kafka.sample; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringbootKafkaSampleApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringbootKafkaSampleApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springboot-kafka-sample/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /springboot-kafka-sample/src/test/java/com/ipman/springboot/kafka/sample/SpringbootKafkaSampleApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.ipman.springboot.kafka.sample; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringbootKafkaSampleApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springboot-lettuce-sample/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springboot-lettuce-sample/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/ba1fe0b303008023f0d0afef7aa0ddea2aea5306/springboot-lettuce-sample/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /springboot-lettuce-sample/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /springboot-lettuce-sample/src/main/java/com/ipman/springboot/lettuce/sample/SpringbootLettuceSampleApplication.java: -------------------------------------------------------------------------------- 1 | package com.ipman.springboot.lettuce.sample; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringbootLettuceSampleApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringbootLettuceSampleApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springboot-lettuce-sample/src/main/java/com/ipman/springboot/lettuce/sample/utils/SyncCommandCallback.java: -------------------------------------------------------------------------------- 1 | package com.ipman.springboot.lettuce.sample.utils; 2 | 3 | import io.lettuce.core.api.sync.RedisCommands; 4 | 5 | /** 6 | * Created by ipipman on 2021/1/20. 7 | * 8 | * @version V1.0 9 | * @Package com.ipman.springboot.lettuce.sample.utils 10 | * @Description: (用一句话描述该文件做什么) 11 | * @date 2021/1/20 7:02 下午 12 | */ 13 | @FunctionalInterface 14 | public interface SyncCommandCallback { 15 | 16 | //抽象方法,为了简化代码,便于传入回调函数 17 | T doInConnection(RedisCommands commands); 18 | } 19 | -------------------------------------------------------------------------------- /springboot-lettuce-sample/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | #Redis服务器地址 2 | spring.redis.host=10.211.55.6 3 | #Redis服务端口 4 | spring.redis.port=6379 5 | #Redis密码 6 | spring.redis.password= 7 | #是否需要SSL 8 | spring.redis.ssl=false 9 | #Redis默认库,一共0~15 10 | spring.redis.database=0 11 | 12 | #设置可分配的最大Redis实例数量 13 | spring.redis.pool.maxTotal=20 14 | #设置最多空闲的Redis实例数量 15 | spring.redis.pool.maxIdle=5 16 | #归还Redis实例时,检查有消息,如果失败,则销毁实例 17 | spring.redis.pool.testOnReturn=true 18 | #当Redis实例处于空闲状态时检查有效性,默认flase 19 | spring.redis.pool.testWhileIdle=true -------------------------------------------------------------------------------- /springboot-lettuce-sample/src/test/java/com/ipman/springboot/lettuce/sample/SpringbootLettuceSampleApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.ipman.springboot.lettuce.sample; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringbootLettuceSampleApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springboot-nacos-sample/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springboot-nacos-sample/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/ba1fe0b303008023f0d0afef7aa0ddea2aea5306/springboot-nacos-sample/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /springboot-nacos-sample/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /springboot-nacos-sample/src/main/java/com/ipman/springboot/nacos/sample/SpringbootNacosSampleApplication.java: -------------------------------------------------------------------------------- 1 | package com.ipman.springboot.nacos.sample; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringbootNacosSampleApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringbootNacosSampleApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springboot-nacos-sample/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=8080 2 | nacos.config.server-addr=10.211.55.6:8848 -------------------------------------------------------------------------------- /springboot-netty-sample/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springboot-netty-sample/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/ba1fe0b303008023f0d0afef7aa0ddea2aea5306/springboot-netty-sample/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /springboot-netty-sample/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.3/apache-maven-3.8.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar 3 | -------------------------------------------------------------------------------- /springboot-netty-sample/src/main/java/com/ipman/netty/springboot/sample/SpringbootNettySampleApplication.java: -------------------------------------------------------------------------------- 1 | package com.ipman.netty.springboot.sample; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringbootNettySampleApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringbootNettySampleApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springboot-netty-sample/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /springboot-netty-sample/src/test/java/com/ipman/netty/springboot/sample/SpringbootNettySampleApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.ipman.netty.springboot.sample; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringbootNettySampleApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springboot-redisson-sample/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springboot-redisson-sample/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/ba1fe0b303008023f0d0afef7aa0ddea2aea5306/springboot-redisson-sample/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /springboot-redisson-sample/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /springboot-redisson-sample/src/main/java/com/ipman/springboot/redisson/sample/SpringbootRedissonSampleApplication.java: -------------------------------------------------------------------------------- 1 | package com.ipman.springboot.redisson.sample; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 6 | 7 | @SpringBootApplication 8 | @EnableConfigurationProperties 9 | public class SpringbootRedissonSampleApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(SpringbootRedissonSampleApplication.class, args); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /springboot-redisson-sample/src/test/java/com/ipman/springboot/redisson/sample/SpringbootRedissonSampleApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.ipman.springboot.redisson.sample; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringbootRedissonSampleApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springboot-rpc-grpc-sample/springboot-rpc-grpc-consume/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springboot-rpc-grpc-sample/springboot-rpc-grpc-consume/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/ba1fe0b303008023f0d0afef7aa0ddea2aea5306/springboot-rpc-grpc-sample/springboot-rpc-grpc-consume/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /springboot-rpc-grpc-sample/springboot-rpc-grpc-consume/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /springboot-rpc-grpc-sample/springboot-rpc-grpc-consume/src/main/java/com/ipman/rpc/grpc/springboot/SpringbootRpcGrpcConsumeApplication.java: -------------------------------------------------------------------------------- 1 | package com.ipman.rpc.grpc.springboot; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringbootRpcGrpcConsumeApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringbootRpcGrpcConsumeApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springboot-rpc-grpc-sample/springboot-rpc-grpc-consume/src/main/java/com/ipman/rpc/grpc/springboot/proto/greeter.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | option java_package = "com.ipman.rpc.grpc.springboot.lib"; 4 | 5 | // The greeter service definition. 6 | service Greeter { 7 | // Sends a greeting 8 | rpc SayHello ( HelloRequest) returns ( HelloReply) {} 9 | 10 | } 11 | // The request message containing the user's name. 12 | message HelloRequest { 13 | string name = 1; 14 | } 15 | // The response message containing the greetings 16 | message HelloReply { 17 | string message = 1; 18 | } -------------------------------------------------------------------------------- /springboot-rpc-grpc-sample/springboot-rpc-grpc-consume/src/main/java/com/ipman/rpc/grpc/springboot/service/IGrpcClientService.java: -------------------------------------------------------------------------------- 1 | package com.ipman.rpc.grpc.springboot.service; 2 | 3 | /** 4 | * Created by ipipman on 2020/12/15. 5 | * 6 | * @version V1.0 7 | * @Package com.ipman.rpc.grpc.springboot.service 8 | * @Description: (用一句话描述该文件做什么) 9 | * @date 2020/12/15 6:28 下午 10 | */ 11 | public interface IGrpcClientService { 12 | String sendMessage(String name); 13 | } 14 | -------------------------------------------------------------------------------- /springboot-rpc-grpc-sample/springboot-rpc-grpc-consume/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=8801 2 | 3 | grpc.client.local-grpc-server.host=127.0.0.1 4 | grpc.client.local-grpc-server.port=8800 5 | grpc.client.local-grpc-server.enableKeepAlive=true 6 | grpc.client.local-grpc-server.keepAliveWithoutCalls=true 7 | -------------------------------------------------------------------------------- /springboot-rpc-grpc-sample/springboot-rpc-grpc-consume/src/test/java/com/ipman/rpc/grpc/springboot/SpringbootRpcGrpcConsumeApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.ipman.rpc.grpc.springboot; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringbootRpcGrpcConsumeApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springboot-rpc-grpc-sample/springboot-rpc-grpc-provide/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springboot-rpc-grpc-sample/springboot-rpc-grpc-provide/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/ba1fe0b303008023f0d0afef7aa0ddea2aea5306/springboot-rpc-grpc-sample/springboot-rpc-grpc-provide/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /springboot-rpc-grpc-sample/springboot-rpc-grpc-provide/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /springboot-rpc-grpc-sample/springboot-rpc-grpc-provide/src/main/java/com/ipman/rpc/grpc/springboot/SpringbootRpcGrpcProvideApplication.java: -------------------------------------------------------------------------------- 1 | package com.ipman.rpc.grpc.springboot; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringbootRpcGrpcProvideApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringbootRpcGrpcProvideApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springboot-rpc-grpc-sample/springboot-rpc-grpc-provide/src/main/java/com/ipman/rpc/grpc/springboot/proto/greeter.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | option java_package = "com.ipman.rpc.grpc.springboot.lib"; 4 | 5 | // The greeter service definition. 6 | service Greeter { 7 | // Sends a greeting 8 | rpc SayHello ( HelloRequest) returns ( HelloReply) {} 9 | 10 | } 11 | // The request message containing the user's name. 12 | message HelloRequest { 13 | string name = 1; 14 | } 15 | // The response message containing the greetings 16 | message HelloReply { 17 | string message = 1; 18 | } -------------------------------------------------------------------------------- /springboot-rpc-grpc-sample/springboot-rpc-grpc-provide/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | grpc.server.port=8800 -------------------------------------------------------------------------------- /springboot-rpc-grpc-sample/springboot-rpc-grpc-provide/src/test/java/com/ipman/rpc/grpc/springboot/SpringbootRpcGrpcProvideApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.ipman.rpc.grpc.springboot; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringbootRpcGrpcProvideApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springboot-rpc-thrift-sample/springboot-rpc-thrift-consume/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springboot-rpc-thrift-sample/springboot-rpc-thrift-consume/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/ba1fe0b303008023f0d0afef7aa0ddea2aea5306/springboot-rpc-thrift-sample/springboot-rpc-thrift-consume/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /springboot-rpc-thrift-sample/springboot-rpc-thrift-consume/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /springboot-rpc-thrift-sample/springboot-rpc-thrift-consume/src/main/java/com/ipman/rpc/thrift/consume/springboot/SpringbootRpcThriftConsumeApplication.java: -------------------------------------------------------------------------------- 1 | package com.ipman.rpc.thrift.consume.springboot; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringbootRpcThriftConsumeApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringbootRpcThriftConsumeApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springboot-rpc-thrift-sample/springboot-rpc-thrift-consume/src/main/java/com/ipman/rpc/thrift/consume/springboot/service/TestDemoService.java: -------------------------------------------------------------------------------- 1 | package com.ipman.rpc.thrift.consume.springboot.service; 2 | 3 | import com.ipman.rpc.thrift.consume.springboot.pojo.DemoPOJO; 4 | 5 | /** 6 | * Created by ipipman on 2020/12/14. 7 | * 8 | * @version V1.0 9 | * @Package com.ipman.rpc.thrift.consume.springboot.service 10 | * @Description: (用一句话描述该文件做什么) 11 | * @date 2020/12/14 5:33 下午 12 | */ 13 | public interface TestDemoService { 14 | 15 | //根据名称获取Demo 16 | DemoPOJO getDemoItem(String name); 17 | 18 | //保存Demo信息 19 | void save(DemoPOJO demoPOJO); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /springboot-rpc-thrift-sample/springboot-rpc-thrift-consume/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=8000 2 | 3 | #Thrfit配置 4 | server.thrift.host=127.0.0.1 5 | server.thrift.port=8800 -------------------------------------------------------------------------------- /springboot-rpc-thrift-sample/springboot-rpc-thrift-consume/src/test/java/com/ipman/rpc/thrift/consume/springboot/SpringbootRpcThriftConsumeApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.ipman.rpc.thrift.consume.springboot; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringbootRpcThriftConsumeApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springboot-rpc-thrift-sample/springboot-rpc-thrift-provide/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springboot-rpc-thrift-sample/springboot-rpc-thrift-provide/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/ba1fe0b303008023f0d0afef7aa0ddea2aea5306/springboot-rpc-thrift-sample/springboot-rpc-thrift-provide/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /springboot-rpc-thrift-sample/springboot-rpc-thrift-provide/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /springboot-rpc-thrift-sample/springboot-rpc-thrift-provide/src/main/java/com/ipman/rpc/thrift/provide/springboot/SpringbootRpcThriftProvideApplication.java: -------------------------------------------------------------------------------- 1 | package com.ipman.rpc.thrift.provide.springboot; 2 | 3 | import com.ipman.rpc.thrift.provide.springboot.server.ThriftServer; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.context.annotation.Bean; 7 | 8 | @SpringBootApplication 9 | public class SpringbootRpcThriftProvideApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(SpringbootRpcThriftProvideApplication.class, args); 13 | } 14 | 15 | /** 16 | * 启动Thrift服务 17 | * 18 | * @return 19 | */ 20 | @Bean(initMethod = "start") 21 | public ThriftServer init() { 22 | return new ThriftServer(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /springboot-rpc-thrift-sample/springboot-rpc-thrift-provide/src/main/java/com/ipman/rpc/thrift/provide/springboot/idl/demo.thrift: -------------------------------------------------------------------------------- 1 | //定义代码生成后存放的位置 2 | namespace java com.ipman.rpc.thrift.provide.springboot.pojo 3 | 4 | //将shrift的数据类型格式转换为java习惯的格式 5 | typedef i16 short 6 | typedef i32 int 7 | typedef i64 long 8 | typedef string String 9 | typedef bool boolean 10 | 11 | //定义demo对象 12 | struct DemoPOJO { 13 | 1:optional String name 14 | } 15 | 16 | //定义数据异常 17 | exception ExceptionPOJO { 18 | //optional 可选 非必传 19 | 1:optional int code, 20 | 2:optional String msg 21 | } 22 | 23 | //定义操作demo服务 24 | service DemoServiceDTO { 25 | //根据名称返回一个demo,required 必传项 26 | DemoPOJO getStudentByName(1:required String name) throws (1:ExceptionPOJO dataException), 27 | 28 | //保存一个demo信息 无返回 抛出DataException异常 29 | void save(1:required DemoPOJO demo) throws (1:ExceptionPOJO dataException) 30 | } 31 | -------------------------------------------------------------------------------- /springboot-rpc-thrift-sample/springboot-rpc-thrift-provide/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | #Thrift监听的端口 2 | server.thrift.port=8800 3 | #线程池最小线程数 4 | server.thrift.min-thread-pool=100 5 | #线程池最大线程数 6 | server.thrift.max-thread-pool=100 -------------------------------------------------------------------------------- /springboot-rpc-thrift-sample/springboot-rpc-thrift-provide/src/test/java/com/ipman/rpc/thrift/provide/springboot/SpringbootRpcThriftProvideApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.ipman.rpc.thrift.provide.springboot; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringbootRpcThriftProvideApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springboot-seata-at-sample/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springboot-seata-at-sample/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/ba1fe0b303008023f0d0afef7aa0ddea2aea5306/springboot-seata-at-sample/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /springboot-seata-at-sample/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /springboot-seata-at-sample/seata-at-account-service/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springboot-seata-at-sample/seata-at-account-service/src/main/java/com/ipman/sb2accountservice/Sb2AccountServiceApplication.java: -------------------------------------------------------------------------------- 1 | package com.ipman.sb2accountservice; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Sb2AccountServiceApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Sb2AccountServiceApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springboot-seata-at-sample/seata-at-account-service/src/main/java/com/ipman/sb2accountservice/config/DataSourceConfig.java: -------------------------------------------------------------------------------- 1 | package com.ipman.sb2accountservice.config; 2 | 3 | import com.alibaba.druid.pool.DruidDataSource; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | 8 | import javax.sql.DataSource; 9 | 10 | /** 11 | * Created by ipipman on 2020/12/9. 12 | * 13 | * @version V1.0 14 | * @Package com.ipman.sb2accountservice.config 15 | * @Description: (用一句话描述该文件做什么) 16 | * @date 2020/12/9 5:30 下午 17 | */ 18 | @Configuration 19 | public class DataSourceConfig { 20 | 21 | /** 22 | * 数据源配置 23 | * 24 | * @return 25 | */ 26 | @Bean 27 | @ConfigurationProperties(prefix = "spring.datasource") 28 | public DataSource druidDataSource() { 29 | return new DruidDataSource(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /springboot-seata-at-sample/seata-at-account-service/src/main/java/com/ipman/sb2accountservice/controller/AccountController.java: -------------------------------------------------------------------------------- 1 | package com.ipman.sb2accountservice.controller; 2 | 3 | import com.ipman.sb2accountservice.service.AccountService; 4 | import io.seata.core.context.RootContext; 5 | import lombok.RequiredArgsConstructor; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.web.bind.annotation.GetMapping; 8 | import org.springframework.web.bind.annotation.RequestParam; 9 | import org.springframework.web.bind.annotation.RestController; 10 | 11 | import java.math.BigDecimal; 12 | 13 | @RestController 14 | @RequiredArgsConstructor(onConstructor_ = {@Autowired}) 15 | public class AccountController { 16 | 17 | private final AccountService accountService; 18 | 19 | @GetMapping 20 | public void debit(@RequestParam String userId, @RequestParam BigDecimal orderMoney) { 21 | System.out.println("account XID " + RootContext.getXID()); 22 | accountService.debit(userId, orderMoney); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /springboot-seata-at-sample/seata-at-account-service/src/main/java/com/ipman/sb2accountservice/entity/Account.java: -------------------------------------------------------------------------------- 1 | package com.ipman.sb2accountservice.entity; 2 | 3 | import lombok.*; 4 | 5 | import java.math.BigDecimal; 6 | 7 | @Getter 8 | @Setter 9 | @ToString 10 | @AllArgsConstructor 11 | @NoArgsConstructor 12 | public class Account { 13 | private Integer id; 14 | private String userId; 15 | private BigDecimal money; 16 | } 17 | -------------------------------------------------------------------------------- /springboot-seata-at-sample/seata-at-account-service/src/main/java/com/ipman/sb2accountservice/mapper/AccountMapper.java: -------------------------------------------------------------------------------- 1 | package com.ipman.sb2accountservice.mapper; 2 | 3 | import com.ipman.sb2accountservice.entity.Account; 4 | import org.apache.ibatis.annotations.Mapper; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | /** 8 | * Created by ipipman on 2020/12/9. 9 | * 10 | * @version V1.0 11 | * @Package com.ipman.sb2accountservice.mapper 12 | * @Description: (用一句话描述该文件做什么) 13 | * @date 2020/12/9 5:49 下午 14 | */ 15 | @Mapper 16 | public interface AccountMapper { 17 | 18 | Account selectByUserId(@Param("userId") String userId); 19 | 20 | int updateById(@Param("account") Account record); 21 | } 22 | -------------------------------------------------------------------------------- /springboot-seata-at-sample/seata-at-account-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=account-service 2 | server.port=8081 3 | 4 | spring.datasource.url=jdbc:mysql://10.211.55.6:3306/db_seata?useSSL=false&serverTimezone=UTC 5 | spring.datasource.username=root 6 | spring.datasource.password=root 7 | mybatis.mapper-locations=classpath*:mapper/*Mapper.xml 8 | 9 | #这里seata server用的是file模式 10 | seata.tx-service-group=my_test_tx_group 11 | seata.service.grouplist=10.211.55.6:8091 12 | logging.level.io.seata=info 13 | logging.level.io.seata.samples.account.persistence.AccountMapper=debug -------------------------------------------------------------------------------- /springboot-seata-at-sample/seata-at-account-service/src/main/resources/mapper/AccountMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 14 | 15 | 16 | update account_tbl 17 | set money = #{account.money,jdbcType=DECIMAL} 18 | where id = #{account.id} 19 | 20 | 21 | -------------------------------------------------------------------------------- /springboot-seata-at-sample/seata-at-account-service/src/test/java/com/ipman/sb2accountservice/Sb2AccountServiceApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.ipman.sb2accountservice; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class Sb2AccountServiceApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springboot-seata-at-sample/seata-at-business-service/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springboot-seata-at-sample/seata-at-business-service/src/main/java/com/ipman/sb2accountservice/Sb2BusinessServiceApplication.java: -------------------------------------------------------------------------------- 1 | package com.ipman.sb2accountservice; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.web.client.RestTemplate; 8 | 9 | @SpringBootApplication(scanBasePackages = "com.ipman.sb2accountservice", exclude = DataSourceAutoConfiguration.class) 10 | public class Sb2BusinessServiceApplication { 11 | 12 | public static void main(String[] args) { 13 | SpringApplication.run(Sb2BusinessServiceApplication.class, args); 14 | } 15 | 16 | @Bean 17 | public RestTemplate restTemplate() { 18 | RestTemplate restTemplate = new RestTemplate(); 19 | return restTemplate; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /springboot-seata-at-sample/seata-at-business-service/src/main/java/com/ipman/sb2accountservice/client/OrderClient.java: -------------------------------------------------------------------------------- 1 | package com.ipman.sb2accountservice.client; 2 | 3 | import lombok.RequiredArgsConstructor; 4 | import lombok.extern.slf4j.Slf4j; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Component; 7 | import org.springframework.web.client.RestTemplate; 8 | 9 | @Slf4j 10 | @Component 11 | @RequiredArgsConstructor(onConstructor_ = {@Autowired}) 12 | public class OrderClient { 13 | 14 | private final RestTemplate restTemplate; 15 | 16 | public void create(String userId, String commodityCode, int orderCount) { 17 | String url = "http://127.0.0.1:8082/api/order/debit?userId=" + userId + "&commodityCode=" + commodityCode + "&count=" + orderCount; 18 | try { 19 | restTemplate.getForEntity(url, Void.class); 20 | } catch (Exception e) { 21 | log.error("create url {} ,error:", url); 22 | throw new RuntimeException(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /springboot-seata-at-sample/seata-at-business-service/src/main/java/com/ipman/sb2accountservice/config/DataSourceConfig.java: -------------------------------------------------------------------------------- 1 | package com.ipman.sb2accountservice.config; 2 | 3 | import com.alibaba.druid.pool.DruidDataSource; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | 8 | import javax.sql.DataSource; 9 | 10 | /** 11 | * Created by ipipman on 2020/12/9. 12 | * 13 | * @version V1.0 14 | * @Package com.ipman.sb2accountservice.config 15 | * @Description: (用一句话描述该文件做什么) 16 | * @date 2020/12/9 5:30 下午 17 | */ 18 | @Configuration 19 | public class DataSourceConfig { 20 | 21 | /** 22 | * 数据源配置 23 | * 24 | * @return 25 | */ 26 | @Bean 27 | @ConfigurationProperties(prefix = "spring.datasource") 28 | public DataSource druidDataSource() { 29 | return new DruidDataSource(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /springboot-seata-at-sample/seata-at-business-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=business-service 2 | server.port=8084 3 | 4 | spring.datasource.url=jdbc:mysql://10.211.55.6:3306/db_seata?useSSL=false&serverTimezone=UTC 5 | spring.datasource.username=root 6 | spring.datasource.password=root 7 | mybatis.mapper-locations=classpath*:mapper/*Mapper.xml 8 | 9 | #这里seata server用的是file模式 10 | seata.tx-service-group=my_test_tx_group 11 | seata.service.grouplist=10.211.55.6:8091 12 | logging.level.io.seata=error 13 | logging.level.io.seata.samples.account.persistence.AccountMapper=info -------------------------------------------------------------------------------- /springboot-seata-at-sample/seata-at-business-service/src/test/java/com/ipman/sb2accountservice/Sb2AccountServiceApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.ipman.sb2accountservice; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class Sb2AccountServiceApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springboot-seata-at-sample/seata-at-order-service/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springboot-seata-at-sample/seata-at-order-service/src/main/java/com/ipman/sb2accountservice/Sb2OrderServiceApplication.java: -------------------------------------------------------------------------------- 1 | package com.ipman.sb2accountservice; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.web.client.RestTemplate; 7 | 8 | @SpringBootApplication 9 | public class Sb2OrderServiceApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(Sb2OrderServiceApplication.class, args); 13 | } 14 | 15 | @Bean 16 | public RestTemplate restTemplate() { 17 | return new RestTemplate(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /springboot-seata-at-sample/seata-at-order-service/src/main/java/com/ipman/sb2accountservice/client/AccountClient.java: -------------------------------------------------------------------------------- 1 | package com.ipman.sb2accountservice.client; 2 | 3 | import lombok.RequiredArgsConstructor; 4 | import lombok.extern.slf4j.Slf4j; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Component; 7 | import org.springframework.web.client.RestTemplate; 8 | 9 | import java.math.BigDecimal; 10 | 11 | @Slf4j 12 | @Component 13 | @RequiredArgsConstructor(onConstructor_ = {@Autowired}) 14 | public class AccountClient { 15 | 16 | private final RestTemplate restTemplate; 17 | 18 | public void debit(String userId, BigDecimal orderMoney) { 19 | String url = "http://127.0.0.1:8081?userId=" + userId + "&orderMoney=" + orderMoney; 20 | try { 21 | restTemplate.getForEntity(url, Void.class); 22 | } catch (Exception e) { 23 | log.error("debit url {} ,error:", url, e); 24 | throw new RuntimeException(); 25 | } 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /springboot-seata-at-sample/seata-at-order-service/src/main/java/com/ipman/sb2accountservice/config/DataSourceConfig.java: -------------------------------------------------------------------------------- 1 | package com.ipman.sb2accountservice.config; 2 | 3 | import com.alibaba.druid.pool.DruidDataSource; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | 8 | import javax.sql.DataSource; 9 | 10 | /** 11 | * Created by ipipman on 2020/12/9. 12 | * 13 | * @version V1.0 14 | * @Package com.ipman.sb2accountservice.config 15 | * @Description: (用一句话描述该文件做什么) 16 | * @date 2020/12/9 5:30 下午 17 | */ 18 | @Configuration 19 | public class DataSourceConfig { 20 | 21 | /** 22 | * 数据源配置 23 | * 24 | * @return 25 | */ 26 | @Bean 27 | @ConfigurationProperties(prefix = "spring.datasource") 28 | public DataSource druidDataSource() { 29 | return new DruidDataSource(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /springboot-seata-at-sample/seata-at-order-service/src/main/java/com/ipman/sb2accountservice/entity/Order.java: -------------------------------------------------------------------------------- 1 | package com.ipman.sb2accountservice.entity; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | import lombok.ToString; 6 | 7 | import java.math.BigDecimal; 8 | 9 | @Getter 10 | @Setter 11 | @ToString 12 | public class Order { 13 | private Integer id; 14 | 15 | private String userId; 16 | 17 | private String commodityCode; 18 | 19 | private Integer count; 20 | 21 | private BigDecimal money; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /springboot-seata-at-sample/seata-at-order-service/src/main/java/com/ipman/sb2accountservice/mapper/OrderMapper.java: -------------------------------------------------------------------------------- 1 | package com.ipman.sb2accountservice.mapper; 2 | 3 | import com.ipman.sb2accountservice.entity.Order; 4 | import org.apache.ibatis.annotations.Mapper; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | @Mapper 8 | public interface OrderMapper { 9 | 10 | int insert(@Param("order") Order record); 11 | 12 | } -------------------------------------------------------------------------------- /springboot-seata-at-sample/seata-at-order-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=order-service 2 | server.port=8082 3 | 4 | spring.datasource.url=jdbc:mysql://10.211.55.6:3306/db_seata?useSSL=false&serverTimezone=UTC 5 | spring.datasource.username=root 6 | spring.datasource.password=root 7 | mybatis.mapper-locations=classpath*:mapper/*Mapper.xml 8 | 9 | #这里seata server用的是file模式 10 | seata.tx-service-group=my_test_tx_group 11 | seata.service.grouplist=10.211.55.6:8091 12 | logging.level.io.seata=info 13 | logging.level.io.seata.samples.account.persistence.AccountMapper=debug -------------------------------------------------------------------------------- /springboot-seata-at-sample/seata-at-order-service/src/main/resources/mapper/OrderMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | insert into order_tbl (user_id,commodity_code,count,money) 14 | values (#{order.userId}, #{order.commodityCode}, #{order.count}, #{order.money}) 15 | 16 | 17 | -------------------------------------------------------------------------------- /springboot-seata-at-sample/seata-at-order-service/src/test/java/com/ipman/sb2accountservice/Sb2AccountServiceApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.ipman.sb2accountservice; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class Sb2AccountServiceApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springboot-seata-at-sample/seata-at-storage-service/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springboot-seata-at-sample/seata-at-storage-service/src/main/java/com/ipman/sb2accountservice/Sb2StorageServiceApplication.java: -------------------------------------------------------------------------------- 1 | package com.ipman.sb2accountservice; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Sb2StorageServiceApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Sb2StorageServiceApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springboot-seata-at-sample/seata-at-storage-service/src/main/java/com/ipman/sb2accountservice/config/DataSourceConfig.java: -------------------------------------------------------------------------------- 1 | package com.ipman.sb2accountservice.config; 2 | 3 | import com.alibaba.druid.pool.DruidDataSource; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | 8 | import javax.sql.DataSource; 9 | 10 | /** 11 | * Created by ipipman on 2020/12/9. 12 | * 13 | * @version V1.0 14 | * @Package com.ipman.sb2accountservice.config 15 | * @Description: (用一句话描述该文件做什么) 16 | * @date 2020/12/9 5:30 下午 17 | */ 18 | @Configuration 19 | public class DataSourceConfig { 20 | 21 | /** 22 | * 数据源配置 23 | * 24 | * @return 25 | */ 26 | @Bean 27 | @ConfigurationProperties(prefix = "spring.datasource") 28 | public DataSource druidDataSource() { 29 | return new DruidDataSource(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /springboot-seata-at-sample/seata-at-storage-service/src/main/java/com/ipman/sb2accountservice/entity/Storage.java: -------------------------------------------------------------------------------- 1 | package com.ipman.sb2accountservice.entity; 2 | 3 | import lombok.*; 4 | 5 | @Builder 6 | @Getter 7 | @Setter 8 | @ToString 9 | @AllArgsConstructor 10 | @NoArgsConstructor 11 | public class Storage { 12 | private Integer id; 13 | private String commodityCode; 14 | private Integer count; 15 | } 16 | -------------------------------------------------------------------------------- /springboot-seata-at-sample/seata-at-storage-service/src/main/java/com/ipman/sb2accountservice/mapper/StorageMapper.java: -------------------------------------------------------------------------------- 1 | package com.ipman.sb2accountservice.mapper; 2 | 3 | import com.ipman.sb2accountservice.entity.Storage; 4 | import org.apache.ibatis.annotations.Mapper; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | @Mapper 10 | public interface StorageMapper { 11 | 12 | Storage selectById(@Param("id") Integer id); 13 | 14 | Storage findByCommodityCode(@Param("commodityCode") String commodityCode); 15 | 16 | int updateById(Storage record); 17 | 18 | void insert(Storage record); 19 | 20 | void insertBatch(List records); 21 | 22 | int updateBatch(@Param("list") List ids, @Param("commodityCode") String commodityCode); 23 | } 24 | -------------------------------------------------------------------------------- /springboot-seata-at-sample/seata-at-storage-service/src/main/java/com/ipman/sb2accountservice/service/StorageService.java: -------------------------------------------------------------------------------- 1 | package com.ipman.sb2accountservice.service; 2 | 3 | 4 | import com.ipman.sb2accountservice.entity.Storage; 5 | import com.ipman.sb2accountservice.mapper.StorageMapper; 6 | import lombok.RequiredArgsConstructor; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Service; 9 | 10 | @Service 11 | @RequiredArgsConstructor(onConstructor_ = {@Autowired}) 12 | public class StorageService { 13 | 14 | private final StorageMapper storageMapper; 15 | 16 | public void deduct(String commodityCode, int count) { 17 | Storage storage = storageMapper.findByCommodityCode(commodityCode); 18 | storage.setCount(storage.getCount() - count); 19 | storageMapper.updateById(storage); 20 | } 21 | 22 | 23 | } 24 | -------------------------------------------------------------------------------- /springboot-seata-at-sample/seata-at-storage-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=storage-service 2 | server.port=8083 3 | 4 | spring.datasource.url=jdbc:mysql://10.211.55.6:3306/db_seata?useSSL=false&serverTimezone=UTC 5 | spring.datasource.username=root 6 | spring.datasource.password=root 7 | mybatis.mapper-locations=classpath*:mapper/*Mapper.xml 8 | 9 | #这里seata server用的是file模式 10 | seata.tx-service-group=my_test_tx_group 11 | seata.service.grouplist=10.211.55.6:8091 12 | logging.level.io.seata=info 13 | logging.level.io.seata.samples.account.persistence.AccountMapper=debug -------------------------------------------------------------------------------- /springboot-seata-at-sample/seata-at-storage-service/src/test/java/com/ipman/sb2accountservice/Sb2AccountServiceApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.ipman.sb2accountservice; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class Sb2AccountServiceApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springboot-seata-tcc-sample/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springboot-seata-tcc-sample/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/ba1fe0b303008023f0d0afef7aa0ddea2aea5306/springboot-seata-tcc-sample/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /springboot-seata-tcc-sample/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /springboot-seata-tcc-sample/src/main/java/com/ipman/seata/tcc/springboot/dubbo/server/seata/SeataServerStarter.java: -------------------------------------------------------------------------------- 1 | package com.ipman.seata.tcc.springboot.dubbo.server.seata; 2 | 3 | import io.seata.server.Server; 4 | 5 | import java.io.IOException; 6 | 7 | public class SeataServerStarter { 8 | 9 | static Server server = null; 10 | 11 | /** 12 | * 启动Seata本地Server 13 | * 14 | * @param args 15 | * @throws IOException 16 | */ 17 | public static void main(String[] args) throws IOException { 18 | server = new Server(); 19 | server.main(args); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /springboot-seata-tcc-sample/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=springboot-tcc-sample 2 | spring.main.allow-bean-definition-overriding=true -------------------------------------------------------------------------------- /springboot-seata-tcc-sample/src/main/resources/provider/seata-tcc.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /springboot-seata-tcc-sample/src/main/resources/spring/seata-tcc.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /springboot-shardingsphere-jdbc-sample/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springboot-shardingsphere-jdbc-sample/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/ba1fe0b303008023f0d0afef7aa0ddea2aea5306/springboot-shardingsphere-jdbc-sample/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /springboot-shardingsphere-jdbc-sample/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /springboot-shardingsphere-jdbc-sample/sql/demo.sql: -------------------------------------------------------------------------------- 1 | SET NAMES utf8mb4; 2 | SET FOREIGN_KEY_CHECKS = 0; 3 | 4 | -- ---------------------------- 5 | -- Table structure for demo 6 | -- ---------------------------- 7 | CREATE database test; 8 | use test; 9 | DROP TABLE IF EXISTS `demo`; 10 | CREATE TABLE `demo` ( 11 | `id` int NOT NULL AUTO_INCREMENT, 12 | `name` varchar(50) NOT NULL, 13 | PRIMARY KEY (`id`) 14 | ) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; 15 | 16 | SET FOREIGN_KEY_CHECKS = 1; 17 | 18 | -------------------------------------------------------------------------------- /springboot-shardingsphere-jdbc-sample/src/main/java/com/ipman/sharding/jdbc/springboot/SpringbootShardingsphereJdbcSampleApplication.java: -------------------------------------------------------------------------------- 1 | package com.ipman.sharding.jdbc.springboot; 2 | 3 | import com.ipman.sharding.jdbc.springboot.service.impl.DemoService; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.context.ApplicationContext; 7 | 8 | @SpringBootApplication 9 | public class SpringbootShardingsphereJdbcSampleApplication { 10 | 11 | public static void main(String[] args) { 12 | ApplicationContext context = SpringApplication.run(SpringbootShardingsphereJdbcSampleApplication.class, args); 13 | 14 | DemoService demoService = (DemoService) context.getBean("DemoService"); 15 | //测试读写分离 16 | demoService.testMasterSlave(); 17 | //测试读写分离事务 18 | demoService.testTransaction(); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /springboot-shardingsphere-jdbc-sample/src/main/java/com/ipman/sharding/jdbc/springboot/dao/DemoMapper.java: -------------------------------------------------------------------------------- 1 | package com.ipman.sharding.jdbc.springboot.dao; 2 | 3 | 4 | import com.ipman.sharding.jdbc.springboot.model.Demo; 5 | 6 | public interface DemoMapper { 7 | int deleteByPrimaryKey(Integer id); 8 | 9 | int insert(Demo record); 10 | 11 | int insertSelective(Demo record); 12 | 13 | Demo selectByPrimaryKey(Integer id); 14 | 15 | int updateByPrimaryKeySelective(Demo record); 16 | 17 | int updateByPrimaryKey(Demo record); 18 | } -------------------------------------------------------------------------------- /springboot-shardingsphere-jdbc-sample/src/main/java/com/ipman/sharding/jdbc/springboot/model/Demo.java: -------------------------------------------------------------------------------- 1 | package com.ipman.sharding.jdbc.springboot.model; 2 | 3 | public class Demo { 4 | private Integer id; 5 | 6 | private String name; 7 | 8 | public Integer getId() { 9 | return id; 10 | } 11 | 12 | public void setId(Integer id) { 13 | this.id = id; 14 | } 15 | 16 | public String getName() { 17 | return name; 18 | } 19 | 20 | public void setName(String name) { 21 | this.name = name == null ? null : name.trim(); 22 | } 23 | 24 | @Override 25 | public String toString() { 26 | return "Demo{" + 27 | "id=" + id + 28 | ", name='" + name + '\'' + 29 | '}'; 30 | } 31 | } -------------------------------------------------------------------------------- /springboot-shardingsphere-jdbc-sample/src/main/java/com/ipman/sharding/jdbc/springboot/service/IDemoService.java: -------------------------------------------------------------------------------- 1 | package com.ipman.sharding.jdbc.springboot.service; 2 | 3 | /** 4 | * Created by ipipman on 2020/12/2. 5 | * 6 | * @version V1.0 7 | * @Package com.ipman.mysql.shardingspherejdbc.service 8 | * @Description: (用一句话描述该文件做什么) 9 | * @date 2020/12/2 7:50 下午 10 | */ 11 | public interface IDemoService { 12 | 13 | //测试读写分离 14 | void testMasterSlave(); 15 | 16 | //测试主从事务 17 | void testTransaction(); 18 | } 19 | -------------------------------------------------------------------------------- /springboot-shardingsphere-jdbc-sample/src/test/java/com/ipman/sharding/jdbc/springboot/springbootshardingspherejdbcsample/SpringbootShardingsphereJdbcSampleApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.ipman.sharding.jdbc.springboot.springbootshardingspherejdbcsample; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringbootShardingsphereJdbcSampleApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springboot-source-code-analysis/(9)IoC思想.md: -------------------------------------------------------------------------------- 1 | ### IoC思想 2 | 3 | 4 | 5 | image-20210921195432177 6 | 7 | 8 | 9 | - 松耦合 10 | - 降低强耦合关系,对象与对象之间的依赖不用new,而是通过Spring容器@Autowired注入完成 11 | - 灵活性 12 | - 不需要初始化使用类的构造方法,而是通过Spring容器完成初始化工作 13 | - 可维护 14 | - 通过Spring xml或注解 的方式,可以清晰的了解类与类之间的依赖关系,提升可读性 15 | 16 | -------------------------------------------------------------------------------- /springboot-source-code-analysis/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springboot-source-code-analysis/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/ba1fe0b303008023f0d0afef7aa0ddea2aea5306/springboot-source-code-analysis/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /springboot-source-code-analysis/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.1/apache-maven-3.8.1-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /springboot-source-code-analysis/src/main/java/com/example/springboot/source/code/analysis/event/EventMulticaster.java: -------------------------------------------------------------------------------- 1 | package com.example.springboot.source.code.analysis.event; 2 | 3 | /** 4 | * Created by ipipman on 2021/8/3. 5 | * 6 | * @version V1.0 7 | * @Package com.example.springboot.source.code.analysis.event 8 | * @Description: (用一句话描述该文件做什么) 9 | * @date 2021/8/3 3:04 下午 10 | */ 11 | 12 | // 事件广播器 13 | public interface EventMulticaster { 14 | 15 | // 广播事件 16 | void multicastEvent(WeatherEvent event); 17 | 18 | // 添加监听器 19 | void addListener(WeatherListener listener); 20 | 21 | // 删除监听器 22 | void removeListener(WeatherListener listener); 23 | } 24 | -------------------------------------------------------------------------------- /springboot-source-code-analysis/src/main/java/com/example/springboot/source/code/analysis/event/RainEvent.java: -------------------------------------------------------------------------------- 1 | package com.example.springboot.source.code.analysis.event; 2 | 3 | /** 4 | * Created by ipipman on 2021/8/3. 5 | * 6 | * @version V1.0 7 | * @Package com.example.springboot.source.code.analysis.event 8 | * @Description: (用一句话描述该文件做什么) 9 | * @date 2021/8/3 2:52 下午 10 | */ 11 | 12 | // 下雨事件 13 | public class RainEvent extends WeatherEvent { 14 | 15 | @Override 16 | public String getWeather() { 17 | return "rain"; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /springboot-source-code-analysis/src/main/java/com/example/springboot/source/code/analysis/event/RainListener.java: -------------------------------------------------------------------------------- 1 | package com.example.springboot.source.code.analysis.event; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | /** 6 | * Created by ipipman on 2021/8/3. 7 | * 8 | * @version V1.0 9 | * @Package com.example.springboot.source.code.analysis.event 10 | * @Description: (用一句话描述该文件做什么) 11 | * @date 2021/8/3 3:00 下午 12 | */ 13 | 14 | 15 | // 下雨监听器 16 | @Component 17 | public class RainListener implements WeatherListener { 18 | 19 | @Override 20 | public void onWeatherEvent(WeatherEvent event) { 21 | if (event instanceof RainEvent) { 22 | System.out.println("rain event ..." + event.getWeather()); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /springboot-source-code-analysis/src/main/java/com/example/springboot/source/code/analysis/event/SnowEvent.java: -------------------------------------------------------------------------------- 1 | package com.example.springboot.source.code.analysis.event; 2 | 3 | /** 4 | * Created by ipipman on 2021/8/3. 5 | * 6 | * @version V1.0 7 | * @Package com.example.springboot.source.code.analysis.event 8 | * @Description: (用一句话描述该文件做什么) 9 | * @date 2021/8/3 2:51 下午 10 | */ 11 | 12 | // 下雪事件 13 | public class SnowEvent extends WeatherEvent { 14 | 15 | @Override 16 | public String getWeather() { 17 | return "snow"; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /springboot-source-code-analysis/src/main/java/com/example/springboot/source/code/analysis/event/SnowListener.java: -------------------------------------------------------------------------------- 1 | package com.example.springboot.source.code.analysis.event; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | /** 6 | * Created by ipipman on 2021/8/3. 7 | * 8 | * @version V1.0 9 | * @Package com.example.springboot.source.code.analysis.event 10 | * @Description: (用一句话描述该文件做什么) 11 | * @date 2021/8/3 3:02 下午 12 | */ 13 | 14 | // 下雪监听器 15 | @Component 16 | public class SnowListener implements WeatherListener { 17 | 18 | @Override 19 | public void onWeatherEvent(WeatherEvent event) { 20 | if (event instanceof SnowEvent) { 21 | System.out.println("snow event.." + event.getWeather()); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /springboot-source-code-analysis/src/main/java/com/example/springboot/source/code/analysis/event/Test.java: -------------------------------------------------------------------------------- 1 | package com.example.springboot.source.code.analysis.event; 2 | 3 | /** 4 | * Created by ipipman on 2021/8/3. 5 | * 6 | * @version V1.0 7 | * @Package com.example.springboot.source.code.analysis.event 8 | * @Description: (用一句话描述该文件做什么) 9 | * @date 2021/8/3 3:29 下午 10 | */ 11 | 12 | 13 | public class Test { 14 | 15 | public static void main(String[] args) { 16 | // 创建事件广播器 17 | WeatherEventMulticaster multicaster = new WeatherEventMulticaster(); 18 | 19 | // 添加事件监听器 20 | WeatherListener listener1 = new SnowListener(); 21 | WeatherListener listener2 = new RainListener(); 22 | multicaster.addListener(listener1); 23 | multicaster.addListener(listener2); 24 | 25 | // 广播事件 26 | WeatherEvent event1 = new RainEvent(); 27 | WeatherEvent event2 = new SnowEvent(); 28 | multicaster.multicastEvent(event1); 29 | multicaster.multicastEvent(event2); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /springboot-source-code-analysis/src/main/java/com/example/springboot/source/code/analysis/event/WeatherEvent.java: -------------------------------------------------------------------------------- 1 | package com.example.springboot.source.code.analysis.event; 2 | 3 | /** 4 | * Created by ipipman on 2021/8/3. 5 | * 6 | * @version V1.0 7 | * @Package com.example.springboot.source.code.analysis.event 8 | * @Description: (用一句话描述该文件做什么) 9 | * @date 2021/8/3 2:50 下午 10 | */ 11 | 12 | 13 | // 天气事件抽象类 14 | public abstract class WeatherEvent { 15 | 16 | // 获取当前天气的事件 17 | public abstract String getWeather(); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /springboot-source-code-analysis/src/main/java/com/example/springboot/source/code/analysis/event/WeatherEventMulticaster.java: -------------------------------------------------------------------------------- 1 | package com.example.springboot.source.code.analysis.event; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | /** 6 | * Created by ipipman on 2021/8/3. 7 | * 8 | * @version V1.0 9 | * @Package com.example.springboot.source.code.analysis.event 10 | * @Description: (用一句话描述该文件做什么) 11 | * @date 2021/8/3 3:27 下午 12 | */ 13 | 14 | // 天气事件广播器 15 | @Component 16 | public class WeatherEventMulticaster extends AbstractEventMulticaster { 17 | 18 | @Override 19 | public void doStart() { 20 | System.out.println("multicaster event begin ..."); 21 | } 22 | 23 | @Override 24 | public void doEnd() { 25 | System.out.println("multicaster evnet end ...."); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /springboot-source-code-analysis/src/main/java/com/example/springboot/source/code/analysis/event/WeatherListener.java: -------------------------------------------------------------------------------- 1 | package com.example.springboot.source.code.analysis.event; 2 | 3 | /** 4 | * Created by ipipman on 2021/8/3. 5 | * 6 | * @version V1.0 7 | * @Package com.example.springboot.source.code.analysis.event 8 | * @Description: (用一句话描述该文件做什么) 9 | * @date 2021/8/3 2:58 下午 10 | */ 11 | 12 | // 天气监听器 13 | public interface WeatherListener { 14 | 15 | // 监听天气事件 16 | void onWeatherEvent(WeatherEvent event); 17 | } 18 | -------------------------------------------------------------------------------- /springboot-source-code-analysis/src/main/java/com/example/springboot/source/code/analysis/event/WeatherRunListener.java: -------------------------------------------------------------------------------- 1 | package com.example.springboot.source.code.analysis.event; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Component; 5 | 6 | /** 7 | * Created by ipipman on 2021/8/9. 8 | * 9 | * @version V1.0 10 | * @Package com.example.springboot.source.code.analysis.event 11 | * @Description: (用一句话描述该文件做什么) 12 | * @date 2021/8/9 3:46 下午 13 | */ 14 | 15 | @Component 16 | public class WeatherRunListener { 17 | 18 | @Autowired 19 | private WeatherEventMulticaster weatherEventMulticaster; 20 | 21 | // 下雪事件 22 | public void snow(){ 23 | weatherEventMulticaster.multicastEvent(new SnowEvent()); 24 | } 25 | 26 | // 下雨事件 27 | public void rain(){ 28 | weatherEventMulticaster.multicastEvent(new RainEvent()); 29 | } 30 | 31 | // 天津监听器 32 | public void addListener(WeatherListener listener){ 33 | weatherEventMulticaster.addListener(listener); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /springboot-source-code-analysis/src/main/java/com/example/springboot/source/code/analysis/ioc/ann/MyBeanConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.example.springboot.source.code.analysis.ioc.ann; 2 | 3 | import com.example.springboot.source.code.analysis.ioc.pojo.Animal; 4 | import com.example.springboot.source.code.analysis.ioc.pojo.Dog; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | 8 | /** 9 | * Created by ipipman on 2021/10/16. 10 | * 11 | * @version V1.0 12 | * @Package com.example.springboot.source.code.analysis.ioc.ann 13 | * @Description: (通过 @Configuration注解 注入一个Bean) 14 | * @date 2021/10/16 12:04 下午 15 | */ 16 | @Configuration 17 | public class MyBeanConfiguration { 18 | 19 | /** 20 | * 通过 @Configuration注解 注入一个Bean 21 | */ 22 | @Bean("dog") 23 | public Animal getDog() { 24 | return new Dog(); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /springboot-source-code-analysis/src/main/java/com/example/springboot/source/code/analysis/ioc/pojo/Animal.java: -------------------------------------------------------------------------------- 1 | package com.example.springboot.source.code.analysis.ioc.pojo; 2 | 3 | /** 4 | * Created by ipipman on 2021/10/16. 5 | * 6 | * @version V1.0 7 | * @Package com.example.springboot.source.code.analysis.ioc.pojo 8 | * @Description: (用一句话描述该文件做什么) 9 | * @date 2021/10/16 12:06 下午 10 | */ 11 | public abstract class Animal { 12 | 13 | public abstract String getName(); 14 | } 15 | -------------------------------------------------------------------------------- /springboot-source-code-analysis/src/main/java/com/example/springboot/source/code/analysis/ioc/pojo/Bird.java: -------------------------------------------------------------------------------- 1 | package com.example.springboot.source.code.analysis.ioc.pojo; 2 | 3 | /** 4 | * Created by ipipman on 2021/10/16. 5 | * 6 | * @version V1.0 7 | * @Package com.example.springboot.source.code.analysis.ioc.pojo 8 | * @Description: (用一句话描述该文件做什么) 9 | * @date 2021/10/16 3:35 下午 10 | */ 11 | public class Bird extends Animal{ 12 | @Override 13 | public String getName() { 14 | return "Bird"; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /springboot-source-code-analysis/src/main/java/com/example/springboot/source/code/analysis/ioc/pojo/Cat.java: -------------------------------------------------------------------------------- 1 | package com.example.springboot.source.code.analysis.ioc.pojo; 2 | 3 | /** 4 | * Created by ipipman on 2021/10/16. 5 | * 6 | * @version V1.0 7 | * @Package com.example.springboot.source.code.analysis.ioc.pojo 8 | * @Description: (用一句话描述该文件做什么) 9 | * @date 2021/10/16 12:09 下午 10 | */ 11 | public class Cat extends Animal{ 12 | @Override 13 | public String getName() { 14 | return "Cat"; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /springboot-source-code-analysis/src/main/java/com/example/springboot/source/code/analysis/ioc/pojo/DemoBean.java: -------------------------------------------------------------------------------- 1 | package com.example.springboot.source.code.analysis.ioc.pojo; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | /** 6 | * Created by ipipman on 2021/10/17. 7 | * 8 | * @version V1.0 9 | * @Package com.example.springboot.source.code.analysis.ioc.pojo 10 | * @Description: (用一句话描述该文件做什么) 11 | * @date 2021/10/17 6:53 下午 12 | */ 13 | @Component 14 | public class DemoBean { 15 | 16 | private String name; 17 | 18 | public String getName() { 19 | return name; 20 | } 21 | 22 | public void setName(String name) { 23 | this.name = name; 24 | } 25 | 26 | 27 | } 28 | -------------------------------------------------------------------------------- /springboot-source-code-analysis/src/main/java/com/example/springboot/source/code/analysis/ioc/pojo/Dog.java: -------------------------------------------------------------------------------- 1 | package com.example.springboot.source.code.analysis.ioc.pojo; 2 | 3 | /** 4 | * Created by ipipman on 2021/10/16. 5 | * 6 | * @version V1.0 7 | * @Package com.example.springboot.source.code.analysis.ioc.pojo 8 | * @Description: (用一句话描述该文件做什么) 9 | * @date 2021/10/16 12:08 下午 10 | */ 11 | public class Dog extends Animal{ 12 | @Override 13 | public String getName() { 14 | return "Dog"; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /springboot-source-code-analysis/src/main/java/com/example/springboot/source/code/analysis/ioc/pojo/Monkey.java: -------------------------------------------------------------------------------- 1 | package com.example.springboot.source.code.analysis.ioc.pojo; 2 | 3 | /** 4 | * Created by ipipman on 2021/10/16. 5 | * 6 | * @version V1.0 7 | * @Package com.example.springboot.source.code.analysis.ioc.pojo 8 | * @Description: (用一句话描述该文件做什么) 9 | * @date 2021/10/16 12:25 下午 10 | */ 11 | public class Monkey extends Animal { 12 | @Override 13 | public String getName() { 14 | return "Monkey"; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /springboot-source-code-analysis/src/main/java/com/example/springboot/source/code/analysis/listener/FirstListener.java: -------------------------------------------------------------------------------- 1 | package com.example.springboot.source.code.analysis.listener; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.boot.context.event.ApplicationStartedEvent; 6 | import org.springframework.context.ApplicationListener; 7 | import org.springframework.core.annotation.Order; 8 | 9 | /** 10 | * Created by ipipman on 2021/9/21. 11 | * 12 | * @version V1.0 13 | * @Package com.example.springboot.source.code.analysis.listener 14 | * @Description: (用一句话描述该文件做什么) 15 | * @date 2021/9/21 4:12 下午 16 | */ 17 | 18 | @Order(1) 19 | public class FirstListener implements ApplicationListener { 20 | 21 | private final static Logger logger = LoggerFactory.getLogger(FirstListener.class); 22 | 23 | @Override 24 | public void onApplicationEvent(ApplicationStartedEvent event) { 25 | logger.info("设置框架事件监听器【ApplicationListener】成功 : run firstListener"); 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /springboot-source-code-analysis/src/main/java/com/example/springboot/source/code/analysis/listener/SecondListener.java: -------------------------------------------------------------------------------- 1 | package com.example.springboot.source.code.analysis.listener; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.boot.context.event.ApplicationStartedEvent; 6 | import org.springframework.context.ApplicationListener; 7 | import org.springframework.core.annotation.Order; 8 | 9 | /** 10 | * Created by ipipman on 2021/9/21. 11 | * 12 | * @version V1.0 13 | * @Package com.example.springboot.source.code.analysis.listener 14 | * @Description: (用一句话描述该文件做什么) 15 | * @date 2021/9/21 4:19 下午 16 | */ 17 | @Order(2) 18 | public class SecondListener implements ApplicationListener { 19 | 20 | private static final Logger logger = LoggerFactory.getLogger(SecondListener.class); 21 | 22 | @Override 23 | public void onApplicationEvent(ApplicationStartedEvent event) { 24 | logger.info("设置框架事件监听器【ApplicationListener】成功 : run secondListener"); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /springboot-source-code-analysis/src/main/java/com/example/springboot/source/code/analysis/listener/ThirdListener.java: -------------------------------------------------------------------------------- 1 | package com.example.springboot.source.code.analysis.listener; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.boot.context.event.ApplicationStartedEvent; 6 | import org.springframework.context.ApplicationListener; 7 | import org.springframework.core.annotation.Order; 8 | 9 | 10 | /** 11 | * Created by ipipman on 2021/9/21. 12 | * 13 | * @version V1.0 14 | * @Package com.example.springboot.source.code.analysis.listener 15 | * @Description: (用一句话描述该文件做什么) 16 | * @date 2021/9/21 4:21 下午 17 | */ 18 | @Order(3) 19 | public class ThirdListener implements ApplicationListener { 20 | 21 | private final static Logger logger = LoggerFactory.getLogger(ThirdListener.class); 22 | 23 | @Override 24 | public void onApplicationEvent(ApplicationStartedEvent event) { 25 | logger.info("设置框架事件监听器【ApplicationListener】成功 : run thirdListener"); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /springboot-source-code-analysis/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | # 通过系统初始化器,设置自定义环境属性 2 | org.springframework.context.ApplicationContextInitializer=\ 3 | com.example.springboot.source.code.analysis.initializer.FirstInitializer 4 | 5 | 6 | # 通过系统事件监听器,设置自定义事件监听器 7 | org.springframework.context.ApplicationListener=\ 8 | com.example.springboot.source.code.analysis.listener.FirstListener -------------------------------------------------------------------------------- /springboot-source-code-analysis/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | # 通过系统初始化器,设置环境属性 2 | context.initializer.classes=\ 3 | com.example.springboot.source.code.analysis.initializer.ThirdInitializer 4 | 5 | # 通过系统事件监听器,监听事件 6 | context.listener.classes=\ 7 | com.example.springboot.source.code.analysis.listener.ThirdListener,\ 8 | com.example.springboot.source.code.analysis.listener.FourthListener 9 | 10 | 11 | # 通过ConfigurableEnviroment.requiredProperty()方法设置的必填属性 12 | app.enviroment=ipman -------------------------------------------------------------------------------- /springboot-swagger-sample/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springboot-swagger-sample/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/ba1fe0b303008023f0d0afef7aa0ddea2aea5306/springboot-swagger-sample/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /springboot-swagger-sample/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.2/apache-maven-3.8.2-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /springboot-swagger-sample/src/main/java/com/ipman/swagger/sample/SpringbootSwaggerSampleApplication.java: -------------------------------------------------------------------------------- 1 | package com.ipman.swagger.sample; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringbootSwaggerSampleApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringbootSwaggerSampleApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springboot-swagger-sample/src/main/java/com/ipman/swagger/sample/entity/User.java: -------------------------------------------------------------------------------- 1 | package com.ipman.swagger.sample.entity; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.*; 6 | 7 | /** 8 | * Created by ipipman on 2021/9/22. 9 | * 10 | * @version V1.0 11 | * @Package com.ipman.swagger.sample.entity 12 | * @Description: (用一句话描述该文件做什么) 13 | * @date 2021/9/22 6:37 下午 14 | */ 15 | @Getter 16 | @Setter 17 | @ToString 18 | @ApiModel(value = "用户实体类", description = "用户信息描述类") 19 | public class User { 20 | 21 | @ApiModelProperty(value = "用户id") 22 | private Integer id; 23 | 24 | @ApiModelProperty(value = "用户名") 25 | private String username; 26 | 27 | @ApiModelProperty(value = "用户密码") 28 | private String password; 29 | } -------------------------------------------------------------------------------- /springboot-swagger-sample/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /springboot-swagger-sample/src/test/java/com/ipman/swagger/sample/SpringbootSwaggerSampleApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.ipman.swagger.sample; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringbootSwaggerSampleApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springboot-transactional-sample/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springboot-transactional-sample/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/ba1fe0b303008023f0d0afef7aa0ddea2aea5306/springboot-transactional-sample/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /springboot-transactional-sample/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /springboot-transactional-sample/src/main/java/com/ipman/springboot/transactional/sample/SpringbootTransactionalSampleApplication.java: -------------------------------------------------------------------------------- 1 | package com.ipman.springboot.transactional.sample; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringbootTransactionalSampleApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringbootTransactionalSampleApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /springboot-transactional-sample/src/main/java/com/ipman/springboot/transactional/sample/common/domain/model/User1.java: -------------------------------------------------------------------------------- 1 | package com.ipman.springboot.transactional.sample.common.domain.model; 2 | 3 | public class User1 { 4 | private Integer id; 5 | 6 | private String name; 7 | 8 | public Integer getId() { 9 | return id; 10 | } 11 | 12 | public void setId(Integer id) { 13 | this.id = id; 14 | } 15 | 16 | public String getName() { 17 | return name; 18 | } 19 | 20 | public void setName(String name) { 21 | this.name = name == null ? null : name.trim(); 22 | } 23 | } -------------------------------------------------------------------------------- /springboot-transactional-sample/src/main/java/com/ipman/springboot/transactional/sample/common/domain/model/User2.java: -------------------------------------------------------------------------------- 1 | package com.ipman.springboot.transactional.sample.common.domain.model; 2 | 3 | public class User2 { 4 | private Integer id; 5 | 6 | private String name; 7 | 8 | public Integer getId() { 9 | return id; 10 | } 11 | 12 | public void setId(Integer id) { 13 | this.id = id; 14 | } 15 | 16 | public String getName() { 17 | return name; 18 | } 19 | 20 | public void setName(String name) { 21 | this.name = name == null ? null : name.trim(); 22 | } 23 | } -------------------------------------------------------------------------------- /springboot-transactional-sample/src/main/java/com/ipman/springboot/transactional/sample/core/dao/User1Mapper.java: -------------------------------------------------------------------------------- 1 | package com.ipman.springboot.transactional.sample.core.dao; 2 | 3 | import com.ipman.springboot.transactional.sample.common.domain.model.User1; 4 | 5 | public interface User1Mapper { 6 | int deleteByPrimaryKey(Integer id); 7 | 8 | int insert(User1 record); 9 | 10 | int insertSelective(User1 record); 11 | 12 | User1 selectByPrimaryKey(Integer id); 13 | 14 | int updateByPrimaryKeySelective(User1 record); 15 | 16 | int updateByPrimaryKey(User1 record); 17 | } -------------------------------------------------------------------------------- /springboot-transactional-sample/src/main/java/com/ipman/springboot/transactional/sample/core/dao/User2Mapper.java: -------------------------------------------------------------------------------- 1 | package com.ipman.springboot.transactional.sample.core.dao; 2 | 3 | import com.ipman.springboot.transactional.sample.common.domain.model.User2; 4 | 5 | public interface User2Mapper { 6 | int deleteByPrimaryKey(Integer id); 7 | 8 | int insert(User2 record); 9 | 10 | int insertSelective(User2 record); 11 | 12 | User2 selectByPrimaryKey(Integer id); 13 | 14 | int updateByPrimaryKeySelective(User2 record); 15 | 16 | int updateByPrimaryKey(User2 record); 17 | } -------------------------------------------------------------------------------- /springboot-transactional-sample/src/main/java/com/ipman/springboot/transactional/sample/core/service/User1Service.java: -------------------------------------------------------------------------------- 1 | package com.ipman.springboot.transactional.sample.core.service; 2 | 3 | import com.ipman.springboot.transactional.sample.common.domain.model.User1; 4 | 5 | /** 6 | * Created by ipipman on 2021/4/2. 7 | * 8 | * @version V1.0 9 | * @Package com.ipman.springboot.transactional.sample.core.service 10 | * @Description: (用一句话描述该文件做什么) 11 | * @date 2021/4/2 11:49 上午 12 | */ 13 | public interface User1Service { 14 | 15 | /** 16 | * Propagation.REQUIRED 17 | * 如果当前没有事务,就创建一个事务 18 | * 如果已经存在一个事务中,加入这个事务中 19 | * 20 | */ 21 | void addRequired(User1 user1); 22 | } 23 | -------------------------------------------------------------------------------- /springboot-transactional-sample/src/main/java/com/ipman/springboot/transactional/sample/core/service/User2Service.java: -------------------------------------------------------------------------------- 1 | package com.ipman.springboot.transactional.sample.core.service; 2 | 3 | import com.ipman.springboot.transactional.sample.common.domain.model.User2; 4 | 5 | /** 6 | * Created by ipipman on 2021/4/2. 7 | * 8 | * @version V1.0 9 | * @Package com.ipman.springboot.transactional.sample.core.service 10 | * @Description: (用一句话描述该文件做什么) 11 | * @date 2021/4/2 11:50 上午 12 | */ 13 | public interface User2Service { 14 | 15 | 16 | /** 17 | * Propagation.REQUIRED 18 | * 如果当前没有事务,就创建一个事务 19 | * 如果已经存在一个事务中,加入这个事务中 20 | */ 21 | void addRequired(User2 user2); 22 | 23 | /** 24 | * Propagation.REQUIRED 25 | * 如果当前没有事务,就创建一个事务 26 | * 如果已经存在一个事务中,加入这个事务中 27 | */ 28 | void addRequiredException(User2 user2); 29 | } 30 | -------------------------------------------------------------------------------- /springboot-transactional-sample/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | #datasource 2 | datasource.type= com.alibaba.druid.pool.DruidDataSource 3 | datasource.driver-class-name= com.mysql.jdbc.Driver 4 | datasource.url= jdbc:mysql://127.0.0.1:3306/stx 5 | datasource.username= root 6 | datasource.initialSize= 5 7 | datasource.minIdle= 5 8 | datasource.maxActive= 30 9 | datasource.maxWait= 60000 10 | datasource.timeBetweenEvictionRunsMillis= 60000 11 | datasource.minEvictableIdleTimeMillis= 30000 12 | datasource.validationQuery= select 'x' 13 | datasource.testWhileIdle= true 14 | datasource.testOnBorrow= true 15 | datasource.testOnReturn= false 16 | datasource.poolPreparedStatements= false 17 | datasource.maxPoolPreparedStatementPerConnectionSize= 20 18 | -------------------------------------------------------------------------------- /springcloud-consul-config-sample/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springcloud-consul-config-sample/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/ba1fe0b303008023f0d0afef7aa0ddea2aea5306/springcloud-consul-config-sample/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /springcloud-consul-config-sample/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /springcloud-consul-config-sample/src/main/java/com/ipman/springcloud/consul/config/center/sample/SpringcloudConsulConfigSampleApplication.java: -------------------------------------------------------------------------------- 1 | package com.ipman.springcloud.consul.config.center.sample; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 6 | 7 | @SpringBootApplication 8 | @EnableDiscoveryClient //让注册中心进行服务发现,将服务注册到服务组件上 9 | public class SpringcloudConsulConfigSampleApplication { 10 | 11 | // hello 12 | public static void main(String[] args) { 13 | SpringApplication.run(SpringcloudConsulConfigSampleApplication.class, args); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /springcloud-consul-config-sample/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.profiles.active=dev 2 | spring.application.name=consul-config 3 | server.port=8081 -------------------------------------------------------------------------------- /springcloud-consul-config-sample/src/main/resources/bootstrap.properties: -------------------------------------------------------------------------------- 1 | #配置consul地址 2 | spring.cloud.consul.host=10.211.55.8 3 | #配置consul端口 4 | spring.cloud.consul.port=8500 5 | #指定服务的 consul service name 6 | spring.cloud.consul.discovery.serviceName=consul-config 7 | #启动consul配置中心 8 | spring.cloud.consul.config.enabled=true 9 | #配置基本文件格式 10 | spring.cloud.consul.config.format=yaml 11 | #配置基本文件,默认值config 12 | spring.cloud.consul.config.prefix=config 13 | #profileSeparator设置用于使用配置文件在属性源中分隔配置文件名称的分隔符的值 14 | spring.cloud.consul.config.profile-separator=: 15 | #表示 consul 上面的 KEY 值(或者说文件的名字),默认是 data 16 | spring.cloud.consul.config.data-key=data 17 | # 健康检查url 18 | spring.cloud.consul.discovery.health-check-url=http://10.211.55.2:8081/actuator/health 19 | # 健康检查的频率, 默认 10 秒 20 | spring.cloud.consul.discovery.health-check-interval=10s 21 | # 健康检查失败多长时间后,取消注册 22 | spring.cloud.consul.discovery.health-check-critical-timeout=5s -------------------------------------------------------------------------------- /springcloud-consul-register-sample/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springcloud-consul-register-sample/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/ba1fe0b303008023f0d0afef7aa0ddea2aea5306/springcloud-consul-register-sample/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /springcloud-consul-register-sample/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /springcloud-consul-register-sample/src/main/java/com/ipman/springcloud/consul/register/sample/SpringcloudConsulRegisterSampleApplication.java: -------------------------------------------------------------------------------- 1 | package com.ipman.springcloud.consul.register.sample; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 6 | 7 | @SpringBootApplication 8 | @EnableDiscoveryClient //让注册中心进行服务发现,将服务注册到服务组件上 9 | public class SpringcloudConsulRegisterSampleApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(SpringcloudConsulRegisterSampleApplication.class, args); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /springcloud-consul-register-sample/src/main/java/com/ipman/springcloud/consul/register/sample/api/DemoController.java: -------------------------------------------------------------------------------- 1 | package com.ipman.springcloud.consul.register.sample.api; 2 | 3 | import com.ipman.springcloud.consul.register.sample.service.DemoService; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.web.bind.annotation.GetMapping; 6 | import org.springframework.web.bind.annotation.RequestMapping; 7 | import org.springframework.web.bind.annotation.RestController; 8 | 9 | /** 10 | * Created by ipipman on 2020/12/28. 11 | * 12 | * @version V1.0 13 | * @Package com.ipman.springcloud.consul.register.sample.api 14 | * @Description: (用一句话描述该文件做什么) 15 | * @date 2020/12/28 7:05 下午 16 | */ 17 | @RestController 18 | @RequestMapping("/demo") 19 | public class DemoController { 20 | 21 | @Autowired 22 | DemoService demoService; 23 | 24 | @GetMapping("hello") 25 | public Object echo(String name){ 26 | return demoService.sayHello(name); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /springcloud-consul-register-sample/src/main/java/com/ipman/springcloud/consul/register/sample/service/DemoService.java: -------------------------------------------------------------------------------- 1 | package com.ipman.springcloud.consul.register.sample.service; 2 | 3 | /** 4 | * Created by ipipman on 2020/12/28. 5 | * 6 | * @version V1.0 7 | * @Package com.ipman.springcloud.consul.register.sample.service 8 | * @Description: (用一句话描述该文件做什么) 9 | * @date 2020/12/28 6:56 下午 10 | */ 11 | public interface DemoService { 12 | 13 | String sayHello(String name); 14 | } 15 | -------------------------------------------------------------------------------- /springcloud-consul-register-sample/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.profiles.active=dev 2 | spring.application.name=consul-provider-service 3 | server.port=8081 -------------------------------------------------------------------------------- /springcloud-consul-register-sample/src/main/resources/bootstrap.properties: -------------------------------------------------------------------------------- 1 | #配置consul地址 2 | spring.cloud.consul.host=10.211.55.8 3 | #配置consul端口 4 | spring.cloud.consul.port=8500 5 | #指定服务的 consul service name 6 | spring.cloud.consul.discovery.serviceName=consul-provider-service 7 | 8 | # 健康检查url 9 | spring.cloud.consul.discovery.health-check-url=http://10.211.55.2:8081/actuator/health 10 | # 健康检查的频率, 默认 10 秒 11 | spring.cloud.consul.discovery.health-check-interval=10s 12 | # 健康检查失败多长时间后,取消注册 13 | spring.cloud.consul.discovery.health-check-critical-timeout=5s -------------------------------------------------------------------------------- /springcloud-consul-ribbon-sample/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springcloud-consul-ribbon-sample/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/ba1fe0b303008023f0d0afef7aa0ddea2aea5306/springcloud-consul-ribbon-sample/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /springcloud-consul-ribbon-sample/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /springcloud-consul-ribbon-sample/src/main/java/com/ipman/springcloud/consul/ribbon/sample/SpringcloudConsulRibbonSampleApplication.java: -------------------------------------------------------------------------------- 1 | package com.ipman.springcloud.consul.ribbon.sample; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 6 | 7 | @SpringBootApplication 8 | @EnableDiscoveryClient 9 | public class SpringcloudConsulRibbonSampleApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(SpringcloudConsulRibbonSampleApplication.class, args); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /springcloud-consul-ribbon-sample/src/main/java/com/ipman/springcloud/consul/ribbon/sample/config/XXProviderRibbonConfig.java: -------------------------------------------------------------------------------- 1 | package com.ipman.springcloud.consul.ribbon.sample.config; 2 | 3 | import com.netflix.loadbalancer.BestAvailableRule; 4 | import com.netflix.loadbalancer.IRule; 5 | import org.springframework.cloud.netflix.ribbon.RibbonClient; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | 9 | /** 10 | * Created by ipipman on 2020/12/29. 11 | * 12 | * @version V1.0 13 | * @Package com.ipman.springcloud.consul.ribbon.sample.config 14 | * @Description: (用一句话描述该文件做什么) 15 | * @date 2020/12/29 10:54 下午 16 | */ 17 | //Ribbon更细力度的配置,可以针对不同服务设置Load Balance策略 18 | @Configuration 19 | public class XXProviderRibbonConfig { 20 | 21 | //BestAvailableRule策略用来选取最少并发量请求的服务器 22 | @Bean 23 | public IRule ribbonRule(){ 24 | return new BestAvailableRule(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /springcloud-nacos-config-sample/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springcloud-nacos-config-sample/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/ba1fe0b303008023f0d0afef7aa0ddea2aea5306/springcloud-nacos-config-sample/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /springcloud-nacos-config-sample/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /springcloud-nacos-config-sample/src/main/java/com/ipman/springcloud/nacos/config/sample/SpringcloudNacosConfigSampleApplication.java: -------------------------------------------------------------------------------- 1 | package com.ipman.springcloud.nacos.config.sample; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 6 | 7 | @SpringBootApplication 8 | @EnableDiscoveryClient //开启后向Nocas注册中心注册当前实例 9 | public class SpringcloudNacosConfigSampleApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(SpringcloudNacosConfigSampleApplication.class, args); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /springcloud-nacos-config-sample/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.profiles.active=dev 2 | spring.application.name=nacos-config 3 | server.port=8081 -------------------------------------------------------------------------------- /springcloud-nacos-config-sample/src/main/resources/bootstrap.properties: -------------------------------------------------------------------------------- 1 | #Nacos注册中心地址 2 | spring.cloud.nacos.discovery.server-addr=10.211.55.6:8848 3 | #Nacos配置中心地址 4 | spring.cloud.nacos.config.server-addr=10.211.55.6:8848 5 | #Nacos配置格式的配置 6 | spring.cloud.nacos.config.file-extension=yaml 7 | #如果不想使用 Nacos 进行配置管理,设置为 false 即可 8 | spring.cloud.nacos.config.enabled=true 9 | 10 | #多配置加载(相同配置时,后者会覆盖前者) 11 | #配置来配置多个DataId 的配置。 12 | spring.cloud.nacos.config.extension-configs[0].data-id=nacos.cfg.test.yaml 13 | #配置来指定dataId所在的组,不明确指定的话使用默认的DEFAULT_GROUP 14 | spring.cloud.nacos.config.extension-configs[0].group=DEFAULT_GROUP 15 | #配置来控制该dataId属性变更时,是否动态刷新加载,默认如果不在DEFAULT_GROUP,自动刷新是关闭的,可以通过置为true来手动开启。 16 | spring.cloud.nacos.config.extension-configs[0].refresh=true -------------------------------------------------------------------------------- /springcloud-nacos-register-sample/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springcloud-nacos-register-sample/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/ba1fe0b303008023f0d0afef7aa0ddea2aea5306/springcloud-nacos-register-sample/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /springcloud-nacos-register-sample/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /springcloud-nacos-register-sample/src/main/java/com/ipman/spirngcloud/nacos/register/sample/SpringcloudNacosRegisterSampleApplication.java: -------------------------------------------------------------------------------- 1 | package com.ipman.spirngcloud.nacos.register.sample; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 6 | 7 | @SpringBootApplication 8 | @EnableDiscoveryClient 9 | public class SpringcloudNacosRegisterSampleApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(SpringcloudNacosRegisterSampleApplication.class, args); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /springcloud-nacos-register-sample/src/main/java/com/ipman/spirngcloud/nacos/register/sample/api/DemoController.java: -------------------------------------------------------------------------------- 1 | package com.ipman.spirngcloud.nacos.register.sample.api; 2 | 3 | import com.ipman.spirngcloud.nacos.register.sample.service.DemoService; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.web.bind.annotation.GetMapping; 6 | import org.springframework.web.bind.annotation.RequestMapping; 7 | import org.springframework.web.bind.annotation.RestController; 8 | 9 | /** 10 | * Created by ipipman on 2020/12/30. 11 | * 12 | * @version V1.0 13 | * @Package com.ipman.spirngcloud.nacos.register.sample.api 14 | * @Description: (用一句话描述该文件做什么) 15 | * @date 2020/12/30 3:14 下午 16 | */ 17 | @RestController 18 | @RequestMapping("/demo") 19 | public class DemoController { 20 | 21 | @Autowired 22 | DemoService demoService; 23 | 24 | @GetMapping("hello") 25 | public Object echo(String name){ 26 | return demoService.sayHello(name); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /springcloud-nacos-register-sample/src/main/java/com/ipman/spirngcloud/nacos/register/sample/service/DemoService.java: -------------------------------------------------------------------------------- 1 | package com.ipman.spirngcloud.nacos.register.sample.service; 2 | 3 | /** 4 | * Created by ipipman on 2020/12/30. 5 | * 6 | * @version V1.0 7 | * @Package com.ipman.spirngcloud.nacos.register.sample.service 8 | * @Description: (用一句话描述该文件做什么) 9 | * @date 2020/12/30 3:13 下午 10 | */ 11 | public interface DemoService { 12 | 13 | String sayHello(String name); 14 | } 15 | -------------------------------------------------------------------------------- /springcloud-nacos-register-sample/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.profiles.active=dev 2 | spring.application.name=nacos-provider-service 3 | server.port=8081 -------------------------------------------------------------------------------- /springcloud-nacos-register-sample/src/main/resources/bootstrap.properties: -------------------------------------------------------------------------------- 1 | #Nacos注册中心地址 2 | spring.cloud.nacos.discovery.server-addr=10.211.55.6:8848 3 | #命名当前服务名称 4 | spring.cloud.nacos.discovery.service=${spring.application.name} 5 | spring.cloud.nacos.discovery.enabled=true -------------------------------------------------------------------------------- /springcloud-nacos-ribbon-sample/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /springcloud-nacos-ribbon-sample/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/ba1fe0b303008023f0d0afef7aa0ddea2aea5306/springcloud-nacos-ribbon-sample/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /springcloud-nacos-ribbon-sample/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /springcloud-nacos-ribbon-sample/src/main/java/com/ipman/springcloud/nacos/ribbon/sample/SpringcloudNacosRibbonSampleApplication.java: -------------------------------------------------------------------------------- 1 | package com.ipman.springcloud.nacos.ribbon.sample; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 6 | 7 | @SpringBootApplication 8 | @EnableDiscoveryClient 9 | public class SpringcloudNacosRibbonSampleApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(SpringcloudNacosRibbonSampleApplication.class, args); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /springcloud-nacos-ribbon-sample/src/main/java/com/ipman/springcloud/nacos/ribbon/sample/config/XXProviderRibbonConfig.java: -------------------------------------------------------------------------------- 1 | package com.ipman.springcloud.nacos.ribbon.sample.config; 2 | 3 | import com.netflix.loadbalancer.BestAvailableRule; 4 | import com.netflix.loadbalancer.IRule; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | 8 | /** 9 | * Created by ipipman on 2020/12/30. 10 | * 11 | * @version V1.0 12 | * @Package com.ipman.springcloud.nacos.ribbon.sample.config 13 | * @Description: (用一句话描述该文件做什么) 14 | * @date 2020/12/30 3:49 下午 15 | */ 16 | //Ribbon更细力度的配置,可以针对不同服务设置Load Balance策略 17 | @Configuration 18 | public class XXProviderRibbonConfig { 19 | 20 | //BestAvailableRule策略用来选取最少并发量请求的服务器 21 | @Bean 22 | public IRule ribbonRule(){ 23 | return new BestAvailableRule(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /springcloud-nacos-ribbon-sample/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=8308 2 | spring.application.name=nacos-ribbon-service 3 | 4 | #Nacos注册中心地址 5 | spring.cloud.nacos.discovery.server-addr=10.211.55.6:8848 6 | #命名当前服务名称 7 | spring.cloud.nacos.discovery.service=${spring.application.name} 8 | spring.cloud.nacos.discovery.enabled=true 9 | 10 | #需要启动provider服务:https://github.com/ipipman/JavaSpringBootSamples/tree/master/springcloud-nacos-register-sample 11 | service.url.nacos.provider.service=http://nacos-provider-service 12 | 13 | #开启Ribbon的饥饿加载模式 14 | ribbon.eager-load.enabled=true 15 | #指定需要饥饿加载的服务名 16 | ribbon.eager-load.clients=nacos-provider-service 17 | #Ribbon的超时 18 | ribbon.ConnectTimeout=3000 19 | ribbon.ReadTimeout=60000 20 | #对第一次请求的服务的重试次数 21 | ribbon.MaxAutoRetries=1 22 | #要重试的下一个服务的最大数量(不包括第一个服务) 23 | ribbon.MaxAutoRetriesNextServer=1 24 | #无论是请求超时或者socket read timeout都进行重试 25 | ribbon.OkToRetryOnAllOperations=true 26 | #默认随机策略 27 | ribbon.NFLoadBalancerRuleClassName=com.netflix.loadbalancer.RandomRule --------------------------------------------------------------------------------