├── .gitignore ├── Chapter1 ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── didispace │ │ │ ├── Chapter1Application.java │ │ │ └── web │ │ │ └── HelloController.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── didispace │ └── Chapter1ApplicationTests.java ├── Chapter2-1-1 ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── didispace │ │ │ ├── Application.java │ │ │ ├── service │ │ │ └── BlogProperties.java │ │ │ └── web │ │ │ └── HelloController.java │ └── resources │ │ ├── application-dev.properties │ │ ├── application-prod.properties │ │ ├── application-test.properties │ │ └── application.properties │ └── test │ └── java │ └── com │ └── didispace │ └── ApplicationTests.java ├── Chapter2-1-2 ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── didispace │ │ ├── Application.java │ │ ├── ApplicationEnvironmentPreparedEventListener.java │ │ ├── ApplicationFailedEventListener.java │ │ ├── ApplicationPreparedEventListener.java │ │ ├── ApplicationReadyEventListener.java │ │ ├── ApplicationStartedEventListener.java │ │ └── ApplicationStartingEventListener.java │ └── resources │ ├── META-INF │ └── spring.factories │ └── application.properties ├── Chapter2-2-1 ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── didispace │ │ ├── Application.java │ │ ├── FooProperties.java │ │ └── PostInfo.java │ └── resources │ └── application.properties ├── Chapter3-1-1 ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── didispace │ │ │ ├── Application.java │ │ │ ├── domain │ │ │ └── User.java │ │ │ └── web │ │ │ ├── HelloController.java │ │ │ └── UserController.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── didispace │ └── ApplicationTests.java ├── Chapter3-1-6 ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── didispace │ │ │ ├── Application.java │ │ │ ├── dto │ │ │ └── ErrorInfo.java │ │ │ ├── exception │ │ │ ├── GlobalExceptionHandler.java │ │ │ └── MyException.java │ │ │ └── web │ │ │ └── HelloController.java │ └── resources │ │ ├── application.properties │ │ └── templates │ │ ├── error.html │ │ └── index.html │ └── test │ └── java │ └── com │ └── didispace │ └── ApplicationTests.java ├── Chapter3-1-7 ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── didispace │ │ └── Application.java │ └── resources │ └── application.properties ├── Chapter3-2-1 ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── didispace │ │ │ ├── Application.java │ │ │ └── service │ │ │ ├── UserService.java │ │ │ └── UserServiceImpl.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── didispace │ └── ApplicationTests.java ├── Chapter3-2-10 ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── didispace │ │ │ ├── Application.java │ │ │ ├── Person.java │ │ │ └── PersonRepository.java │ └── resources │ │ └── application.properties │ └── test │ ├── java │ └── com │ │ └── didispace │ │ └── ApplicationTests.java │ └── resources │ ├── application.properties │ └── ldap-server.ldif ├── Chapter3-2-11 ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── didispace │ │ │ └── Application.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── didispace │ └── ApplicationTests.java ├── Chapter3-2-2 ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── didispace │ │ │ ├── Application.java │ │ │ └── domain │ │ │ ├── User.java │ │ │ └── UserRepository.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── didispace │ └── ApplicationTests.java ├── Chapter3-2-3 ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── didispace │ │ │ ├── Application.java │ │ │ └── DataSourceConfig.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── didispace │ └── ApplicationTests.java ├── Chapter3-2-4 ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── didispace │ │ │ ├── Application.java │ │ │ ├── DataSourceConfig.java │ │ │ ├── PrimaryConfig.java │ │ │ ├── SecondaryConfig.java │ │ │ └── domain │ │ │ ├── p │ │ │ ├── User.java │ │ │ └── UserRepository.java │ │ │ └── s │ │ │ ├── Message.java │ │ │ └── MessageRepository.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── didispace │ └── ApplicationTests.java ├── Chapter3-2-5 ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── didispace │ │ │ ├── Application.java │ │ │ ├── RedisConfig.java │ │ │ ├── RedisObjectSerializer.java │ │ │ └── domain │ │ │ └── User.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── didispace │ └── ApplicationTests.java ├── Chapter3-2-7 ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── didispace │ │ │ ├── Application.java │ │ │ └── domain │ │ │ ├── User.java │ │ │ └── UserMapper.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── didispace │ └── ApplicationTests.java ├── Chapter3-2-8 ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── didispace │ │ │ ├── Application.java │ │ │ └── domain │ │ │ ├── User.java │ │ │ └── UserMapper.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── didispace │ └── ApplicationTests.java ├── Chapter3-3-1 ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── didispace │ │ │ ├── Application.java │ │ │ ├── domain │ │ │ ├── User.java │ │ │ └── UserRepository.java │ │ │ └── service │ │ │ └── UserService.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── didispace │ └── ApplicationTests.java ├── Chapter4-1-1 ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── didispace │ │ │ ├── Application.java │ │ │ └── task │ │ │ └── ScheduledTasks.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── didispace │ └── ApplicationTests.java ├── Chapter4-1-2 ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── didispace │ │ │ ├── Application.java │ │ │ └── async │ │ │ └── Task.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── didispace │ └── ApplicationTests.java ├── Chapter4-1-3 ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── didispace │ │ │ ├── Application.java │ │ │ └── async │ │ │ └── Task.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── didispace │ └── ApplicationTests.java ├── Chapter4-1-4 ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── didispace │ │ │ ├── Application.java │ │ │ └── async │ │ │ └── Task.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── didispace │ └── ApplicationTests.java ├── Chapter4-1-5 ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── didispace │ │ │ ├── Application.java │ │ │ └── async │ │ │ └── Task.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── didispace │ └── ApplicationTests.java ├── Chapter4-2-2 ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── didispace │ │ │ └── Application.java │ └── resources │ │ ├── application.properties │ │ └── log4j.properties │ └── test │ └── java │ └── com │ └── didispace │ └── ApplicationTests.java ├── Chapter4-2-3 ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── didispace │ │ │ └── Application.java │ └── resources │ │ ├── application-dev.properties │ │ ├── application-prod.properties │ │ ├── application-test.properties │ │ ├── application.properties │ │ └── log4j.properties │ └── test │ └── java │ └── com │ └── didispace │ └── ApplicationTests.java ├── Chapter4-2-4 ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── didispace │ │ │ ├── Application.java │ │ │ ├── aspect │ │ │ └── WebLogAspect.java │ │ │ └── web │ │ │ └── HelloController.java │ └── resources │ │ ├── application.properties │ │ └── log4j.properties │ └── test │ └── java │ └── com │ └── didispace │ └── ApplicationTests.java ├── Chapter4-2-6 ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── didispace │ │ │ └── DemoApplication.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── didispace │ └── DemoApplicationTests.java ├── Chapter4-3-1 ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── didispace │ │ │ ├── Application.java │ │ │ ├── WebSecurityConfig.java │ │ │ └── web │ │ │ └── HelloController.java │ └── resources │ │ ├── application.properties │ │ └── templates │ │ ├── hello.html │ │ ├── index.html │ │ └── login.html │ └── test │ └── java │ └── com │ └── didispace │ └── ApplicationTests.java ├── Chapter4-4-1 ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── didispace │ │ │ ├── Application.java │ │ │ └── domain │ │ │ ├── User.java │ │ │ └── UserRepository.java │ └── resources │ │ ├── application.properties │ │ └── ehcache.xml │ └── test │ └── java │ └── com │ └── didispace │ └── ApplicationTests.java ├── Chapter4-4-2 ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── didispace │ │ │ ├── Application.java │ │ │ └── domain │ │ │ ├── User.java │ │ │ └── UserRepository.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── didispace │ └── ApplicationTests.java ├── Chapter4-5-1 ├── pom.xml ├── src │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── didispace │ │ │ │ └── Application.java │ │ └── resources │ │ │ ├── application.properties │ │ │ └── templates │ │ │ └── template.vm │ └── test │ │ └── java │ │ └── com │ │ └── didispace │ │ └── ApplicationTests.java └── weixin.jpg ├── Chapter6-2-1 ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── didispace │ │ │ ├── Application.java │ │ │ └── web │ │ │ └── HelloController.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── didispace │ └── ApplicationTests.java ├── Chapter9-1-1 ├── compute-service │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── didispace │ │ │ │ ├── ComputeServiceApplication.java │ │ │ │ └── web │ │ │ │ └── ComputeController.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── didispace │ │ └── ApplicationTests.java └── eureka-server │ ├── pom.xml │ └── src │ └── main │ ├── java │ └── com │ │ └── didispace │ │ └── Application.java │ └── resources │ └── application.properties ├── Chapter9-1-2 ├── eureka-feign │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── didispace │ │ │ ├── FeignApplication.java │ │ │ ├── service │ │ │ └── ComputeClient.java │ │ │ └── web │ │ │ └── ConsumerController.java │ │ └── resources │ │ └── application.properties └── eureka-ribbon │ ├── pom.xml │ └── src │ └── main │ ├── java │ └── com │ │ └── didispace │ │ ├── RibbonApplication.java │ │ └── web │ │ └── ConsumerController.java │ └── resources │ └── application.properties ├── Chapter9-1-3 ├── compute-service │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── didispace │ │ │ │ ├── ComputeServiceApplication.java │ │ │ │ └── web │ │ │ │ └── ComputeController.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── didispace │ │ └── ApplicationTests.java ├── eureka-feign │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── didispace │ │ ├── FeignApplication.java │ │ ├── service │ │ ├── ComputeClient.java │ │ └── ComputeClientHystrix.java │ │ └── web │ │ └── ConsumerController.java ├── eureka-ribbon │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── didispace │ │ ├── RibbonApplication.java │ │ ├── service │ │ └── ComputeService.java │ │ └── web │ │ └── ConsumerController.java └── eureka-server │ ├── pom.xml │ └── src │ └── main │ ├── java │ └── com │ │ └── didispace │ │ └── Application.java │ └── resources │ └── application.properties ├── Chapter9-1-4 ├── config-client │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── didispace │ │ │ ├── Application.java │ │ │ └── web │ │ │ └── TestController.java │ │ └── resources │ │ └── bootstrap.properties ├── config-repo │ ├── didispace-dev.properties │ ├── didispace-prod.properties │ ├── didispace-test.properties │ └── didispace.properties └── config-server │ ├── pom.xml │ └── src │ └── main │ ├── java │ └── com │ │ └── didispace │ │ └── Application.java │ └── resources │ ├── application.properties │ ├── didispace-dev.properties │ ├── didispace-prod.properties │ ├── didispace-test.properties │ └── didispace.properties ├── Chapter9-1-5 ├── api-gateway │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── didispace │ │ │ ├── Application.java │ │ │ └── filter │ │ │ └── AccessFilter.java │ │ └── resources │ │ └── application.properties ├── eureka-server │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── didispace │ │ │ └── Application.java │ │ └── resources │ │ └── application.properties ├── service-A │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── didispace │ │ │ │ ├── ComputeServiceApplication.java │ │ │ │ └── web │ │ │ │ └── ComputeController.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── didispace │ │ └── ApplicationTests.java └── service-B │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── didispace │ │ │ ├── ComputeServiceApplication.java │ │ │ └── web │ │ │ └── ComputeController.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── didispace │ └── ApplicationTests.java ├── Chapter9-2-1 ├── compute-service │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── didispace │ │ │ │ ├── Application.java │ │ │ │ └── service │ │ │ │ ├── ComputeService.java │ │ │ │ └── impl │ │ │ │ └── ComputeServiceImpl.java │ │ └── resources │ │ │ ├── application.properties │ │ │ └── dubbo.xml │ │ └── test │ │ └── java │ │ └── com │ │ └── didispace │ │ └── ApplicationTests.java └── consumer │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── didispace │ │ │ ├── Application.java │ │ │ └── service │ │ │ └── ComputeService.java │ └── resources │ │ ├── application.properties │ │ └── dubbo.xml │ └── test │ └── java │ └── com │ └── didispace │ └── ApplicationTests.java ├── README.md ├── Spring-Learning ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── leelovejava │ └── spring │ └── proxy │ ├── cglib │ ├── TestCglib.java │ ├── UserServiceCglib.java │ └── UserServiceImpl.java │ └── jdk │ ├── ServiceInvocationHandler.java │ ├── Test.java │ ├── UserService.java │ └── UserServiceImpl.java ├── boot-datasource ├── boot-sqllite │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── leelovejava │ │ │ └── boot │ │ │ └── sqlite │ │ │ ├── SqlLiteApplication.java │ │ │ ├── config │ │ │ ├── MyBatisConfig.java │ │ │ └── MyBatisMapperScannerConfig.java │ │ │ ├── controller │ │ │ └── HelloWorldController.java │ │ │ ├── mapper │ │ │ └── HelloMapper.java │ │ │ ├── model │ │ │ ├── HelloModel.java │ │ │ └── ReqBody.java │ │ │ └── service │ │ │ └── HelloService.java │ │ └── resources │ │ └── application.yml ├── click-house-learning │ ├── .gitignore │ ├── REAME.md │ ├── boot-clickhouse │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── com │ │ │ │ └── leelovejava │ │ │ │ └── clickhouse │ │ │ │ ├── ClickHouseApplication.java │ │ │ │ ├── config │ │ │ │ ├── DruidConfig.java │ │ │ │ └── JdbcParamConfig.java │ │ │ │ ├── controller │ │ │ │ └── UserInfoController.java │ │ │ │ ├── entity │ │ │ │ └── UserInfo.java │ │ │ │ ├── mapper │ │ │ │ └── UserInfoMapper.java │ │ │ │ └── service │ │ │ │ ├── UserInfoService.java │ │ │ │ └── impl │ │ │ │ └── UserInfoServiceImpl.java │ │ │ └── resources │ │ │ ├── user-info.sql │ │ │ ├── application.yml │ │ │ └── mapper │ │ │ └── com.leelovejava.clickhouse │ │ │ └── dao │ │ │ └── UserInfoMapper.xml │ ├── clickhouse-jdbc │ │ ├── REAME.md │ │ ├── pom.xml │ │ └── src │ │ │ └── test │ │ │ └── java │ │ │ └── clickhouse │ │ │ ├── ClickHouseDataSourceTest.java │ │ │ ├── ClickHouseTest.java │ │ │ └── MyCustomInputStream.java │ ├── doc │ │ ├── clickhouse_zh.pdf │ │ └── 尚硅谷大数据技术之ClickHouse.docx │ └── pom.xml ├── mysql-mycat │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── leelovejava │ │ │ │ └── boot │ │ │ │ └── datasource │ │ │ │ └── mycat │ │ │ │ ├── MyCatApplication.java │ │ │ │ ├── dao │ │ │ │ └── UserDao.java │ │ │ │ └── model │ │ │ │ └── UserModel.java │ │ └── resources │ │ │ ├── application.yml │ │ │ ├── create_table.sql │ │ │ └── mycat-conf │ │ │ ├── rule.xml │ │ │ ├── schema.xml │ │ │ └── server.xml │ │ └── test │ │ └── java │ │ └── com │ │ └── leelovejava │ │ └── boot │ │ └── datasource │ │ └── mysql │ │ └── test │ │ └── MyCatTest.java ├── pom.xml └── sharding-database-table │ ├── README.md │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── leelovejava │ │ │ └── sharding │ │ │ ├── ShardingDatabaseTableApplication.java │ │ │ ├── config │ │ │ ├── ShardingConfig.java │ │ │ └── algorithm │ │ │ │ ├── DatabaseShardingAlgorithm.java │ │ │ │ ├── StaffTableComplexKeysShardingAlgorithm.java │ │ │ │ └── StaffTableTableShardingAlgorithm.java │ │ │ ├── mapper │ │ │ └── ShardingMapper.java │ │ │ ├── model │ │ │ └── StaffPO.java │ │ │ └── service │ │ │ ├── ShardingService.java │ │ │ └── impl │ │ │ └── ShardingServiceImpl.java │ └── resources │ │ ├── application.yml │ │ ├── create_table.sql │ │ └── logback.xml │ └── test │ └── java │ └── com │ └── leelovejava │ └── sharding │ └── ShardingDatabaseTableApplicationTests.java ├── boot-docker ├── .gitignore ├── Dockerfile ├── README.md ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── leelovejava │ │ └── boot │ │ └── docker │ │ ├── BootDockerApplication.java │ │ └── controller │ │ └── HelloController.java │ └── resources │ └── application.yml ├── boot-dubbo ├── README.md ├── compute-service │ ├── compute-api-server │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── leelovejava │ │ │ │ │ └── dubbo │ │ │ │ │ ├── Application.java │ │ │ │ │ └── service │ │ │ │ │ └── impl │ │ │ │ │ └── ComputeServiceImpl.java │ │ │ └── resources │ │ │ │ ├── application.properties │ │ │ │ └── dubbo.xml │ │ │ └── test │ │ │ └── java │ │ │ └── com │ │ │ └── leelovejava │ │ │ └── dubbo │ │ │ └── ApplicationTests.java │ ├── compute-api │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── leelovejava │ │ │ └── dubbo │ │ │ └── service │ │ │ ├── ComputeService.java │ │ │ └── impl │ │ │ └── ComputeServiceImpl.java │ └── pom.xml └── consumer │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── leelovejava │ │ │ └── dubbo │ │ │ └── Application.java │ └── resources │ │ ├── META-INF │ │ ├── dubbo │ │ │ └── com.leelovejava.dubbo.spi.Robot │ │ └── services │ │ │ └── com.leelovejava.dubbo.spi.Robot │ │ ├── application.properties │ │ └── dubbo.xml │ └── test │ └── java │ └── com │ └── leelovejava │ └── dubbo │ ├── ApplicationTests.java │ └── spi │ ├── Bumblebee.java │ ├── OptimusPrime.java │ ├── README.md │ ├── Robot.java │ └── test │ ├── DubboSPITest.java │ └── JavaSPITest.java ├── boot-es ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── leelovejava │ │ │ └── essearch │ │ │ ├── ElasticSearchApplication.java │ │ │ ├── controller │ │ │ └── EsSearchController.java │ │ │ ├── document │ │ │ ├── ProductDocument.java │ │ │ └── ProductDocumentBuilder.java │ │ │ ├── page │ │ │ ├── Page.java │ │ │ ├── Paginable.java │ │ │ └── SimplePage.java │ │ │ ├── repository │ │ │ └── ProductDocumentRepository.java │ │ │ ├── service │ │ │ ├── BaseSearchService.java │ │ │ ├── EsSearchService.java │ │ │ └── impl │ │ │ │ ├── BaseSearchServiceImpl.java │ │ │ │ └── EsSearchServiceImpl.java │ │ │ └── vo │ │ │ ├── HouseData.java │ │ │ └── SearchResult.java │ └── resources │ │ ├── application.properties │ │ └── productIndex.json │ └── test │ └── java │ └── com │ └── leelovejava │ └── es │ ├── ElasticSearchApplicationTests.java │ ├── ElasticTemplateTest.java │ └── ElasticsearchTemplateTests.java ├── boot-fastdfs ├── READE.md ├── lib │ └── fastdfs-client-java-1.28-SNAPSHOT.jar ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── leelovejava │ │ └── boot │ │ └── fastdfs │ │ ├── FastDFSApplication.java │ │ ├── controller │ │ ├── GlobalExceptionHandler.java │ │ └── UploadController.java │ │ └── util │ │ ├── FastDFSClient.java │ │ └── FastDFSFile.java │ └── resources │ ├── application.properties │ ├── application.yml │ ├── fdfs_client.conf │ ├── logback.xml │ └── templates │ ├── upload.html │ └── uploadStatus.html ├── boot-favor-submit ├── README.md ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── leelovejava │ │ └── boot │ │ └── favor │ │ ├── FavorSubmitApplication.java │ │ ├── ResubmitLock.java │ │ ├── annotation │ │ ├── CacheLock.java │ │ ├── CacheParam.java │ │ └── Resubmit.java │ │ ├── controller │ │ └── BookController.java │ │ ├── interceptor │ │ └── LockMethodInterceptor.java │ │ ├── service │ │ ├── CacheKeyGenerator.java │ │ └── LockKeyGenerator.java │ │ └── utils │ │ └── RedisLockHelper.java │ └── resources │ └── application.yml ├── boot-feature ├── boot_2.1_feature.md ├── common_2.1.properties ├── spring-boot 2.X中文配置.txt └── spring-boot 2.X英文配置.txt ├── boot-flyway ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── didispace │ │ │ ├── Application.java │ │ │ └── service │ │ │ ├── UserService.java │ │ │ └── UserServiceImpl.java │ └── resources │ │ ├── application.properties │ │ └── db │ │ ├── V1__Base_version.sql │ │ ├── V2__Student_version.sql │ │ ├── V3__Student_Alter_Score_version.sql │ │ ├── V4__Student_addField_table.sql │ │ └── V5__init_tables.sql │ └── test │ └── java │ └── com │ └── didispace │ └── ApplicationTests.java ├── boot-globalization ├── .gitignore ├── README.md ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── leelovejava │ │ └── boot │ │ └── globalization │ │ ├── GlobalizationApplication.java │ │ ├── config │ │ └── I18Config.java │ │ └── contoller │ │ └── IndexController.java │ └── resources │ ├── application.yml │ ├── i18n │ ├── messages.properties │ ├── messages_en_US.properties │ └── messages_zh_CN.properties │ └── templates │ └── index.html ├── boot-login ├── README.md └── pom.xml ├── boot-mongodb ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── didispace │ │ │ ├── MongodbApplication.java │ │ │ ├── aspect │ │ │ └── WebLogAspect.java │ │ │ ├── domain │ │ │ ├── User.java │ │ │ └── UserRepository.java │ │ │ ├── log │ │ │ └── MongoAppender.java │ │ │ └── web │ │ │ └── HelloController.java │ └── resources │ │ ├── application.properties │ │ └── log4j.properties │ └── test │ └── java │ └── com │ └── didispace │ ├── ApplicationTests.java │ ├── NativeMethodTest.java │ └── TestMongoDB.java ├── boot-monitor ├── .gitignore ├── README.md ├── boot-admin-actuator │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── leelovejava │ │ │ └── admin │ │ │ └── actuator │ │ │ └── ActuatorApplication.java │ │ └── resources │ │ ├── application.yml │ │ └── prometheus.yml └── pom.xml ├── boot-mqtt ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── mqtt │ │ │ ├── MqttApplication.java │ │ │ ├── client │ │ │ ├── MqttPushClient.java │ │ │ └── callback │ │ │ │ └── PushCallback.java │ │ │ ├── config │ │ │ └── MqttConfig.java │ │ │ └── dto │ │ │ └── PushPayload.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── mqtt │ └── test │ └── test.java ├── boot-mysql ├── sharding-sphere-db │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── leelovejava │ │ │ │ └── boot │ │ │ │ └── mysql │ │ │ │ ├── config │ │ │ │ └── DbShardingAlgorithm.java │ │ │ │ ├── mapper │ │ │ │ ├── OrderMapeer.xml │ │ │ │ └── OrderMapper.java │ │ │ │ ├── model │ │ │ │ └── OrderModel.java │ │ │ │ └── service │ │ │ │ └── OrderService.java │ │ └── resources │ │ │ ├── Sharding-Sphere实战:实现类多租户分库分表.txt │ │ │ ├── appliation.properties │ │ │ ├── doc │ │ │ ├── sharding-proxy实战:解救分表后痛苦的测试小姐姐.md │ │ │ ├── sjdbc源码分析.md │ │ │ └── 分库分表技术演进&最佳实践-修订篇.md │ │ │ ├── init.sql │ │ │ └── sjdbc源码分析.md │ │ └── test │ │ └── java │ │ └── com │ │ └── leelovejava │ │ └── boot │ │ └── mysql │ │ └── sharding │ │ └── sphere │ │ └── OrderSpringBootTests.java └── sharding-sphere-table │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── leelovejava │ │ │ └── boot │ │ │ └── mysql │ │ │ ├── config │ │ │ └── OrderShardingAlgorithm.java │ │ │ ├── mapper │ │ │ ├── OrderMapeer.xml │ │ │ └── OrderMapper.java │ │ │ ├── model │ │ │ └── OrderModel.java │ │ │ └── service │ │ │ └── OrderService.java │ └── resources │ │ ├── appliation.properties │ │ └── init.sql │ └── test │ └── java │ └── com │ └── leelovejava │ └── boot │ └── mysql │ └── sharding │ └── sphere │ └── OrderSpringBootTests.java ├── boot-neo4j ├── .gitignore ├── README.md ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── leelovejava │ │ └── boot │ │ └── neo4j │ │ ├── BootNeo4jApplication.java │ │ ├── config │ │ └── CustomIdStrategy.java │ │ ├── constants │ │ └── NeoConsts.java │ │ ├── model │ │ ├── Class.java │ │ ├── Lesson.java │ │ ├── Student.java │ │ └── Teacher.java │ │ ├── payload │ │ ├── ClassmateInfoGroupByLesson.java │ │ └── TeacherStudent.java │ │ ├── repository │ │ ├── ClassRepository.java │ │ ├── LessonRepository.java │ │ ├── StudentRepository.java │ │ └── TeacherRepository.java │ │ └── service │ │ └── NeoService.java │ └── resources │ └── application.yml ├── boot-netty ├── 1.txt ├── 2.txt ├── README.md ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ ├── atguigu │ │ ├── bio │ │ │ └── BIOServer.java │ │ ├── netty │ │ │ ├── buf │ │ │ │ ├── NettyByteBuf01.java │ │ │ │ └── NettyByteBuf02.java │ │ │ ├── codec │ │ │ │ ├── NettyClient.java │ │ │ │ ├── NettyClientHandler.java │ │ │ │ ├── NettyServer.java │ │ │ │ ├── NettyServerHandler.java │ │ │ │ ├── Student.proto │ │ │ │ └── StudentPOJO.java │ │ │ ├── codec2 │ │ │ │ ├── MyDataInfo.java │ │ │ │ ├── NettyClient.java │ │ │ │ ├── NettyClientHandler.java │ │ │ │ ├── NettyServer.java │ │ │ │ ├── NettyServerHandler.java │ │ │ │ └── Student.proto │ │ │ ├── dubborpc │ │ │ │ ├── customer │ │ │ │ │ └── ClientBootstrap.java │ │ │ │ ├── netty │ │ │ │ │ ├── NettyClient.java │ │ │ │ │ ├── NettyClientHandler.java │ │ │ │ │ ├── NettyServer.java │ │ │ │ │ └── NettyServerHandler.java │ │ │ │ ├── provider │ │ │ │ │ ├── HelloServiceImpl.java │ │ │ │ │ └── ServerBootstrap.java │ │ │ │ └── publicinterface │ │ │ │ │ └── HelloService.java │ │ │ ├── groupchat │ │ │ │ ├── GroupChatClient.java │ │ │ │ ├── GroupChatClientHandler.java │ │ │ │ ├── GroupChatServer.java │ │ │ │ ├── GroupChatServerHandler.java │ │ │ │ └── User.java │ │ │ ├── heartbeat │ │ │ │ ├── MyServer.java │ │ │ │ ├── MyServerHandler.java │ │ │ │ └── Test.java │ │ │ ├── http │ │ │ │ ├── TestHttpServerHandler.java │ │ │ │ ├── TestServer.java │ │ │ │ └── TestServerInitializer.java │ │ │ ├── inboundhandlerandoutboundhandler │ │ │ │ ├── MyByteToLongDecoder.java │ │ │ │ ├── MyByteToLongDecoder2.java │ │ │ │ ├── MyClient.java │ │ │ │ ├── MyClientHandler.java │ │ │ │ ├── MyClientInitializer.java │ │ │ │ ├── MyLongToByteEncoder.java │ │ │ │ ├── MyServer.java │ │ │ │ ├── MyServerHandler.java │ │ │ │ └── MyServerInitializer.java │ │ │ ├── protocoltcp │ │ │ │ ├── MessageProtocol.java │ │ │ │ ├── MyClient.java │ │ │ │ ├── MyClientHandler.java │ │ │ │ ├── MyClientInitializer.java │ │ │ │ ├── MyMessageDecoder.java │ │ │ │ ├── MyMessageEncoder.java │ │ │ │ ├── MyServer.java │ │ │ │ ├── MyServerHandler.java │ │ │ │ └── MyServerInitializer.java │ │ │ ├── simple │ │ │ │ ├── NettyClient.java │ │ │ │ ├── NettyClientHandler.java │ │ │ │ ├── NettyServer.java │ │ │ │ ├── NettyServerHandler.java │ │ │ │ └── Test.java │ │ │ ├── source │ │ │ │ ├── echo │ │ │ │ │ ├── EchoClient.java │ │ │ │ │ ├── EchoClientHandler.java │ │ │ │ │ ├── EchoServer.java │ │ │ │ │ ├── EchoServerHandler.java │ │ │ │ │ └── Test.java │ │ │ │ └── echo2 │ │ │ │ │ ├── EchoClient.java │ │ │ │ │ ├── EchoClientHandler.java │ │ │ │ │ ├── EchoServer.java │ │ │ │ │ └── EchoServerHandler.java │ │ │ ├── tcp │ │ │ │ ├── MyClient.java │ │ │ │ ├── MyClientHandler.java │ │ │ │ ├── MyClientInitializer.java │ │ │ │ ├── MyServer.java │ │ │ │ ├── MyServerHandler.java │ │ │ │ └── MyServerInitializer.java │ │ │ └── websocket │ │ │ │ ├── MyServer.java │ │ │ │ ├── MyTextWebSocketFrameHandler.java │ │ │ │ └── hello.html │ │ └── nio │ │ │ ├── BasicBuffer.java │ │ │ ├── MappedByteBufferTest.java │ │ │ ├── NIOByteBufferPutGet.java │ │ │ ├── NIOClient.java │ │ │ ├── NIOFileChannel01.java │ │ │ ├── NIOFileChannel02.java │ │ │ ├── NIOFileChannel03.java │ │ │ ├── NIOFileChannel04.java │ │ │ ├── NIOServer.java │ │ │ ├── ReadOnlyBuffer.java │ │ │ ├── ScatteringAndGatheringTest.java │ │ │ ├── groupchat │ │ │ ├── GroupChatClient.java │ │ │ └── GroupChatServer.java │ │ │ └── zerocopy │ │ │ ├── NewIOClient.java │ │ │ ├── NewIOServer.java │ │ │ ├── OldIOClient.java │ │ │ └── OldIOServer.java │ │ └── leelovejava │ │ └── netty │ │ ├── client │ │ ├── ClientApplication.java │ │ ├── NettyClient.java │ │ ├── NettyClientHandler.java │ │ └── NettyClientInitializer.java │ │ └── server │ │ ├── NettyServer.java │ │ ├── NettyServerHandler.java │ │ ├── ServerApplication.java │ │ └── ServerChannelInitializer.java │ └── resources │ └── log4j.properties ├── boot-rabbitmq ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── leelovejava │ │ │ └── rabbit │ │ │ ├── BootRabbitmqApplication.java │ │ │ ├── Receiver.java │ │ │ ├── Sender.java │ │ │ ├── config │ │ │ └── RabbitConfig.java │ │ │ ├── controller │ │ │ └── OrderController.java │ │ │ ├── service │ │ │ ├── BaseApiService.java │ │ │ ├── OrderService.java │ │ │ └── consumer │ │ │ │ ├── DispatchConsumer.java │ │ │ │ └── DlOrderConsumer.java │ │ │ └── transaction │ │ │ ├── ApiConstants.java │ │ │ ├── ResponseBase.java │ │ │ ├── entity │ │ │ ├── DispatchEntity.java │ │ │ └── OrderEntity.java │ │ │ └── mapper │ │ │ ├── DispatchMapper.java │ │ │ └── OrderMapper.java │ └── resources │ │ └── application.yml │ └── test │ ├── java │ └── com │ │ └── leelovejava │ │ └── HelloApplicationTests.java │ └── resources │ ├── create.sql │ └── rabbitmq分布式事务.png ├── boot-redis ├── REAME.md ├── distributed-lock-redisson │ ├── README.md │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── leelovejava │ │ └── lock │ │ └── redisson │ │ ├── Distributed.java │ │ ├── RedissonMultiLock2.java │ │ ├── RedissonTest.java │ │ └── Sample.java ├── pom.xml └── redis-delay │ ├── pom.xml │ └── src │ └── main │ ├── java │ └── com │ │ └── leelovejava │ │ └── redis │ │ ├── DataRedisApplication.java │ │ ├── delay │ │ ├── conf │ │ │ └── RedisListenerConfig.java │ │ ├── listener │ │ │ └── RedisKeyExpirationListener.java │ │ └── package-info.java │ │ └── penetration │ │ ├── BloomFilterDemo.java │ │ └── package-info.java │ ├── resources │ └── application.properties │ └── test │ └── java │ └── com.leelovejava.redis.test │ ├── OrderService.java │ ├── RedisDistributedLock.java │ └── RedisUtil.java ├── boot-sample-tomcat-jsp ├── pom.xml └── src │ └── main │ ├── java │ └── sample │ │ └── tomcat │ │ └── jsp │ │ ├── SampleTomcatJspApplication.java │ │ └── WelcomeController.java │ ├── resources │ └── application.properties │ └── webapp │ └── WEB-INF │ └── jsp │ └── welcome.jsp ├── boot-scala ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── leelovejava │ │ │ ├── BootScalaApplication.java │ │ │ ├── crontroller │ │ │ ├── HelloBoot.java │ │ │ └── MetaDatabaseController.java │ │ │ ├── domain │ │ │ └── MetaDatabase.java │ │ │ ├── repository │ │ │ └── MetaDatabaseRepository.java │ │ │ ├── service │ │ │ └── MetaDatabaseService.java │ │ │ └── utils │ │ │ ├── ResultVO.java │ │ │ └── ResultVOUtil.java │ ├── resources │ │ └── application.yml │ └── scala │ │ └── com │ │ └── leelovejava │ │ ├── controller │ │ ├── MetaTableController.scala │ │ └── ScalaHelloBoot.scala │ │ ├── demo │ │ ├── ch01 │ │ │ ├── 1_declare.sc │ │ │ ├── 2_type.sc │ │ │ ├── 3_operator.sc │ │ │ ├── 4_call.sc │ │ │ ├── 5_apply.sc │ │ │ └── 6_option.sc │ │ ├── ch02 │ │ │ ├── 1_ifelse.sc │ │ │ ├── 2_inout.sc │ │ │ ├── 3_while.sc │ │ │ ├── 4_for.sc │ │ │ ├── 5_function.sc │ │ │ ├── 6_lazy.sc │ │ │ └── 7_exception.sc │ │ ├── ch03 │ │ │ ├── 10_list.sc │ │ │ ├── 11_set.sc │ │ │ ├── 12_maptolist.sc │ │ │ ├── 13_scan.sc │ │ │ ├── 14_zip.sc │ │ │ ├── 15_iter.sc │ │ │ ├── 16_stream.sc │ │ │ ├── 17_view.sc │ │ │ ├── 18_concurrent.sc │ │ │ ├── 1_array.sc │ │ │ ├── 2_arraytransform.sc │ │ │ ├── 3_dimensions.sc │ │ │ ├── 4_arrayjava.sc │ │ │ ├── 5_map.sc │ │ │ ├── 6_mapjava.sc │ │ │ ├── 7_tuple.sc │ │ │ ├── 8_queue.sc │ │ │ └── 9_stack.sc │ │ ├── ch04 │ │ │ ├── 10_copy.sc │ │ │ ├── 11_mvalue.sc │ │ │ ├── 12_nest.sc │ │ │ ├── 14_enum.sc │ │ │ ├── 15_partial.sc │ │ │ ├── 1_switch.sc │ │ │ ├── 2_guard.sc │ │ │ ├── 3_var.sc │ │ │ ├── 4_type.sc │ │ │ ├── 5_bind.sc │ │ │ ├── 6_unapply.sc │ │ │ ├── 7_var.sc │ │ │ ├── 8_for.sc │ │ │ ├── 9_case.sc │ │ │ └── seal_13 │ │ │ │ ├── Amount.scala │ │ │ │ └── Euro.scala │ │ ├── ch05 │ │ │ ├── 1_var.sc │ │ │ ├── 2_anonymity.sc │ │ │ ├── 3_high.sc │ │ │ ├── 4_infer.sc │ │ │ ├── 5_closure.sc │ │ │ ├── 6_currying.sc │ │ │ └── 7_abstract.sc │ │ ├── ch06 │ │ │ ├── 1_class.sc │ │ │ ├── 2_getter.sc │ │ │ ├── 3_private.sc │ │ │ ├── 4_bean.sc │ │ │ ├── 5_constructor.sc │ │ │ ├── 6_subclass.sc │ │ │ ├── 6_subclass_object.sc │ │ │ └── 6_subclass_outer.sc │ │ ├── ch07 │ │ │ ├── 1_single.sc │ │ │ ├── 2_object.sc │ │ │ ├── 3_apply.sc │ │ │ ├── 4_main.sc │ │ │ └── 5_enum.sc │ │ ├── ch08 │ │ │ ├── sec01 │ │ │ │ ├── Employee.scala │ │ │ │ ├── Manager.scala │ │ │ │ └── Person.scala │ │ │ ├── sec02 │ │ │ │ ├── Employee.scala │ │ │ │ ├── Manager.scala │ │ │ │ └── Other.scala │ │ │ ├── sec03 │ │ │ │ └── Person.scala │ │ │ ├── sec04 │ │ │ │ └── Person.scala │ │ │ ├── sec05 │ │ │ │ └── Manager.scala │ │ │ └── sec06 │ │ │ │ └── rename.sc │ │ ├── ch09 │ │ │ ├── sec01 │ │ │ │ └── Employee.scala │ │ │ ├── sec02 │ │ │ │ └── Employee.scala │ │ │ ├── sec03 │ │ │ │ └── Employee.scala │ │ │ ├── sec04 │ │ │ │ └── Manager.scala │ │ │ ├── sec05 │ │ │ │ └── 5_supercon.sc │ │ │ ├── sec06 │ │ │ │ └── 6_property.scala │ │ │ ├── sec07 │ │ │ │ └── 7_anonymity.sc │ │ │ ├── sec08 │ │ │ │ └── 8_abstract.scala │ │ │ └── sec09 │ │ │ │ └── Creature.scala │ │ ├── ch10 │ │ │ ├── sec02 │ │ │ │ └── Logger.scala │ │ │ ├── sec03 │ │ │ │ └── Logger.scala │ │ │ ├── sec04 │ │ │ │ └── Logger.scala │ │ │ ├── sec05 │ │ │ │ └── Logger.scala │ │ │ ├── sec06 │ │ │ │ └── Logger.scala │ │ │ ├── sec07 │ │ │ │ └── Logger.scala │ │ │ ├── sec08 │ │ │ │ └── Logger.scala │ │ │ ├── sec09 │ │ │ │ └── Logger.scala │ │ │ ├── sec10 │ │ │ │ ├── Logger.scala │ │ │ │ └── app.log │ │ │ ├── sec11 │ │ │ │ ├── Logger.scala │ │ │ │ ├── myapp.log │ │ │ │ └── myapp2.log │ │ │ ├── sec12 │ │ │ │ └── Logger.scala │ │ │ ├── sec13 │ │ │ │ └── Logger.scala │ │ │ └── sec14 │ │ │ │ └── Logger.scala │ │ ├── ch11 │ │ │ ├── 1_class.sc │ │ │ ├── 2_method.sc │ │ │ ├── 3_limit.sc │ │ │ ├── 4_view.sc │ │ │ ├── 5_context.sc │ │ │ ├── 6_manifest.sc │ │ │ ├── 8_multi.sc │ │ │ ├── 9_transfer.sc │ │ │ ├── Complex.scala │ │ │ ├── Implicit.scala │ │ │ ├── TypeParameters.scala │ │ │ └── reflect2.scala │ │ ├── ch12 │ │ │ ├── 01_implicit.scala │ │ │ ├── 02_richfile.scala │ │ │ ├── 03_import.scala │ │ │ ├── 04_change.sc │ │ │ ├── 05_param.sc │ │ │ ├── 06_transfer.sc │ │ │ └── 07_context.sc │ │ ├── ch13 │ │ │ ├── sec01 │ │ │ │ ├── 01_readline.sc │ │ │ │ └── mary.txt │ │ │ ├── sec02 │ │ │ │ ├── 02_char.sc │ │ │ │ └── mary.txt │ │ │ ├── sec03 │ │ │ │ ├── 03_unit.sc │ │ │ │ └── values.txt │ │ │ ├── sec04 │ │ │ │ ├── 04_binary.sc │ │ │ │ ├── 04_url.sc │ │ │ │ ├── 04_write.sc │ │ │ │ └── repl-session.zip │ │ │ ├── sec05 │ │ │ │ ├── 05_seri.sc │ │ │ │ └── test.obj │ │ │ ├── sec06 │ │ │ │ ├── 06_process.sc │ │ │ │ └── output.txt │ │ │ └── sec07 │ │ │ │ └── 07_regex.sc │ │ ├── ch14 │ │ │ ├── sec01 │ │ │ │ └── 01_link.sc │ │ │ ├── sec02 │ │ │ │ └── Network.sc │ │ │ ├── sec04 │ │ │ │ └── Book.sc │ │ │ └── sec05 │ │ │ │ └── Appender.sc │ │ ├── convert │ │ │ └── MainApp.scala │ │ └── train │ │ │ ├── Lesson_Trait01.scala │ │ │ └── Lesson_Trait02.scala │ │ ├── domain │ │ └── MetaTable.scala │ │ ├── obj │ │ ├── DecProgramApp.scala │ │ ├── HelloWorld.scala │ │ └── obj │ │ │ ├── Account.scala │ │ │ └── Accounts.scala │ │ ├── repository │ │ └── MetaTableRepository.scala │ │ └── service │ │ └── MetaTableService.scala │ └── test │ └── java │ └── com │ └── leelovejava │ ├── ImoocBootScalaApplicationTests.java │ └── service │ └── MetaDatabaseServiceTest.java ├── boot-session ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── leelovejava │ │ └── boot │ │ └── session │ │ ├── SessionApplication.java │ │ ├── config │ │ ├── SessionConfig.java │ │ └── SessionInitializer.java │ │ └── controller │ │ └── IndexController.java │ └── resources │ └── application.yml ├── boot-starter-tutorial ├── README.md ├── pom.xml └── src │ └── main │ ├── java │ └── site │ │ └── exception │ │ ├── GirlFriendAutoConfiguration.java │ │ ├── GirlFriendService.java │ │ ├── GirlFriendServiceImpl.java │ │ └── GirlFriendServiceProperties.java │ └── resources │ └── META-INF │ └── spring.factories ├── boot-statemachine ├── REAME.md ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── leelovejava │ │ └── boot │ │ └── statemachine │ │ ├── EventListener.java │ │ ├── StateMachineApplication.java │ │ ├── config │ │ └── StateMachineConfig.java │ │ ├── constant │ │ └── RedisKeyConstant.java │ │ ├── entity │ │ ├── Events.java │ │ ├── Order.java │ │ └── States.java │ │ └── service │ │ ├── BizStateMachinePersist.java │ │ └── StateMachineService.java │ └── resources │ └── application.yml ├── boot-swagger ├── REAME.md ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── didispace │ │ ├── Application.java │ │ ├── Swagger2.java │ │ ├── domain │ │ └── User.java │ │ └── web │ │ ├── HelloController.java │ │ └── UserController.java │ └── resources │ └── application.properties ├── boot-templates ├── boot-freemarker │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── didispace │ │ │ │ ├── Application.java │ │ │ │ └── web │ │ │ │ └── HelloController.java │ │ └── resources │ │ │ ├── application.properties │ │ │ └── templates │ │ │ └── index.ftl │ │ └── test │ │ └── java │ │ └── com │ │ └── didispace │ │ └── ApplicationTests.java ├── boot-thymeleaf │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── didispace │ │ │ │ ├── ThymeleafApplication.java │ │ │ │ ├── model │ │ │ │ └── User.java │ │ │ │ └── web │ │ │ │ └── HelloController.java │ │ └── resources │ │ │ ├── application.yml │ │ │ ├── assets │ │ │ ├── 1526434145635.png │ │ │ ├── 1526435213659.png │ │ │ ├── 1526435267302.png │ │ │ ├── 1526435317440.png │ │ │ ├── 1526435434999.png │ │ │ ├── 1526435647041.png │ │ │ ├── 1526435706301.png │ │ │ ├── 1526436248528.png │ │ │ ├── 1526438010948.png │ │ │ ├── 1526438337869.png │ │ │ ├── 1526440538848.png │ │ │ ├── 1526958538157.png │ │ │ ├── 1526958856078.png │ │ │ ├── 1526959781368.png │ │ │ ├── 1526959990356.png │ │ │ ├── 1526960230778.png │ │ │ ├── 1526960384564.png │ │ │ ├── 1526960499522.png │ │ │ ├── 1526960621714.png │ │ │ ├── 1526961251878.png │ │ │ ├── 1526961525185.png │ │ │ └── 1526961583904.png │ │ │ ├── templates │ │ │ ├── index.html │ │ │ ├── show2.html │ │ │ └── show3.html │ │ │ └── thymeleaf语法入门.md │ │ └── test │ │ └── java │ │ └── com │ │ └── didispace │ │ └── ApplicationTests.java ├── boot-velocity │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── didispace │ │ │ │ ├── Application.java │ │ │ │ └── web │ │ │ │ └── HelloController.java │ │ └── resources │ │ │ ├── application.properties │ │ │ └── templates │ │ │ └── index.vm │ │ └── test │ │ └── java │ │ └── com │ │ └── didispace │ │ └── ApplicationTests.java └── pom.xml ├── boot-validate ├── README.md ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── battcn │ │ ├── BootValidateApplication.java │ │ ├── annotation │ │ └── DateTime.java │ │ ├── controller │ │ └── ValidateController.java │ │ ├── pojo │ │ └── Book.java │ │ └── validator │ │ └── DateTimeValidator.java │ └── resources │ └── application.properties ├── boot-work-flowable ├── .gitignore ├── REAME.md ├── doc │ ├── 01-程序启动创建MySQL表.png │ ├── 02-创建60张表.png │ ├── 03-示例 请假流程.png │ └── 04-查看请假流程.png ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── leelovejava │ │ └── boot │ │ └── flowable │ │ ├── SpringbootWorkFlowableApplication.java │ │ ├── config │ │ └── FlowableConfig.java │ │ └── controller │ │ └── LeaveController.java │ └── resources │ ├── application.yml │ └── processes │ └── LeaveProcess.bpmn20.xml ├── drools-learning ├── README.md ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── leelovejava │ │ └── drools │ │ └── rules │ │ ├── aviator │ │ ├── Test.java │ │ └── package-info.java │ │ ├── easy │ │ ├── RuleClass.java │ │ ├── RuleJavaClient.java │ │ ├── RuleYmlClient.java │ │ └── package-info.java │ │ └── mvel │ │ ├── MvelUtils.java │ │ └── package-info.java │ └── resources │ ├── META-INF │ └── kmodule.xml │ ├── fizzbuzz.yml │ └── rules │ └── age.drl ├── easyexcel ├── README.md ├── pom.xml └── src │ └── test │ ├── java │ └── com │ │ ├── alibaba │ │ └── easyexcel │ │ │ └── test │ │ │ ├── WriteTest.java │ │ │ ├── listen │ │ │ └── ExcelListener.java │ │ │ ├── model │ │ │ ├── ReadModel.java │ │ │ ├── ReadModel0.java │ │ │ ├── ReadModel2.java │ │ │ ├── WriteModel.java │ │ │ └── WriteModel2.java │ │ │ └── util │ │ │ ├── DataUtil.java │ │ │ └── FileUtil.java │ │ └── leelovejava │ │ └── easyexcel │ │ └── ReadTest.java │ └── resources │ └── 1.xlsx ├── id-generate ├── README.md ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── leelovejava │ └── id │ └── generate │ └── snowflake │ ├── IdWorker.java │ ├── SnowflakeIdFactory.java │ └── SnowflakeIdWorker.java ├── java-new-features ├── REAMDE.md ├── jdk11-learning │ ├── README.md │ ├── jdk11-learning.iml │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── atguigu │ │ └── java │ │ ├── ApiTest.java │ │ ├── EpsilonTest.java │ │ ├── HttpClientTest.java │ │ ├── InputStreamTest.java │ │ ├── OptionalTest.java │ │ ├── StreamTest.java │ │ ├── StringTest.java │ │ └── ZgcTest.java ├── jdk12-learning │ ├── README.md │ ├── pom.xml │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── atguigu │ │ │ └── java │ │ │ ├── FilesTest.java │ │ │ ├── NumberFormatTest.java │ │ │ ├── StringConstantTest.java │ │ │ ├── StringTest.java │ │ │ ├── SwitchNewTest.java │ │ │ └── SwitchOldTest.java │ └── tmp │ │ ├── a.txt │ │ └── b.txt ├── jdk13-learning │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── com.atguigu.java │ │ ├── SwitchTest.java │ │ └── TextBlockTest.java ├── jdk15-learning │ ├── README.md │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── atguigu │ │ ├── java │ │ ├── LambdaTest.java │ │ └── Person.java │ │ ├── java1 │ │ ├── InstanceofTest.java │ │ ├── TextBlocksTest.java │ │ └── record │ │ │ ├── Customer.java │ │ │ ├── Point.java │ │ │ └── RecordTest.java │ │ └── java2 │ │ └── EdDSATest.java ├── jdk8-learning │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── atguigu │ │ │ ├── annotation │ │ │ ├── MyAnnotation.java │ │ │ ├── MyAnnotations.java │ │ │ └── TestAnnotation.java │ │ │ ├── dateapi │ │ │ ├── DateFormatThreadLocal.java │ │ │ ├── LocalDateTimeTest.java │ │ │ └── SimpleDateFormatTest.java │ │ │ ├── forkjoin │ │ │ ├── ForkJoinCalculate.java │ │ │ └── TestForkJoin.java │ │ │ ├── function │ │ │ ├── MyFunction.java │ │ │ ├── MyFunction2.java │ │ │ └── TestLambda.java │ │ │ ├── lambda │ │ │ ├── Employee.java │ │ │ ├── FilterEmployeeForAge.java │ │ │ ├── FilterEmployeeForSalary.java │ │ │ ├── Lambda1Test.java │ │ │ ├── Lambda2Test.java │ │ │ ├── Lambda3Test.java │ │ │ ├── MethodRefTest.java │ │ │ ├── MyFun.java │ │ │ ├── MyPredicate.java │ │ │ └── StreamApiTest.java │ │ │ ├── optional │ │ │ ├── NewMan.java │ │ │ └── TestOptional.java │ │ │ ├── statisfunction │ │ │ ├── MyFun.java │ │ │ ├── MyInterface.java │ │ │ ├── SubClass.java │ │ │ └── TestDefaultInterface.java │ │ │ └── stream │ │ │ ├── MyClass.java │ │ │ ├── TestStreamAPI1.java │ │ │ ├── TestStreamAPI2.java │ │ │ ├── TestStreamAPI3.java │ │ │ ├── exec │ │ │ ├── TransactionTest.java │ │ │ └── model │ │ │ │ ├── Trader.java │ │ │ │ └── Transaction.java │ │ │ ├── list │ │ │ └── TestStreamListApi.java │ │ │ └── model │ │ │ ├── Employee.java │ │ │ ├── Godness.java │ │ │ └── Man.java │ │ └── test │ │ ├── java │ │ └── com │ │ │ └── leelovejava │ │ │ ├── classloader │ │ │ └── MyClassLoader.java │ │ │ ├── gc │ │ │ ├── FinallizeGc.java │ │ │ └── ReferenceCountingGC.java │ │ │ ├── interview │ │ │ ├── MultiBigIntTest.java │ │ │ ├── SaleNumberToChar.java │ │ │ ├── Test1.java │ │ │ ├── Test10.java │ │ │ ├── Test10_2.java │ │ │ ├── Test11.java │ │ │ ├── Test13.java │ │ │ ├── Test14.java │ │ │ ├── Test15.java │ │ │ ├── Test16.java │ │ │ ├── Test2.java │ │ │ ├── Test3.java │ │ │ ├── Test4.java │ │ │ ├── Test5.java │ │ │ ├── Test6.java │ │ │ ├── Test7.java │ │ │ ├── Test8.java │ │ │ ├── Test9.java │ │ │ ├── code │ │ │ │ ├── AllNotTheSame.java │ │ │ │ ├── CountTextLineNum.java │ │ │ │ ├── GoSteps.java │ │ │ │ ├── ReplaceSpecialCharacter.java │ │ │ │ └── package-info.java │ │ │ ├── design │ │ │ │ ├── observer │ │ │ │ │ └── ObserverPattern.java │ │ │ │ ├── package-info.java │ │ │ │ └── singleton │ │ │ │ │ ├── Singleton01.java │ │ │ │ │ ├── Singleton02.java │ │ │ │ │ ├── Singleton03.java │ │ │ │ │ ├── Singleton04.java │ │ │ │ │ └── Singleton05.java │ │ │ ├── ip │ │ │ │ ├── IpTest.java │ │ │ │ └── IpTest2.java │ │ │ ├── jvm │ │ │ │ ├── oom │ │ │ │ │ ├── GCOverheadDemo.java │ │ │ │ │ ├── JavaHeapSpaceDemo.java │ │ │ │ │ ├── StackOverflowErrorDemo.java │ │ │ │ │ └── package-info.java │ │ │ │ └── ref │ │ │ │ │ ├── BitMap.java │ │ │ │ │ ├── PhantomReferenceDemo.java │ │ │ │ │ ├── ReferenceQueueDemo.java │ │ │ │ │ ├── ReferenceScenes.java │ │ │ │ │ ├── SoftReferenceDemo.java │ │ │ │ │ ├── StrongReferenceDemo.java │ │ │ │ │ ├── WeakHashMapDemo.java │ │ │ │ │ ├── WeakReferenceDemo.java │ │ │ │ │ └── package-info.java │ │ │ ├── map │ │ │ │ └── TestHashMap.java │ │ │ └── sort │ │ │ │ ├── ListNode.java │ │ │ │ └── SortTest.java │ │ │ ├── juc │ │ │ ├── SemaphoreTest.java │ │ │ ├── TestABCAlternate.java │ │ │ ├── TestAtomicDemo.java │ │ │ ├── TestCallable.java │ │ │ ├── TestCompareAndSwap.java │ │ │ ├── TestCopyOnWriteArrayList.java │ │ │ ├── TestCountDownLatch.java │ │ │ ├── TestForkJoinPool.java │ │ │ ├── TestLock.java │ │ │ ├── TestProductorAndConsumer.java │ │ │ ├── TestProductorAndConsumerForLock.java │ │ │ ├── TestReadWriteLock.java │ │ │ ├── TestScheduledThreadPool.java │ │ │ ├── TestThread8Monitor.java │ │ │ ├── TestThreadPool.java │ │ │ ├── TestVolatile.java │ │ │ └── package-info.java │ │ │ ├── jvisualvm │ │ │ ├── DeadLock.java │ │ │ ├── JavaHeapTest.java │ │ │ ├── MemoryCpuTest.java │ │ │ ├── MyThread.java │ │ │ └── TestPermGen.java │ │ │ ├── operation │ │ │ ├── BitTest.java │ │ │ └── structures │ │ │ │ ├── ArrayStack.java │ │ │ │ ├── PriorityQueue.java │ │ │ │ ├── RoundQueue.java │ │ │ │ └── redblock │ │ │ │ ├── RBTree.java │ │ │ │ └── RBTreeNode.java │ │ │ └── zip │ │ │ ├── FileUtils.java │ │ │ └── ZipTest.java │ │ └── resources │ │ └── 面试 Java 编程机试题 60 例答案及关键思路讲解.md └── pom.xml ├── java-tools-learning ├── pom.xml └── src │ └── test │ └── java │ └── com │ └── leelovejava │ └── tools │ ├── commons │ ├── BeanUtilsTest.java │ ├── CodecTest.java │ ├── CollectionsTest.java │ ├── IOUtilsTest.java │ ├── LangTest.java │ └── model │ │ └── User.java │ └── guava │ ├── BloomFilterTest.java │ ├── CollectionTest.java │ └── WatchTest.java ├── jsoup ├── pom.xml └── src │ ├── main │ └── resources │ │ └── test.js │ └── test │ ├── java │ └── com │ │ └── leelovejava │ │ └── jsoup │ │ ├── Test01.java │ │ ├── Test02.java │ │ └── TestSelenium.java │ └── resources │ └── crypto-js-4.0.0 │ └── crypto-js.js ├── jwt-boot ├── README.md ├── assets │ └── images │ │ ├── 16024917572853.jpg │ │ ├── 16025554664693.jpg │ │ ├── 16025582888220.jpg │ │ ├── 16025588086122.jpg │ │ ├── 16025593897605.jpg │ │ └── 16025831079288.jpg ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── leelovejava │ │ └── boot │ │ └── jwt │ │ ├── JwtApplication.java │ │ ├── config │ │ ├── AudienceConfig.java │ │ ├── CorsConfig.java │ │ └── WebMvcConfig.java │ │ ├── constant │ │ ├── Constants.java │ │ └── ResultEnum.java │ │ ├── controller │ │ └── UserController.java │ │ ├── filter │ │ └── JwtFilter.java │ │ ├── service │ │ ├── UserService.java │ │ └── UserServiceImpl.java │ │ ├── util │ │ ├── JwtHelper.java │ │ ├── MatcherUtil.java │ │ └── ResultVOUtil.java │ │ └── vo │ │ ├── ResultVo.java │ │ ├── RoleVo.java │ │ └── UserVo.java │ └── resources │ └── application.yml └── seckill ├── pom.xml └── resources ├── readme.md ├── seckill.sql ├── start-service.sh └── start-web.sh /.gitignore: -------------------------------------------------------------------------------- 1 | .class 2 | .classpath 3 | .project 4 | build 5 | bin 6 | .bak 7 | .settings 8 | Thumbs.db 9 | .DS_Store 10 | ._.DS_Store 11 | logs 12 | target 13 | *.iml 14 | .idea 15 | -------------------------------------------------------------------------------- /Chapter1/src/main/java/com/didispace/Chapter1Application.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Chapter1Application { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Chapter1Application.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Chapter1/src/main/java/com/didispace/web/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.didispace.web; 2 | 3 | import org.springframework.web.bind.annotation.RequestMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | public class HelloController { 8 | 9 | @RequestMapping("/hello") 10 | public String index() { 11 | return "Hello World"; 12 | } 13 | 14 | } -------------------------------------------------------------------------------- /Chapter1/src/main/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/Chapter1/src/main/resources/application.properties -------------------------------------------------------------------------------- /Chapter2-1-1/src/main/java/com/didispace/Application.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * 8 | * @author 程序猿DD 9 | * @version 1.0.0 10 | * @blog http://blog.didispace.com 11 | * 12 | */ 13 | @SpringBootApplication 14 | public class Application { 15 | 16 | public static void main(String[] args) { 17 | 18 | SpringApplication.run(Application.class, args); 19 | 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /Chapter2-1-1/src/main/java/com/didispace/web/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.didispace.web; 2 | 3 | import org.springframework.web.bind.annotation.RequestMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | /** 7 | * 8 | * @author 程序猿DD 9 | * @version 1.0.0 10 | * @blog http://blog.didispace.com 11 | * 12 | */ 13 | @RestController 14 | public class HelloController { 15 | 16 | @RequestMapping("/hello") 17 | public String index() { 18 | return "Hello World"; 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /Chapter2-1-1/src/main/resources/application-dev.properties: -------------------------------------------------------------------------------- 1 | # 服务端口 2 | server.port=1111 -------------------------------------------------------------------------------- /Chapter2-1-1/src/main/resources/application-prod.properties: -------------------------------------------------------------------------------- 1 | # 服务端口 2 | server.port=3333 -------------------------------------------------------------------------------- /Chapter2-1-1/src/main/resources/application-test.properties: -------------------------------------------------------------------------------- 1 | # 服务端口 2 | server.port=2222 -------------------------------------------------------------------------------- /Chapter2-1-1/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | com.didispace.blog.name=程序猿DD 2 | com.didispace.blog.title=Spring Boot教程 3 | com.didispace.blog.desc=${com.didispace.blog.name}正在努力写《${com.didispace.blog.title}》 4 | 5 | # 随机字符串 6 | com.didispace.blog.value=${random.value} 7 | # 随机int 8 | com.didispace.blog.number=${random.int} 9 | # 随机long 10 | com.didispace.blog.bignumber=${random.long} 11 | # 10以内的随机数 12 | com.didispace.blog.test1=${random.int(10)} 13 | # 10-20的随机数 14 | com.didispace.blog.test2=${random.int[10,20]} 15 | 16 | # 多环境配置文件激活属性 17 | spring.profiles.active=dev -------------------------------------------------------------------------------- /Chapter2-1-2/src/main/java/com/didispace/ApplicationEnvironmentPreparedEventListener.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent; 5 | import org.springframework.context.ApplicationListener; 6 | 7 | @Slf4j 8 | public class ApplicationEnvironmentPreparedEventListener implements ApplicationListener { 9 | 10 | @Override 11 | public void onApplicationEvent(ApplicationEnvironmentPreparedEvent event) { 12 | log.info("......ApplicationEnvironmentPreparedEvent......"); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /Chapter2-1-2/src/main/java/com/didispace/ApplicationFailedEventListener.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | import org.springframework.boot.context.event.ApplicationFailedEvent; 5 | import org.springframework.context.ApplicationListener; 6 | 7 | @Slf4j 8 | public class ApplicationFailedEventListener implements ApplicationListener { 9 | 10 | @Override 11 | public void onApplicationEvent(ApplicationFailedEvent event) { 12 | log.info("......ApplicationFailedEvent......"); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /Chapter2-1-2/src/main/java/com/didispace/ApplicationPreparedEventListener.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | import org.springframework.boot.context.event.ApplicationPreparedEvent; 5 | import org.springframework.context.ApplicationListener; 6 | 7 | @Slf4j 8 | public class ApplicationPreparedEventListener implements ApplicationListener { 9 | 10 | @Override 11 | public void onApplicationEvent(ApplicationPreparedEvent event) { 12 | log.info("......ApplicationPreparedEvent......"); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /Chapter2-1-2/src/main/java/com/didispace/ApplicationReadyEventListener.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | import org.springframework.boot.context.event.ApplicationReadyEvent; 5 | import org.springframework.context.ApplicationListener; 6 | 7 | @Slf4j 8 | public class ApplicationReadyEventListener implements ApplicationListener { 9 | 10 | @Override 11 | public void onApplicationEvent(ApplicationReadyEvent event) { 12 | log.info("......ApplicationReadyEvent......"); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /Chapter2-1-2/src/main/java/com/didispace/ApplicationStartedEventListener.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.context.event.ApplicationStartedEvent; 6 | import org.springframework.context.ApplicationListener; 7 | 8 | @Slf4j 9 | public class ApplicationStartedEventListener implements ApplicationListener { 10 | 11 | @Override 12 | public void onApplicationEvent(ApplicationStartedEvent event) { 13 | log.info("......ApplicationStartedEvent......"); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /Chapter2-1-2/src/main/java/com/didispace/ApplicationStartingEventListener.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | import org.springframework.boot.context.event.ApplicationStartingEvent; 5 | import org.springframework.context.ApplicationListener; 6 | 7 | @Slf4j 8 | public class ApplicationStartingEventListener implements ApplicationListener { 9 | 10 | @Override 11 | public void onApplicationEvent(ApplicationStartingEvent event) { 12 | log.info("......ApplicationStartingEvent......"); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /Chapter2-1-2/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.context.ApplicationListener=com.didispace.ApplicationEnvironmentPreparedEventListener,\ 2 | com.didispace.ApplicationFailedEventListener,\ 3 | com.didispace.ApplicationPreparedEventListener,\ 4 | com.didispace.ApplicationReadyEventListener,\ 5 | com.didispace.ApplicationStartedEventListener,\ 6 | com.didispace.ApplicationStartingEventListener -------------------------------------------------------------------------------- /Chapter2-1-2/src/main/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/Chapter2-1-2/src/main/resources/application.properties -------------------------------------------------------------------------------- /Chapter2-2-1/src/main/java/com/didispace/FooProperties.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import lombok.Data; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | 6 | /** 7 | * Spring Boot Configuration Annotation Processor not configured 问题解决 8 | * https://blog.csdn.net/liangjiabao5555/article/details/104062932 9 | * @author leelovejava 10 | */ 11 | @Data 12 | @ConfigurationProperties(prefix = "com.didispace") 13 | public class FooProperties { 14 | 15 | private String foo; 16 | 17 | private String databasePlatform; 18 | 19 | } -------------------------------------------------------------------------------- /Chapter2-2-1/src/main/java/com/didispace/PostInfo.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import lombok.Data; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | 6 | @Data 7 | @ConfigurationProperties 8 | public class PostInfo { 9 | 10 | private String title; 11 | private String content; 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Chapter2-2-1/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | com.didispace.foo=bar 2 | com.didispace.database-platform=sql 3 | 4 | com.didispace.post[0]=Why Spring Boot 5 | com.didispace.post[1]=Why Spring Cloud 6 | 7 | com.didispace.posts[0].title=Why Spring Boot 8 | com.didispace.posts[0].content=It is perfect! 9 | com.didispace.posts[1].title=Why Spring Cloud 10 | com.didispace.posts[1].content=It is perfect too! 11 | -------------------------------------------------------------------------------- /Chapter3-1-1/src/main/java/com/didispace/Application.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * 8 | * @author 程序猿DD 9 | * @version 1.0.0 10 | * @blog http://blog.didispace.com 11 | * 12 | */ 13 | @SpringBootApplication 14 | public class Application { 15 | 16 | public static void main(String[] args) { 17 | 18 | SpringApplication.run(Application.class, args); 19 | 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /Chapter3-1-1/src/main/java/com/didispace/web/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.didispace.web; 2 | 3 | import org.springframework.web.bind.annotation.RequestMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | /** 7 | * 8 | * @author 程序猿DD 9 | * @version 1.0.0 10 | * @blog http://blog.didispace.com 11 | * 12 | */ 13 | @RestController 14 | public class HelloController { 15 | 16 | @RequestMapping("/hello") 17 | public String index() { 18 | return "Hello World"; 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /Chapter3-1-1/src/main/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/Chapter3-1-1/src/main/resources/application.properties -------------------------------------------------------------------------------- /Chapter3-1-6/src/main/java/com/didispace/Application.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * 8 | * @author 程序猿DD 9 | * @version 1.0.0 10 | * @blog http://blog.didispace.com 11 | * 12 | */ 13 | @SpringBootApplication 14 | public class Application { 15 | 16 | public static void main(String[] args) { 17 | 18 | SpringApplication.run(Application.class, args); 19 | 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /Chapter3-1-6/src/main/java/com/didispace/exception/MyException.java: -------------------------------------------------------------------------------- 1 | package com.didispace.exception; 2 | 3 | /** 4 | * @author 程序猿DD 5 | * @version 1.0.0 6 | * @date 16/5/2 上午10:50. 7 | * @blog http://blog.didispace.com 8 | */ 9 | public class MyException extends Exception { 10 | 11 | public MyException(String message) { 12 | super(message); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /Chapter3-1-6/src/main/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/Chapter3-1-6/src/main/resources/application.properties -------------------------------------------------------------------------------- /Chapter3-1-6/src/main/resources/templates/error.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 统一异常处理 6 | 7 | 8 |

Error Handler

9 |
10 |
11 | 12 | -------------------------------------------------------------------------------- /Chapter3-1-6/src/main/resources/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

Hello World

9 | 10 | -------------------------------------------------------------------------------- /Chapter3-1-7/src/main/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/Chapter3-1-7/src/main/resources/application.properties -------------------------------------------------------------------------------- /Chapter3-2-1/src/main/java/com/didispace/Application.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Application { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Application.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Chapter3-2-1/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.url=jdbc:mysql://localhost:3306/test 2 | spring.datasource.username=root 3 | spring.datasource.password=root 4 | spring.datasource.driver-class-name=com.mysql.jdbc.Driver -------------------------------------------------------------------------------- /Chapter3-2-10/src/main/java/com/didispace/Application.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Application { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Application.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Chapter3-2-10/src/main/java/com/didispace/Person.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import lombok.Data; 4 | import org.springframework.ldap.odm.annotations.*; 5 | 6 | import javax.naming.Name; 7 | 8 | @Entry(base = "ou=people,dc=didispace,dc=com", objectClasses = "inetOrgPerson") 9 | @Data 10 | public class Person { 11 | 12 | @Id 13 | private Name id; 14 | @DnAttribute(value = "uid", index = 3) 15 | private String uid; 16 | @Attribute(name = "cn") 17 | private String commonName; 18 | @Attribute(name = "sn") 19 | private String suerName; 20 | private String userPassword; 21 | 22 | } 23 | -------------------------------------------------------------------------------- /Chapter3-2-10/src/main/java/com/didispace/PersonRepository.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import org.springframework.data.repository.CrudRepository; 4 | 5 | import javax.naming.Name; 6 | 7 | public interface PersonRepository extends CrudRepository { 8 | 9 | 10 | } -------------------------------------------------------------------------------- /Chapter3-2-10/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | #spring.ldap.urls=ldap://localhost:1235 2 | #spring.ldap.base=dc=didispace,dc=com 3 | #spring.ldap.username=didispace 4 | #spring.ldap.password=123456 -------------------------------------------------------------------------------- /Chapter3-2-10/src/test/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.ldap.embedded.ldif=ldap-server.ldif 2 | spring.ldap.embedded.base-dn=dc=didispace,dc=com 3 | 4 | -------------------------------------------------------------------------------- /Chapter3-2-10/src/test/resources/ldap-server.ldif: -------------------------------------------------------------------------------- 1 | dn: dc=didispace,dc=com 2 | objectClass: top 3 | objectClass: domain 4 | 5 | dn: ou=people,dc=didispace,dc=com 6 | objectclass: top 7 | objectclass: organizationalUnit 8 | ou: people 9 | 10 | dn: uid=ben,ou=people,dc=didispace,dc=com 11 | objectclass: top 12 | objectclass: person 13 | objectclass: organizationalPerson 14 | objectclass: inetOrgPerson 15 | cn: didi 16 | sn: zhaiyongchao 17 | uid: didi 18 | userPassword: {SHA}nFCebWjxfaLbHHG1Qk5UU4trbvQ= 19 | -------------------------------------------------------------------------------- /Chapter3-2-11/src/main/java/com/didispace/Application.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import com.spring4all.mongodb.EnableMongoPlus; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | 7 | @EnableMongoPlus 8 | @SpringBootApplication 9 | public class Application { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(Application.class, args); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /Chapter3-2-11/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.data.mongodb.uri=mongodb://localhost:27017/test 2 | 3 | spring.data.mongodb.option.min-connection-per-host=20 4 | spring.data.mongodb.option.max-connection-per-host=200 5 | -------------------------------------------------------------------------------- /Chapter3-2-2/src/main/java/com/didispace/Application.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Application { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Application.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Chapter3-2-2/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.url=jdbc:mysql://localhost:3306/test 2 | spring.datasource.username=root 3 | spring.datasource.password=root 4 | spring.datasource.driver-class-name=com.mysql.jdbc.Driver 5 | 6 | spring.jpa.properties.hibernate.hbm2ddl.auto=create-drop -------------------------------------------------------------------------------- /Chapter3-2-3/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.primary.url=jdbc:mysql://192.168.109.128:3306/test1 2 | spring.datasource.primary.username=root 3 | spring.datasource.primary.password=123456 4 | spring.datasource.primary.driver-class-name=com.mysql.jdbc.Driver 5 | 6 | spring.datasource.secondary.url=jdbc:mysql://192.168.109.128:3306/test2 7 | spring.datasource.secondary.username=root 8 | spring.datasource.secondary.password=123456 9 | spring.datasource.secondary.driver-class-name=com.mysql.jdbc.Driver 10 | -------------------------------------------------------------------------------- /Chapter3-2-4/src/main/java/com/didispace/domain/p/UserRepository.java: -------------------------------------------------------------------------------- 1 | package com.didispace.domain.p; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | import org.springframework.data.jpa.repository.Query; 5 | import org.springframework.data.repository.query.Param; 6 | 7 | 8 | /** 9 | * @author 程序猿DD 10 | * @version 1.0.0 11 | * @date 16/3/23 下午2:34. 12 | * @blog http://blog.didispace.com 13 | */ 14 | public interface UserRepository extends JpaRepository { 15 | 16 | 17 | } 18 | -------------------------------------------------------------------------------- /Chapter3-2-4/src/main/java/com/didispace/domain/s/MessageRepository.java: -------------------------------------------------------------------------------- 1 | package com.didispace.domain.s; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | 5 | 6 | /** 7 | * @author 程序猿DD 8 | * @version 1.0.0 9 | * @date 16/3/23 下午2:34. 10 | * @blog http://blog.didispace.com 11 | */ 12 | public interface MessageRepository extends JpaRepository { 13 | 14 | 15 | } 16 | -------------------------------------------------------------------------------- /Chapter3-2-4/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.primary.url=jdbc:mysql://localhost:3306/test1 2 | spring.datasource.primary.username=root 3 | spring.datasource.primary.password=52261340 4 | spring.datasource.primary.driver-class-name=com.mysql.jdbc.Driver 5 | 6 | spring.datasource.secondary.url=jdbc:mysql://localhost:3306/test2 7 | spring.datasource.secondary.username=root 8 | spring.datasource.secondary.password=52261340 9 | spring.datasource.secondary.driver-class-name=com.mysql.jdbc.Driver 10 | 11 | spring.jpa.properties.hibernate.hbm2ddl.auto=create-drop -------------------------------------------------------------------------------- /Chapter3-2-5/src/main/java/com/didispace/Application.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Application { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Application.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Chapter3-2-5/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | # REDIS (RedisProperties) 2 | # Redis数据库索引(默认为0) 3 | spring.redis.database=0 4 | # Redis服务器地址 5 | spring.redis.host=localhost 6 | # Redis服务器连接端口 7 | spring.redis.port=6379 8 | # Redis服务器连接密码(默认为空) 9 | spring.redis.password= 10 | # 连接池最大连接数(使用负值表示没有限制) 11 | spring.redis.pool.max-active=8 12 | # 连接池最大阻塞等待时间(使用负值表示没有限制) 13 | spring.redis.pool.max-wait=-1 14 | # 连接池中的最大空闲连接 15 | spring.redis.pool.max-idle=8 16 | # 连接池中的最小空闲连接 17 | spring.redis.pool.min-idle=0 18 | # 连接超时时间(毫秒) 19 | spring.redis.timeout=0 20 | 21 | 22 | -------------------------------------------------------------------------------- /Chapter3-2-7/src/main/java/com/didispace/Application.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Application { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Application.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Chapter3-2-7/src/main/java/com/didispace/domain/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.didispace.domain; 2 | 3 | import org.apache.ibatis.annotations.*; 4 | 5 | @Mapper 6 | public interface UserMapper { 7 | 8 | @Select("SELECT * FROM USER WHERE NAME = #{name}") 9 | User findByName(@Param("name") String name); 10 | 11 | @Insert("INSERT INTO USER(NAME, AGE) VALUES(#{name}, #{age})") 12 | int insert(@Param("name") String name, @Param("age") Integer age); 13 | 14 | } -------------------------------------------------------------------------------- /Chapter3-2-7/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.url=jdbc:mysql://localhost:3306/test 2 | spring.datasource.username=root 3 | spring.datasource.password=123456 4 | spring.datasource.driver-class-name=com.mysql.jdbc.Driver -------------------------------------------------------------------------------- /Chapter3-2-8/src/main/java/com/didispace/Application.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Application { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Application.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Chapter3-2-8/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.url=jdbc:mysql://localhost:3306/test 2 | spring.datasource.username=root 3 | spring.datasource.password=123456 4 | spring.datasource.driver-class-name=com.mysql.jdbc.Driver -------------------------------------------------------------------------------- /Chapter3-3-1/src/main/java/com/didispace/Application.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Application { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Application.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Chapter3-3-1/src/main/java/com/didispace/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.didispace.service; 2 | 3 | import com.didispace.domain.User; 4 | import org.springframework.transaction.annotation.Propagation; 5 | import org.springframework.transaction.annotation.Isolation; 6 | import org.springframework.transaction.annotation.Transactional; 7 | 8 | 9 | /** 10 | * Created by Administrator on 2016/5/27. 11 | */ 12 | public interface UserService { 13 | 14 | @Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED) 15 | User login(String name, String password); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /Chapter3-3-1/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.url=jdbc:mysql://localhost:3306/test 2 | spring.datasource.username=root 3 | spring.datasource.password=123456 4 | spring.datasource.driver-class-name=com.mysql.jdbc.Driver 5 | 6 | spring.jpa.properties.hibernate.hbm2ddl.auto=create -------------------------------------------------------------------------------- /Chapter4-1-1/README.md: -------------------------------------------------------------------------------- 1 | ## boot并发 2 | [SpringBoot开发案例之CountDownLatch多任务并行处理](https://blog.52itstyle.com/archives/2689/) 3 | 4 | [SpringBoot开发案例之多任务并行+线程池处理](https://blog.52itstyle.com/archives/2705/) 5 | 6 | [SpringBoot开发案例从0到1构建分布式秒杀系统](https://blog.52itstyle.com/archives/2853/) -------------------------------------------------------------------------------- /Chapter4-1-1/src/main/java/com/didispace/Application.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.scheduling.annotation.EnableScheduling; 6 | 7 | @SpringBootApplication 8 | @EnableScheduling 9 | public class Application { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(Application.class, args); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /Chapter4-1-1/src/main/java/com/didispace/task/ScheduledTasks.java: -------------------------------------------------------------------------------- 1 | package com.didispace.task; 2 | 3 | import org.springframework.scheduling.annotation.Scheduled; 4 | import org.springframework.stereotype.Component; 5 | 6 | import java.text.SimpleDateFormat; 7 | import java.util.Date; 8 | 9 | @Component 10 | public class ScheduledTasks { 11 | 12 | private static final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss"); 13 | 14 | @Scheduled(fixedRate = 5000) 15 | public void reportCurrentTime() { 16 | System.out.println("当前时间:" + dateFormat.format(new Date())); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /Chapter4-1-1/src/main/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/Chapter4-1-1/src/main/resources/application.properties -------------------------------------------------------------------------------- /Chapter4-1-1/src/test/java/com/didispace/ApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.SpringApplicationConfiguration; 6 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 7 | 8 | 9 | @RunWith(SpringJUnit4ClassRunner.class) 10 | @SpringApplicationConfiguration(classes = Application.class) 11 | public class ApplicationTests { 12 | 13 | 14 | @Test 15 | public void getHello() throws Exception { 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /Chapter4-1-2/src/main/java/com/didispace/Application.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.scheduling.annotation.EnableAsync; 6 | import org.springframework.scheduling.annotation.EnableScheduling; 7 | 8 | @SpringBootApplication 9 | @EnableAsync 10 | public class Application { 11 | 12 | public static void main(String[] args) { 13 | SpringApplication.run(Application.class, args); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /Chapter4-1-2/src/main/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/Chapter4-1-2/src/main/resources/application.properties -------------------------------------------------------------------------------- /Chapter4-1-3/src/main/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/Chapter4-1-3/src/main/resources/application.properties -------------------------------------------------------------------------------- /Chapter4-1-4/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.redis.pool.max-wait=5000 2 | spring.redis.pool.max-active=10 3 | -------------------------------------------------------------------------------- /Chapter4-1-5/src/main/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/Chapter4-1-5/src/main/resources/application.properties -------------------------------------------------------------------------------- /Chapter4-2-2/README.md: -------------------------------------------------------------------------------- 1 | # boot-log 2 | 3 | [SpringBoot 2.x中英文日志配置详解](https://blog.52itstyle.com/archives/2632/) -------------------------------------------------------------------------------- /Chapter4-2-2/src/main/java/com/didispace/Application.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import org.apache.log4j.Logger; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.scheduling.annotation.EnableAsync; 7 | import org.springframework.scheduling.annotation.EnableScheduling; 8 | 9 | @SpringBootApplication 10 | public class Application { 11 | 12 | public static void main(String[] args) { 13 | SpringApplication.run(Application.class, args); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /Chapter4-2-2/src/main/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/Chapter4-2-2/src/main/resources/application.properties -------------------------------------------------------------------------------- /Chapter4-2-3/src/main/java/com/didispace/Application.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import org.apache.log4j.Logger; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.scheduling.annotation.EnableAsync; 7 | import org.springframework.scheduling.annotation.EnableScheduling; 8 | 9 | @SpringBootApplication 10 | public class Application { 11 | 12 | public static void main(String[] args) { 13 | SpringApplication.run(Application.class, args); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /Chapter4-2-3/src/main/resources/application-dev.properties: -------------------------------------------------------------------------------- 1 | logging.level.com.didispace=INFO -------------------------------------------------------------------------------- /Chapter4-2-3/src/main/resources/application-prod.properties: -------------------------------------------------------------------------------- 1 | logging.level.com.didispace=INFO -------------------------------------------------------------------------------- /Chapter4-2-3/src/main/resources/application-test.properties: -------------------------------------------------------------------------------- 1 | logging.level.com.didispace=DEBUG -------------------------------------------------------------------------------- /Chapter4-2-3/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.profiles.active=dev -------------------------------------------------------------------------------- /Chapter4-2-4/src/main/java/com/didispace/Application.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Application { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Application.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Chapter4-2-4/src/main/java/com/didispace/web/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.didispace.web; 2 | 3 | import org.springframework.web.bind.annotation.*; 4 | 5 | /** 6 | * @author 程序猿DD 7 | * @version 1.0.0 8 | * @date 16/5/19 下午1:27. 9 | * @blog http://blog.didispace.com 10 | */ 11 | @RestController 12 | public class HelloController { 13 | 14 | @RequestMapping(value = "/hello", method = RequestMethod.GET) 15 | @ResponseBody 16 | public String hello(@RequestParam String name) { 17 | return "Hello " + name; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /Chapter4-2-4/src/main/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/Chapter4-2-4/src/main/resources/application.properties -------------------------------------------------------------------------------- /Chapter4-2-6/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | management.security.enabled=false 2 | -------------------------------------------------------------------------------- /Chapter4-2-6/src/test/java/com/didispace/DemoApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class DemoApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /Chapter4-3-1/src/main/java/com/didispace/Application.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * 8 | * @author 程序猿DD 9 | * @version 1.0.0 10 | * @blog http://blog.didispace.com 11 | * 12 | */ 13 | @SpringBootApplication 14 | public class Application { 15 | 16 | public static void main(String[] args) { 17 | 18 | SpringApplication.run(Application.class, args); 19 | 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /Chapter4-3-1/src/main/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/Chapter4-3-1/src/main/resources/application.properties -------------------------------------------------------------------------------- /Chapter4-3-1/src/main/resources/templates/hello.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | Hello World! 6 | 7 | 8 |

Hello [[${#httpServletRequest.remoteUser}]]!

9 |
10 | 11 |
12 | 13 | -------------------------------------------------------------------------------- /Chapter4-3-1/src/main/resources/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | Spring Security入门 6 | 7 | 8 |

欢迎使用Spring Security!

9 | 10 |

点击 这里 打个招呼吧

11 | 12 | -------------------------------------------------------------------------------- /Chapter4-4-1/src/main/java/com/didispace/Application.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cache.annotation.EnableCaching; 6 | 7 | /** 8 | * @author 程序猿DD 9 | * @version 1.0.0 10 | * @date 16/3/23 下午2:34. 11 | * @blog http://blog.didispace.com 12 | */ 13 | @SpringBootApplication 14 | @EnableCaching 15 | public class Application { 16 | 17 | public static void main(String[] args) { 18 | SpringApplication.run(Application.class, args); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /Chapter4-4-1/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.url=jdbc:mysql://localhost:3306/test 2 | spring.datasource.username=root 3 | spring.datasource.password=123456 4 | spring.datasource.driver-class-name=com.mysql.jdbc.Driver 5 | 6 | spring.jpa.properties.hibernate.hbm2ddl.auto=create-drop 7 | spring.jpa.properties.hibernate.show_sql=true -------------------------------------------------------------------------------- /Chapter4-4-1/src/main/resources/ehcache.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Chapter4-4-2/src/main/java/com/didispace/Application.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cache.annotation.EnableCaching; 6 | 7 | /** 8 | * @author 程序猿DD 9 | * @version 1.0.0 10 | * @date 16/3/23 下午2:34. 11 | * @blog http://blog.didispace.com 12 | */ 13 | @SpringBootApplication 14 | @EnableCaching 15 | public class Application { 16 | 17 | public static void main(String[] args) { 18 | SpringApplication.run(Application.class, args); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /Chapter4-4-2/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.url=jdbc:mysql://localhost:3306/test 2 | spring.datasource.username=root 3 | spring.datasource.password=123456 4 | spring.datasource.driver-class-name=com.mysql.jdbc.Driver 5 | 6 | spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect 7 | spring.jpa.properties.hibernate.hbm2ddl.auto=create-drop 8 | spring.jpa.properties.hibernate.show_sql=true 9 | 10 | spring.redis.host=localhost 11 | spring.redis.port=6379 12 | spring.redis.pool.max-idle=8 13 | spring.redis.pool.min-idle=0 14 | spring.redis.pool.max-active=8 15 | spring.redis.pool.max-wait=-1 16 | 17 | -------------------------------------------------------------------------------- /Chapter4-5-1/src/main/java/com/didispace/Application.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Application { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Application.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Chapter4-5-1/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.mail.host=smtp.qq.com 2 | spring.mail.username=username@qq.com 3 | spring.mail.password=password 4 | spring.mail.properties.mail.smtp.auth=true 5 | spring.mail.properties.mail.smtp.starttls.enable=true 6 | spring.mail.properties.mail.smtp.starttls.required=true -------------------------------------------------------------------------------- /Chapter4-5-1/src/main/resources/templates/template.vm: -------------------------------------------------------------------------------- 1 | 2 | 3 |

你好, ${username}, 这是一封模板邮件!

4 | 5 | -------------------------------------------------------------------------------- /Chapter4-5-1/weixin.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/Chapter4-5-1/weixin.jpg -------------------------------------------------------------------------------- /Chapter6-2-1/src/main/java/com/didispace/Application.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * 8 | * @author 程序猿DD 9 | * @version 1.0.0 10 | * @blog http://blog.didispace.com 11 | * 12 | */ 13 | @SpringBootApplication 14 | public class Application { 15 | 16 | public static void main(String[] args) { 17 | 18 | SpringApplication.run(Application.class, args); 19 | 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /Chapter6-2-1/src/main/java/com/didispace/web/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.didispace.web; 2 | 3 | import org.springframework.web.bind.annotation.RequestMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | /** 7 | * 8 | * @author 程序猿DD 9 | * @version 1.0.0 10 | * @blog http://blog.didispace.com 11 | * 12 | */ 13 | @RestController 14 | public class HelloController { 15 | 16 | @RequestMapping("/hello") 17 | public String index() { 18 | return "Hello World"; 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /Chapter6-2-1/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | #management.info.git.mode=full -------------------------------------------------------------------------------- /Chapter6-2-1/src/test/java/com/didispace/ApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import org.junit.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | 7 | /** 8 | * 9 | * @author 程序猿DD 10 | * @version 1.0.0 11 | * @blog http://blog.didispace.com 12 | * 13 | */ 14 | @SpringBootTest 15 | public class ApplicationTests { 16 | 17 | @Test 18 | public void test1() throws Exception { 19 | 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /Chapter9-1-1/compute-service/src/main/java/com/didispace/ComputeServiceApplication.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import org.springframework.boot.autoconfigure.SpringBootApplication; 4 | import org.springframework.boot.builder.SpringApplicationBuilder; 5 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 6 | 7 | @EnableDiscoveryClient 8 | @SpringBootApplication 9 | public class ComputeServiceApplication { 10 | 11 | public static void main(String[] args) { 12 | new SpringApplicationBuilder(ComputeServiceApplication.class).web(true).run(args); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /Chapter9-1-1/compute-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=compute-service 2 | 3 | server.port=2222 4 | 5 | eureka.client.serviceUrl.defaultZone=http://localhost:1111/eureka/ 6 | 7 | -------------------------------------------------------------------------------- /Chapter9-1-1/eureka-server/src/main/java/com/didispace/Application.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import org.springframework.boot.autoconfigure.SpringBootApplication; 4 | import org.springframework.boot.builder.SpringApplicationBuilder; 5 | import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; 6 | 7 | @EnableEurekaServer 8 | @SpringBootApplication 9 | public class Application { 10 | 11 | public static void main(String[] args) { 12 | new SpringApplicationBuilder(Application.class).web(true).run(args); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /Chapter9-1-1/eureka-server/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=1111 2 | #eureka.instance.hostname=localhost 3 | 4 | eureka.client.register-with-eureka=false 5 | eureka.client.fetch-registry=false 6 | eureka.client.serviceUrl.defaultZone=http://localhost:${server.port}/eureka/ -------------------------------------------------------------------------------- /Chapter9-1-2/eureka-feign/src/main/java/com/didispace/FeignApplication.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 6 | import org.springframework.cloud.netflix.feign.EnableFeignClients; 7 | 8 | @SpringBootApplication 9 | @EnableDiscoveryClient 10 | @EnableFeignClients 11 | public class FeignApplication { 12 | 13 | public static void main(String[] args) { 14 | SpringApplication.run(FeignApplication.class, args); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /Chapter9-1-2/eureka-feign/src/main/java/com/didispace/service/ComputeClient.java: -------------------------------------------------------------------------------- 1 | package com.didispace.service; 2 | 3 | import org.springframework.cloud.netflix.feign.FeignClient; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | import org.springframework.web.bind.annotation.RequestMethod; 6 | import org.springframework.web.bind.annotation.RequestParam; 7 | 8 | @FeignClient("compute-service") 9 | public interface ComputeClient { 10 | 11 | @RequestMapping(method = RequestMethod.GET, value = "/add") 12 | Integer add(@RequestParam(value = "a") Integer a, @RequestParam(value = "b") Integer b); 13 | 14 | } -------------------------------------------------------------------------------- /Chapter9-1-2/eureka-feign/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=feign-consumer 2 | server.port=3333 3 | 4 | eureka.client.serviceUrl.defaultZone=http://localhost:1111/eureka/ 5 | 6 | -------------------------------------------------------------------------------- /Chapter9-1-2/eureka-ribbon/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=ribbon-consumer 2 | server.port=3333 3 | 4 | eureka.client.serviceUrl.defaultZone=http://localhost:1111/eureka/ 5 | 6 | -------------------------------------------------------------------------------- /Chapter9-1-3/compute-service/src/main/java/com/didispace/ComputeServiceApplication.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import org.springframework.boot.autoconfigure.SpringBootApplication; 4 | import org.springframework.boot.builder.SpringApplicationBuilder; 5 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 6 | 7 | @EnableDiscoveryClient 8 | @SpringBootApplication 9 | public class ComputeServiceApplication { 10 | 11 | public static void main(String[] args) { 12 | new SpringApplicationBuilder(ComputeServiceApplication.class).web(true).run(args); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /Chapter9-1-3/compute-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=compute-service 2 | 3 | server.port=2222 4 | 5 | eureka.client.serviceUrl.defaultZone=http://localhost:1111/eureka/ 6 | 7 | -------------------------------------------------------------------------------- /Chapter9-1-3/eureka-feign/src/main/java/com/didispace/FeignApplication.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 6 | import org.springframework.cloud.netflix.feign.EnableFeignClients; 7 | 8 | @SpringBootApplication 9 | @EnableDiscoveryClient 10 | @EnableFeignClients 11 | public class FeignApplication { 12 | 13 | public static void main(String[] args) { 14 | SpringApplication.run(FeignApplication.class, args); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /Chapter9-1-3/eureka-feign/src/main/java/com/didispace/service/ComputeClientHystrix.java: -------------------------------------------------------------------------------- 1 | package com.didispace.service; 2 | 3 | import org.springframework.stereotype.Component; 4 | import org.springframework.web.bind.annotation.RequestParam; 5 | 6 | @Component 7 | public class ComputeClientHystrix implements ComputeClient { 8 | 9 | @Override 10 | public Integer add(@RequestParam(value = "a") Integer a, @RequestParam(value = "b") Integer b) { 11 | return -9999; 12 | } 13 | 14 | } -------------------------------------------------------------------------------- /Chapter9-1-3/eureka-server/src/main/java/com/didispace/Application.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import org.springframework.boot.autoconfigure.SpringBootApplication; 4 | import org.springframework.boot.builder.SpringApplicationBuilder; 5 | import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; 6 | 7 | @EnableEurekaServer 8 | @SpringBootApplication 9 | public class Application { 10 | 11 | public static void main(String[] args) { 12 | new SpringApplicationBuilder(Application.class).web(true).run(args); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /Chapter9-1-3/eureka-server/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=1111 2 | #eureka.instance.hostname=localhost 3 | 4 | eureka.client.register-with-eureka=false 5 | eureka.client.fetch-registry=false 6 | eureka.client.serviceUrl.defaultZone=http://localhost:${server.port}/eureka/ -------------------------------------------------------------------------------- /Chapter9-1-4/config-client/src/main/java/com/didispace/Application.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import org.springframework.boot.autoconfigure.SpringBootApplication; 4 | import org.springframework.boot.builder.SpringApplicationBuilder; 5 | 6 | @SpringBootApplication 7 | public class Application { 8 | 9 | public static void main(String[] args) { 10 | new SpringApplicationBuilder(Application.class).web(true).run(args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Chapter9-1-4/config-client/src/main/resources/bootstrap.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=didispace 2 | spring.cloud.config.profile=dev 3 | spring.cloud.config.uri=http://localhost:7001/ 4 | 5 | server.port=7002 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Chapter9-1-4/config-repo/didispace-dev.properties: -------------------------------------------------------------------------------- 1 | from=git-dev-1.0 -------------------------------------------------------------------------------- /Chapter9-1-4/config-repo/didispace-prod.properties: -------------------------------------------------------------------------------- 1 | from=git-prod-1.0 -------------------------------------------------------------------------------- /Chapter9-1-4/config-repo/didispace-test.properties: -------------------------------------------------------------------------------- 1 | from=git-test-1.0 -------------------------------------------------------------------------------- /Chapter9-1-4/config-repo/didispace.properties: -------------------------------------------------------------------------------- 1 | from=git-default-1.0 2 | -------------------------------------------------------------------------------- /Chapter9-1-4/config-server/src/main/java/com/didispace/Application.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import org.springframework.boot.autoconfigure.SpringBootApplication; 4 | import org.springframework.boot.builder.SpringApplicationBuilder; 5 | import org.springframework.cloud.config.server.EnableConfigServer; 6 | 7 | @EnableConfigServer 8 | @SpringBootApplication 9 | public class Application { 10 | 11 | public static void main(String[] args) { 12 | new SpringApplicationBuilder(Application.class).web(true).run(args); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /Chapter9-1-4/config-server/src/main/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/Chapter9-1-4/config-server/src/main/resources/application.properties -------------------------------------------------------------------------------- /Chapter9-1-4/config-server/src/main/resources/didispace-dev.properties: -------------------------------------------------------------------------------- 1 | from=local-dev -------------------------------------------------------------------------------- /Chapter9-1-4/config-server/src/main/resources/didispace-prod.properties: -------------------------------------------------------------------------------- 1 | from=local-prod -------------------------------------------------------------------------------- /Chapter9-1-4/config-server/src/main/resources/didispace-test.properties: -------------------------------------------------------------------------------- 1 | from=local-test -------------------------------------------------------------------------------- /Chapter9-1-4/config-server/src/main/resources/didispace.properties: -------------------------------------------------------------------------------- 1 | from=local -------------------------------------------------------------------------------- /Chapter9-1-5/api-gateway/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=api-gateway 2 | server.port=5555 3 | 4 | # routes to serviceId 5 | zuul.routes.api-a.path=/api-a/** 6 | zuul.routes.api-a.serviceId=service-A 7 | 8 | zuul.routes.api-b.path=/api-b/** 9 | zuul.routes.api-b.serviceId=service-B 10 | 11 | # routes to url 12 | zuul.routes.api-a-url.path=/api-a-url/** 13 | zuul.routes.api-a-url.url=http://localhost:2222/ 14 | 15 | eureka.client.serviceUrl.defaultZone=http://localhost:1111/eureka/ -------------------------------------------------------------------------------- /Chapter9-1-5/eureka-server/src/main/java/com/didispace/Application.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import org.springframework.boot.autoconfigure.SpringBootApplication; 4 | import org.springframework.boot.builder.SpringApplicationBuilder; 5 | import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; 6 | 7 | @EnableEurekaServer 8 | @SpringBootApplication 9 | public class Application { 10 | 11 | public static void main(String[] args) { 12 | new SpringApplicationBuilder(Application.class).web(true).run(args); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /Chapter9-1-5/eureka-server/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=1111 2 | #eureka.instance.hostname=localhost 3 | 4 | eureka.client.register-with-eureka=false 5 | eureka.client.fetch-registry=false 6 | eureka.client.serviceUrl.defaultZone=http://localhost:${server.port}/eureka/ -------------------------------------------------------------------------------- /Chapter9-1-5/service-A/src/main/java/com/didispace/ComputeServiceApplication.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import org.springframework.boot.autoconfigure.SpringBootApplication; 4 | import org.springframework.boot.builder.SpringApplicationBuilder; 5 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 6 | 7 | @EnableDiscoveryClient 8 | @SpringBootApplication 9 | public class ComputeServiceApplication { 10 | 11 | public static void main(String[] args) { 12 | new SpringApplicationBuilder(ComputeServiceApplication.class).web(true).run(args); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /Chapter9-1-5/service-A/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=service-A 2 | 3 | server.port=2222 4 | 5 | eureka.client.serviceUrl.defaultZone=http://localhost:1111/eureka/ 6 | 7 | -------------------------------------------------------------------------------- /Chapter9-1-5/service-B/src/main/java/com/didispace/ComputeServiceApplication.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import org.springframework.boot.autoconfigure.SpringBootApplication; 4 | import org.springframework.boot.builder.SpringApplicationBuilder; 5 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 6 | 7 | @EnableDiscoveryClient 8 | @SpringBootApplication 9 | public class ComputeServiceApplication { 10 | 11 | public static void main(String[] args) { 12 | new SpringApplicationBuilder(ComputeServiceApplication.class).web(true).run(args); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /Chapter9-1-5/service-B/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=service-B 2 | 3 | server.port=3333 4 | 5 | eureka.client.serviceUrl.defaultZone=http://localhost:1111/eureka/ 6 | 7 | -------------------------------------------------------------------------------- /Chapter9-2-1/compute-service/src/main/java/com/didispace/service/ComputeService.java: -------------------------------------------------------------------------------- 1 | package com.didispace.service; 2 | 3 | /** 4 | * Created by zhaiyc on 2016/7/14. 5 | */ 6 | public interface ComputeService { 7 | 8 | Integer add(int a, int b); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /Chapter9-2-1/compute-service/src/main/java/com/didispace/service/impl/ComputeServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.didispace.service.impl; 2 | 3 | import com.didispace.service.ComputeService; 4 | 5 | /** 6 | * Created by zhaiyc on 2016/7/14. 7 | */ 8 | public class ComputeServiceImpl implements ComputeService { 9 | 10 | @Override 11 | public Integer add(int a, int b) { 12 | return a + b; 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /Chapter9-2-1/compute-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | #ZooKeeper 2 | dubbo.registry.address=localhost:2181 3 | 4 | logging.level.root=DEBUG -------------------------------------------------------------------------------- /Chapter9-2-1/consumer/src/main/java/com/didispace/service/ComputeService.java: -------------------------------------------------------------------------------- 1 | package com.didispace.service; 2 | 3 | /** 4 | * Created by zhaiyc on 2016/7/14. 5 | */ 6 | public interface ComputeService { 7 | 8 | Integer add(int a, int b); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /Chapter9-2-1/consumer/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | #ZooKeeper 2 | dubbo.registry.address=localhost:2181 3 | 4 | 5 | logging.level.root=DEBUG -------------------------------------------------------------------------------- /Spring-Learning/src/main/java/com/leelovejava/spring/proxy/cglib/UserServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.spring.proxy.cglib; 2 | 3 | /** 4 | * 业务类 5 | * 6 | * 没有实现接口 7 | * 8 | * 如果类是final的,则无法生成代理对象,报错 9 | * 10 | * 如果方法是final的,代理无效 11 | * 12 | * @author Muscleape 13 | * 14 | */ 15 | public class UserServiceImpl { 16 | public void addUser() { 17 | System.out.println("增加一个用户。。。"); 18 | } 19 | 20 | public void editUser() { 21 | System.out.println("编辑一个用户。。。"); 22 | } 23 | } -------------------------------------------------------------------------------- /Spring-Learning/src/main/java/com/leelovejava/spring/proxy/jdk/UserService.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.spring.proxy.jdk; 2 | 3 | /** 4 | * 业务接口 5 | * 6 | * @author leelovejava 7 | */ 8 | public interface UserService { 9 | /** 10 | * 增加一个用户 11 | */ 12 | void addUser(); 13 | 14 | /** 15 | * 编辑账户 16 | */ 17 | void editUser(); 18 | } -------------------------------------------------------------------------------- /Spring-Learning/src/main/java/com/leelovejava/spring/proxy/jdk/UserServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.spring.proxy.jdk; 2 | 3 | /** 4 | * 业务接口实现类 5 | * 6 | * @author leelovejava 7 | */ 8 | public class UserServiceImpl implements UserService { 9 | 10 | @Override 11 | public void addUser() { 12 | System.out.println("增加一个用户。。。"); 13 | } 14 | 15 | @Override 16 | public void editUser() { 17 | System.out.println("编辑一个用户。。。"); 18 | } 19 | 20 | } -------------------------------------------------------------------------------- /boot-datasource/boot-sqllite/src/main/java/com/leelovejava/boot/sqlite/model/HelloModel.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.boot.sqlite.model; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * @author leelovejava 9 | */ 10 | @Data 11 | @AllArgsConstructor 12 | @NoArgsConstructor 13 | public class HelloModel { 14 | private long id; 15 | private String title; 16 | private String text; 17 | 18 | public HelloModel(String title, String text) { 19 | this.title = title; 20 | this.text = text; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /boot-datasource/boot-sqllite/src/main/java/com/leelovejava/boot/sqlite/model/ReqBody.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.boot.sqlite.model; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * @author leelovejava 7 | */ 8 | @Data 9 | public class ReqBody { 10 | /** 11 | * 分支名 12 | */ 13 | private String name; 14 | private String email; 15 | } 16 | -------------------------------------------------------------------------------- /boot-datasource/boot-sqllite/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | sqlite: 2 | # 数据库名称 3 | dbName: sqlite.db 4 | spring: 5 | datasource: 6 | driver-class-name: org.sqlite.JDBC 7 | # 方式一: 引用外部文件 8 | # url: jdbc:sqlite:D:/eclipse/xy.db 9 | #方式二: 引用项目中的文件 10 | # url: jdbc:sqlite::resource:static/sqlite/xy.db 11 | url: jdbc:sqlite:D:\setup\sqlite\hello.sqlite 12 | username: root 13 | password: root 14 | # Mybatis配置 15 | mybatis: 16 | mapperLocations: classpath:mapper/**/*.xml 17 | # sql打印 18 | logging: 19 | level: debug 20 | level.com.leelovejava.boot.sqllite: debug 21 | path: logs/ 22 | -------------------------------------------------------------------------------- /boot-datasource/click-house-learning/boot-clickhouse/src/main/java/com/leelovejava/clickhouse/ClickHouseApplication.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.clickhouse; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | 7 | /** 8 | * @author leelovejava 9 | */ 10 | @SpringBootApplication 11 | @MapperScan(basePackages = {"com.leelovejava.clickhouse.mapper"}) 12 | public class ClickHouseApplication { 13 | public static void main(String[] args) { 14 | SpringApplication.run(ClickHouseApplication.class, args); 15 | } 16 | } -------------------------------------------------------------------------------- /boot-datasource/click-house-learning/boot-clickhouse/src/main/java/com/leelovejava/clickhouse/entity/UserInfo.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.clickhouse.entity; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * @author leelovejava 7 | */ 8 | @Data 9 | public class UserInfo { 10 | 11 | private Integer id ; 12 | private String userName ; 13 | private String passWord ; 14 | private String phone ; 15 | private String email ; 16 | private String createDay ; 17 | } -------------------------------------------------------------------------------- /boot-datasource/click-house-learning/boot-clickhouse/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | datasource: 3 | type: com.alibaba.druid.pool.DruidDataSource 4 | click: 5 | driverClassName: ru.yandex.clickhouse.ClickHouseDriver 6 | url: jdbc:clickhouse://127.0.0.1:8123/default 7 | initialSize: 10 8 | maxActive: 100 9 | minIdle: 10 10 | maxWait: 6000 11 | http: 12 | encoding: 13 | charset: UTF-8 14 | force: true 15 | enabled: true 16 | 17 | # mybatis 配置 18 | mybatis: 19 | type-aliases-package: com.leelovejava.clickhouse.entity 20 | mapper-locations: classpath:/mapper/*.xml -------------------------------------------------------------------------------- /boot-datasource/click-house-learning/clickhouse-jdbc/REAME.md: -------------------------------------------------------------------------------- 1 | ## client 2 | 3 | ### [JDBC](https://github.com/ClickHouse/clickhouse-jdbc) 4 | 5 | ```xml 6 | 7 | ru.yandex.clickhouse 8 | clickhouse-jdbc 9 | 0.2.4 10 | 11 | ``` 12 | 13 | 14 | URL syntax: jdbc:clickhouse://:[/], e.g. jdbc:clickhouse://localhost:8123/test 15 | 16 | JDBC Driver Class: `ru.yandex.clickhouse.ClickHouseDriver` 17 | -------------------------------------------------------------------------------- /boot-datasource/click-house-learning/clickhouse-jdbc/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | click-house-learning 7 | com.leelovejava.boot 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | clickhouse-jdbc 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /boot-datasource/click-house-learning/clickhouse-jdbc/src/test/java/clickhouse/MyCustomInputStream.java: -------------------------------------------------------------------------------- 1 | package clickhouse; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | 6 | public class MyCustomInputStream extends InputStream { 7 | @Override 8 | public int read() throws IOException { 9 | return 0; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /boot-datasource/click-house-learning/doc/clickhouse_zh.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/boot-datasource/click-house-learning/doc/clickhouse_zh.pdf -------------------------------------------------------------------------------- /boot-datasource/click-house-learning/doc/尚硅谷大数据技术之ClickHouse.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/boot-datasource/click-house-learning/doc/尚硅谷大数据技术之ClickHouse.docx -------------------------------------------------------------------------------- /boot-datasource/mysql-mycat/README.md: -------------------------------------------------------------------------------- 1 | [Mycat(配置篇)](https://blog.csdn.net/qq_28804275/article/details/80892095) -------------------------------------------------------------------------------- /boot-datasource/mysql-mycat/src/main/java/com/leelovejava/boot/datasource/mycat/MyCatApplication.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.boot.datasource.mycat; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * 启动类 8 | * 9 | * @author leelovejava 10 | * @date 2019/09/13 11 | */ 12 | @SpringBootApplication 13 | public class MyCatApplication { 14 | public static void main(String[] args) { 15 | SpringApplication.run(MyCatApplication.class, args); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /boot-datasource/mysql-mycat/src/main/java/com/leelovejava/boot/datasource/mycat/model/UserModel.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.boot.datasource.mycat.model; 2 | 3 | import lombok.Data; 4 | 5 | import javax.persistence.Entity; 6 | import javax.persistence.Id; 7 | import javax.persistence.Table; 8 | 9 | /** 10 | * 用户 数据实体层 11 | * @author leelovejava 12 | */ 13 | @Entity 14 | @Table(name = "tb_user") 15 | @Data 16 | public class UserModel { 17 | 18 | @Id 19 | private Long id; 20 | 21 | private String name; 22 | } 23 | -------------------------------------------------------------------------------- /boot-datasource/mysql-mycat/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | jpa: 3 | show-sql: true 4 | hibernate: 5 | ddl-auto: update 6 | # 命名策略 7 | naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy 8 | properties: 9 | hibernate: 10 | dialect: org.hibernate.dialect.MySQL5Dialect 11 | datasource: 12 | url: jdbc:mysql://node01:8066/mycats?characterEncoding=UTF-8&useSSL=false&autoReconnect=true&rewriteBatchedStatements=true 13 | username: mycat 14 | password: mycat -------------------------------------------------------------------------------- /boot-datasource/mysql-mycat/src/main/resources/create_table.sql: -------------------------------------------------------------------------------- 1 | CREATE DATABASE mycat1; 2 | CREATE DATABASE mycat2; 3 | 4 | USE mycat1; 5 | DROP TABLE IF EXISTS `tb_user`; 6 | CREATE TABLE `tb_user` ( 7 | `id` bigint(20) NOT NULL, 8 | `name` varchar(255) DEFAULT NULL, 9 | PRIMARY KEY (`id`) 10 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 11 | 12 | USE mycat2; 13 | DROP TABLE IF EXISTS `tb_user`; 14 | CREATE TABLE `tb_user` ( 15 | `id` bigint(20) NOT NULL, 16 | `name` varchar(255) DEFAULT NULL, 17 | PRIMARY KEY (`id`) 18 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -------------------------------------------------------------------------------- /boot-datasource/sharding-database-table/README.md: -------------------------------------------------------------------------------- 1 | https://blog.csdn.net/justry_deng/article/details/90815986 -------------------------------------------------------------------------------- /boot-datasource/sharding-database-table/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | datasource: 3 | druid: 4 | url: jdbc:mysql://localhost:3306/other?characterEncoding=utf8&serverTimezone=GMT%2B8 5 | username: root 6 | password: root 7 | max-active: 10 8 | driver-class-name: com.mysql.jdbc.Driver 9 | initial-size: 5 10 | max-wait: 5000000 11 | 12 | #spring.datasource.url=jdbc:mysql://localhost/other 13 | #spring.datasource.username=root 14 | #spring.datasource.password=root 15 | #spring.datasource.driver-class-name=com.mysql.jdbc.Driver -------------------------------------------------------------------------------- /boot-docker/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | 4 | ### STS ### 5 | .apt_generated 6 | .classpath 7 | .factorypath 8 | .project 9 | .settings 10 | .springBeans 11 | .sts4-cache 12 | 13 | ### IntelliJ IDEA ### 14 | .idea 15 | *.iws 16 | *.iml 17 | *.ipr 18 | 19 | ### NetBeans ### 20 | /nbproject/private/ 21 | /build/ 22 | /nbbuild/ 23 | /dist/ 24 | /nbdist/ 25 | /.nb-gradle/ 26 | -------------------------------------------------------------------------------- /boot-docker/Dockerfile: -------------------------------------------------------------------------------- 1 | # 基础镜像 2 | FROM openjdk:8-jdk-alpine 3 | 4 | # 作者信息 5 | MAINTAINER "leelovejava leelovejava@163.com" 6 | 7 | # 添加一个存储空间 8 | VOLUME /tmp 9 | 10 | # 暴露8080端口 11 | EXPOSE 8080 12 | 13 | # 添加变量,如果使用dockerfile-maven-plugin,则会自动替换这里的变量内容 14 | ARG JAR_FILE=target/boot-docker.jar 15 | 16 | # 往容器中添加jar包 17 | ADD ${JAR_FILE} app.jar 18 | 19 | # 启动镜像自动运行程序 20 | ENTRYPOINT ["java","-Djava.security.egd=file:/dev/urandom","-jar","/app.jar"] 21 | -------------------------------------------------------------------------------- /boot-docker/src/main/java/com/leelovejava/boot/docker/BootDockerApplication.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.boot.docker; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * 启动器 8 | * 9 | * @author leelovejava 10 | * @date 2020/11/12 21:26 11 | **/ 12 | @SpringBootApplication 13 | public class BootDockerApplication { 14 | public static void main(String[] args) { 15 | SpringApplication.run(BootDockerApplication.class, args); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /boot-docker/src/main/java/com/leelovejava/boot/docker/controller/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.boot.docker.controller; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | import org.springframework.web.bind.annotation.RestController; 6 | 7 | /** 8 | * @author leelovejava 9 | * @date 2020/11/12 21:27 10 | **/ 11 | @RestController 12 | @RequestMapping 13 | public class HelloController { 14 | @GetMapping 15 | public String hello() { 16 | return "Hello,From Docker!"; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /boot-docker/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | servlet: 4 | context-path: /demo 5 | -------------------------------------------------------------------------------- /boot-dubbo/README.md: -------------------------------------------------------------------------------- 1 | # dubbo 2 | -------------------------------------------------------------------------------- /boot-dubbo/compute-service/compute-api-server/src/main/java/com/leelovejava/dubbo/service/impl/ComputeServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.dubbo.service.impl; 2 | 3 | import com.leelovejava.dubbo.service.ComputeService; 4 | 5 | /** 6 | * @author zhaiyc 7 | * @date 2016/7/14 8 | */ 9 | public class ComputeServiceImpl implements ComputeService { 10 | 11 | @Override 12 | public Integer add(int a, int b) { 13 | return a + b; 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /boot-dubbo/compute-service/compute-api-server/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | # ZooKeeper 2 | dubbo.registry.address=localhost:2181 3 | 4 | logging.level.root=DEBUG 5 | -------------------------------------------------------------------------------- /boot-dubbo/compute-service/compute-api/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | 7 | 8 | com.didispace 9 | compute-service 10 | 1.0-SNAPSHOT 11 | 12 | 13 | compute-api 14 | compute-api 15 | jar 16 | 17 | -------------------------------------------------------------------------------- /boot-dubbo/compute-service/compute-api/src/main/java/com/leelovejava/dubbo/service/ComputeService.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.dubbo.service; 2 | 3 | /** 4 | * @author zhaiyc 5 | * @date 2016/7/14 6 | */ 7 | public interface ComputeService { 8 | 9 | Integer add(int a, int b); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /boot-dubbo/compute-service/compute-api/src/main/java/com/leelovejava/dubbo/service/impl/ComputeServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.dubbo.service.impl; 2 | 3 | import com.leelovejava.dubbo.service.ComputeService; 4 | 5 | /** 6 | * @author zhaiyc 7 | * @date 2016/7/14 8 | */ 9 | public class ComputeServiceImpl implements ComputeService { 10 | 11 | @Override 12 | public Integer add(int a, int b) { 13 | return a + b; 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /boot-dubbo/consumer/src/main/java/com/leelovejava/dubbo/Application.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.dubbo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.context.annotation.ImportResource; 6 | 7 | /** 8 | * @author leelovejava 9 | */ 10 | @SpringBootApplication 11 | @ImportResource({"classpath:dubbo.xml"}) 12 | public class Application { 13 | 14 | public static void main(String[] args) throws InterruptedException { 15 | SpringApplication.run(Application.class, args); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /boot-dubbo/consumer/src/main/resources/META-INF/dubbo/com.leelovejava.dubbo.spi.Robot: -------------------------------------------------------------------------------- 1 | optimusPrime = com.leelovejava.dubbo.spi.OptimusPrime 2 | bumblebee = com.leelovejava.dubbo.spi.Bumblebee 3 | -------------------------------------------------------------------------------- /boot-dubbo/consumer/src/main/resources/META-INF/services/com.leelovejava.dubbo.spi.Robot: -------------------------------------------------------------------------------- 1 | com.leelovejava.dubbo.spi.OptimusPrime 2 | com.leelovejava.dubbo.spi.Bumblebee 3 | -------------------------------------------------------------------------------- /boot-dubbo/consumer/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | #ZooKeeper 2 | dubbo.registry.address=localhost:2181 3 | 4 | 5 | logging.level.root=INFO -------------------------------------------------------------------------------- /boot-dubbo/consumer/src/test/java/com/leelovejava/dubbo/spi/Bumblebee.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.dubbo.spi; 2 | 3 | public class Bumblebee implements Robot { 4 | 5 | @Override 6 | public void sayHello() { 7 | System.out.println("Hello, I am Bumblebee."); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /boot-dubbo/consumer/src/test/java/com/leelovejava/dubbo/spi/OptimusPrime.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.dubbo.spi; 2 | 3 | public class OptimusPrime implements Robot { 4 | 5 | @Override 6 | public void sayHello() { 7 | System.out.println("Hello, I am Optimus Prime."); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /boot-dubbo/consumer/src/test/java/com/leelovejava/dubbo/spi/Robot.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.dubbo.spi; 2 | 3 | import org.apache.dubbo.common.extension.SPI; 4 | 5 | @SPI 6 | public interface Robot { 7 | void sayHello(); 8 | } 9 | -------------------------------------------------------------------------------- /boot-dubbo/consumer/src/test/java/com/leelovejava/dubbo/spi/test/JavaSPITest.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.dubbo.spi.test; 2 | 3 | import com.leelovejava.dubbo.spi.Robot; 4 | import org.junit.Test; 5 | 6 | import java.util.ServiceLoader; 7 | 8 | /** 9 | * Java SPI 示例 10 | * 11 | * @author leelovejava 12 | */ 13 | public class JavaSPITest { 14 | 15 | @Test 16 | public void sayHello() throws Exception { 17 | ServiceLoader serviceLoader = ServiceLoader.load(Robot.class); 18 | System.out.println("Java SPI"); 19 | serviceLoader.forEach(Robot::sayHello); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /boot-es/.gitignore: -------------------------------------------------------------------------------- 1 | # Java class files 2 | *.class 3 | 4 | # Log Files 5 | *.log 6 | 7 | # Intellij 8 | *.iml 9 | */*.iml 10 | 11 | */.idea/ 12 | .idea/ 13 | */.settings/ 14 | */target/ 15 | -------------------------------------------------------------------------------- /boot-es/src/main/java/com/leelovejava/essearch/ElasticSearchApplication.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.essearch; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * @author leelovejava 8 | */ 9 | @SpringBootApplication 10 | public class ElasticSearchApplication { 11 | 12 | public static void main(String[] args) { 13 | SpringApplication.run(ElasticSearchApplication.class, args); 14 | } 15 | 16 | } 17 | 18 | -------------------------------------------------------------------------------- /boot-es/src/main/java/com/leelovejava/essearch/repository/ProductDocumentRepository.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.essearch.repository; 2 | 3 | 4 | import com.leelovejava.essearch.document.ProductDocument; 5 | import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; 6 | import org.springframework.stereotype.Component; 7 | 8 | /** 9 | * @author zhoudong 10 | * @version 0.1 11 | * @date 2018/12/13 17:35 12 | */ 13 | @Component 14 | public interface ProductDocumentRepository extends ElasticsearchRepository { 15 | } 16 | -------------------------------------------------------------------------------- /boot-es/src/main/java/com/leelovejava/essearch/vo/SearchResult.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.essearch.vo; 2 | import lombok.AllArgsConstructor; 3 | import lombok.Data; 4 | import lombok.NoArgsConstructor; 5 | import java.util.List; 6 | 7 | /** 8 | * @author leelovejava 9 | * @date 2019/11/2 22:15 10 | **/ 11 | @Data 12 | @AllArgsConstructor 13 | @NoArgsConstructor 14 | public class SearchResult { 15 | private Integer totalPage; 16 | private List list; 17 | } 18 | -------------------------------------------------------------------------------- /boot-es/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | # elasticsearch.yml 文件中的 cluster.name 2 | spring.data.elasticsearch.cluster-name=elasticsearch 3 | # elasticsearch 调用地址,多个使用“,”隔开 4 | spring.data.elasticsearch.cluster-nodes=localhost:9300 -------------------------------------------------------------------------------- /boot-es/src/main/resources/productIndex.json: -------------------------------------------------------------------------------- 1 | { 2 | "properties": { 3 | "createTime": { 4 | "type": "long" 5 | }, 6 | "productDesc": { 7 | "type": "text", 8 | "analyzer": "ik_max_word", 9 | "search_analyzer": "ik_max_word" 10 | }, 11 | "productName": { 12 | "type": "text", 13 | "analyzer": "ik_max_word", 14 | "search_analyzer": "ik_max_word" 15 | }, 16 | "updateTime": { 17 | "type": "long" 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /boot-fastdfs/READE.md: -------------------------------------------------------------------------------- 1 | # FastDFS 2 | 3 | ## FastDFS-client 4 | 5 | [github](https://github.com/happyfish100/fastdfs-client-java) 6 | -------------------------------------------------------------------------------- /boot-fastdfs/lib/fastdfs-client-java-1.28-SNAPSHOT.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/boot-fastdfs/lib/fastdfs-client-java-1.28-SNAPSHOT.jar -------------------------------------------------------------------------------- /boot-fastdfs/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | #http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#common-application-properties 2 | #search multipart 3 | spring.servlet.http.multipart.max-file-size=10MB 4 | spring.servlet.http.multipart.max-request-size=10MB -------------------------------------------------------------------------------- /boot-fastdfs/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | servlet: 3 | http: 4 | multipart: 5 | max-file-size: 10MB 6 | max-request-size: 10MB 7 | -------------------------------------------------------------------------------- /boot-fastdfs/src/main/resources/fdfs_client.conf: -------------------------------------------------------------------------------- 1 | connect_timeout = 60 2 | network_timeout = 60 3 | charset = UTF-8 4 | http.tracker_http_port = 8080 5 | http.anti_steal_token = no 6 | http.secret_key = 123456 7 | 8 | tracker_server = 192.168.53.85:22122 9 | tracker_server = 192.168.53.86:22122 -------------------------------------------------------------------------------- /boot-fastdfs/src/main/resources/templates/upload.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

Spring Boot file upload example

6 | 7 |
8 |

9 | 10 |
11 | 12 | 13 | -------------------------------------------------------------------------------- /boot-fastdfs/src/main/resources/templates/uploadStatus.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

Spring Boot - Upload Status

6 | 7 |
8 |

9 |

10 | 11 |
12 |

13 |

14 | 15 | 16 | -------------------------------------------------------------------------------- /boot-favor-submit/README.md: -------------------------------------------------------------------------------- 1 | # 重复提交 2 | [一起来学SpringBoot | 第二十三篇:轻松搞定重复提交(分布式锁)](https://blog.battcn.com/2018/06/13/springboot/v2-cache-redislock/) 3 | 4 | [幂等问题 8种方案解决重复提交](https://juejin.im/post/5d31928c51882564c966a71c) -------------------------------------------------------------------------------- /boot-favor-submit/src/main/java/com/leelovejava/boot/favor/annotation/CacheParam.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.boot.favor.annotation; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * 锁的参数 7 | * 8 | * @author leelovejava 9 | */ 10 | @Target({ElementType.PARAMETER, ElementType.METHOD, ElementType.FIELD}) 11 | @Retention(RetentionPolicy.RUNTIME) 12 | @Documented 13 | @Inherited 14 | public @interface CacheParam { 15 | 16 | /** 17 | * 字段名称 18 | * 19 | * @return String 20 | */ 21 | String name() default ""; 22 | } -------------------------------------------------------------------------------- /boot-favor-submit/src/main/java/com/leelovejava/boot/favor/annotation/Resubmit.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.boot.favor.annotation; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * @author leelovejava 7 | */ 8 | @Target(ElementType.METHOD) 9 | @Retention(RetentionPolicy.RUNTIME) 10 | @Documented 11 | public @interface Resubmit { 12 | 13 | /** 14 | * 延时时间 在延时多久后可以再次提交 15 | * 16 | * @return Time unit is one second 17 | */ 18 | int delaySeconds() default 20; 19 | } -------------------------------------------------------------------------------- /boot-favor-submit/src/main/java/com/leelovejava/boot/favor/service/CacheKeyGenerator.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.boot.favor.service; 2 | 3 | import org.aspectj.lang.ProceedingJoinPoint; 4 | 5 | /** 6 | * key生成器 7 | * 8 | * @author Levin 9 | * @date 2018/03/22 10 | */ 11 | public interface CacheKeyGenerator { 12 | 13 | /** 14 | * 获取AOP参数,生成指定缓存Key 15 | * 16 | * @param pjp PJP 17 | * @return 缓存KEY 18 | */ 19 | String getLockKey(ProceedingJoinPoint pjp); 20 | } -------------------------------------------------------------------------------- /boot-favor-submit/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | redis: 3 | host: localhost 4 | port: 6379 5 | #password: 123456 -------------------------------------------------------------------------------- /boot-flyway/src/main/java/com/didispace/Application.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Application { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Application.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /boot-flyway/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.url=jdbc:mysql://192.168.109.131:3306/test 2 | spring.datasource.username=root 3 | spring.datasource.password=123456 4 | spring.datasource.driver-class-name=com.mysql.jdbc.Driver 5 | 6 | flyway.locations=classpath:/db -------------------------------------------------------------------------------- /boot-flyway/src/main/resources/db/V1__Base_version.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS `user` ; 2 | 3 | 4 | CREATE TABLE `user` ( 5 | `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键', 6 | `name` varchar(30) NOT NULL COMMENT '姓名', 7 | `age` int(5) DEFAULT NULL COMMENT '年龄', 8 | PRIMARY KEY (`id`) 9 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 10 | -------------------------------------------------------------------------------- /boot-flyway/src/main/resources/db/V2__Student_version.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS `student` ; 2 | 3 | 4 | CREATE TABLE `student` ( 5 | `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键', 6 | `name` varchar(30) NOT NULL COMMENT '姓名', 7 | `age` int(5) DEFAULT NULL COMMENT '年龄', 8 | PRIMARY KEY (`id`) 9 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 10 | -------------------------------------------------------------------------------- /boot-flyway/src/main/resources/db/V3__Student_Alter_Score_version.sql: -------------------------------------------------------------------------------- 1 | --student表中增加分数字段 2 | alter table student add score float(10,2) null; 3 | -------------------------------------------------------------------------------- /boot-flyway/src/main/resources/db/V4__Student_addField_table.sql: -------------------------------------------------------------------------------- 1 | alter table student add store_num int(11) null COMMENT '到店次数'; 2 | alter table student add last_store_date datetime null COMMENT '上次到店时间'; 3 | alter table student add enter_images_url VARCHAR(128) null COMMENT '入库照片'; -------------------------------------------------------------------------------- /boot-globalization/.gitignore: -------------------------------------------------------------------------------- 1 | # Java class files 2 | *.class 3 | 4 | # Log Files 5 | *.log 6 | 7 | # Intellij 8 | *.iml 9 | */*.iml 10 | 11 | */.idea/ 12 | .idea/ 13 | */.settings/ 14 | */target/ 15 | -------------------------------------------------------------------------------- /boot-globalization/src/main/java/com/leelovejava/boot/globalization/GlobalizationApplication.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.boot.globalization; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * 国际化 8 | * 9 | * @author leelovejava 10 | * @date 2020/4/12 20:06 11 | **/ 12 | @SpringBootApplication 13 | public class GlobalizationApplication { 14 | public static void main(String[] args) { 15 | SpringApplication.run(GlobalizationApplication.class, args); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /boot-globalization/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | # 端口号 2 | server: 3 | port: 8888 4 | spring: 5 | thymeleaf: 6 | # 去除thymeleaf的html严格校验 7 | mode: LEGACYHTML5 8 | freemarker: 9 | # 设定thymeleaf文件路径 默认为src/main/resources/templates 10 | template-loader-path: 11 | lasspath:/templates 12 | # 国际化 13 | messages: 14 | basename: i18n/messages 15 | encoding: UTF-8 16 | -------------------------------------------------------------------------------- /boot-globalization/src/main/resources/i18n/messages.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/boot-globalization/src/main/resources/i18n/messages.properties -------------------------------------------------------------------------------- /boot-globalization/src/main/resources/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 国际化 6 | 7 | 8 |

9 | English(US) 10 | 简体中文
11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /boot-login/README.md: -------------------------------------------------------------------------------- 1 | [基于Spring的微信第三方登录实现](https://www.tianmaying.com/tutorial/OAuth-login-weixin) 2 | [基于Spring的QQ第三方登录实现](https://www.tianmaying.com/tutorial/OAuth-login-QQ) 3 | [基于Spring的新浪微博第三方登录实现](https://www.tianmaying.com/tutorial/OAuth-login-weibo) -------------------------------------------------------------------------------- /boot-login/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.leelovejava 8 | boot-login 9 | 1.0-SNAPSHOT 10 | 11 | 12 | -------------------------------------------------------------------------------- /boot-mongodb/src/main/java/com/didispace/MongodbApplication.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * @author leelovejava 8 | */ 9 | @SpringBootApplication 10 | public class MongodbApplication { 11 | 12 | public static void main(String[] args) { 13 | SpringApplication.run(MongodbApplication.class, args); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /boot-mongodb/src/main/java/com/didispace/domain/UserRepository.java: -------------------------------------------------------------------------------- 1 | package com.didispace.domain; 2 | 3 | import com.mongodb.client.result.DeleteResult; 4 | import com.mongodb.client.result.UpdateResult; 5 | import org.springframework.data.mongodb.repository.MongoRepository; 6 | 7 | /** 8 | * @author 程序猿DD 9 | * @version 1.0.0 10 | * @date 16/4/27 下午10:16. 11 | * @blog http://blog.didispace.com 12 | */ 13 | public interface UserRepository extends MongoRepository { 14 | 15 | /** 16 | * 查询 17 | * 18 | * @param username 19 | * @return 20 | */ 21 | User findByUsername(String username); 22 | } 23 | -------------------------------------------------------------------------------- /boot-mongodb/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.data.mongodb.uri=mongodb://localhost:27017/testdb 2 | 3 | 4 | -------------------------------------------------------------------------------- /boot-mongodb/src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | # LOG4J配置 2 | log4j.rootCategory=INFO, stdout 3 | log4j.logger.mongodb=INFO, mongodb 4 | 5 | # 控制台输出 6 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender 7 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 8 | log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} %5p %c{1}:%L - %m%n 9 | 10 | # mongodb输出 11 | log4j.appender.mongodb=com.didispace.log.MongoAppender 12 | log4j.appender.mongodb.connectionUrl=mongodb://localhost:27017 13 | log4j.appender.mongodb.databaseName=testdb 14 | log4j.appender.mongodb.collectionName=logs_request 15 | -------------------------------------------------------------------------------- /boot-monitor/.gitignore: -------------------------------------------------------------------------------- 1 | .class 2 | .classpath 3 | .project 4 | build 5 | bin 6 | .bak 7 | .settings 8 | Thumbs.db 9 | .DS_Store 10 | ._.DS_Store 11 | logs 12 | target 13 | *.iml 14 | .idea 15 | -------------------------------------------------------------------------------- /boot-monitor/boot-admin-actuator/src/main/java/com/leelovejava/admin/actuator/ActuatorApplication.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.admin.actuator; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class ActuatorApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(ActuatorApplication.class, args); 11 | } 12 | 13 | } 14 | 15 | -------------------------------------------------------------------------------- /boot-monitor/boot-admin-actuator/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | spring: 4 | application: 5 | name: prometheus-test 6 | management: 7 | endpoints: 8 | web: 9 | exposure: 10 | # 将 Actuator 的 /actuator/prometheus 端点暴露出来 11 | include: 'prometheus' 12 | metrics: 13 | # 为指标设置一个名为application="prometheus-test" 的Tag,Tag是Prometheus提供的一种能力,从而实现更加灵活的筛选 14 | tags: 15 | application: ${spring.application.name} -------------------------------------------------------------------------------- /boot-monitor/boot-admin-actuator/src/main/resources/prometheus.yml: -------------------------------------------------------------------------------- 1 | scrape_configs: 2 | # 任意写,建议英文,不要包含特殊字符 3 | - job_name: 'spring' 4 | # 多久采集一次数据 5 | scrape_interval: 15s 6 | # 采集时的超时时间 7 | scrape_timeout: 10s 8 | # 采集的路径是啥 9 | metrics_path: '/actuator/prometheus' 10 | # 采集服务的地址,设置成上面Spring Boot应用所在服务器的具体地址。 11 | static_configs: 12 | - targets: ['localhost:8080'] -------------------------------------------------------------------------------- /boot-mysql/sharding-sphere-db/src/main/java/com/leelovejava/boot/mysql/mapper/OrderMapeer.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | insert into tb_order (user_id, order_no, order_time, merchant) 7 | values (#{userId}, #{orderNo}, #{orderTime}, #{merchant}) 8 | 9 | -------------------------------------------------------------------------------- /boot-mysql/sharding-sphere-db/src/main/java/com/leelovejava/boot/mysql/mapper/OrderMapper.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.boot.mysql.mapper; 2 | 3 | import com.leelovejava.boot.mysql.model.OrderModel; 4 | import org.apache.ibatis.annotations.Mapper; 5 | 6 | @Mapper 7 | public interface OrderMapper { 8 | int save(OrderModel orderModel); 9 | } 10 | -------------------------------------------------------------------------------- /boot-mysql/sharding-sphere-db/src/main/java/com/leelovejava/boot/mysql/service/OrderService.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.boot.mysql.service; 2 | 3 | import com.leelovejava.boot.mysql.mapper.OrderMapper; 4 | import com.leelovejava.boot.mysql.model.OrderModel; 5 | import org.springframework.stereotype.Service; 6 | 7 | import javax.annotation.Resource; 8 | 9 | @Service 10 | public class OrderService { 11 | @Resource 12 | private OrderMapper orderMapper; 13 | 14 | public int save(OrderModel orderModel) { 15 | return orderMapper.save(orderModel); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /boot-mysql/sharding-sphere-db/src/main/resources/init.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE tb_order ( 2 | id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, 3 | user_id int(11) NOT NULL COMMENT '姓名', 4 | order_no varchar(32) NOT NULL COMMENT '订单号', 5 | order_time datetime NOT NULL COMMENT '订单时间', 6 | merchant varchar(16) NOT NULL COMMENT '商户名称', 7 | UNIQUE KEY uk_order_no (order_no) 8 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -------------------------------------------------------------------------------- /boot-mysql/sharding-sphere-table/src/main/java/com/leelovejava/boot/mysql/mapper/OrderMapeer.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | insert into tb_order (user_id, order_no, order_time, merchant) 7 | values (#{userId}, #{orderNo}, #{orderTime}, #{merchant}) 8 | 9 | -------------------------------------------------------------------------------- /boot-mysql/sharding-sphere-table/src/main/java/com/leelovejava/boot/mysql/mapper/OrderMapper.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.boot.mysql.mapper; 2 | 3 | import com.leelovejava.boot.mysql.model.OrderModel; 4 | import org.apache.ibatis.annotations.Mapper; 5 | 6 | @Mapper 7 | public interface OrderMapper { 8 | int save(OrderModel orderModel); 9 | } 10 | -------------------------------------------------------------------------------- /boot-mysql/sharding-sphere-table/src/main/java/com/leelovejava/boot/mysql/service/OrderService.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.boot.mysql.service; 2 | 3 | import com.leelovejava.boot.mysql.mapper.OrderMapper; 4 | import com.leelovejava.boot.mysql.model.OrderModel; 5 | import org.springframework.stereotype.Service; 6 | 7 | import javax.annotation.Resource; 8 | 9 | @Service 10 | public class OrderService { 11 | @Resource 12 | private OrderMapper orderMapper; 13 | 14 | public int save(OrderModel orderModel) { 15 | return orderMapper.save(orderModel); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /boot-mysql/sharding-sphere-table/src/main/resources/init.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE tb_order ( 2 | id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, 3 | user_id int(11) NOT NULL COMMENT '姓名', 4 | order_no varchar(32) NOT NULL COMMENT '订单号', 5 | order_time datetime NOT NULL COMMENT '订单时间', 6 | merchant varchar(16) NOT NULL COMMENT '商户名称', 7 | UNIQUE KEY uk_order_no (order_no) 8 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -------------------------------------------------------------------------------- /boot-neo4j/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | 4 | ### STS ### 5 | .apt_generated 6 | .classpath 7 | .factorypath 8 | .project 9 | .settings 10 | .springBeans 11 | .sts4-cache 12 | 13 | ### IntelliJ IDEA ### 14 | .idea 15 | *.iws 16 | *.iml 17 | *.ipr 18 | 19 | ### NetBeans ### 20 | /nbproject/private/ 21 | /build/ 22 | /nbbuild/ 23 | /dist/ 24 | /nbdist/ 25 | /.nb-gradle/ 26 | -------------------------------------------------------------------------------- /boot-neo4j/src/main/java/com/leelovejava/boot/neo4j/BootNeo4jApplication.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.boot.neo4j; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * 启动器 8 | * 9 | * @author leelovejava 10 | * @date 2020/11/5 17:51 11 | **/ 12 | @SpringBootApplication 13 | public class BootNeo4jApplication { 14 | public static void main(String[] args) { 15 | SpringApplication.run(BootNeo4jApplication.class, args); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /boot-neo4j/src/main/java/com/leelovejava/boot/neo4j/config/CustomIdStrategy.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.boot.neo4j.config; 2 | 3 | import cn.hutool.core.util.IdUtil; 4 | import org.neo4j.ogm.id.IdStrategy; 5 | 6 | /** 7 | * 自定义主键策略 8 | * 9 | * @author leelovejava 10 | * @date 2020/11/5 17:41 11 | **/ 12 | public class CustomIdStrategy implements IdStrategy { 13 | @Override 14 | public Object generateId(Object o) { 15 | return IdUtil.fastUUID(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /boot-neo4j/src/main/java/com/leelovejava/boot/neo4j/payload/TeacherStudent.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.boot.neo4j.payload; 2 | 3 | import com.leelovejava.boot.neo4j.model.Student; 4 | import lombok.Data; 5 | import org.springframework.data.neo4j.annotation.QueryResult; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * 师生关系 11 | * @author leelovejava 12 | * @date 2020/11/5 17:43 13 | **/ 14 | @Data 15 | @QueryResult 16 | public class TeacherStudent { 17 | /** 18 | * 教师姓名 19 | */ 20 | private String teacherName; 21 | 22 | /** 23 | * 学生信息 24 | */ 25 | private List students; 26 | } 27 | -------------------------------------------------------------------------------- /boot-neo4j/src/main/java/com/leelovejava/boot/neo4j/repository/ClassRepository.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.boot.neo4j.repository; 2 | 3 | import com.leelovejava.boot.neo4j.model.Class; 4 | import org.springframework.data.neo4j.repository.Neo4jRepository; 5 | 6 | import java.util.Optional; 7 | 8 | /** 9 | * 班级节点Repository 10 | * 11 | * @author leelovejava 12 | * @date 2020/11/5 17:44 13 | **/ 14 | public interface ClassRepository extends Neo4jRepository { 15 | /** 16 | * 根据班级名称查询班级信息 17 | * 18 | * @param name 班级名称 19 | * @return 班级信息 20 | */ 21 | Optional findByName(String name); 22 | } 23 | -------------------------------------------------------------------------------- /boot-neo4j/src/main/java/com/leelovejava/boot/neo4j/repository/LessonRepository.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.boot.neo4j.repository; 2 | 3 | import com.leelovejava.boot.neo4j.model.Lesson; 4 | import org.springframework.data.neo4j.repository.Neo4jRepository; 5 | 6 | /** 7 | * 课程节点Repository 8 | * @author leelovejava 9 | * @date 2020/11/5 17:46 10 | **/ 11 | public interface LessonRepository extends Neo4jRepository{ 12 | } 13 | -------------------------------------------------------------------------------- /boot-neo4j/src/main/java/com/leelovejava/boot/neo4j/repository/TeacherRepository.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.boot.neo4j.repository; 2 | 3 | import com.leelovejava.boot.neo4j.model.Teacher; 4 | import org.springframework.data.neo4j.repository.Neo4jRepository; 5 | 6 | /** 7 | * 教师节点Repository 8 | * 9 | * @author leelovejava 10 | * @date 2020/11/5 17:48 11 | **/ 12 | public interface TeacherRepository extends Neo4jRepository { 13 | } 14 | -------------------------------------------------------------------------------- /boot-neo4j/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | data: 3 | neo4j: 4 | uri: bolt://localhost 5 | username: neo4j 6 | password: admin 7 | open-in-view: false 8 | -------------------------------------------------------------------------------- /boot-netty/1.txt: -------------------------------------------------------------------------------- 1 | Hel9o,world 2 | 尚硅谷 3 | 你好 4 | hello,ok -------------------------------------------------------------------------------- /boot-netty/README.md: -------------------------------------------------------------------------------- 1 | [SpringBoot使用netty](https://www.jianshu.com/p/b60180a0a0e6) 2 | 3 | 安装protobuf -------------------------------------------------------------------------------- /boot-netty/src/main/java/com/atguigu/netty/codec/Student.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; //版本 2 | option java_outer_classname = "StudentPOJO";//生成的外部类名,同时也是文件名 3 | //protobuf 使用message 管理数据 4 | message Student { //会在 StudentPOJO 外部类生成一个内部类 Student, 他是真正发送的POJO对象 5 | int32 id = 1; // Student 类中有 一个属性 名字为 id 类型为int32(protobuf类型) 1表示属性序号,不是值 6 | string name = 2; 7 | } -------------------------------------------------------------------------------- /boot-netty/src/main/java/com/atguigu/netty/dubborpc/provider/ServerBootstrap.java: -------------------------------------------------------------------------------- 1 | package com.atguigu.netty.dubborpc.provider; 2 | 3 | import com.atguigu.netty.dubborpc.netty.NettyServer; 4 | 5 | //ServerBootstrap 会启动一个服务提供者,就是 NettyServer 6 | public class ServerBootstrap { 7 | public static void main(String[] args) { 8 | 9 | //代码代填.. 10 | NettyServer.startServer("127.0.0.1", 7000); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /boot-netty/src/main/java/com/atguigu/netty/dubborpc/publicinterface/HelloService.java: -------------------------------------------------------------------------------- 1 | package com.atguigu.netty.dubborpc.publicinterface; 2 | 3 | //这个是接口,是服务提供方和 服务消费方都需要 4 | public interface HelloService { 5 | 6 | String hello(String mes); 7 | } 8 | -------------------------------------------------------------------------------- /boot-netty/src/main/java/com/atguigu/netty/groupchat/GroupChatClientHandler.java: -------------------------------------------------------------------------------- 1 | package com.atguigu.netty.groupchat; 2 | 3 | import io.netty.channel.ChannelHandlerContext; 4 | import io.netty.channel.SimpleChannelInboundHandler; 5 | 6 | public class GroupChatClientHandler extends SimpleChannelInboundHandler { 7 | @Override 8 | protected void channelRead0(ChannelHandlerContext ctx, String msg) throws Exception { 9 | System.out.println(msg.trim()); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /boot-netty/src/main/java/com/atguigu/netty/groupchat/User.java: -------------------------------------------------------------------------------- 1 | package com.atguigu.netty.groupchat; 2 | 3 | public class User { 4 | private int id; 5 | private String pwd; 6 | } 7 | -------------------------------------------------------------------------------- /boot-netty/src/main/java/com/atguigu/netty/heartbeat/Test.java: -------------------------------------------------------------------------------- 1 | package com.atguigu.netty.heartbeat; 2 | 3 | public class Test { 4 | public static void main(String[] args) throws Exception { 5 | //纳秒 10亿分之1 6 | System.out.println(System.nanoTime()); 7 | Thread.sleep(1000); 8 | System.out.println(System.nanoTime()); 9 | 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /boot-netty/src/main/java/com/atguigu/netty/protocoltcp/MessageProtocol.java: -------------------------------------------------------------------------------- 1 | package com.atguigu.netty.protocoltcp; 2 | 3 | 4 | /** 5 | * 协议包 6 | * 7 | * @author leelovejava 8 | */ 9 | public class MessageProtocol { 10 | private int len; //关键 11 | private byte[] content; 12 | 13 | public int getLen() { 14 | return len; 15 | } 16 | 17 | public void setLen(int len) { 18 | this.len = len; 19 | } 20 | 21 | public byte[] getContent() { 22 | return content; 23 | } 24 | 25 | public void setContent(byte[] content) { 26 | this.content = content; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /boot-netty/src/main/java/com/atguigu/netty/protocoltcp/MyMessageEncoder.java: -------------------------------------------------------------------------------- 1 | package com.atguigu.netty.protocoltcp; 2 | 3 | import io.netty.buffer.ByteBuf; 4 | import io.netty.channel.ChannelHandlerContext; 5 | import io.netty.handler.codec.MessageToByteEncoder; 6 | 7 | public class MyMessageEncoder extends MessageToByteEncoder { 8 | @Override 9 | protected void encode(ChannelHandlerContext ctx, MessageProtocol msg, ByteBuf out) throws Exception { 10 | System.out.println("MyMessageEncoder encode 方法被调用"); 11 | out.writeInt(msg.getLen()); 12 | out.writeBytes(msg.getContent()); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /boot-netty/src/main/java/com/atguigu/netty/simple/Test.java: -------------------------------------------------------------------------------- 1 | package com.atguigu.netty.simple; 2 | 3 | import io.netty.util.NettyRuntime; 4 | 5 | public class Test { 6 | public static void main(String[] args) { 7 | System.out.println(NettyRuntime.availableProcessors()); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /boot-netty/src/main/java/com/atguigu/netty/source/echo/Test.java: -------------------------------------------------------------------------------- 1 | package com.atguigu.netty.source.echo; 2 | 3 | public class Test { 4 | public static void main(String[] args) throws Exception { 5 | System.out.println(System.nanoTime()); 6 | Thread.sleep(1000); 7 | System.out.println(System.nanoTime()); 8 | 9 | 10 | int a = 10; 11 | int b = 20; 12 | int c = 10; 13 | c -= a - b; // c = c - (a-b) = c - a + b = 10 - 10 + 20 14 | System.out.println(c); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /boot-netty/src/main/java/com/atguigu/netty/tcp/MyClientInitializer.java: -------------------------------------------------------------------------------- 1 | package com.atguigu.netty.tcp; 2 | 3 | import io.netty.channel.ChannelInitializer; 4 | import io.netty.channel.ChannelPipeline; 5 | import io.netty.channel.socket.SocketChannel; 6 | 7 | 8 | public class MyClientInitializer extends ChannelInitializer { 9 | @Override 10 | protected void initChannel(SocketChannel ch) throws Exception { 11 | 12 | ChannelPipeline pipeline = ch.pipeline(); 13 | pipeline.addLast(new MyClientHandler()); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /boot-netty/src/main/java/com/atguigu/netty/tcp/MyServerInitializer.java: -------------------------------------------------------------------------------- 1 | package com.atguigu.netty.tcp; 2 | 3 | 4 | 5 | import io.netty.channel.ChannelInitializer; 6 | import io.netty.channel.ChannelPipeline; 7 | import io.netty.channel.socket.SocketChannel; 8 | 9 | 10 | public class MyServerInitializer extends ChannelInitializer { 11 | 12 | @Override 13 | protected void initChannel(SocketChannel ch) throws Exception { 14 | ChannelPipeline pipeline = ch.pipeline(); 15 | 16 | pipeline.addLast(new MyServerHandler()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /boot-netty/src/main/java/com/leelovejava/netty/client/ClientApplication.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.netty.client; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * 客户端 启动类 8 | * 9 | * @author leelovejava 10 | */ 11 | @SpringBootApplication 12 | public class ClientApplication { 13 | 14 | public static void main(String[] args) { 15 | SpringApplication.run(ClientApplication.class, args); 16 | // 启动netty客户端 17 | NettyClient nettyClient = new NettyClient(); 18 | nettyClient.start(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /boot-netty/src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | #log4j.rootLogger=DEBUG, stdout 2 | #log4j.appender.stdout=org.apache.log4j.ConsoleAppender 3 | #log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 4 | #log4j.appender.stdout.layout.ConversionPattern=[%p] %C{1} - %m%n -------------------------------------------------------------------------------- /boot-rabbitmq/src/main/java/com/leelovejava/rabbit/BootRabbitmqApplication.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.rabbit; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * @author 翟永超 8 | */ 9 | @SpringBootApplication 10 | public class BootRabbitmqApplication { 11 | 12 | public static void main(String[] args) { 13 | SpringApplication.run(BootRabbitmqApplication.class, args); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /boot-rabbitmq/src/main/java/com/leelovejava/rabbit/transaction/ApiConstants.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.rabbit.transaction; 2 | 3 | /** 4 | * @author 翟永超 5 | */ 6 | public interface ApiConstants { 7 | /** 8 | * 应请求成功 9 | */ 10 | String HTTP_RES_CODE_200_VALUE = "success"; 11 | /** 12 | * 系统错误 13 | */ 14 | String HTTP_RES_CODE_500_VALUE = "fial"; 15 | /** 16 | * 响应请求成功code 17 | */ 18 | Integer HTTP_RES_CODE_200 = 200; 19 | /** 20 | * 系统错误 21 | */ 22 | Integer HTTP_RES_CODE_500 = 500; 23 | /** 24 | * 未关联QQ账号 25 | */ 26 | Integer HTTP_RES_CODE_201 = 201; 27 | 28 | } -------------------------------------------------------------------------------- /boot-rabbitmq/src/main/java/com/leelovejava/rabbit/transaction/entity/DispatchEntity.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.rabbit.transaction.entity; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * 派单 7 | * 8 | * @author 翟永超 9 | */ 10 | @Data 11 | public class DispatchEntity { 12 | 13 | private Long id; 14 | /** 15 | * 订单号 16 | */ 17 | private String orderId; 18 | /** 19 | * 外卖员id 20 | */ 21 | private Long takeoutUserId; 22 | 23 | } -------------------------------------------------------------------------------- /boot-rabbitmq/src/main/java/com/leelovejava/rabbit/transaction/entity/OrderEntity.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.rabbit.transaction.entity; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * 订单对象 7 | * @author 翟永超 8 | */ 9 | @Data 10 | public class OrderEntity { 11 | 12 | private Long id; 13 | /** 14 | * 订单名称 15 | */ 16 | private String name; 17 | /** 18 | * 下单金额 19 | */ 20 | private Double orderMoney; 21 | /** 22 | * 订单id 23 | */ 24 | private String orderId; 25 | } -------------------------------------------------------------------------------- /boot-rabbitmq/src/main/resources/application.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/boot-rabbitmq/src/main/resources/application.yml -------------------------------------------------------------------------------- /boot-rabbitmq/src/test/resources/rabbitmq分布式事务.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/boot-rabbitmq/src/test/resources/rabbitmq分布式事务.png -------------------------------------------------------------------------------- /boot-redis/distributed-lock-redisson/README.md: -------------------------------------------------------------------------------- 1 | [Redisson实现Redis分布式锁的N种姿势](https://mp.weixin.qq.com/s/iaZcc7QGbGHkZkfLeYp1yg) 2 | 3 | [中文文档](https://github.com/redisson/redisson/wiki/%E7%9B%AE%E5%BD%95) -------------------------------------------------------------------------------- /boot-redis/redis-delay/src/main/java/com/leelovejava/redis/delay/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * redis延迟队列 3 | * Springboot实现redis键失效监控操作 `https://blog.csdn.net/weixin_40969748/article/details/79593808` 4 | */ 5 | package com.leelovejava.redis.delay; -------------------------------------------------------------------------------- /boot-redis/redis-delay/src/main/java/com/leelovejava/redis/penetration/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 缓存击穿 3 | * 1. 缓存空值 4 | * 2. BloomFilter 5 | */ 6 | package com.leelovejava.redis.penetration; -------------------------------------------------------------------------------- /boot-redis/redis-delay/src/main/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/boot-redis/redis-delay/src/main/resources/application.properties -------------------------------------------------------------------------------- /boot-sample-tomcat-jsp/src/main/java/sample/tomcat/jsp/WelcomeController.java: -------------------------------------------------------------------------------- 1 | package sample.tomcat.jsp; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.GetMapping; 5 | 6 | @Controller 7 | public class WelcomeController { 8 | 9 | @GetMapping("/") 10 | public String welcome() { 11 | return "welcome"; 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /boot-sample-tomcat-jsp/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.mvc.view.prefix=/WEB-INF/jsp/ 2 | spring.mvc.view.suffix=.jsp 3 | application.message=Hello Phil -------------------------------------------------------------------------------- /boot-sample-tomcat-jsp/src/main/webapp/WEB-INF/jsp/welcome.jsp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

welcome

5 | 6 | 7 | -------------------------------------------------------------------------------- /boot-scala/src/main/java/com/leelovejava/BootScalaApplication.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * 8 | * @author tianhao 9 | */ 10 | @SpringBootApplication 11 | public class BootScalaApplication { 12 | 13 | public static void main(String[] args) { 14 | SpringApplication.run(BootScalaApplication.class, args); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /boot-scala/src/main/java/com/leelovejava/crontroller/HelloBoot.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.crontroller; 2 | 3 | 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | import org.springframework.web.bind.annotation.RequestMethod; 6 | import org.springframework.web.bind.annotation.RestController; 7 | 8 | /** 9 | * @author tianhao 10 | */ 11 | @RestController 12 | public class HelloBoot { 13 | 14 | 15 | @RequestMapping(value = "/sayHello", method = RequestMethod.GET) 16 | public String sayHello(){ 17 | return "Hello Boot...."; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /boot-scala/src/main/java/com/leelovejava/repository/MetaDatabaseRepository.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.repository; 2 | 3 | import com.leelovejava.domain.MetaDatabase; 4 | import org.springframework.data.repository.CrudRepository; 5 | 6 | public interface MetaDatabaseRepository extends CrudRepository{ 7 | } 8 | -------------------------------------------------------------------------------- /boot-scala/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 7777 3 | context-path: /scala-boot 4 | 5 | spring: 6 | datasource: 7 | driver-class-name: com.mysql.jdbc.Driver 8 | username: root 9 | password: root 10 | url: jdbc:mysql://192.168.9.183:3306/bootscala?useSSL=false 11 | jpa: 12 | hibernate: 13 | ddl-auto: update 14 | database: mysql 15 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/controller/ScalaHelloBoot.scala: -------------------------------------------------------------------------------- 1 | package com.leelovejava.controller 2 | 3 | import org.springframework.web.bind.annotation.{RequestMapping, RequestMethod, RestController} 4 | 5 | 6 | @RestController 7 | class ScalaHelloBoot { 8 | 9 | /** 10 | * http://127.0.0.1:7777/scala-boot/sayScalaHello 11 | * @return 12 | */ 13 | @RequestMapping(value = Array("/sayScalaHello"), method = Array(RequestMethod.GET)) 14 | def sayScalaHello() = { 15 | 16 | "Hello Scala Boot...." 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch01/1_declare.sc: -------------------------------------------------------------------------------- 1 | // These are meant to be typed into the REPL. You can also run 2 | // scala -Xnojline < repl-session.sc to run them all at once. 3 | 4 | // val不能改变 5 | val answer = 8 * 5 + 2 6 | 7 | 0.5 * answer 8 | 9 | val greeting: String = null 10 | //answer = 0 // This will give an error 11 | 12 | 13 | // var 能够改变 14 | var counter = 0 15 | counter = 1 // Ok, can change a var 16 | 17 | 18 | // 多值声明 19 | var i, j = 0 20 | var greeting2, message: String = null 21 | 22 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch01/2_type.sc: -------------------------------------------------------------------------------- 1 | // These are meant to be typed into the REPL. You can also run 2 | // scala -Xnojline < repl-session.sc to run them all at once. 3 | 4 | // 隐式转换成RichInt 5 | 1.toString() 6 | 7 | 1.to(10) 8 | 9 | // String 隐式转换成 StringOps 10 | "Hello".intersect("World") 11 | 12 | // 类型之间的转换需要通过方法进行,没有强制转化 13 | 99.04.toInt 14 | 15 | val i = null 16 | 17 | val j:Int = null -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch01/3_operator.sc: -------------------------------------------------------------------------------- 1 | // These are meant to be typed into the REPL. You can also run 2 | // scala -Xnojline < repl-session.scala to run them all at once. 3 | 4 | // Scala风格 5 | "Hello" intersect "World" // Can omit . and () for binary method 6 | "Hello".intersect("World") 7 | 8 | // 没有++、--操作符 9 | var counter = 0 10 | counter += 1 // Increments counter—Scala has no ++ 11 | 12 | // 提供BigInt和BigDecimal对象来处理大数据 13 | val x: BigInt = 1234567890 14 | x * x * x 15 | 16 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch01/4_call.sc: -------------------------------------------------------------------------------- 1 | // These are meant to be typed into the REPL. You can also run 2 | // scala -Xnojline < repl-session.scala to run them all at once. 3 | 4 | import scala.math._ 5 | // 函数调用 6 | sqrt(2) 7 | pow(2, 4) 8 | min(3, Pi) 9 | 10 | // 方法调用 11 | "Hello".distinct 12 | 13 | 14 | // 静态方法调用 15 | BigInt.probablePrime(100, scala.util.Random) 16 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch01/5_apply.sc: -------------------------------------------------------------------------------- 1 | // These are meant to be typed into the REPL. You can also run 2 | // scala -Xnojline < repl-session.scala to run them all at once. 3 | 4 | //获取字符 5 | "Hello"(4) 6 | 7 | //apply获取字符 8 | "Hello".apply(4) 9 | 10 | 11 | //声明数组 12 | val arr = Array(1,2,3) 13 | 14 | //apply声明数组 15 | Array.apply(1,2,3) 16 | 17 | BigInt("1234567890") 18 | 19 | BigInt.apply("1234567890") 20 | 21 | BigInt("1234567890") * BigInt("112358111321") 22 | 23 | //更新值 24 | arr(1) = 3 25 | 26 | arr 27 | 28 | //update方法更新值 29 | arr.update(1,4) 30 | 31 | arr -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch01/6_option.sc: -------------------------------------------------------------------------------- 1 | val scores = Map("Alice" -> 1729, "Fred" -> 42) 2 | 3 | scores.get("Alice") match { 4 | case Some(score) => println(score) 5 | case None => println("No score") 6 | } 7 | 8 | val alicesScore = scores.get("Alice") 9 | if (alicesScore.isEmpty) { println("No score") 10 | } else println(alicesScore.get) 11 | 12 | println(alicesScore.getOrElse("No score")) 13 | 14 | println(scores.getOrElse("Alice", "No score")) 15 | 16 | for (score <- scores.get("Alice")) println(score) 17 | 18 | scores.get("Alice").foreach(println _) -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch02/6_lazy.sc: -------------------------------------------------------------------------------- 1 | 2 | 3 | def init(): String = { 4 | println("call init()") 5 | return "" 6 | } 7 | 8 | 9 | def noLazy() { 10 | val property = init();//没有使用lazy修饰 11 | println("after init()") 12 | println(property) 13 | } 14 | 15 | def lazyed() { 16 | lazy val property = init();//没有使用lazy修饰 17 | println("after init()") 18 | println(property) 19 | } 20 | 21 | 22 | noLazy() 23 | 24 | lazyed() -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch02/7_exception.sc: -------------------------------------------------------------------------------- 1 | // These are meant to be typed into the REPL. You can also run 2 | // scala -Xnojline < repl-session.scala to run them all at once. 3 | 4 | import java.io.IOException 5 | 6 | import scala.math._ 7 | // 异常的为Nothing 8 | def root(x: Double) = 9 | if (x >= 0) { sqrt(x) 10 | } else throw new IllegalArgumentException("x should not be negative") 11 | 12 | try { 13 | println(root(4)) 14 | println(root(-4)) 15 | } catch { 16 | case e: Exception => println(e) 17 | } finally { 18 | println("finally....") 19 | } 20 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch03/11_set.sc: -------------------------------------------------------------------------------- 1 | 2 | var numberSet = Set(1, 2, 3) 3 | numberSet += 5 // Sets numberSet to the immutable set numberSet + 5 4 | numberSet 5 | 6 | Set(1, 2, 3) - 2 7 | 8 | Set(1, 2, 3) +1 9 | 10 | // 无序访问 11 | for(x <- Set(1, 2, 3, 4 ,5, 6)) print(x) 12 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch03/12_maptolist.sc: -------------------------------------------------------------------------------- 1 | // These are meant to be typed into the REPL. You can also run 2 | // scala -Xnojline < repl-session.scala to run them all at once. 3 | 4 | val names = List("Peter", "Paul", "Mary") 5 | 6 | // map 映射 7 | names.map(_.toUpperCase) // List("PETER", "PAUL", "MARY") 8 | 9 | for (n <- names) yield n.toUpperCase 10 | 11 | def ulcase(s: String) = Vector(s.toUpperCase(), s.toLowerCase()) 12 | 13 | names.map(ulcase) 14 | 15 | // flatmap映射 16 | names.flatMap(ulcase) 17 | 18 | names.foreach(println) 19 | 20 | 21 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch03/16_stream.sc: -------------------------------------------------------------------------------- 1 | 2 | // #:: 返回一个流 3 | def numsForm(n: BigInt) : Stream[BigInt] = n #:: numsForm( n + 1 ) 4 | 5 | val tenOrMore = numsForm(10) 6 | 7 | tenOrMore.tail 8 | 9 | tenOrMore.head 10 | 11 | // 获取最后一个元素 12 | tenOrMore.tail.tail.tail 13 | 14 | 15 | var squares = numsForm(5).map(x => x * x) 16 | 17 | squares.take(5).force 18 | 19 | //squares.force 不要尝试对一个无穷流的成员进行求值,OutOfMemoryError -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch03/18_concurrent.sc: -------------------------------------------------------------------------------- 1 | // These are meant to be typed into the REPL. You can also run 2 | // scala -Xnojline < repl-session.scala to run them all at once. 3 | 4 | (1 to 5).par.foreach{it => println(Thread.currentThread);print("^"+ it)} 5 | 6 | (1 to 5).par.map( _ + 100).seq -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch03/4_arrayjava.sc: -------------------------------------------------------------------------------- 1 | // These are meant to be typed into the REPL. You can also run 2 | // scala -Xnojline < repl-session.scala to run them all at once. 3 | 4 | 5 | // 和Java的互操作 6 | 7 | import scala.collection.JavaConverters._ 8 | import scala.collection.mutable 9 | import scala.collection.mutable.ArrayBuffer 10 | 11 | val command = ArrayBuffer("ls", "-al", "/") 12 | // ProessBuilder是java方法 13 | val pb = new ProcessBuilder(command.asJava) // Scala to Java 14 | 15 | val cmd : mutable.Buffer[String] = pb.command().asScala // Java to Scala 16 | 17 | cmd == command 18 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch03/6_mapjava.sc: -------------------------------------------------------------------------------- 1 | // These are meant to be typed into the REPL. You can also run 2 | // scala -Xnojline < repl-session.scala to run them all at once. 3 | 4 | import scala.collection.JavaConverters._ 5 | val ids = java.time.ZoneId.SHORT_IDS.asScala 6 | 7 | val props = System.getProperties().asScala 8 | 9 | import java.awt.font.TextAttribute._ // Import keys for map below 10 | val attrs = Map(FAMILY -> "Serif", SIZE -> 12) // A Scala map 11 | val font = new java.awt.Font(attrs.asJava) // Expects a Java map 12 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch03/7_tuple.sc: -------------------------------------------------------------------------------- 1 | // These are meant to be typed into the REPL. You can also run 2 | // scala -Xnojline < repl-session.scala to run them all at once. 3 | 4 | // 元组操作 5 | (1, 3.14, "Fred") 6 | 7 | val t = (1, 3.14, "Fred") 8 | 9 | val second = t._2 10 | 11 | val first = t _1 12 | 13 | //变量赋值 14 | val (first1, second1, third) = t 15 | 16 | val (first2, second2, _) = t 17 | 18 | 19 | // 拉链操作 20 | val symbols = Array("<", "-", ">") 21 | val counts = Array(2, 10, 2) 22 | val pairs = symbols.zip(counts) 23 | 24 | for ((s, n) <- pairs) print(s * n) 25 | 26 | symbols.zip(counts).toMap 27 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch03/8_queue.sc: -------------------------------------------------------------------------------- 1 | val q1 = new scala.collection.mutable.Queue[Int] 2 | 3 | //追加元素 4 | q1 += 1 5 | 6 | q1 += 2 7 | 8 | //追加多个元素并返回队列 9 | q1 ++= List(3, 4) 10 | 11 | //返回并从队列删除第一个元素 12 | q1.dequeue() 13 | 14 | //追加多个元素,返回类型为Unit 15 | q1.enqueue(5, 6, 7) 16 | 17 | q1 18 | 19 | //队列首部 20 | q1.head 21 | 22 | //队列尾部 23 | q1.tail 24 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch03/9_stack.sc: -------------------------------------------------------------------------------- 1 | val s = new scala.collection.mutable.Stack[Int]() 2 | 3 | //入栈 4 | s.push(1) 5 | 6 | //入栈多个元素 7 | s.push(2, 3, 4) 8 | 9 | //出栈 10 | s.pop() 11 | 12 | s 13 | 14 | s.push(5) 15 | 16 | //取栈顶元素而不出栈 17 | s.top 18 | 19 | s 20 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch04/10_copy.sc: -------------------------------------------------------------------------------- 1 | //package com.atguigu.scala.ch11.sec10 2 | 3 | abstract class Amount 4 | case class Dollar(value: Double) extends Amount 5 | case class Currency(value: Double, unit: String) extends Amount 6 | 7 | case object Nothing extends Amount 8 | 9 | val amt = Currency(29.95, "EUR") 10 | val price = amt.copy(value = 19.95) 11 | println(price) 12 | println(amt.copy(unit = "CHF")) 13 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch04/14_enum.sc: -------------------------------------------------------------------------------- 1 | //package com.atguigu.scala.ch11.sec15 2 | 3 | sealed abstract class TrafficLightColor 4 | 5 | case object Red extends TrafficLightColor 6 | 7 | case object Yellow extends TrafficLightColor 8 | 9 | case object Green extends TrafficLightColor 10 | 11 | for (color <- Array(Red, Yellow, Green)) 12 | println( 13 | color match { 14 | case Red => "stop" 15 | case Yellow => "hurry up" 16 | case Green => "go" 17 | }) 18 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch04/15_partial.sc: -------------------------------------------------------------------------------- 1 | // These are meant to be typed into the REPL. You can also run 2 | // scala -Xnojline < 15_partial.sc to run them all at once. 3 | 4 | val f: PartialFunction[Char, Int] = { case '+' => 1 ; case '-' => -1 } 5 | f('-') 6 | f.isDefinedAt('0') 7 | 8 | f('0') 9 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch04/2_guard.sc: -------------------------------------------------------------------------------- 1 | // These are meant to be typed into the REPL. You can also run 2 | // scala -Xnojline < repl-session.scala to run them all at once. 3 | 4 | //如果匹配,则把字符转换成10进制。 5 | 6 | for (ch <- "+-3!") { 7 | var sign = 0 8 | var digit = 0 9 | 10 | ch match { 11 | case '+' => sign = 1 12 | case '-' => sign = -1 13 | case _ if Character.isDigit(ch) => digit = Character.digit(ch, 10) 14 | case _ => sign = 0 15 | } 16 | 17 | println(ch + " " + sign + " " + digit) 18 | } 19 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch04/7_var.sc: -------------------------------------------------------------------------------- 1 | // These are meant to be typed into the REPL. You can also run 2 | // scala -Xnojline < repl-session.scala to run them all at once. 3 | 4 | val (x, y) = (1, 2) 5 | 6 | val (q, r) = BigInt(10) /% 3 7 | 8 | val arr = Array(1, 7, 2, 9) 9 | 10 | val Array(first, second, _*) = arr 11 | 12 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch04/8_for.sc: -------------------------------------------------------------------------------- 1 | // These are meant to be typed into the REPL. You can also run 2 | // scala -Xnojline < repl-session.scala to run them all at once. 3 | 4 | import scala.collection.JavaConverters._ 5 | // Converts Java Properties to a Scala map—just to get an interesting example 6 | for ((k, v) <- System.getProperties.asScala) 7 | println(k + " -> " + v) 8 | 9 | // 忽略匹配失败的项目,打出所有value为空的条目 10 | for ((k, "") <- System.getProperties.asScala) 11 | println(k) 12 | 13 | // 通过守卫提取所有V等于空的属性。 14 | for ((k, v) <- System.getProperties.asScala if v == "") 15 | println(k) 16 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch04/seal_13/Amount.scala: -------------------------------------------------------------------------------- 1 | package com.leelovejava.demo.ch04.seal_13 2 | 3 | sealed abstract class Amount 4 | 5 | case class Dollar(value: Double) extends Amount 6 | case class Currency(value: Double, unit: String) extends Amount 7 | 8 | object Main extends App { 9 | def show(amt: Amount) = 10 | // You will get a "match not exhaustive" warning. 11 | // That warning is not there if Amount isn't sealed. 12 | amt match { 13 | case Currency(v, u) => "I have " + v + " " + u 14 | } 15 | 16 | println(show(Currency(100000, "JPY"))) 17 | } 18 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch04/seal_13/Euro.scala: -------------------------------------------------------------------------------- 1 | package com.leelovejava.demo.ch04.seal_13 2 | 3 | 4 | 5 | //case class Euro(value: Double) extends Amount 6 | // This class doesn't compile since Amount is sealed in another file 7 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch05/1_var.sc: -------------------------------------------------------------------------------- 1 | // These are meant to be typed into the REPL. You can also run 2 | // scala -Xnojline < repl-session.scala to run them all at once. 3 | 4 | import scala.math._ 5 | val num = 3.14 6 | // _将ceil方法转换成函数,将函数赋值给变量 7 | val fun = ceil _ 8 | 9 | fun(num) 10 | 11 | // 传递函数 12 | Array(3.14, 1.42, 2.0).map(fun) 13 | 14 | 15 | def plus(x: Double) = 3 * x 16 | 17 | 18 | Array(3.14, 1.42, 2.0).map(plus) 19 | 20 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch05/2_anonymity.sc: -------------------------------------------------------------------------------- 1 | // These are meant to be typed into the REPL. You can also run 2 | // scala -Xnojline < repl-session.scala to run them all at once. 3 | 4 | // 函数表达式 5 | (x: Double) => 3 * x 6 | 7 | // 匿名函数 8 | val triple = (x: Double) => 3 * x 9 | 10 | Array(3.14, 1.42, 2.0).map(triple) 11 | // 包含在()中 12 | Array(3.14, 1.42, 2.0).map((x: Double) => 3 * x) 13 | // 包含在{}中 14 | Array(3.14, 1.42, 2.0) map { (x: Double) => 3 * x } 15 | 16 | def triple(x:Double)= 3 * x -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch05/3_high.sc: -------------------------------------------------------------------------------- 1 | // These are meant to be typed into the REPL. You can also run 2 | // scala -Xnojline < repl-session.scala to run them all at once. 3 | 4 | import scala.math._ 5 | 6 | def valueAtOneQuarter(f: (Double) => Double) = f(0.25) 7 | 8 | valueAtOneQuarter(ceil _) 9 | valueAtOneQuarter(sqrt _) 10 | 11 | // 产出函数 12 | def mulBy(factor : Double) = (x : Double) => factor * x 13 | 14 | val quintuple = mulBy(5) 15 | quintuple(20) 16 | 17 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch05/4_infer.sc: -------------------------------------------------------------------------------- 1 | // These are meant to be typed into the REPL. You can also run 2 | // scala -Xnojline < repl-session.scala to run them all at once. 3 | 4 | def valueAtOneQuarter(f: (Double) => Double) = f(0.25) 5 | 6 | // 传入函数表达式 7 | valueAtOneQuarter((x: Double) => 3 * x) 8 | // 参数推断省去类型信息 9 | valueAtOneQuarter((x) => 3 * x) 10 | // 单个参数可以省去括号 11 | valueAtOneQuarter(x => 3 * x) 12 | // 如果变量旨在=>右边只出现一次,可以用_来代替 13 | valueAtOneQuarter(3 * _) 14 | 15 | val fun2 = 3 * (_: Double) // OK 16 | val fun3: (Double) => Double = 3 * _ // OK 17 | 18 | val fun1 = 3 * _ // Error: Can’t infer types -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch05/5_closure.sc: -------------------------------------------------------------------------------- 1 | // These are meant to be typed into the REPL. You can also run 2 | // scala -Xnojline < repl-session.scala to run them all at once. 3 | 4 | def mulBy(factor : Double) = (x : Double) => factor * x 5 | 6 | val triple = mulBy(3) 7 | val half = mulBy(0.5) 8 | println(triple(14) + " " + half(14)) 9 | 10 | 11 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch05/6_currying.sc: -------------------------------------------------------------------------------- 1 | // These are meant to be typed into the REPL. You can also run 2 | // scala -Xnojline < repl-session.scala to run them all at once. 3 | 4 | // 传统定义两个参数 5 | def mul(x:Int, y: Int) = x * y 6 | mul(6,7) 7 | // 柯里化定义,使用到了闭包 8 | def mulOneAtATime(x: Int) = (y: Int) => x * y 9 | 10 | mulOneAtATime(6)(7) 11 | 12 | // Scala中可以简写 13 | def mulOneAtATime(x: Int)(y: Int) = x * y 14 | 15 | val a = Array("Hello", "World") 16 | val b = Array("hello", "world") 17 | // def corresponds[B](that: GenSeq[B])(p: (A,B) => Boolean): Boolean 18 | a.corresponds(b)(_.equalsIgnoreCase(_)) 19 | 20 | 21 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch06/3_private.sc: -------------------------------------------------------------------------------- 1 | // These are meant to be typed into the REPL. You can also run 2 | // scala -Xnojline < repl-session.scala to run them all at once. 3 | 4 | class Counter { 5 | private var value = 0 6 | def increment() { value += 1 } 7 | 8 | def isLess(other : Counter) = value < other.value 9 | // Can access private field of other object 10 | } 11 | 12 | class Counter2 { 13 | private[this] var value = 0 14 | def increment() { value += 1 } 15 | 16 | def isLess(other : Counter) = value < other.value 17 | // Can't access private[this] field of other object 18 | } 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch06/4_bean.sc: -------------------------------------------------------------------------------- 1 | import scala.beans.BeanProperty 2 | // These are meant to be typed into the REPL. You can also run 3 | // scala -Xnojline < repl-session.scala to run them all at once. 4 | 5 | 6 | class Person { 7 | @BeanProperty var name : String = _ 8 | } 9 | 10 | val fred = new Person 11 | fred.setName("Fred") 12 | fred.getName 13 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch07/1_single.sc: -------------------------------------------------------------------------------- 1 | // These are meant to be typed into the REPL. You can also run 2 | // scala -Xnojline < repl-session.scala to run them all at once. 3 | 4 | object Accounts { 5 | println("init") 6 | private var lastNumber = 0 7 | val abc = "wu" 8 | def newUniqueNumber() = { lastNumber += 1; lastNumber } 9 | } 10 | 11 | Accounts.newUniqueNumber() 12 | Accounts.newUniqueNumber() 13 | Accounts.abc -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch07/4_main.sc: -------------------------------------------------------------------------------- 1 | object Hello { 2 | def main(args: Array[String]) { 3 | println("Hello, World!") 4 | } 5 | } 6 | 7 | object Hello1 extends App { 8 | if (args.length > 0) 9 | println("Hello, " + args(0)) 10 | else 11 | println("Hello, World!") 12 | } -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch07/5_enum.sc: -------------------------------------------------------------------------------- 1 | // These are meant to be typed into the REPL. You can also run 2 | // scala -Xnojline < repl-session.scala to run them all at once. 3 | 4 | object TrafficLightColor extends Enumeration { 5 | val Red, Yellow, Green = Value 6 | } 7 | 8 | TrafficLightColor.Red 9 | TrafficLightColor.Red.id 10 | 11 | object TrafficLightColorSecond extends Enumeration { 12 | val Red = Value(0, "Stop") 13 | val Yellow = Value(10) // Name "Yellow" 14 | val Green = Value("Go") // ID 11 15 | } 16 | 17 | import TrafficLightColorSecond._ 18 | 19 | Red 20 | Yellow 21 | Green 22 | Green.id -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch08/sec01/Manager.scala: -------------------------------------------------------------------------------- 1 | package com.leelovejava.demo.ch08.sec01 2 | 3 | class Manager(name: String) { 4 | def description = "A manager with name " + name 5 | } 6 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch08/sec02/Manager.scala: -------------------------------------------------------------------------------- 1 | package com.leelovejava.demo.ch08.sec02 2 | 3 | class Manager { 4 | // The following doesn't work (look into Other.scala) 5 | // val subordinates = new collection.mutable.ArrayBuffer[Employee] 6 | val subordinates = new _root_.scala.collection.mutable.ArrayBuffer[Employee] 7 | def description = "A manager with " + subordinates.length + " subordinates" 8 | } 9 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch08/sec02/Other.scala: -------------------------------------------------------------------------------- 1 | package com.leelovejava.demo.ch08.sec02 2 | 3 | // ... 4 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch08/sec03/Person.scala: -------------------------------------------------------------------------------- 1 | package com.leelovejava.demo.ch08.sec03 2 | 3 | // 定义在父包 4 | package object people { 5 | val defaultName = "John Q. Public" 6 | } 7 | 8 | object Sec03Main extends App { 9 | val john = new com.leelovejava.demo.ch08.sec03.Person 10 | println(john.description) 11 | } 12 | 13 | class Person { 14 | var name = people.defaultName // A constant from the package 15 | def description = "A person with name " + name 16 | } 17 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch08/sec04/Person.scala: -------------------------------------------------------------------------------- 1 | package com.leelovejava.demo.ch08.sec04 2 | 3 | package object people { 4 | val defaultName = "John Q. Public" 5 | } 6 | 7 | object Sec04Main extends App { 8 | //val john = new com.leelovejava.demo.ch08.sec04.Person 9 | //println(john.description) 10 | } 11 | 12 | private[sec04] class Person { 13 | //var name = people.defaultName // A constant from the package 14 | //private[sec04] def description = "A person with name " + name 15 | //private[people] def description2 = "A person with name " + name 16 | } 17 | 18 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch08/sec06/rename.sc: -------------------------------------------------------------------------------- 1 | // These are meant to be typed into the REPL. You can also run 2 | // scala -Xnojline < repl-session.scala to run them all at once. 3 | 4 | import java.awt.{Color, Font} 5 | 6 | Color.RED 7 | Font.BOLD 8 | 9 | import java.util.{HashMap => JavaHashMap} 10 | import scala.collection.mutable._ 11 | 12 | new JavaHashMap[String, Int] 13 | new HashMap[String, Int] 14 | 15 | import java.util.{HashSet => _, _} 16 | import scala.collection.mutable._ 17 | 18 | new HashSet[String] 19 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch09/sec01/Employee.scala: -------------------------------------------------------------------------------- 1 | package com.leelovejava.demo.ch09.sec01 2 | 3 | class Person { 4 | var name = "" 5 | } 6 | 7 | class Employee extends Person { 8 | var salary = 0.0 9 | def description = "An employee with name " + name + " and salary " + salary 10 | } 11 | 12 | object Sec01Main extends App { 13 | val fred = new Employee 14 | fred.name = "Fred" 15 | fred.salary = 50000 16 | println(fred.description) 17 | } 18 | 19 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch09/sec02/Employee.scala: -------------------------------------------------------------------------------- 1 | package com.leelovejava.demo.ch09.sec02 2 | 3 | class Person { 4 | var name = "" 5 | override def toString = getClass.getName + "[name=" + name + "]" 6 | } 7 | 8 | class Employee extends Person { 9 | var salary = 0.0 10 | override def toString = super.toString + "[salary=" + salary + "]" 11 | } 12 | 13 | object Sec02Main extends App { 14 | val fred = new Employee 15 | fred.name = "Fred" 16 | fred.salary = 50000 17 | println(fred) 18 | } 19 | 20 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch09/sec07/7_anonymity.sc: -------------------------------------------------------------------------------- 1 | // These are meant to be typed into the REPL. You can also run 2 | // scala -Xnojline < repl-session.scala to run them all at once. 3 | 4 | class Person(val name: String) { 5 | override def toString = getClass.getName + "[name=" + name + "]" 6 | } 7 | 8 | val alien = new Person("Fred") { 9 | def greeting = "Greetings, Earthling! My name is Fred." 10 | } 11 | 12 | def meet(p: Person{def greeting: String}) { 13 | println(p.name + " says: " + p.greeting) 14 | } 15 | 16 | meet(alien) 17 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch10/sec02/Logger.scala: -------------------------------------------------------------------------------- 1 | package com.leelovejava.demo.ch10.sec02 2 | 3 | import java.io.Serializable 4 | 5 | trait Logger { 6 | def log(msg: String) // An abstract method 7 | } 8 | 9 | class ConsoleLogger extends Logger // Use extends, not implements 10 | with Cloneable with Serializable { // Use with to add multiple traits 11 | def log(msg: String) { println(msg) } // No override needed 12 | } 13 | 14 | object Main extends App { 15 | val logger = new ConsoleLogger 16 | logger.log("Exiting Main") 17 | } 18 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch10/sec03/Logger.scala: -------------------------------------------------------------------------------- 1 | package com.leelovejava.demo.ch10.sec03 2 | 3 | trait ConsoleLogger { 4 | def log(msg: String) { println(msg) } 5 | } 6 | 7 | class Account { 8 | protected var balance = 0.0 9 | } 10 | 11 | class SavingsAccount extends Account with ConsoleLogger { 12 | def withdraw(amount: Double) { 13 | if (amount > balance) log("Insufficient funds") 14 | else balance -= amount 15 | } 16 | // More methods ... 17 | } 18 | 19 | object Main extends App { 20 | val acct = new SavingsAccount 21 | acct.withdraw(100) 22 | } 23 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch10/sec10/app.log: -------------------------------------------------------------------------------- 1 | # Tue Dec 06 09:22:46 PST 2011 2 | Insufficient... 3 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch10/sec11/myapp.log: -------------------------------------------------------------------------------- 1 | Insufficient funds 2 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch10/sec11/myapp2.log: -------------------------------------------------------------------------------- 1 | Insufficient funds 2 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch11/1_class.sc: -------------------------------------------------------------------------------- 1 | // These are meant to be typed into the REPL. You can also run 2 | // scala -Xnojline < repl-session.scala to run them all at once. 3 | 4 | class Pair[T, S](val first: T, val second: S) { 5 | override def toString = "(" + first + "," + second + ")" 6 | } 7 | 8 | val p = new Pair(42, "String") 9 | 10 | val p2 = new Pair[Any, Any](42, "String") 11 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch11/2_method.sc: -------------------------------------------------------------------------------- 1 | // These are meant to be typed into the REPL. You can also run 2 | // scala -Xnojline < repl-session.scala to run them all at once. 3 | 4 | def getMiddle[T](a: Array[T]) = a(a.length / 2) 5 | 6 | getMiddle(Array("Mary", "had", "a", "little", "lamb")) 7 | 8 | val f = getMiddle[String] _ 9 | 10 | f(Array("Mary", "had", "a", "little", "lamb")) 11 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch11/4_view.sc: -------------------------------------------------------------------------------- 1 | // These are meant to be typed into the REPL. You can also run 2 | // scala -Xnojline < repl-session.scala to run them all at once. 3 | 4 | //视图界定 5 | class PairSec04[T <% Comparable[T]](val first: T, val second: T) { 6 | def smaller = if (first.compareTo(second) < 0) first else second 7 | override def toString = "(" + first + "," + second + ")" 8 | } 9 | 10 | val p = new PairSec04(4, 2) // Works 11 | p.smaller 12 | 13 | 14 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch11/5_context.sc: -------------------------------------------------------------------------------- 1 | // These are meant to be typed into the REPL. You can also run 2 | // scala -Xnojline < 5_context.sc to run them all at once. 3 | 4 | class Pair[T : Ordering](val first: T, val second: T) { 5 | def smaller(implicit ord: Ordering[T]) ={ 6 | println(ord) 7 | if (ord.compare(first, second) < 0) first else second 8 | } 9 | 10 | override def toString = "(" + first + "," + second + ")" 11 | } 12 | // Predef 类中有对应的隐式参数 13 | 14 | val p = new Pair(4, 2) 15 | p.smaller 16 | 17 | val q = new Pair("Fred", "Brooks") 18 | q.smaller 19 | 20 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch12/05_param.sc: -------------------------------------------------------------------------------- 1 | // These are meant to be typed into the REPL. You can also run 2 | // scala -Xnojline < repl-session.scala to run them all at once. 3 | 4 | case class Delimiters(left: String, right: String) 5 | 6 | def quote(what: String)(implicit delims: Delimiters) = 7 | delims.left + what + delims.right 8 | 9 | quote("Bonjour le monde")(Delimiters("«", "»")) 10 | 11 | object FrenchPunctuation { 12 | implicit val quoteDelimiters = Delimiters("«", "»") 13 | } 14 | 15 | import FrenchPunctuation._ 16 | // import FrenchPunctuation.quoteDelimiters 17 | 18 | quote("Bonjour le monde") 19 | 20 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch12/06_transfer.sc: -------------------------------------------------------------------------------- 1 | // These are meant to be typed into the REPL. You can also run 2 | // scala -Xnojline < 06_transfer.sc to run them all at once. 3 | 4 | def smaller[T](a: T, b: T)(implicit order: T => Ordered[T]) 5 | = if (order(a) < b) a else b 6 | 7 | smaller(40, 2) 8 | 9 | smaller("Hello", "World") 10 | 11 | def smaller1[T](a: T, b: T)(implicit order: T => Ordered[T]) 12 | = if (a < b) a else b // Can omit call to order 13 | 14 | smaller1(40, 2) 15 | 16 | smaller1("Hello", "World") 17 | 18 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch13/sec01/mary.txt: -------------------------------------------------------------------------------- 1 | Mary had a little lamb, 2 | little lamb, little lamb, 3 | Mary had a little lamb, its fleece was white as snow. 4 | And everywhere that Mary went, 5 | Mary went, Mary went, 6 | and everywhere that Mary went, the lamb was sure to go. 7 | 8 | It followed her to school one day 9 | school one day, school one day, 10 | It followed her to school one day, which was against the rules. 11 | It made the children laugh and play, 12 | laugh and play, laugh and play, 13 | it made the children laugh and play to see a lamb at school. 14 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch13/sec02/mary.txt: -------------------------------------------------------------------------------- 1 | Mary had a little lamb, 2 | little lamb, little lamb, 3 | Mary had a little lamb, its fleece was white as snow. 4 | And everywhere that Mary went, 5 | Mary went, Mary went, 6 | and everywhere that Mary went, the lamb was sure to go. 7 | 8 | It followed her to school one day 9 | school one day, school one day, 10 | It followed her to school one day, which was against the rules. 11 | It made the children laugh and play, 12 | laugh and play, laugh and play, 13 | it made the children laugh and play to see a lamb at school. 14 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch13/sec03/03_unit.sc: -------------------------------------------------------------------------------- 1 | // These are meant to be typed into the REPL. You can also run 2 | // scala -Xnojline < 03_unit.sc to run them all at once. 3 | 4 | import scala.io._ 5 | 6 | val source = Source.fromFile("values.txt", "UTF-8") 7 | val tokens = source.mkString.split("\\s+") 8 | val numbers = for (w <- tokens) yield w.toDouble 9 | println("Sum: " + numbers.sum) 10 | 11 | print("How old are you? ") 12 | val age = StdIn.readInt() 13 | println("Next year, you will be " + (age + 1)) 14 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch13/sec03/values.txt: -------------------------------------------------------------------------------- 1 | 18.3 2 | 20.7 3 | 23.5 4 | 28.3 5 | 33.2 6 | 38.8 7 | 40.1 8 | 39.1 9 | 36.3 10 | 30.2 11 | 22.9 12 | 18.3 13 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch13/sec04/04_binary.sc: -------------------------------------------------------------------------------- 1 | // These are meant to be typed into the REPL. You can also run 2 | // scala -Xnojline < 04_binary.sc to run them all at once. 3 | 4 | import java.io._ 5 | 6 | val file = new File("repl-session.zip") 7 | val in = new FileInputStream(file) 8 | val bytes = new Array[Byte](file.length.toInt) 9 | in.read(bytes) 10 | in.close() 11 | 12 | print(f"Zip files starts with ${bytes(0)}%c${bytes(1)}%c, the initials of their inventor.%n") 13 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch13/sec04/04_url.sc: -------------------------------------------------------------------------------- 1 | // These are meant to be typed into the REPL. You can also run 2 | // scala -Xnojline < 04_url.sc to run them all at once. 3 | 4 | import scala.io.Source 5 | 6 | val source1 = Source.fromURL("http://horstmann.com", "UTF-8") 7 | println(source1.mkString.length + " bytes") 8 | val source2 = Source.fromString("Hello, World!") 9 | println(source2.mkString.length + " bytes") 10 | // Reads from the given string—useful for debugging 11 | println("What is your name?") 12 | val source3 = Source.stdin 13 | // Reads from standard input 14 | println("Hello, " + source3.getLines.next) 15 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch13/sec04/04_write.sc: -------------------------------------------------------------------------------- 1 | // These are meant to be typed into the REPL. You can also run 2 | // scala -Xnojline < 04_write.sc to run them all at once. 3 | 4 | import java.io._ 5 | 6 | val out = new PrintWriter("numbers.txt") 7 | for (i <- 1 to 10) out.print("%6d %10.6f\n".format(i, 1.0 / i)) 8 | out.close() 9 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch13/sec04/repl-session.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/boot-scala/src/main/scala/com/leelovejava/demo/ch13/sec04/repl-session.zip -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch13/sec05/test.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/boot-scala/src/main/scala/com/leelovejava/demo/ch13/sec05/test.obj -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch14/sec01/01_link.sc: -------------------------------------------------------------------------------- 1 | class A { 2 | private var name:String=null 3 | /*def setName(name:String)={ 4 | this.name = name 5 | this // 返回调用对象 6 | }*/ 7 | 8 | def setName(name:String):this.type ={ 9 | this.name = name 10 | this // 返回调用对象 11 | } 12 | } 13 | class B extends A{ 14 | private var sex:String = null 15 | def setAge(sex:String)={ 16 | this.sex=sex 17 | this 18 | } 19 | } 20 | val a:A = new A 21 | val b:B = new B 22 | b.setName("WangBa").setAge("woman") // 无法执行 23 | print(b) 24 | b.setAge("WangBa").setName("woman") // 可以执行 25 | print(b) 26 | 27 | 28 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch14/sec04/Book.sc: -------------------------------------------------------------------------------- 1 | class Document { 2 | import scala.collection.mutable._ 3 | type Index = HashMap[String, (Int, Int)] 4 | } 5 | 6 | class Book extends Document { 7 | val tables = new Index 8 | val figures = new Index 9 | 10 | def addTableRef(title: String, chapter: Int, section: Int) { 11 | tables += title -> (chapter, section) 12 | } 13 | 14 | def addFigureRef(caption: String, chapter: Int, section: Int) { 15 | figures += caption -> (chapter, section) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/ch14/sec05/Appender.sc: -------------------------------------------------------------------------------- 1 | def appendLines(target: { def append(str: String): Any }, lines: Iterable[String]) { 2 | for (l <- lines) { target.append(l); target.append("\n") } 3 | } 4 | 5 | val lines = Array("Mary", "had", "a", "little", "lamb") 6 | 7 | val builder = new StringBuilder 8 | appendLines(builder, lines) 9 | println(builder) -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/demo/train/Lesson_Trait01.scala: -------------------------------------------------------------------------------- 1 | package com.leelovejava.demo.train 2 | 3 | /** 4 | * trait 特质特性,第一个关键字用extends,之后用with 5 | */ 6 | 7 | trait Speak{ 8 | def speak(name:String) = { 9 | println(name+" is speaking...") 10 | } 11 | } 12 | trait Listen{ 13 | def listen(name:String) = { 14 | println(name+" is listening...") 15 | } 16 | } 17 | 18 | class Person1() extends Speak with Listen{ 19 | 20 | } 21 | 22 | 23 | object Lesson_Trait01 { 24 | def main(args: Array[String]): Unit = { 25 | val p = new Person1() 26 | p.speak("zhangsan") 27 | p.listen("lisi") 28 | } 29 | } -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/domain/MetaTable.scala: -------------------------------------------------------------------------------- 1 | package com.leelovejava.domain 2 | 3 | import javax.persistence.{Entity, GeneratedValue, Id, Table} 4 | 5 | import scala.beans.BeanProperty 6 | 7 | 8 | @Entity 9 | @Table 10 | class MetaTable { 11 | 12 | @Id 13 | @GeneratedValue 14 | @BeanProperty 15 | var id:Integer = _ 16 | 17 | @BeanProperty 18 | var name:String = _ 19 | 20 | @BeanProperty 21 | var tableType:String = _ 22 | 23 | @BeanProperty 24 | var dbId:Integer = _ 25 | } 26 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/obj/DecProgramApp.scala: -------------------------------------------------------------------------------- 1 | package com.leelovejava.obj 2 | 3 | /** 4 | * 声明式编程 5 | */ 6 | object DecProgramApp { 7 | 8 | def main(args: Array[String]): Unit = { 9 | val page = 1 10 | val allUsers = List(User("jack", 1, "2018-12-12"), User("rose", 2, "2018-12-13")) 11 | val pageList = 12 | allUsers 13 | .sortBy(u => (u.role, u.name, u.addTime)) // 依次按 role, name, addTime 进行排序 14 | .drop(page * 10) // 跳过之前页数据 15 | .take(10) // 取当前页数据,如不足10个则全部返回 16 | } 17 | } 18 | 19 | case class User(name: String, role: Int, addTime: String) -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/obj/HelloWorld.scala: -------------------------------------------------------------------------------- 1 | package com.leelovejava.obj 2 | 3 | object HelloWorld { 4 | 5 | def main(args: Array[String]): Unit = { 6 | println("Hello World!") 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/obj/obj/Accounts.scala: -------------------------------------------------------------------------------- 1 | package com.leelovejava.obj.obj 2 | 3 | /** 4 | * Scala对象之单例对象 5 | */ 6 | object Accounts { 7 | /** 8 | * 单例对象 9 | * Scala中没有静态方法和静态字段,可以用object语法达到同样目的 10 | */ 11 | println("init") 12 | private var lastNumber = 0 13 | 14 | /** 15 | * 对象具有类的所有特性,但不能给构造器设置参数 16 | * @return 17 | */ 18 | def newUniqueNumber() = { 19 | lastNumber += 1 20 | // 最后一行为返回 21 | lastNumber 22 | } 23 | // 调用 Accounts.newUniqueNumber() 24 | } 25 | -------------------------------------------------------------------------------- /boot-scala/src/main/scala/com/leelovejava/repository/MetaTableRepository.scala: -------------------------------------------------------------------------------- 1 | package com.leelovejava.repository 2 | 3 | import com.leelovejava.domain.MetaTable 4 | import org.springframework.data.repository.CrudRepository 5 | 6 | trait MetaTableRepository extends CrudRepository[MetaTable, Integer]{ 7 | 8 | } 9 | -------------------------------------------------------------------------------- /boot-scala/src/test/java/com/leelovejava/ImoocBootScalaApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class ImoocBootScalaApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /boot-session/src/main/java/com/leelovejava/boot/session/SessionApplication.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.boot.session; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * @author leelovejava 8 | * @date 2020/4/15 9:54 9 | **/ 10 | @SpringBootApplication 11 | public class SessionApplication { 12 | public static void main(String[] args) { 13 | SpringApplication.run(SessionApplication.class, args); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /boot-session/src/main/java/com/leelovejava/boot/session/config/SessionConfig.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.boot.session.config; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession; 5 | 6 | /** 7 | * session配置 8 | * 设置session的默认在redis中的存活时间 9 | * @author leelovejava 10 | */ 11 | @Configuration 12 | @EnableRedisHttpSession(maxInactiveIntervalInSeconds = 60 * 60 * 8) 13 | public class SessionConfig { 14 | } 15 | -------------------------------------------------------------------------------- /boot-session/src/main/java/com/leelovejava/boot/session/config/SessionInitializer.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.boot.session.config; 2 | 3 | 4 | import org.springframework.session.web.context.AbstractHttpSessionApplicationInitializer; 5 | 6 | /** 7 | * 初始化Session配置 8 | * 9 | * @author leelovejava 10 | */ 11 | public class SessionInitializer extends AbstractHttpSessionApplicationInitializer { 12 | public SessionInitializer() { 13 | super(SessionConfig.class); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /boot-session/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | redis: 3 | host: 127.0.0.1 4 | database: 1 5 | session: 6 | # 设置session保存为默认redis的方式 7 | store-type: redis 8 | -------------------------------------------------------------------------------- /boot-starter-tutorial/README.md: -------------------------------------------------------------------------------- 1 | [SpringBoot自定义starter](https://mp.weixin.qq.com/s/F0JyDDYJ5OUvj7H8vBMYWA) -------------------------------------------------------------------------------- /boot-starter-tutorial/src/main/java/site/exception/GirlFriendService.java: -------------------------------------------------------------------------------- 1 | package site.exception; 2 | 3 | /** 4 | * 女盆友接口 5 | * @author www.exception.site(exception 教程网) 6 | * @date 2019/1/30 7 | * @time 11:07 8 | * @discription 9 | **/ 10 | public interface GirlFriendService { 11 | /** 12 | * 打招呼 13 | * @return 14 | */ 15 | void say(); 16 | } -------------------------------------------------------------------------------- /boot-starter-tutorial/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/boot-starter-tutorial/src/main/resources/META-INF/spring.factories -------------------------------------------------------------------------------- /boot-statemachine/src/main/java/com/leelovejava/boot/statemachine/constant/RedisKeyConstant.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.boot.statemachine.constant; 2 | 3 | /** 4 | * redis的键定义 5 | * 6 | * @author leelovejava 7 | * @date 2020/6/4 0:36 8 | **/ 9 | public class RedisKeyConstant { 10 | /** 11 | * 状态机 前缀+订单id 12 | */ 13 | public static final String STATE_MACHINE_PREFIX = "statemachine:order"; 14 | } 15 | -------------------------------------------------------------------------------- /boot-statemachine/src/main/java/com/leelovejava/boot/statemachine/entity/Events.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.boot.statemachine.entity; 2 | 3 | /** 4 | * 事件 5 | * 6 | * @author leelovejava 7 | */ 8 | public enum Events { 9 | /** 10 | * 支付 11 | * 支付事件PAY会触发状态从待支付UNPAID状态到待收货WAITING_FOR_RECEIVE状态的迁移 12 | */ 13 | PAY, 14 | /** 15 | * 收货 16 | * 收货事件RECEIVE会触发状态从待收货WAITING_FOR_RECEIVE状态到结束DONE状态的迁移 17 | */ 18 | RECEIVE 19 | } -------------------------------------------------------------------------------- /boot-statemachine/src/main/java/com/leelovejava/boot/statemachine/entity/States.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.boot.statemachine.entity; 2 | 3 | /** 4 | * 状态 5 | * 6 | * @author leelovejava 7 | */ 8 | public enum States { 9 | /** 10 | * 待支付 11 | */ 12 | UNPAID, 13 | /** 14 | * 待收货 15 | */ 16 | WAITING_FOR_RECEIVE, 17 | /** 18 | * 结束 19 | */ 20 | DONE; 21 | } -------------------------------------------------------------------------------- /boot-statemachine/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: stateMachine 4 | redis: 5 | host: 127.0.0.1 6 | database: 1 -------------------------------------------------------------------------------- /boot-swagger/src/main/java/com/didispace/Application.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * 8 | * @author 程序猿DD 9 | * @version 1.0.0 10 | * @blog http://blog.didispace.com 11 | * 12 | */ 13 | @SpringBootApplication 14 | public class Application { 15 | 16 | public static void main(String[] args) { 17 | 18 | SpringApplication.run(Application.class, args); 19 | 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /boot-swagger/src/main/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/boot-swagger/src/main/resources/application.properties -------------------------------------------------------------------------------- /boot-templates/boot-freemarker/src/main/java/com/didispace/Application.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * 8 | * @author 程序猿DD 9 | * @version 1.0.0 10 | * @blog http://blog.didispace.com 11 | * 12 | */ 13 | @SpringBootApplication 14 | public class Application { 15 | 16 | public static void main(String[] args) { 17 | 18 | SpringApplication.run(Application.class, args); 19 | 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /boot-templates/boot-freemarker/src/main/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/boot-templates/boot-freemarker/src/main/resources/application.properties -------------------------------------------------------------------------------- /boot-templates/boot-freemarker/src/main/resources/templates/index.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | FreeMarker模板引擎 9 |

${host}

10 | 11 | -------------------------------------------------------------------------------- /boot-templates/boot-thymeleaf/src/main/java/com/didispace/ThymeleafApplication.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * 8 | * @author 程序猿DD 9 | * @version 1.0.0 10 | * @blog http://blog.didispace.com 11 | * 12 | */ 13 | @SpringBootApplication 14 | public class ThymeleafApplication { 15 | 16 | public static void main(String[] args) { 17 | 18 | SpringApplication.run(ThymeleafApplication.class, args); 19 | 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /boot-templates/boot-thymeleaf/src/main/resources/application.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/boot-templates/boot-thymeleaf/src/main/resources/application.yml -------------------------------------------------------------------------------- /boot-templates/boot-thymeleaf/src/main/resources/assets/1526434145635.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/boot-templates/boot-thymeleaf/src/main/resources/assets/1526434145635.png -------------------------------------------------------------------------------- /boot-templates/boot-thymeleaf/src/main/resources/assets/1526435213659.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/boot-templates/boot-thymeleaf/src/main/resources/assets/1526435213659.png -------------------------------------------------------------------------------- /boot-templates/boot-thymeleaf/src/main/resources/assets/1526435267302.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/boot-templates/boot-thymeleaf/src/main/resources/assets/1526435267302.png -------------------------------------------------------------------------------- /boot-templates/boot-thymeleaf/src/main/resources/assets/1526435317440.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/boot-templates/boot-thymeleaf/src/main/resources/assets/1526435317440.png -------------------------------------------------------------------------------- /boot-templates/boot-thymeleaf/src/main/resources/assets/1526435434999.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/boot-templates/boot-thymeleaf/src/main/resources/assets/1526435434999.png -------------------------------------------------------------------------------- /boot-templates/boot-thymeleaf/src/main/resources/assets/1526435647041.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/boot-templates/boot-thymeleaf/src/main/resources/assets/1526435647041.png -------------------------------------------------------------------------------- /boot-templates/boot-thymeleaf/src/main/resources/assets/1526435706301.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/boot-templates/boot-thymeleaf/src/main/resources/assets/1526435706301.png -------------------------------------------------------------------------------- /boot-templates/boot-thymeleaf/src/main/resources/assets/1526436248528.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/boot-templates/boot-thymeleaf/src/main/resources/assets/1526436248528.png -------------------------------------------------------------------------------- /boot-templates/boot-thymeleaf/src/main/resources/assets/1526438010948.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/boot-templates/boot-thymeleaf/src/main/resources/assets/1526438010948.png -------------------------------------------------------------------------------- /boot-templates/boot-thymeleaf/src/main/resources/assets/1526438337869.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/boot-templates/boot-thymeleaf/src/main/resources/assets/1526438337869.png -------------------------------------------------------------------------------- /boot-templates/boot-thymeleaf/src/main/resources/assets/1526440538848.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/boot-templates/boot-thymeleaf/src/main/resources/assets/1526440538848.png -------------------------------------------------------------------------------- /boot-templates/boot-thymeleaf/src/main/resources/assets/1526958538157.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/boot-templates/boot-thymeleaf/src/main/resources/assets/1526958538157.png -------------------------------------------------------------------------------- /boot-templates/boot-thymeleaf/src/main/resources/assets/1526958856078.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/boot-templates/boot-thymeleaf/src/main/resources/assets/1526958856078.png -------------------------------------------------------------------------------- /boot-templates/boot-thymeleaf/src/main/resources/assets/1526959781368.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/boot-templates/boot-thymeleaf/src/main/resources/assets/1526959781368.png -------------------------------------------------------------------------------- /boot-templates/boot-thymeleaf/src/main/resources/assets/1526959990356.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/boot-templates/boot-thymeleaf/src/main/resources/assets/1526959990356.png -------------------------------------------------------------------------------- /boot-templates/boot-thymeleaf/src/main/resources/assets/1526960230778.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/boot-templates/boot-thymeleaf/src/main/resources/assets/1526960230778.png -------------------------------------------------------------------------------- /boot-templates/boot-thymeleaf/src/main/resources/assets/1526960384564.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/boot-templates/boot-thymeleaf/src/main/resources/assets/1526960384564.png -------------------------------------------------------------------------------- /boot-templates/boot-thymeleaf/src/main/resources/assets/1526960499522.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/boot-templates/boot-thymeleaf/src/main/resources/assets/1526960499522.png -------------------------------------------------------------------------------- /boot-templates/boot-thymeleaf/src/main/resources/assets/1526960621714.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/boot-templates/boot-thymeleaf/src/main/resources/assets/1526960621714.png -------------------------------------------------------------------------------- /boot-templates/boot-thymeleaf/src/main/resources/assets/1526961251878.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/boot-templates/boot-thymeleaf/src/main/resources/assets/1526961251878.png -------------------------------------------------------------------------------- /boot-templates/boot-thymeleaf/src/main/resources/assets/1526961525185.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/boot-templates/boot-thymeleaf/src/main/resources/assets/1526961525185.png -------------------------------------------------------------------------------- /boot-templates/boot-thymeleaf/src/main/resources/assets/1526961583904.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/boot-templates/boot-thymeleaf/src/main/resources/assets/1526961583904.png -------------------------------------------------------------------------------- /boot-templates/boot-thymeleaf/src/main/resources/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Thymeleaf 6 | 7 | 8 |

Hello World

9 | 10 | -------------------------------------------------------------------------------- /boot-templates/boot-velocity/src/main/java/com/didispace/Application.java: -------------------------------------------------------------------------------- 1 | package com.didispace; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * 8 | * @author 程序猿DD 9 | * @version 1.0.0 10 | * @blog http://blog.didispace.com 11 | * 12 | */ 13 | @SpringBootApplication 14 | public class Application { 15 | 16 | public static void main(String[] args) { 17 | 18 | SpringApplication.run(Application.class, args); 19 | 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /boot-templates/boot-velocity/src/main/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/boot-templates/boot-velocity/src/main/resources/application.properties -------------------------------------------------------------------------------- /boot-templates/boot-velocity/src/main/resources/templates/index.vm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Velocity模板 9 |

${host}

10 | 11 | -------------------------------------------------------------------------------- /boot-validate/README.md: -------------------------------------------------------------------------------- 1 | # SpringBoot 数据验证 2 | 3 | [Spring Boot 参数校验](https://www.cnblogs.com/cjsblog/p/8946768.html) 4 | 5 | 基于类验证 6 | [轻松搞定数据验证(一)](https://blog.battcn.com/2018/06/05/springboot/v2-other-validate1/) 7 | 8 | 基于自定义注解验证 9 | [轻松搞定数据验证(二)](https://blog.battcn.com/2018/06/06/springboot/v2-other-validate2/) 10 | 11 | [Hibernate-validator](https://blog.csdn.net/xgblog/article/details/52548659) -------------------------------------------------------------------------------- /boot-validate/src/main/java/com/battcn/BootValidateApplication.java: -------------------------------------------------------------------------------- 1 | package com.battcn; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | 7 | /** 8 | * @author Levin 9 | */ 10 | @SpringBootApplication 11 | public class BootValidateApplication { 12 | public static void main(String[] args) { 13 | SpringApplication.run(BootValidateApplication.class, args); 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /boot-validate/src/main/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/boot-validate/src/main/resources/application.properties -------------------------------------------------------------------------------- /boot-work-flowable/.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 | © 2020 GitHub, Inc. 35 | -------------------------------------------------------------------------------- /boot-work-flowable/REAME.md: -------------------------------------------------------------------------------- 1 | # flowable 2 | 3 | ## 工作流 4 | 5 | ## 官网 6 | [flowable](https://www.flowable.org/docs/userguide/index.html) 7 | -------------------------------------------------------------------------------- /boot-work-flowable/doc/01-程序启动创建MySQL表.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/boot-work-flowable/doc/01-程序启动创建MySQL表.png -------------------------------------------------------------------------------- /boot-work-flowable/doc/02-创建60张表.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/boot-work-flowable/doc/02-创建60张表.png -------------------------------------------------------------------------------- /boot-work-flowable/doc/03-示例 请假流程.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/boot-work-flowable/doc/03-示例 请假流程.png -------------------------------------------------------------------------------- /boot-work-flowable/doc/04-查看请假流程.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/boot-work-flowable/doc/04-查看请假流程.png -------------------------------------------------------------------------------- /boot-work-flowable/src/main/java/com/leelovejava/boot/flowable/SpringbootWorkFlowableApplication.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.boot.flowable; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * @author tianhao 8 | */ 9 | @SpringBootApplication 10 | public class SpringbootWorkFlowableApplication { 11 | 12 | public static void main(String[] args) { 13 | SpringApplication.run(SpringbootWorkFlowableApplication.class, args); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /boot-work-flowable/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | datasource: 3 | url: jdbc:mysql://127.0.0.1:3306/flowable?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&verifyServerCertificate=false&useSSL=false 4 | username: root 5 | password: root 6 | server: 7 | port: 4000 8 | -------------------------------------------------------------------------------- /drools-learning/README.md: -------------------------------------------------------------------------------- 1 | 规则引擎 2 | https://www.jianshu.com/p/41ea7a43093c 3 | -------------------------------------------------------------------------------- /drools-learning/src/main/resources/META-INF/kmodule.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /drools-learning/src/main/resources/rules/age.drl: -------------------------------------------------------------------------------- 1 | import com.lrq.wechatDemo.domain.User // 导入类 2 | 3 | dialect "mvel" 4 | 5 | rule "age" // 规则名,唯一 6 | when 7 | $user : User(age<15 || age>60) //规则的条件部分 8 | then 9 | System.out.println("年龄不符合要求!"); 10 | end -------------------------------------------------------------------------------- /easyexcel/README.md: -------------------------------------------------------------------------------- 1 | [easyexcel](https://github.com/alibaba/easyexcel) 2 | 3 | [7 行代码优雅地实现 Excel 文件导出功能](https://mp.weixin.qq.com/s/F19RlBLfgrXBdOqS0cmU6Q) -------------------------------------------------------------------------------- /easyexcel/src/test/java/com/alibaba/easyexcel/test/model/ReadModel0.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.easyexcel.test.model; 2 | 3 | import com.alibaba.excel.annotation.ExcelProperty; 4 | 5 | import java.math.BigDecimal; 6 | import java.util.Date; 7 | 8 | public class ReadModel0 { 9 | 10 | @ExcelProperty(index = 2) 11 | private String birthday; 12 | 13 | public String getBirthday() { 14 | return birthday; 15 | } 16 | 17 | public void setBirthday(String birthday) { 18 | this.birthday = birthday; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /easyexcel/src/test/java/com/alibaba/easyexcel/test/util/FileUtil.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.easyexcel.test.util; 2 | 3 | import java.io.InputStream; 4 | 5 | public class FileUtil { 6 | 7 | public static InputStream getResourcesFileInputStream(String fileName) { 8 | try { 9 | return Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName); 10 | } catch (Exception e) { 11 | e.printStackTrace(); 12 | return null; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /easyexcel/src/test/resources/1.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/easyexcel/src/test/resources/1.xlsx -------------------------------------------------------------------------------- /java-new-features/REAMDE.md: -------------------------------------------------------------------------------- 1 | [openJDK](http://jdk.java.net/archive/) -------------------------------------------------------------------------------- /java-new-features/jdk11-learning/src/main/java/com/atguigu/java/InputStreamTest.java: -------------------------------------------------------------------------------- 1 | package com.atguigu.java; 2 | 3 | import org.junit.Test; 4 | 5 | import java.io.FileOutputStream; 6 | 7 | /** 8 | * 改进的文件API。 9 | * InputStream 加强 10 | * 11 | * @author leelovejava 12 | */ 13 | public class InputStreamTest { 14 | 15 | @Test 16 | public void testName() throws Exception { 17 | var cl = this.getClass().getClassLoader(); 18 | try (var is = cl.getResourceAsStream("file"); var os = new FileOutputStream("file2")) { 19 | // 把输入流中的所有数据直接自动地复制到输出流中 20 | is.transferTo(os); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /java-new-features/jdk12-learning/tmp/a.txt: -------------------------------------------------------------------------------- 1 | abc -------------------------------------------------------------------------------- /java-new-features/jdk12-learning/tmp/b.txt: -------------------------------------------------------------------------------- 1 | abc -------------------------------------------------------------------------------- /java-new-features/jdk15-learning/src/main/java/com/atguigu/java/LambdaTest.java: -------------------------------------------------------------------------------- 1 | package com.atguigu.java; 2 | 3 | /** 4 | * @author shkstart Email:shkstart@126.com 5 | * @create 2020 14:27 6 | */ 7 | public class LambdaTest { 8 | public static void main(String[] args) { 9 | Runnable r = () -> { 10 | System.out.println("hello"); 11 | }; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /java-new-features/jdk8-learning/src/main/java/com/atguigu/annotation/MyAnnotations.java: -------------------------------------------------------------------------------- 1 | package com.atguigu.annotation; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.Target; 5 | 6 | import static java.lang.annotation.ElementType.*; 7 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 8 | 9 | @Target({TYPE, FIELD, METHOD,PARAMETER,CONSTRUCTOR,LOCAL_VARIABLE}) 10 | @Retention(RUNTIME) 11 | public @interface MyAnnotations { 12 | MyAnnotation [] value(); 13 | } 14 | -------------------------------------------------------------------------------- /java-new-features/jdk8-learning/src/main/java/com/atguigu/function/MyFunction.java: -------------------------------------------------------------------------------- 1 | package com.atguigu.function; 2 | 3 | /** 4 | * 自定义函数式接口 5 | */ 6 | @FunctionalInterface 7 | public interface MyFunction { 8 | 9 | String getValue(String str); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /java-new-features/jdk8-learning/src/main/java/com/atguigu/function/MyFunction2.java: -------------------------------------------------------------------------------- 1 | package com.atguigu.function; 2 | 3 | /** 4 | * 函数式接口中使用泛型 5 | * @param 参数 6 | * @param 返回值 7 | */ 8 | public interface MyFunction2 { 9 | 10 | R getValue(T t1, T t2); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /java-new-features/jdk8-learning/src/main/java/com/atguigu/lambda/FilterEmployeeForAge.java: -------------------------------------------------------------------------------- 1 | package com.atguigu.lambda; 2 | 3 | /** 4 | * @author y.x 5 | */ 6 | public class FilterEmployeeForAge implements MyPredicate { 7 | 8 | @Override 9 | public boolean test(Employee t) { 10 | return t.getAge() <= 35; 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /java-new-features/jdk8-learning/src/main/java/com/atguigu/lambda/FilterEmployeeForSalary.java: -------------------------------------------------------------------------------- 1 | package com.atguigu.lambda; 2 | 3 | /** 4 | * @author y.x 5 | */ 6 | public class FilterEmployeeForSalary implements MyPredicate { 7 | 8 | @Override 9 | public boolean test(Employee t) { 10 | return t.getSalary() >= 5000; 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /java-new-features/jdk8-learning/src/main/java/com/atguigu/lambda/MyFun.java: -------------------------------------------------------------------------------- 1 | package com.atguigu.lambda; 2 | 3 | /** 4 | * @author y.x 5 | */ 6 | @FunctionalInterface 7 | public interface MyFun { 8 | 9 | Integer getValue(Integer num); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /java-new-features/jdk8-learning/src/main/java/com/atguigu/lambda/MyPredicate.java: -------------------------------------------------------------------------------- 1 | package com.atguigu.lambda; 2 | 3 | /** 4 | * @author y.x 5 | */ 6 | @FunctionalInterface 7 | public interface MyPredicate { 8 | 9 | boolean test(T t); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /java-new-features/jdk8-learning/src/main/java/com/atguigu/statisfunction/MyFun.java: -------------------------------------------------------------------------------- 1 | package com.atguigu.statisfunction; 2 | 3 | public interface MyFun { 4 | /** 5 | * 接口中默认方法 6 | * @return 7 | */ 8 | default String getName(){ 9 | return "哈哈哈"; 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /java-new-features/jdk8-learning/src/main/java/com/atguigu/statisfunction/MyInterface.java: -------------------------------------------------------------------------------- 1 | package com.atguigu.statisfunction; 2 | 3 | /** 4 | * 6-接口中的默认方法与静态方法 5 | * @author y.x 6 | */ 7 | public interface MyInterface { 8 | 9 | default String getName(){ 10 | return "呵呵呵"; 11 | } 12 | 13 | static void show(){ 14 | System.out.println("接口中的静态方法"); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /java-new-features/jdk8-learning/src/main/java/com/atguigu/statisfunction/SubClass.java: -------------------------------------------------------------------------------- 1 | package com.atguigu.statisfunction; 2 | 3 | /** 4 | * @author y.x 5 | */ 6 | public class SubClass /*extends MyClass*/ implements MyFun, MyInterface { 7 | 8 | @Override 9 | public String getName() { 10 | return MyInterface.super.getName(); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /java-new-features/jdk8-learning/src/main/java/com/atguigu/statisfunction/TestDefaultInterface.java: -------------------------------------------------------------------------------- 1 | package com.atguigu.statisfunction; 2 | 3 | public class TestDefaultInterface { 4 | 5 | public static void main(String[] args) { 6 | SubClass sc = new SubClass(); 7 | System.out.println(sc.getName()); 8 | 9 | MyInterface.show(); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /java-new-features/jdk8-learning/src/main/java/com/atguigu/stream/MyClass.java: -------------------------------------------------------------------------------- 1 | package com.atguigu.stream; 2 | 3 | /** 4 | * 构造器引用 5 | * 格式:ClassName::new 6 | */ 7 | public class MyClass { 8 | 9 | public String getName(){ 10 | return "嘿嘿嘿"; 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /java-new-features/jdk8-learning/src/main/java/com/atguigu/stream/model/Godness.java: -------------------------------------------------------------------------------- 1 | package com.atguigu.stream.model; 2 | 3 | public class Godness { 4 | 5 | private String name; 6 | 7 | public Godness() { 8 | } 9 | 10 | public Godness(String name) { 11 | this.name = name; 12 | } 13 | 14 | public String getName() { 15 | return name; 16 | } 17 | 18 | public void setName(String name) { 19 | this.name = name; 20 | } 21 | 22 | @Override 23 | public String toString() { 24 | return "Godness [name=" + name + "]"; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /java-new-features/jdk8-learning/src/main/java/com/atguigu/stream/model/Man.java: -------------------------------------------------------------------------------- 1 | package com.atguigu.stream.model; 2 | 3 | public class Man { 4 | 5 | private Godness god; 6 | 7 | public Man() { 8 | } 9 | 10 | public Man(Godness god) { 11 | this.god = god; 12 | } 13 | 14 | public Godness getGod() { 15 | return god; 16 | } 17 | 18 | public void setGod(Godness god) { 19 | this.god = god; 20 | } 21 | 22 | @Override 23 | public String toString() { 24 | return "Man [god=" + god + "]"; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /java-new-features/jdk8-learning/src/test/java/com/leelovejava/interview/code/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 面试 Java 编程机试题 60 例 3 | */ 4 | package com.leelovejava.interview.code; 5 | -------------------------------------------------------------------------------- /java-new-features/jdk8-learning/src/test/java/com/leelovejava/interview/design/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 设计模式 3 | */ 4 | package com.leelovejava.interview.design; 5 | 6 | /** 7 | * java中的设计模式 8 | * 1. 单例 9 | * java.lang.RunTime#getRuntime() 10 | * java.lang.System#getSecurityManager() 11 | * 2. 责任链 12 | * java.util.logging.Logger#log() 13 | * javax.servlet.Filter#doFilter() 14 | * 3. 观察者模式 15 | * java.util.Observer/java.util.Observable 16 | * javax.servlet.http.HttpSessionBindingListener 17 | */ -------------------------------------------------------------------------------- /java-new-features/jdk8-learning/src/test/java/com/leelovejava/interview/design/singleton/Singleton01.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.interview.design.singleton; 2 | 3 | /** 4 | * 懒汉模式 5 | */ 6 | public class Singleton01 { 7 | private Singleton01() { 8 | } 9 | 10 | 11 | private static Singleton01 singleton = null; 12 | 13 | public static Singleton01 getInstance() { 14 | if (singleton == null) { 15 | singleton = new Singleton01(); 16 | } 17 | return singleton; 18 | } 19 | } -------------------------------------------------------------------------------- /java-new-features/jdk8-learning/src/test/java/com/leelovejava/interview/design/singleton/Singleton02.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.interview.design.singleton; 2 | 3 | /** 4 | * 恶汉模式 5 | */ 6 | public class Singleton02 { 7 | private Singleton02() { 8 | } 9 | 10 | private static Singleton02 singleton = new Singleton02(); 11 | 12 | public static Singleton02 getInstance() { 13 | return singleton; 14 | 15 | } 16 | } -------------------------------------------------------------------------------- /java-new-features/jdk8-learning/src/test/java/com/leelovejava/interview/design/singleton/Singleton03.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.interview.design.singleton; 2 | 3 | /** 4 | * 线程安全的单例模式: 对 getInstance 方法加锁 5 | */ 6 | public class Singleton03 { 7 | private Singleton03() { 8 | } 9 | 10 | private static Singleton03 singleton = null; 11 | 12 | public static synchronized Singleton03 getInstance() { 13 | if (singleton == null) { 14 | singleton = new Singleton03(); 15 | } 16 | return singleton; 17 | } 18 | } -------------------------------------------------------------------------------- /java-new-features/jdk8-learning/src/test/java/com/leelovejava/interview/design/singleton/Singleton05.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.interview.design.singleton; 2 | 3 | /** 4 | * 实现方式 3: 静态内部类 5 | */ 6 | public class Singleton05 { 7 | private static class getInstanceFac { 8 | private static final Singleton05 INSTANCE = new Singleton05(); 9 | } 10 | 11 | private Singleton05() { 12 | } 13 | 14 | public static final Singleton05 getInstance() { 15 | return getInstanceFac.INSTANCE; 16 | } 17 | } -------------------------------------------------------------------------------- /java-new-features/jdk8-learning/src/test/java/com/leelovejava/interview/jvm/oom/StackOverflowErrorDemo.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.interview.jvm.oom; 2 | 3 | /** 4 | * 堆栈溢出错误 5 | * @author leelovejava 6 | * @date 2019/10/29 23:36 7 | **/ 8 | public class StackOverflowErrorDemo { 9 | 10 | public static void main(String[] args) { 11 | stackOverflowError(); 12 | } 13 | 14 | private static void stackOverflowError() { 15 | stackOverflowError(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /java-new-features/jdk8-learning/src/test/java/com/leelovejava/interview/jvm/oom/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * java.lang.StackOverflowError 3 | * java.lang.OutOfMemoryError:java heap space 4 | * java.lang.OutOfMemoryError:GC overhead limit exceeded 5 | * java.lang.OutOfMemoryError:Direct buffer memory 6 | * java.lang.OutOfMemoryError:unable to create new native thread 7 | * java.lang.OutOfMemoryError:Metaspace 8 | */ 9 | package com.leelovejava.interview.jvm.oom; -------------------------------------------------------------------------------- /java-new-features/jdk8-learning/src/test/java/com/leelovejava/interview/jvm/ref/BitMap.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.interview.jvm.ref; 2 | 3 | /** 4 | * @author leelovejava 5 | * @date 2019/10/29 22:36 6 | **/ 7 | public class BitMap { 8 | } 9 | -------------------------------------------------------------------------------- /java-new-features/jdk8-learning/src/test/java/com/leelovejava/interview/jvm/ref/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 引用 3 | * 强引用: 死都不会收 4 | * 软引用: 内存不足时回收,充足时不会被回收(softReference) 5 | * 弱引用: 不管内存是否足够,gc一律回收(WeakReference) 6 | * 虚引用: 如果一个对象仅持有虚引用,那么它就和没有任何引用一样,在任何时候都可能被垃圾回收(PhantomReference) 7 | */ 8 | package com.leelovejava.interview.jvm.ref; 9 | -------------------------------------------------------------------------------- /java-tools-learning/src/test/java/com/leelovejava/tools/commons/model/User.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.tools.commons.model; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * 用户 7 | */ 8 | @Data 9 | public class User { 10 | private String username; 11 | private String password; 12 | } -------------------------------------------------------------------------------- /java-tools-learning/src/test/java/com/leelovejava/tools/guava/WatchTest.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.tools.guava; 2 | 3 | import com.google.common.base.Stopwatch; 4 | 5 | import java.util.concurrent.TimeUnit; 6 | 7 | /** 8 | * WatchTest 9 | * 10 | * @author y.x 11 | * @date 2019/11/25 12 | */ 13 | public class WatchTest { 14 | /** 15 | * 查看某段代码的运行时间 16 | * TimeUnit 可以指定时间精度 17 | */ 18 | public void test01() { 19 | Stopwatch stopwatch = Stopwatch.createStarted(); 20 | // do something 21 | long second = stopwatch.elapsed(TimeUnit.SECONDS); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /jwt-boot/assets/images/16024917572853.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/jwt-boot/assets/images/16024917572853.jpg -------------------------------------------------------------------------------- /jwt-boot/assets/images/16025554664693.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/jwt-boot/assets/images/16025554664693.jpg -------------------------------------------------------------------------------- /jwt-boot/assets/images/16025582888220.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/jwt-boot/assets/images/16025582888220.jpg -------------------------------------------------------------------------------- /jwt-boot/assets/images/16025588086122.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/jwt-boot/assets/images/16025588086122.jpg -------------------------------------------------------------------------------- /jwt-boot/assets/images/16025593897605.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/jwt-boot/assets/images/16025593897605.jpg -------------------------------------------------------------------------------- /jwt-boot/assets/images/16025831079288.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leelovejava/SpringBoot-Learning/774e0b74475d26bb1e6472f3b8830538ca86b6ae/jwt-boot/assets/images/16025831079288.jpg -------------------------------------------------------------------------------- /jwt-boot/src/main/java/com/leelovejava/boot/jwt/constant/Constants.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.boot.jwt.constant; 2 | 3 | /** 4 | * @author leelovejava 5 | */ 6 | public class Constants { 7 | public static final String CLAIMS = "clamims"; 8 | } 9 | -------------------------------------------------------------------------------- /jwt-boot/src/main/java/com/leelovejava/boot/jwt/constant/ResultEnum.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.boot.jwt.constant; 2 | 3 | /** 4 | * 枚举 返回结果 5 | * @author tianhao 6 | */ 7 | public class ResultEnum { 8 | public static String LOGIN_ERROR = "登录失败"; 9 | } 10 | -------------------------------------------------------------------------------- /jwt-boot/src/main/java/com/leelovejava/boot/jwt/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.boot.jwt.service; 2 | 3 | import com.leelovejava.boot.jwt.vo.UserVo; 4 | 5 | /** 6 | * @author leelovejava 7 | */ 8 | public interface UserService { 9 | UserVo get(UserVo userVo); 10 | } 11 | -------------------------------------------------------------------------------- /jwt-boot/src/main/java/com/leelovejava/boot/jwt/util/MatcherUtil.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.boot.jwt.util; 2 | 3 | import java.util.regex.Pattern; 4 | 5 | /** 6 | * 验证工具类 7 | * @author leelovejava 8 | */ 9 | public class MatcherUtil { 10 | /** 11 | * 正则验证是否是邮箱,邮箱为true 12 | * 13 | * @param usernameOrEmail 用户名或者是 邮箱 14 | * @return 15 | */ 16 | public static boolean matcherEmail(String usernameOrEmail) { 17 | return Pattern.matches("^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$", usernameOrEmail); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /jwt-boot/src/main/java/com/leelovejava/boot/jwt/util/ResultVOUtil.java: -------------------------------------------------------------------------------- 1 | package com.leelovejava.boot.jwt.util; 2 | 3 | import com.leelovejava.boot.jwt.vo.ResultVo; 4 | 5 | /** 6 | * @author leelovejava 7 | */ 8 | public class ResultVOUtil { 9 | public static ResultVo error(String code, String msg) { 10 | return new ResultVo(code, msg); 11 | } 12 | 13 | public static ResultVo success(String data) { 14 | return new ResultVo("200", "成功", data); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /jwt-boot/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8081 3 | spring: 4 | application: 5 | name: jwtApplication 6 | ## jwt配置 7 | audience: 8 | clientId: 098f6bcd4621d373cade4e832627b4f6 9 | base64Secret: MDk4ZjZiY2Q0NjIxZDM3M2NhZGU0ZTgzMjYyN2I0ZjY= 10 | name: restapiuser 11 | expiresSecond: 172800 12 | --------------------------------------------------------------------------------