├── springboot-learn-custom-event
├── build.gradle
└── src
│ └── main
│ ├── resources
│ └── application.yml
│ └── java
│ └── com
│ └── plf
│ └── learn
│ └── custom
│ └── event
│ ├── SpringBootEventApplication.java
│ ├── emailevents
│ ├── EmailEventPublish.java
│ ├── EmailEvent.java
│ └── EmailEventListener.java
│ ├── controller
│ ├── GlobalExceptionController.java
│ └── MailEventController.java
│ └── configuration
│ └── ThreadPool.java
├── springboot-learn-threadlocal
├── build.gradle
└── src
│ └── main
│ ├── resources
│ └── application.yml
│ └── java
│ └── com
│ └── plf
│ └── learn
│ └── thread
│ ├── entity
│ └── User.java
│ ├── ThreadLocalApplication.java
│ ├── base
│ └── Message.java
│ ├── interceptor
│ ├── UserContextHolder.java
│ ├── WebMvcConfig.java
│ └── AuthActionInterceptor.java
│ └── controller
│ └── ThreadController.java
├── springboot-learn-staticftl
├── src
│ └── main
│ │ ├── resources
│ │ ├── static
│ │ │ ├── css
│ │ │ │ └── test.css
│ │ │ └── html
│ │ │ │ └── 1574062245007.html
│ │ ├── templates
│ │ │ ├── index.html
│ │ │ └── blog
│ │ │ │ └── detail.html
│ │ └── application.yml
│ │ └── java
│ │ └── com
│ │ └── plf
│ │ └── learn
│ │ └── staticftl
│ │ ├── bean
│ │ └── Blog.java
│ │ ├── repository
│ │ └── BlogRepository.java
│ │ ├── SpringBootStaticFtlApplication.java
│ │ ├── controller
│ │ ├── TestController.java
│ │ └── BlogController.java
│ │ ├── component
│ │ └── ActiveMQProducer.java
│ │ └── listener
│ │ └── BlogStaticFtlListener.java
└── build.gradle
├── springboot-learn-mail
├── build.gradle
└── src
│ └── main
│ ├── resources
│ └── application.yml
│ └── java
│ └── com
│ └── plf
│ └── learn
│ └── mail
│ ├── SpringBootMailApplication.java
│ ├── controller
│ └── MailController.java
│ └── config
│ └── ThreadPoolTaskConfig.java
├── springboot-learn-mongodb
├── build.gradle
└── src
│ └── main
│ ├── resources
│ └── application.yml
│ └── java
│ └── com
│ └── plf
│ └── learn
│ └── mongodb
│ ├── MongoDBApplication.java
│ ├── repository
│ └── CommentRepository.java
│ ├── bean
│ └── Comment.java
│ ├── controller
│ └── CommentController.java
│ └── service
│ └── CommentService.java
├── springboot-learn-solr
├── build.gradle
└── src
│ └── main
│ ├── resources
│ └── application.yml
│ └── java
│ └── com
│ └── plf
│ └── learn
│ └── solr
│ ├── SolrApplication.java
│ ├── entity
│ └── Worker.java
│ └── controller
│ └── SolrController.java
├── springboot-learn-document
├── build.gradle
└── src
│ └── main
│ ├── resources
│ ├── application.yml
│ └── templates
│ │ └── word
│ │ └── template.doc
│ └── java
│ └── com
│ └── plf
│ └── learn
│ └── document
│ ├── enums
│ └── DocumentEnums.java
│ ├── utils
│ ├── interfaces
│ │ └── OperateDocument.java
│ └── CloseUtils.java
│ ├── SpringBootDocumentApplication.java
│ ├── service
│ └── AnalysisFileService.java
│ ├── controller
│ └── UploadFileController.java
│ └── container
│ └── DocumentContext.java
├── springboot-learn-jetcache
├── build.gradle
└── src
│ └── main
│ ├── resources
│ └── application.yml
│ └── java
│ └── com
│ └── plf
│ └── learn
│ └── jetcache
│ ├── bean
│ └── Person.java
│ ├── service
│ ├── PersonService.java
│ └── impl
│ │ └── PersonServiceImpl.java
│ ├── SpringBootJetcacheApplication.java
│ └── controller
│ └── PersonController.java
├── springboot-learn-kafka
├── build.gradle
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── plf
│ │ └── learn
│ │ └── kafka
│ │ ├── KafkaApplication.java
│ │ ├── message
│ │ └── Message.java
│ │ ├── consumer
│ │ └── KafkaConsumer.java
│ │ ├── producer
│ │ └── KafkaProducer.java
│ │ └── controller
│ │ └── KafkaController.java
│ └── resources
│ └── application.yml
├── springboot-learn-neo4j
├── build.gradle
└── src
│ ├── main
│ ├── resources
│ │ └── application.yml
│ └── java
│ │ └── com
│ │ └── plf
│ │ └── learn
│ │ └── neo4j
│ │ ├── Neo4jApplication.java
│ │ ├── entity
│ │ └── MinFamily.java
│ │ ├── controllrt
│ │ └── Neo4jController.java
│ │ └── dao
│ │ └── MinFamilyRepository.java
│ └── test
│ └── java
│ └── com
│ └── plf
│ └── learn
│ └── neo4j
│ └── Neo4jTest.java
├── springboot-learn-api-limiter
├── src
│ ├── main
│ │ ├── resources
│ │ │ ├── test.http
│ │ │ └── application.yml
│ │ └── java
│ │ │ └── com
│ │ │ └── plf
│ │ │ └── learn
│ │ │ └── limiter
│ │ │ ├── SpringBootApiLimiterApplication.java
│ │ │ ├── controller
│ │ │ └── ApiController.java
│ │ │ └── annotations
│ │ │ └── ApiRateLimiter.java
│ └── test
│ │ └── java
│ │ └── com
│ │ └── plf
│ │ └── learn
│ │ └── httpclient
│ │ └── HttpTest.java
└── build.gradle
├── springboot-learn-elasticsearch
├── build.gradle
└── src
│ └── main
│ ├── resources
│ ├── application.yml
│ └── readme.txt
│ └── java
│ └── com
│ └── plf
│ └── learn
│ └── elasticsearch
│ ├── repository
│ └── BookRepository.java
│ ├── ElasticSearchApplication.java
│ ├── bean
│ └── Book.java
│ ├── service
│ ├── IndexService.java
│ └── BookService.java
│ └── controller
│ └── BookController.java
├── springboot-learn-jpa
├── build.gradle
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── plf
│ │ └── learn
│ │ └── jpa
│ │ ├── dto
│ │ └── StudentDto.java
│ │ ├── SpringBootJpaApplication.java
│ │ ├── bean
│ │ ├── School.java
│ │ └── Student.java
│ │ ├── repository
│ │ └── StudentRepository.java
│ │ ├── controller
│ │ └── StudentController.java
│ │ └── service
│ │ └── StudentService.java
│ └── resources
│ └── application.yml
├── springboot-learn-log
├── build.gradle
└── src
│ └── main
│ ├── resources
│ └── application.yml
│ └── java
│ └── com
│ └── plf
│ └── learn
│ └── log
│ ├── repository
│ └── LogMessageRepository.java
│ ├── LogApplication.java
│ ├── service
│ └── LogMessageService.java
│ ├── entity
│ └── LogMessage.java
│ ├── controller
│ └── LogController.java
│ └── annotation
│ └── Loggable.java
├── springboot-learn-caffeine
├── build.gradle
└── src
│ └── main
│ ├── resources
│ └── application.yml
│ └── java
│ └── com
│ └── plf
│ └── learn
│ └── caffeine
│ ├── SpringBootCaffeineApplication.java
│ ├── dao
│ └── UserInfoDao.java
│ ├── controller
│ └── CaffeineController.java
│ ├── service
│ └── UserInfoService.java
│ └── config
│ ├── CaffeineConfig.java
│ └── CaffeineMonitorAspect.java
├── springboot-learn-redis
├── build.gradle
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── plf
│ │ └── learn
│ │ └── redis
│ │ ├── annotations
│ │ └── ApiIdempotent.java
│ │ ├── RedisSentinelApplication.java
│ │ ├── service
│ │ ├── TokenService.java
│ │ └── impl
│ │ │ └── TokenServiceImpl.java
│ │ ├── configuration
│ │ ├── GlobalExceptionHandler.java
│ │ └── WebConfiguration.java
│ │ ├── controller
│ │ └── RedisController.java
│ │ ├── utils
│ │ └── RedisUtils.java
│ │ └── interceptor
│ │ └── ApiIdempotentInterceptor.java
│ └── resources
│ └── application.yml
├── springboot-learn-mybatis-plus
├── build.gradle
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── plf
│ │ └── learn
│ │ └── mybatisplus
│ │ ├── mapper
│ │ ├── UserMapper.java
│ │ └── LogMapper.java
│ │ ├── service
│ │ ├── UserService.java
│ │ ├── LogService.java
│ │ └── impl
│ │ │ ├── UserServiceImpl.java
│ │ │ └── LogServiceImpl.java
│ │ ├── dto
│ │ └── LogDto.java
│ │ ├── SpringBootMybatisPlusApplication.java
│ │ ├── entity
│ │ ├── User.java
│ │ └── Log.java
│ │ ├── config
│ │ ├── MybatisPlusConfig.java
│ │ └── MyMetaObjectHandler.java
│ │ └── controller
│ │ └── LogController.java
│ └── resources
│ └── application.yml
├── springboot-learn-share-session
├── build.gradle
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── plf
│ │ └── learn
│ │ └── share
│ │ └── session
│ │ ├── SpringBootShareSessionApplication.java
│ │ └── controller
│ │ └── ShareSessionController.java
│ └── resources
│ └── application.yml
├── springboot-learn-websocket
├── build.gradle
└── src
│ └── main
│ ├── resources
│ ├── application.yml
│ └── note.txt
│ └── java
│ └── com
│ └── plf
│ └── learn
│ └── websocket
│ ├── entity
│ ├── RequestMessage.java
│ └── ResponseMessage.java
│ ├── WebSocketApplication.java
│ ├── service
│ └── WebSocketService.java
│ ├── config
│ └── WebSocketConfig.java
│ └── controller
│ └── WebSocketController.java
├── springboot-learn-aop-multidata
├── build.gradle
└── src
│ └── main
│ ├── resources
│ └── application.yml
│ └── java
│ └── com
│ └── plf
│ └── learn
│ └── aop
│ └── multidata
│ ├── SpringBootMultidata.java
│ ├── annotation
│ └── TargetDataSource.java
│ ├── config
│ ├── DynamicDataSource.java
│ └── DynamicDataSourceHolder.java
│ ├── service
│ └── CountTablesService.java
│ └── controller
│ └── CountTablesController.java
├── springboot-learn-sharding-jdbc
├── build.gradle
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── plf
│ │ └── learn
│ │ └── sharding
│ │ ├── bean
│ │ └── Order.java
│ │ ├── test
│ │ └── SnowTest.java
│ │ ├── mapper
│ │ └── OrderMapper.java
│ │ ├── service
│ │ └── OrderService.java
│ │ ├── SpringBootShardingApplication.java
│ │ └── controller
│ │ └── OrderController.java
│ └── resources
│ ├── sql
│ ├── ds0.sql
│ └── ds1.sql
│ └── application.yml
├── springboot-learn-distributed-lock
├── build.gradle
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── plf
│ │ └── learn
│ │ └── lock
│ │ ├── SpringBootLockApplication.java
│ │ ├── config
│ │ ├── RedissonConfig.java
│ │ └── CuratorConfig.java
│ │ ├── utils
│ │ └── StringUtils.java
│ │ ├── test
│ │ └── BuyTest.java
│ │ └── redis
│ │ ├── RedissonDistributionLock.java
│ │ └── RedisUtils.java
│ └── resources
│ └── application.yml
├── springboot-learn-elastic-job
├── build.gradle
└── src
│ └── main
│ ├── resources
│ ├── application.yml
│ └── readme.txt
│ └── java
│ └── com
│ └── plf
│ └── learn
│ └── elastic
│ ├── bean
│ └── FileCustom.java
│ ├── SpringBootElasticApplication.java
│ ├── service
│ └── FileCustomService.java
│ ├── mapper
│ └── FileCustomMapper.java
│ ├── config
│ └── ElasticJobRegistryCenterConfig.java
│ └── job
│ └── FileBackupJob.java
├── springboot-learn-jwt
├── build.gradle
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── plf
│ │ └── learn
│ │ └── jwt
│ │ ├── bean
│ │ └── Person.java
│ │ ├── SpringBootJwtApplication.java
│ │ ├── repository
│ │ └── PersonRepository.java
│ │ ├── common
│ │ ├── JwtResult.java
│ │ └── ResponseData.java
│ │ ├── service
│ │ └── PersonService.java
│ │ ├── utils
│ │ └── RedisUtils.java
│ │ └── filter
│ │ └── JwtFilter.java
│ └── resources
│ ├── application.yml
│ └── readme.txt
├── springboot-learn-shiro
├── build.gradle
└── src
│ └── main
│ ├── resources
│ ├── templates
│ │ ├── fail.html
│ │ ├── noperssion.html
│ │ ├── user.html
│ │ ├── admin.html
│ │ ├── defaultException.html
│ │ ├── hello.html
│ │ ├── success.html
│ │ └── login.html
│ └── application.yml
│ └── java
│ └── com
│ └── plf
│ └── learn
│ └── shiro
│ ├── repository
│ └── UserRepository.java
│ ├── service
│ ├── AdminActionService.java
│ └── UserService.java
│ ├── SpringBootShiroApplication.java
│ ├── utils
│ ├── KeyDecode.java
│ └── EncryptionPassword.java
│ ├── config
│ └── GlobalDefaultExceptionHandler.java
│ └── bean
│ └── User.java
├── springboot-learn-dataway
├── build.gradle
└── src
│ └── main
│ ├── resources
│ ├── readme.txt
│ └── application.yml
│ └── java
│ └── com
│ └── plf
│ └── learn
│ └── dataway
│ ├── SpringBootDatawayApplication.java
│ └── hasor
│ └── module
│ └── HasorModule.java
├── springboot-learn-security
├── build.gradle
└── src
│ └── main
│ ├── resources
│ ├── templates
│ │ ├── 403.html
│ │ ├── product
│ │ │ ├── add.html
│ │ │ ├── delete.html
│ │ │ ├── list.html
│ │ │ └── update.html
│ │ ├── index.html
│ │ └── login.html
│ └── application.yml
│ └── java
│ └── com
│ └── plf
│ └── learn
│ └── security
│ ├── entity
│ ├── Role.java
│ ├── Permission.java
│ └── User.java
│ ├── SecurityApplication.java
│ ├── controller
│ ├── IndexController.java
│ └── ProductController.java
│ ├── config
│ └── ErrorPageConfig.java
│ ├── mapper
│ └── UserMapper.java
│ ├── handler
│ └── MyAuthenticationFailtureHandler.java
│ └── service
│ └── MyUserDetailService.java
├── springboot-learn-druid-monitor
├── build.gradle
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── plf
│ │ └── learn
│ │ └── monitor
│ │ ├── bean
│ │ └── Person.java
│ │ ├── mapper
│ │ └── PersonMapper.java
│ │ ├── SpringBootMonitorApplication.java
│ │ ├── service
│ │ └── PersonService.java
│ │ ├── controller
│ │ └── PersonController.java
│ │ └── config
│ │ └── DruidConfiguration.java
│ └── resources
│ ├── mapper
│ └── PersonMapper.xml
│ └── application.yml
├── .gitignore
└── settings.gradle
/springboot-learn-custom-event/build.gradle:
--------------------------------------------------------------------------------
1 | dependencies{
2 |
3 | }
--------------------------------------------------------------------------------
/springboot-learn-threadlocal/build.gradle:
--------------------------------------------------------------------------------
1 | dependencies {
2 |
3 | }
4 |
--------------------------------------------------------------------------------
/springboot-learn-staticftl/src/main/resources/static/css/test.css:
--------------------------------------------------------------------------------
1 | h1 span {color:red}
--------------------------------------------------------------------------------
/springboot-learn-mail/build.gradle:
--------------------------------------------------------------------------------
1 | dependencies {
2 | implementation libs.mail
3 | }
4 |
--------------------------------------------------------------------------------
/springboot-learn-mongodb/build.gradle:
--------------------------------------------------------------------------------
1 | dependencies{
2 | implementation libs.mongodb
3 | }
--------------------------------------------------------------------------------
/springboot-learn-solr/build.gradle:
--------------------------------------------------------------------------------
1 | dependencies {
2 | implementation libs.solr
3 | }
4 |
--------------------------------------------------------------------------------
/springboot-learn-document/build.gradle:
--------------------------------------------------------------------------------
1 | dependencies{
2 | implementation libs.word
3 | }
4 |
--------------------------------------------------------------------------------
/springboot-learn-jetcache/build.gradle:
--------------------------------------------------------------------------------
1 | dependencies{
2 | implementation libs.jetcache
3 | }
--------------------------------------------------------------------------------
/springboot-learn-kafka/build.gradle:
--------------------------------------------------------------------------------
1 | dependencies{
2 | implementation libs.kafka
3 | }
4 |
5 |
--------------------------------------------------------------------------------
/springboot-learn-neo4j/build.gradle:
--------------------------------------------------------------------------------
1 | dependencies{
2 | implementation libs.neo4j
3 | }
4 |
5 |
--------------------------------------------------------------------------------
/springboot-learn-api-limiter/src/main/resources/test.http:
--------------------------------------------------------------------------------
1 | GET http://localhost:8080/api/limiter/hello
--------------------------------------------------------------------------------
/springboot-learn-elasticsearch/build.gradle:
--------------------------------------------------------------------------------
1 | dependencies {
2 | implementation libs.elasticsearch
3 | }
4 |
--------------------------------------------------------------------------------
/springboot-learn-api-limiter/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | servlet:
3 | context-path: /api/limiter
--------------------------------------------------------------------------------
/springboot-learn-jpa/build.gradle:
--------------------------------------------------------------------------------
1 | dependencies{
2 | implementation libs.mysql
3 | implementation libs.jpa
4 | }
5 |
--------------------------------------------------------------------------------
/springboot-learn-log/build.gradle:
--------------------------------------------------------------------------------
1 | dependencies {
2 | implementation libs.mongodb
3 | implementation libs.aop
4 | }
5 |
--------------------------------------------------------------------------------
/springboot-learn-api-limiter/build.gradle:
--------------------------------------------------------------------------------
1 | dependencies {
2 | implementation libs.guava
3 | implementation libs.aop
4 | }
5 |
--------------------------------------------------------------------------------
/springboot-learn-caffeine/build.gradle:
--------------------------------------------------------------------------------
1 | dependencies {
2 | implementation libs.caffeine
3 | implementation libs.aop
4 | }
5 |
--------------------------------------------------------------------------------
/springboot-learn-document/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8100
3 | servlet:
4 | context-path: /document
--------------------------------------------------------------------------------
/springboot-learn-redis/build.gradle:
--------------------------------------------------------------------------------
1 | dependencies{
2 | implementation libs.redis
3 | implementation libs.commonspool
4 | }
5 |
--------------------------------------------------------------------------------
/springboot-learn-mybatis-plus/build.gradle:
--------------------------------------------------------------------------------
1 | dependencies{
2 | implementation libs.mysql
3 | implementation libs.mybatisplus
4 | }
--------------------------------------------------------------------------------
/springboot-learn-share-session/build.gradle:
--------------------------------------------------------------------------------
1 | dependencies{
2 | implementation libs.redis
3 | implementation libs.springsession
4 | }
--------------------------------------------------------------------------------
/springboot-learn-threadlocal/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8026
3 | servlet:
4 | context-path: /thread
5 |
--------------------------------------------------------------------------------
/springboot-learn-custom-event/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8001
3 | servlet:
4 | context-path: /customevent
5 |
--------------------------------------------------------------------------------
/springboot-learn-websocket/build.gradle:
--------------------------------------------------------------------------------
1 | dependencies {
2 | implementation libs.websocket
3 | implementation libs.thymeleaf
4 | }
5 |
--------------------------------------------------------------------------------
/springboot-learn-websocket/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8026
3 | sprnig:
4 | thymeleaf:
5 | cache: false
6 |
--------------------------------------------------------------------------------
/springboot-learn-aop-multidata/build.gradle:
--------------------------------------------------------------------------------
1 | dependencies{
2 | implementation libs.mysql
3 | implementation libs.aop
4 | implementation libs.jdbc
5 | }
6 |
--------------------------------------------------------------------------------
/springboot-learn-sharding-jdbc/build.gradle:
--------------------------------------------------------------------------------
1 | dependencies{
2 | implementation libs.mysql
3 | implementation libs.mybatis
4 | implementation libs.sharding
5 | }
--------------------------------------------------------------------------------
/springboot-learn-staticftl/build.gradle:
--------------------------------------------------------------------------------
1 | dependencies{
2 | implementation libs.freemarker
3 | implementation libs.mongodb
4 | implementation libs.activemq
5 | }
--------------------------------------------------------------------------------
/springboot-learn-distributed-lock/build.gradle:
--------------------------------------------------------------------------------
1 | dependencies{
2 | implementation libs.redis
3 | implementation libs.redisson
4 | implementation libs.curator
5 | }
6 |
--------------------------------------------------------------------------------
/springboot-learn-elastic-job/build.gradle:
--------------------------------------------------------------------------------
1 | dependencies {
2 | implementation libs.mysql
3 | implementation libs.elasticjob
4 | implementation libs.mybatis
5 | }
6 |
--------------------------------------------------------------------------------
/springboot-learn-jwt/build.gradle:
--------------------------------------------------------------------------------
1 | dependencies{
2 | implementation libs.jwt
3 | implementation libs.mysql
4 | implementation libs.jpa
5 | implementation libs.redis
6 | }
7 |
--------------------------------------------------------------------------------
/springboot-learn-neo4j/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | data:
3 | neo4j:
4 | username: neo4j
5 | password: 12345678
6 | uri: bolt://192.168.164.130:7687
--------------------------------------------------------------------------------
/springboot-learn-shiro/build.gradle:
--------------------------------------------------------------------------------
1 | dependencies{
2 | implementation libs.shiro
3 | implementation libs.thymeleaf
4 | implementation libs.mysql
5 | implementation libs.jpa
6 | }
7 |
--------------------------------------------------------------------------------
/springboot-learn-dataway/build.gradle:
--------------------------------------------------------------------------------
1 | dependencies {
2 | implementation libs.dataway
3 | implementation libs.druid
4 | implementation libs.mysql
5 | implementation libs.jdbc
6 | }
7 |
--------------------------------------------------------------------------------
/springboot-learn-document/src/main/resources/templates/word/template.doc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Panlf/springboot-learn/HEAD/springboot-learn-document/src/main/resources/templates/word/template.doc
--------------------------------------------------------------------------------
/springboot-learn-caffeine/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8089
3 | servlet:
4 | context-path: /caffeine
5 |
6 | spring:
7 | main:
8 | allow-bean-definition-overriding: true
--------------------------------------------------------------------------------
/springboot-learn-security/build.gradle:
--------------------------------------------------------------------------------
1 | dependencies {
2 | implementation libs.thymeleaf
3 | implementation libs.mybatis
4 | implementation libs.mysql
5 | implementation libs.springsecurity
6 | }
7 |
--------------------------------------------------------------------------------
/springboot-learn-security/src/main/resources/templates/403.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 403
6 |
7 |
8 | 你无权访问
9 |
10 |
--------------------------------------------------------------------------------
/springboot-learn-solr/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8025
3 | servlet:
4 | context-path: /solr
5 | spring:
6 | data:
7 | solr:
8 | host: http://127.0.0.1:8983/solr/test_solr2
--------------------------------------------------------------------------------
/springboot-learn-shiro/src/main/resources/templates/fail.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 登录失败
6 |
7 |
8 | 登录失败
9 |
10 |
--------------------------------------------------------------------------------
/springboot-learn-shiro/src/main/resources/templates/noperssion.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Shiro异常页面
6 |
7 |
8 | 没有权限
9 |
10 |
--------------------------------------------------------------------------------
/springboot-learn-security/src/main/resources/templates/product/add.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 商品添加
6 |
7 |
8 | 这是商品添加页面
9 |
10 |
--------------------------------------------------------------------------------
/springboot-learn-security/src/main/resources/templates/product/delete.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 商品删除
6 |
7 |
8 | 这是商品删除页面
9 |
10 |
--------------------------------------------------------------------------------
/springboot-learn-security/src/main/resources/templates/product/list.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 商品列表
6 |
7 |
8 | 这是商品列表页面
9 |
10 |
--------------------------------------------------------------------------------
/springboot-learn-security/src/main/resources/templates/product/update.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 商品更新
6 |
7 |
8 | 这是商品更新页面
9 |
10 |
--------------------------------------------------------------------------------
/springboot-learn-shiro/src/main/resources/templates/user.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | user
6 |
7 |
8 | USER PAGE
9 |
10 |
--------------------------------------------------------------------------------
/springboot-learn-shiro/src/main/resources/templates/admin.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | admin
6 |
7 |
8 | ADMIN PAGE
9 |
10 |
--------------------------------------------------------------------------------
/springboot-learn-shiro/src/main/resources/templates/defaultException.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 异常页面
6 |
7 |
8 | 不好意思,出现异常
9 |
10 |
--------------------------------------------------------------------------------
/springboot-learn-shiro/src/main/resources/templates/hello.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Hello
6 |
7 |
8 | Hello,Thymeleaf
9 |
10 |
--------------------------------------------------------------------------------
/springboot-learn-druid-monitor/build.gradle:
--------------------------------------------------------------------------------
1 | dependencies{
2 | implementation libs.postgresql
3 | implementation libs.pagehelper
4 | implementation libs.mybatis
5 | implementation libs.log4j
6 | implementation libs.druid
7 | }
8 |
9 |
--------------------------------------------------------------------------------
/springboot-learn-log/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8012
3 | servlet:
4 | context-path: /log
5 |
6 | spring:
7 | data:
8 | mongodb:
9 | host: 127.0.0.1
10 | port: 27017
11 | database: log
12 |
--------------------------------------------------------------------------------
/springboot-learn-dataway/src/main/resources/readme.txt:
--------------------------------------------------------------------------------
1 | hasor-dataway的Jar包中的META-INF中选择初始化的数据表
2 |
3 | 1、http://127.0.0.1:8066/dataway/interface-ui/ 访问管理页面,进行新建接口
4 | 2、配置好SQL或者DataQL,然后Smoke Test测试,测试通过Publish接口
5 | 3、根据配置的接口进行调用http://127.0.0.1:8066/dataway/api/
--------------------------------------------------------------------------------
/springboot-learn-staticftl/src/main/resources/static/html/1574062245007.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | 母猪的产后护理
9 | 母猪
10 | 吃了算了
11 |
12 |
--------------------------------------------------------------------------------
/springboot-learn-mongodb/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8018
3 | servlet:
4 | context-path: /mongodb
5 |
6 | spring:
7 | data:
8 | mongodb:
9 | host: 127.0.0.1
10 | port: 27017
11 | database: articledb
12 |
13 |
14 |
--------------------------------------------------------------------------------
/springboot-learn-elasticsearch/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8013
3 | servlet:
4 | context-path: /elastic
5 |
6 |
7 | spring:
8 | data:
9 | elasticsearch:
10 | cluster-name: my-application
11 | cluster-nodes: 127.0.0.1:9300
12 |
--------------------------------------------------------------------------------
/springboot-learn-security/src/main/java/com/plf/learn/security/entity/Role.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.security.entity;
2 |
3 | import lombok.Data;
4 |
5 | @Data
6 | public class Role {
7 |
8 | private Integer id;
9 |
10 | private String roleName;
11 |
12 | private String roleDesc;
13 | }
14 |
--------------------------------------------------------------------------------
/springboot-learn-security/src/main/java/com/plf/learn/security/entity/Permission.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.security.entity;
2 |
3 | import lombok.Data;
4 |
5 | @Data
6 | public class Permission {
7 | private Integer id;
8 |
9 | private String permName;
10 |
11 | private String permTag;
12 | }
13 |
--------------------------------------------------------------------------------
/springboot-learn-shiro/src/main/resources/templates/success.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 登录成功
6 |
7 |
8 | 登录成功
9 |
10 |
11 |
12 |
13 | Test ShiroService
14 |
15 |
--------------------------------------------------------------------------------
/springboot-learn-mail/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8002
3 | servlet:
4 | context-path: /mail
5 |
6 | spring:
7 | mail:
8 | # smtp.126.com smtp.qq.com
9 | host: smtp.163.com
10 | username: plflovecw@163.com
11 | password: cw0713
12 | default-encoding: UTF-8
13 |
--------------------------------------------------------------------------------
/springboot-learn-mybatis-plus/src/main/java/com/plf/learn/mybatisplus/mapper/UserMapper.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.mybatisplus.mapper;
2 |
3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 | import com.plf.learn.mybatisplus.entity.User;
5 |
6 | public interface UserMapper extends BaseMapper{
7 |
8 | }
9 |
--------------------------------------------------------------------------------
/springboot-learn-staticftl/src/main/resources/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Test
5 |
6 |
7 |
8 | Hello,My Name is ${name}
9 |
10 |
--------------------------------------------------------------------------------
/springboot-learn-staticftl/src/main/resources/templates/blog/detail.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | ${blog.title}
6 |
7 |
8 | ${blog.title}
9 | ${blog.author}
10 | ${blog.content}
11 |
12 |
--------------------------------------------------------------------------------
/springboot-learn-mybatis-plus/src/main/java/com/plf/learn/mybatisplus/service/UserService.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.mybatisplus.service;
2 |
3 | import java.util.List;
4 |
5 | import com.plf.learn.mybatisplus.entity.User;
6 |
7 | public interface UserService {
8 | public List listUser(String username);
9 | }
10 |
--------------------------------------------------------------------------------
/springboot-learn-mybatis-plus/src/main/java/com/plf/learn/mybatisplus/dto/LogDto.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.mybatisplus.dto;
2 |
3 | import lombok.Data;
4 |
5 | import java.util.Date;
6 |
7 | @Data
8 | public class LogDto{
9 | private String content;
10 |
11 | private Date createtime;
12 |
13 | private String username;
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/springboot-learn-druid-monitor/src/main/java/com/plf/learn/monitor/bean/Person.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.monitor.bean;
2 |
3 | import lombok.Data;
4 |
5 | /**
6 | * @author Panlf
7 | * @date 2019/7/11
8 | */
9 | @Data
10 | public class Person {
11 | private Integer id;
12 | private String name;
13 | private Integer age;
14 | }
15 |
--------------------------------------------------------------------------------
/springboot-learn-elastic-job/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8022
3 | servlet:
4 | context-path: /elastic
5 |
6 | spring:
7 | datasource:
8 | url: jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8&useSSL=true&serverTimezone=GMT%2B8
9 | username: root
10 | password: root
11 | driver-class-name: com.mysql.cj.jdbc.Driver
--------------------------------------------------------------------------------
/springboot-learn-security/src/main/resources/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 首页
6 |
7 |
8 | 以下是网站的功能
9 | 商品添加
10 | 商品删除
11 | 商品列表
12 | 商品更新
13 |
14 |
--------------------------------------------------------------------------------
/springboot-learn-shiro/src/main/resources/templates/login.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 登录页
6 |
7 |
8 |
13 |
14 |
--------------------------------------------------------------------------------
/springboot-learn-staticftl/src/main/java/com/plf/learn/staticftl/bean/Blog.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.staticftl.bean;
2 |
3 | import lombok.Data;
4 |
5 | /**
6 | * @author Panlf
7 | * @date 2019/11/15
8 | */
9 | @Data
10 | public class Blog {
11 |
12 | private String id;
13 |
14 | private String title;
15 |
16 | private String author;
17 |
18 | private String content;
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/springboot-learn-log/src/main/java/com/plf/learn/log/repository/LogMessageRepository.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.log.repository;
2 |
3 | import com.plf.learn.log.entity.LogMessage;
4 | import org.springframework.data.mongodb.repository.MongoRepository;
5 |
6 | /**
7 | * @author Panlf
8 | * @date 2020/3/18
9 | */
10 | public interface LogMessageRepository extends MongoRepository {
11 | }
12 |
--------------------------------------------------------------------------------
/springboot-learn-druid-monitor/src/main/resources/mapper/PersonMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
9 |
--------------------------------------------------------------------------------
/springboot-learn-druid-monitor/src/main/java/com/plf/learn/monitor/mapper/PersonMapper.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.monitor.mapper;
2 |
3 | import com.plf.learn.monitor.bean.Person;
4 | import org.springframework.stereotype.Repository;
5 |
6 | import java.util.List;
7 |
8 | /**
9 | * @author Panlf
10 | * @date 2019/7/11
11 | */
12 | @Repository
13 | public interface PersonMapper {
14 | public List findPerson();
15 | }
16 |
--------------------------------------------------------------------------------
/springboot-learn-security/src/main/resources/templates/login.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 登录
6 |
7 |
8 |
9 | 登录页面
10 |
15 |
16 |
--------------------------------------------------------------------------------
/springboot-learn-sharding-jdbc/src/main/java/com/plf/learn/sharding/bean/Order.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.sharding.bean;
2 |
3 | import lombok.Data;
4 | import org.apache.ibatis.type.Alias;
5 |
6 | /**
7 | * @author Panlf
8 | * @date 2019/6/12
9 | */
10 | @Data
11 | @Alias("t_order")
12 | public class Order {
13 | private Long id;
14 | private Long orderId;
15 | private Long userId;
16 | private String username;
17 | }
18 |
--------------------------------------------------------------------------------
/springboot-learn-websocket/src/main/java/com/plf/learn/websocket/entity/RequestMessage.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.websocket.entity;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Data;
5 | import lombok.NoArgsConstructor;
6 |
7 | /**
8 | * 请求的消息类
9 | * @author Panlf
10 | * @date 2020/3/20
11 | */
12 | @Data
13 | @AllArgsConstructor
14 | @NoArgsConstructor
15 | public class RequestMessage {
16 | private String name;
17 | }
18 |
--------------------------------------------------------------------------------
/springboot-learn-websocket/src/main/java/com/plf/learn/websocket/entity/ResponseMessage.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.websocket.entity;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Data;
5 | import lombok.NoArgsConstructor;
6 |
7 | /**
8 | * 响应的消息类
9 | * @author Panlf
10 | * @date 2020/3/20
11 | */
12 | @Data
13 | @AllArgsConstructor
14 | @NoArgsConstructor
15 | public class ResponseMessage {
16 | private String content;
17 | }
18 |
--------------------------------------------------------------------------------
/springboot-learn-websocket/src/main/resources/note.txt:
--------------------------------------------------------------------------------
1 | WebSocket
2 | WebSocket 是一种网络通信协议。
3 |
4 | WebSocket 是 HTML5 开始提供的一种在单个 TCP 连接上进行全双工(full-duplex)通讯的协议。
5 | 没有了 Request 和 Response 的概念,两者地位完全平等,连接一旦建立,
6 | 就建立了真•持久性连接,双方可以随时向对方发送数据。
7 |
8 | WebSocket的出现历程
9 | 短轮询效率低,非常浪费资源(网络带宽和计算资源)。有一定延迟、服务器压力较大,并且大部分是无效请求。
10 |
11 | 长轮询虽然省去了大量无效请求,减少了服务器压力和一定的网络带宽的占用,但是还是需要保持大量的连接。
12 |
13 | 最后到了基于流的方式,在服务器往客户端推送,这个方向的流实时性比较好。
14 | 但是依旧是单向的,客户端请求服务器依然还需要一次 HTTP 请求。
15 |
16 |
--------------------------------------------------------------------------------
/springboot-learn-jpa/src/main/java/com/plf/learn/jpa/dto/StudentDto.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.jpa.dto;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Data;
5 | import lombok.NoArgsConstructor;
6 |
7 | @Data
8 | @AllArgsConstructor
9 | @NoArgsConstructor
10 | public class StudentDto {
11 | private Integer id;
12 |
13 | private String name;
14 |
15 | private Integer age;
16 |
17 | private Integer schoolId;
18 |
19 | private String schoolName;
20 | }
21 |
--------------------------------------------------------------------------------
/springboot-learn-threadlocal/src/main/java/com/plf/learn/thread/entity/User.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.thread.entity;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Data;
5 | import lombok.NoArgsConstructor;
6 |
7 | /**
8 | * @author Panlf
9 | * @date 2020/3/20
10 | */
11 | @Data
12 | @AllArgsConstructor
13 | @NoArgsConstructor
14 | public class User {
15 | private String id;
16 |
17 | private String username;
18 |
19 | private String password;
20 | }
21 |
--------------------------------------------------------------------------------
/springboot-learn-document/src/main/java/com/plf/learn/document/enums/DocumentEnums.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.document.enums;
2 |
3 | /**
4 | * @author Panlf
5 | * @date 2020/2/13
6 | */
7 | public enum DocumentEnums {
8 | TXT("txt"),WORD_DOC("word_doc"),WORD_DOCX("word_docx");
9 |
10 | private String name;
11 |
12 | DocumentEnums(){}
13 |
14 | DocumentEnums(String name){
15 | this.name= name;
16 | }
17 |
18 | public String getName(){
19 | return name;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/springboot-learn-staticftl/src/main/java/com/plf/learn/staticftl/repository/BlogRepository.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.staticftl.repository;
2 |
3 | import com.plf.learn.staticftl.bean.Blog;
4 | import org.springframework.data.mongodb.repository.MongoRepository;
5 | import org.springframework.stereotype.Repository;
6 |
7 | /**
8 | * @author Panlf
9 | * @date 2019/11/18
10 | */
11 | @Repository
12 | public interface BlogRepository extends MongoRepository {
13 | }
14 |
--------------------------------------------------------------------------------
/springboot-learn-log/src/main/java/com/plf/learn/log/LogApplication.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.log;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | /**
7 | *
8 | * @author Panlf
9 | * @date 2020/3/18
10 | */
11 | @SpringBootApplication
12 | public class LogApplication {
13 | public static void main(String[] args) {
14 | SpringApplication.run(LogApplication.class,args);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/springboot-learn-neo4j/src/main/java/com/plf/learn/neo4j/Neo4jApplication.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.neo4j;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | /**
6 | * @author panlf
7 | * @date 2021/12/25
8 | */
9 | @SpringBootApplication
10 | public class Neo4jApplication {
11 | public static void main(String[] args) {
12 | SpringApplication.run(Neo4jApplication.class,args);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/springboot-learn-solr/src/main/java/com/plf/learn/solr/SolrApplication.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.solr;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | /**
7 | * @author Panlf
8 | * @date 2020/3/18
9 | */
10 | @SpringBootApplication
11 | public class SolrApplication {
12 | public static void main(String[] args) {
13 | SpringApplication.run(SolrApplication.class,args);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled class file
2 | *.class
3 |
4 | # Log file
5 | *.log
6 |
7 | # BlueJ files
8 | *.ctxt
9 |
10 | # Mobile Tools for Java (J2ME)
11 | .mtj.tmp/
12 |
13 | # Package Files #
14 | *.jar
15 | *.war
16 | *.ear
17 | *.zip
18 | *.tar.gz
19 | *.rar
20 |
21 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
22 | hs_err_pid*
23 | /target/
24 | */build/*
25 |
26 | gradlew
27 | gradlew.bat
28 | gradle/
29 | out/
30 | .idea/
31 | .gradle/
32 | .git/
33 |
--------------------------------------------------------------------------------
/springboot-learn-elasticsearch/src/main/java/com/plf/learn/elasticsearch/repository/BookRepository.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.elasticsearch.repository;
2 |
3 | import com.plf.learn.elasticsearch.bean.Book;
4 | import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
5 |
6 | /**
7 | * ElasticsearchCrudRepository 就是SpringBoot自带的CRUD
8 | * @author Panlf
9 | * @date 2019/12/27
10 | */
11 | public interface BookRepository extends ElasticsearchRepository {
12 | }
13 |
--------------------------------------------------------------------------------
/springboot-learn-kafka/src/main/java/com/plf/learn/kafka/KafkaApplication.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.kafka;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | /**
7 | * @author Panlf
8 | * @date 2019/12/26
9 | */
10 | @SpringBootApplication
11 | public class KafkaApplication {
12 | public static void main(String[] args) {
13 | SpringApplication.run(KafkaApplication.class,args);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/springboot-learn-mybatis-plus/src/main/java/com/plf/learn/mybatisplus/SpringBootMybatisPlusApplication.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.mybatisplus;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class SpringBootMybatisPlusApplication {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(SpringBootMybatisPlusApplication.class, args);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/springboot-learn-redis/src/main/java/com/plf/learn/redis/annotations/ApiIdempotent.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.redis.annotations;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | /**
9 | * @author Panlf
10 | * @date 2019/12/26
11 | */
12 | @Target({ElementType.METHOD})
13 | @Retention(RetentionPolicy.RUNTIME)
14 | public @interface ApiIdempotent {
15 | }
16 |
--------------------------------------------------------------------------------
/springboot-learn-elastic-job/src/main/java/com/plf/learn/elastic/bean/FileCustom.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.elastic.bean;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Data;
5 | import lombok.NoArgsConstructor;
6 |
7 | @Data
8 | @AllArgsConstructor
9 | @NoArgsConstructor
10 | public class FileCustom {
11 |
12 | private String id;
13 |
14 | private String name;
15 |
16 | private String type;
17 |
18 | private String path;
19 |
20 | private Boolean backUp=false;
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/springboot-learn-mongodb/src/main/java/com/plf/learn/mongodb/MongoDBApplication.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.mongodb;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | /**
7 | * @author Panlf
8 | * @date 2020/3/2
9 | */
10 | @SpringBootApplication
11 | public class MongoDBApplication {
12 | public static void main(String[] args) {
13 | SpringApplication.run(MongoDBApplication.class);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/springboot-learn-jwt/src/main/java/com/plf/learn/jwt/bean/Person.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.jwt.bean;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.*;
6 |
7 | /**
8 | * @author Panlf
9 | * @date 2019/5/16
10 | */
11 | @Entity
12 | @Data
13 | public class Person {
14 |
15 | @Id
16 | @GeneratedValue(strategy = GenerationType.IDENTITY)
17 | private Integer id;
18 |
19 | @Column
20 | private String username;
21 |
22 | @Column
23 | private String password;
24 | }
25 |
--------------------------------------------------------------------------------
/springboot-learn-jpa/src/main/java/com/plf/learn/jpa/SpringBootJpaApplication.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.jpa;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | /**
7 | * @author Panlf
8 | * @date 2019/5/5
9 | */
10 | @SpringBootApplication
11 | public class SpringBootJpaApplication {
12 | public static void main(String[] args){
13 | SpringApplication.run(SpringBootJpaApplication.class,args);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/springboot-learn-jwt/src/main/java/com/plf/learn/jwt/SpringBootJwtApplication.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.jwt;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | /**
7 | * @author Panlf
8 | * @date 2019/5/14
9 | */
10 | @SpringBootApplication
11 | public class SpringBootJwtApplication {
12 | public static void main(String[] args){
13 | SpringApplication.run(SpringBootJwtApplication.class,args);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/springboot-learn-security/src/main/java/com/plf/learn/security/SecurityApplication.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.security;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | /**
7 | * @author Panlf
8 | * @date 2020/3/13
9 | */
10 | @SpringBootApplication
11 | public class SecurityApplication {
12 | public static void main(String[] args) {
13 | SpringApplication.run(SecurityApplication.class,args);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/springboot-learn-redis/src/main/java/com/plf/learn/redis/RedisSentinelApplication.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.redis;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | /**
7 | * @author Panlf
8 | * @date 2019/12/26
9 | */
10 | @SpringBootApplication
11 | public class RedisSentinelApplication {
12 | public static void main(String[] args) {
13 | SpringApplication.run(RedisSentinelApplication.class,args);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/springboot-learn-threadlocal/src/main/java/com/plf/learn/thread/ThreadLocalApplication.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.thread;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | /**
7 | * @author Panlf
8 | * @date 2020/3/20
9 | */
10 | @SpringBootApplication
11 | public class ThreadLocalApplication {
12 | public static void main(String[] args) {
13 | SpringApplication.run(ThreadLocalApplication.class,args);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/springboot-learn-websocket/src/main/java/com/plf/learn/websocket/WebSocketApplication.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.websocket;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | /**
7 | * @author Panlf
8 | * @date 2020/3/20
9 | */
10 | @SpringBootApplication
11 | public class WebSocketApplication {
12 | public static void main(String[] args) {
13 | SpringApplication.run(WebSocketApplication.class,args);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/springboot-learn-aop-multidata/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8008
3 | servlet:
4 | context-path: /aop
5 |
6 | spring:
7 | datasource:
8 | url_user: jdbc:mysql://localhost:3306/house_user?useUnicode=true&characterEncoding=UTF-8&useSSL=true&serverTimezone=GMT%2B8
9 | url_comment: jdbc:mysql://localhost:3306/house_comment?useUnicode=true&characterEncoding=UTF-8&useSSL=true&serverTimezone=GMT%2B8
10 | username: root
11 | password: root
12 | driver-class-name: com.mysql.cj.jdbc.Driver
--------------------------------------------------------------------------------
/springboot-learn-mail/src/main/java/com/plf/learn/mail/SpringBootMailApplication.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.mail;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | /**
7 | * @author Panlf
8 | * @date 2019/4/20
9 | */
10 | @SpringBootApplication
11 | public class SpringBootMailApplication {
12 |
13 | public static void main(String[] args) {
14 | SpringApplication.run(SpringBootMailApplication.class, args);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/springboot-learn-aop-multidata/src/main/java/com/plf/learn/aop/multidata/SpringBootMultidata.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.aop.multidata;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | /**
7 | * @author Panlf
8 | * @date 2019/8/7
9 | */
10 | @SpringBootApplication
11 | public class SpringBootMultidata {
12 |
13 | public static void main(String[] args) {
14 | SpringApplication.run(SpringBootMultidata.class,args);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/springboot-learn-distributed-lock/src/main/java/com/plf/learn/lock/SpringBootLockApplication.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.lock;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | /**
7 | * @author Panlf
8 | * @date 2019/4/19
9 | */
10 | @SpringBootApplication
11 | public class SpringBootLockApplication {
12 | public static void main(String[] args) {
13 | SpringApplication.run(SpringBootLockApplication.class, args);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/springboot-learn-shiro/src/main/java/com/plf/learn/shiro/repository/UserRepository.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.shiro.repository;
2 |
3 | import com.plf.learn.shiro.bean.User;
4 | import org.springframework.data.jpa.repository.JpaRepository;
5 |
6 | /**
7 | * @author Panlf
8 | * @date 2019/6/6
9 | */
10 | public interface UserRepository extends JpaRepository {
11 |
12 | /**
13 | * 根据用户名查找用户
14 | * @param username
15 | * @return
16 | */
17 | User findDistinctByUsername(String username);
18 | }
19 |
--------------------------------------------------------------------------------
/springboot-learn-elastic-job/src/main/java/com/plf/learn/elastic/SpringBootElasticApplication.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.elastic;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | /**
7 | * @author Panlf
8 | * @date 2019/12/2
9 | */
10 | @SpringBootApplication
11 | public class SpringBootElasticApplication {
12 | public static void main(String[] args) {
13 | SpringApplication.run(SpringBootElasticApplication.class,args);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/springboot-learn-jwt/src/main/java/com/plf/learn/jwt/repository/PersonRepository.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.jwt.repository;
2 |
3 | import com.plf.learn.jwt.bean.Person;
4 | import org.springframework.data.repository.CrudRepository;
5 |
6 | /**
7 | * @author Panlf
8 | * @date 2019/5/16
9 | */
10 | public interface PersonRepository extends CrudRepository {
11 |
12 | /**
13 | * 根据用户名查找用户
14 | * @param username
15 | * @return
16 | */
17 | public Person findPersonByUsername(String username);
18 | }
19 |
--------------------------------------------------------------------------------
/springboot-learn-caffeine/src/main/java/com/plf/learn/caffeine/SpringBootCaffeineApplication.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.caffeine;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | /**
7 | * @author panlf
8 | * @date 2021/8/16
9 | */
10 | @SpringBootApplication
11 | public class SpringBootCaffeineApplication {
12 | public static void main(String[] args) {
13 | SpringApplication.run(SpringBootCaffeineApplication.class,args);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/springboot-learn-elasticsearch/src/main/java/com/plf/learn/elasticsearch/ElasticSearchApplication.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.elasticsearch;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | /**
7 | * @author Panlf
8 | * @date 2019/12/27
9 | */
10 | @SpringBootApplication
11 | public class ElasticSearchApplication {
12 | public static void main(String[] args) {
13 | SpringApplication.run(ElasticSearchApplication.class,args);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/springboot-learn-jwt/src/main/java/com/plf/learn/jwt/common/JwtResult.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.jwt.common;
2 |
3 | import io.jsonwebtoken.Claims;
4 | import lombok.Data;
5 |
6 | /**
7 | * @author Panlf
8 | * @date 2019/5/14
9 | */
10 | @Data
11 | public class JwtResult {
12 |
13 | /**
14 | * 错误编码 在JwtUtils中定义常量
15 | *
16 | * 200为正确
17 | */
18 | private int errCode;
19 |
20 | /**
21 | * 是否成功
22 | */
23 | private boolean success;
24 |
25 | /**
26 | * 验证过程中payload中的数据
27 | */
28 | private Claims claims;
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/springboot-learn-api-limiter/src/main/java/com/plf/learn/limiter/SpringBootApiLimiterApplication.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.limiter;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | /**
7 | * @author panlf
8 | * @date 2021/9/1
9 | */
10 | @SpringBootApplication
11 | public class SpringBootApiLimiterApplication {
12 | public static void main(String[] args) {
13 | SpringApplication.run(SpringBootApiLimiterApplication.class,args);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/springboot-learn-custom-event/src/main/java/com/plf/learn/custom/event/SpringBootEventApplication.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.custom.event;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | /**
7 | * @author Panlf
8 | * @date 2019/4/19
9 | */
10 | @SpringBootApplication
11 | public class SpringBootEventApplication {
12 | public static void main(String[] args) {
13 | SpringApplication.run(SpringBootEventApplication.class, args);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/springboot-learn-jpa/src/main/java/com/plf/learn/jpa/bean/School.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.jpa.bean;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.Column;
6 | import javax.persistence.Entity;
7 | import javax.persistence.GeneratedValue;
8 | import javax.persistence.GenerationType;
9 | import javax.persistence.Id;
10 |
11 |
12 | @Entity
13 | @Data
14 | public class School {
15 | @Id
16 | @GeneratedValue(strategy = GenerationType.IDENTITY)
17 | private Integer id;
18 |
19 | @Column
20 | private String schoolName;
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/springboot-learn-staticftl/src/main/java/com/plf/learn/staticftl/SpringBootStaticFtlApplication.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.staticftl;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | /**
7 | * @author Panlf
8 | * @date 2019/11/15
9 | */
10 | @SpringBootApplication
11 | public class SpringBootStaticFtlApplication {
12 | public static void main(String[] args) {
13 | SpringApplication.run(SpringBootStaticFtlApplication.class,args);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/springboot-learn-aop-multidata/src/main/java/com/plf/learn/aop/multidata/annotation/TargetDataSource.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.aop.multidata.annotation;
2 |
3 | import java.lang.annotation.Retention;
4 | import java.lang.annotation.Target;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.ElementType;
7 |
8 | /**
9 | * @author Panlf
10 | * @date 2019/8/7
11 | */
12 | @Retention(RetentionPolicy.RUNTIME)
13 | @Target(ElementType.METHOD)
14 | public @interface TargetDataSource {
15 | String value() default "";
16 | }
17 |
--------------------------------------------------------------------------------
/springboot-learn-redis/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8012
3 | servlet:
4 | context-path: /redis
5 |
6 | spring:
7 | redis:
8 | sentinel:
9 | #哨兵监听redis server名称
10 | master: mymaster
11 | #哨兵的配置列表
12 | nodes: 127.0.0.1:26000,127.0.0.1:26001,127.0.0.1:26002
13 | lettuce:
14 | pool:
15 | #最大连接数
16 | max-active: 8
17 | #最大阻塞等待时间(负数表示没限制)
18 | max-wait: -1
19 | #最大空闲
20 | max-idle: 8
21 | #最小空闲
22 | min-idle: 0
23 | timeout: 10000ms
24 |
25 |
--------------------------------------------------------------------------------
/springboot-learn-document/src/main/java/com/plf/learn/document/utils/interfaces/OperateDocument.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.document.utils.interfaces;
2 |
3 | /**
4 | * @author Panlf
5 | * @date 2020/2/13
6 | */
7 | public interface OperateDocument {
8 |
9 | /**
10 | * 读文档
11 | * @param path
12 | * @return
13 | */
14 | public String readDocument(String path);
15 |
16 | /**
17 | * 写文档
18 | * @param path
19 | * @param content
20 | * @return
21 | */
22 | public boolean writeDocument(String path,String content);
23 | }
24 |
--------------------------------------------------------------------------------
/springboot-learn-shiro/src/main/java/com/plf/learn/shiro/service/AdminActionService.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.shiro.service;
2 |
3 | import lombok.extern.slf4j.Slf4j;
4 | import org.apache.shiro.authz.annotation.RequiresRoles;
5 | import org.springframework.stereotype.Service;
6 |
7 | /**
8 | * admin 用户权限测试
9 | * @author Panlf
10 | * @date 2019/6/5
11 | */
12 | @Service
13 | @Slf4j
14 | public class AdminActionService {
15 |
16 | @RequiresRoles("admin")
17 | public void logVisitService(){
18 | log.info("AdminActionService Admin Role Visit--");
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/springboot-learn-kafka/src/main/java/com/plf/learn/kafka/message/Message.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.kafka.message;
2 |
3 | import lombok.Data;
4 |
5 | import java.io.Serializable;
6 | import java.util.Date;
7 |
8 | /**
9 | * @author Panlf
10 | * @date 2019/12/26
11 | */
12 | @Data
13 | public class Message implements Serializable {
14 |
15 | private static final long serialVersionUID = 1L;
16 |
17 | private Integer id;
18 |
19 | private String topic;
20 |
21 | private Integer partition;
22 |
23 | private String content;
24 |
25 | private Date createTime;
26 | }
27 |
--------------------------------------------------------------------------------
/springboot-learn-jetcache/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8005
3 | servlet:
4 | context-path: /jetcache
5 |
6 |
7 | jetcache:
8 | statIntervalMinutes: 15
9 | areaInCacheName: false
10 | local:
11 | default:
12 | type: linkedhashmap
13 | keyConvertor: fastjson
14 | remote:
15 | default:
16 | type: redis
17 | keyConvertor: fastjson
18 | valueEncoder: java
19 | valueDecoder: java
20 | poolConfig:
21 | minIdle: 5
22 | maxIdle: 20
23 | maxTotal: 50
24 | host: 127.0.0.1
25 | port: 6379
26 |
--------------------------------------------------------------------------------
/springboot-learn-mongodb/src/main/java/com/plf/learn/mongodb/repository/CommentRepository.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.mongodb.repository;
2 |
3 | import com.plf.learn.mongodb.bean.Comment;
4 | import org.springframework.data.domain.Page;
5 | import org.springframework.data.domain.Pageable;
6 | import org.springframework.data.mongodb.repository.MongoRepository;
7 |
8 | /**
9 | * @author Panlf
10 | * @date 2020/3/2
11 | */
12 | public interface CommentRepository extends MongoRepository{
13 |
14 | public Page findByParentid(String parentid, Pageable pageable);
15 | }
16 |
--------------------------------------------------------------------------------
/springboot-learn-security/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8025
3 | servlet:
4 | context-path: /security
5 |
6 | spring:
7 | datasource:
8 | url: jdbc:mysql://localhost:3306/practice?useUnicode=true&characterEncoding=UTF-8&useSSL=true&serverTimezone=GMT%2B8
9 | username: root
10 | password: root
11 | driver-class-name: com.mysql.cj.jdbc.Driver
12 | mybatis:
13 | type-aliases-package: com.plf.learn.security
14 |
15 | logging:
16 | level:
17 | com:
18 | plf:
19 | learn:
20 | security:
21 | mapper: debug
22 |
--------------------------------------------------------------------------------
/springboot-learn-solr/src/main/java/com/plf/learn/solr/entity/Worker.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.solr.entity;
2 |
3 | import lombok.Data;
4 | import org.apache.solr.client.solrj.beans.Field;
5 | import org.springframework.data.solr.core.mapping.SolrDocument;
6 |
7 |
8 | /**
9 | * @author Panlf
10 | * @date 2020/3/18
11 | */
12 | @Data
13 | @SolrDocument(solrCoreName = "worker")
14 | public class Worker {
15 | @Field("workid")
16 | private String workid;
17 |
18 | @Field("position")
19 | private String position;
20 |
21 | @Field("salary")
22 | private double salary;
23 | }
24 |
--------------------------------------------------------------------------------
/springboot-learn-aop-multidata/src/main/java/com/plf/learn/aop/multidata/config/DynamicDataSource.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.aop.multidata.config;
2 |
3 | import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;
4 |
5 | /**
6 | * 动态数据源的实现类
7 | * @author Panlf
8 | * @date 2019/8/7
9 | */
10 | public class DynamicDataSource extends AbstractRoutingDataSource {
11 |
12 | /**
13 | * 数据源路由,此方用于产生要选取的数据源逻辑名称
14 | */
15 | @Override
16 | protected Object determineCurrentLookupKey() {
17 | return DynamicDataSourceHolder.getDataSource();
18 | }
19 | }
20 |
21 |
--------------------------------------------------------------------------------
/springboot-learn-staticftl/src/main/java/com/plf/learn/staticftl/controller/TestController.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.staticftl.controller;
2 |
3 | import org.springframework.stereotype.Controller;
4 | import org.springframework.ui.Model;
5 | import org.springframework.web.bind.annotation.RequestMapping;
6 |
7 | /**
8 | * @author Panlf
9 | * @date 2019/11/15
10 | */
11 | @Controller
12 | public class TestController {
13 |
14 |
15 | @RequestMapping("/index")
16 | public String toIndex(Model model) {
17 | model.addAttribute("name", "lisi");
18 | return "index";
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/springboot-learn-jetcache/src/main/java/com/plf/learn/jetcache/bean/Person.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.jetcache.bean;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Data;
5 | import lombok.NoArgsConstructor;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 |
8 | import java.io.Serializable;
9 |
10 | /**
11 | * @author Panlf
12 | * @date 2019/5/24
13 | */
14 | @Data
15 | @AllArgsConstructor
16 | @NoArgsConstructor
17 | public class Person implements Serializable{
18 |
19 | private Integer id;
20 |
21 | private String name;
22 |
23 | private Integer age;
24 | }
25 |
--------------------------------------------------------------------------------
/springboot-learn-security/src/main/java/com/plf/learn/security/controller/IndexController.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.security.controller;
2 |
3 | import org.springframework.stereotype.Controller;
4 | import org.springframework.web.bind.annotation.RequestMapping;
5 |
6 | @Controller
7 | public class IndexController {
8 |
9 | @RequestMapping("/index")
10 | public String index() {
11 | return "index";
12 | }
13 |
14 | @RequestMapping("/403")
15 | public String forbidden() {
16 | return "403";
17 | }
18 |
19 | @RequestMapping("/login")
20 | public String login() {
21 | return "login";
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/springboot-learn-shiro/src/main/java/com/plf/learn/shiro/SpringBootShiroApplication.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.shiro;
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 Panlf
9 | * @date 2019/6/5
10 | */
11 | @SpringBootApplication
12 | @EnableCaching
13 | public class SpringBootShiroApplication {
14 |
15 | public static void main(String[] args) {
16 | SpringApplication.run(SpringBootShiroApplication.class,args);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/springboot-learn-dataway/src/main/java/com/plf/learn/dataway/SpringBootDatawayApplication.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.dataway;
2 |
3 | import net.hasor.spring.boot.EnableHasor;
4 | import net.hasor.spring.boot.EnableHasorWeb;
5 | import org.springframework.boot.SpringApplication;
6 | import org.springframework.boot.autoconfigure.SpringBootApplication;
7 |
8 | @EnableHasor()
9 | @EnableHasorWeb()
10 | @SpringBootApplication
11 | public class SpringBootDatawayApplication {
12 |
13 | public static void main(String[] args) {
14 | SpringApplication.run(SpringBootDatawayApplication.class,args);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/springboot-learn-document/src/main/java/com/plf/learn/document/SpringBootDocumentApplication.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.document;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.scheduling.annotation.EnableAsync;
6 |
7 | /**
8 | * @author Panlf
9 | * @date 2020/2/13
10 | */
11 | @SpringBootApplication
12 | @EnableAsync
13 | public class SpringBootDocumentApplication {
14 | public static void main(String[] args) {
15 | SpringApplication.run(SpringBootDocumentApplication.class,args);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/springboot-learn-redis/src/main/java/com/plf/learn/redis/service/TokenService.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.redis.service;
2 |
3 | import javax.servlet.http.HttpServletRequest;
4 |
5 | /**
6 | * @author Panlf
7 | * @date 2019/12/26
8 | */
9 | public interface TokenService {
10 | /**
11 | * 创建token
12 | * @param username 用户名
13 | * @return
14 | */
15 | public String createToken(String username);
16 |
17 | /**
18 | * 检验Token
19 | * @param request
20 | * @return
21 | * @throws Exception
22 | */
23 | public boolean checkToken(HttpServletRequest request) throws Exception;
24 | }
25 |
--------------------------------------------------------------------------------
/springboot-learn-jetcache/src/main/java/com/plf/learn/jetcache/service/PersonService.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.jetcache.service;
2 |
3 | import com.plf.learn.jetcache.bean.Person;
4 |
5 | /**
6 | * @author Panlf
7 | * @date 2019/5/24
8 | */
9 | public interface PersonService {
10 | /**
11 | * 根据Id获取用户
12 | * @param id
13 | * @return
14 | */
15 | Person getPersonById(Integer id);
16 |
17 | /**
18 | * 更新用户
19 | * @param person
20 | */
21 | void updatePerson(Person person);
22 |
23 | /**
24 | * 删除用户
25 | * @param id
26 | */
27 | void deletePerson(Integer id);
28 | }
29 |
--------------------------------------------------------------------------------
/springboot-learn-jpa/src/main/java/com/plf/learn/jpa/bean/Student.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.jpa.bean;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.Column;
6 | import javax.persistence.Entity;
7 | import javax.persistence.GeneratedValue;
8 | import javax.persistence.GenerationType;
9 | import javax.persistence.Id;
10 |
11 | @Entity
12 | @Data
13 | public class Student {
14 |
15 | @Id
16 | @GeneratedValue(strategy = GenerationType.IDENTITY)
17 | private Integer id;
18 |
19 | @Column
20 | private String name;
21 |
22 | @Column
23 | private Integer age;
24 |
25 | @Column
26 | private Integer schoolId;
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/springboot-learn-neo4j/src/main/java/com/plf/learn/neo4j/entity/MinFamily.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.neo4j.entity;
2 |
3 | import lombok.Data;
4 | import lombok.NoArgsConstructor;
5 | import org.springframework.data.neo4j.core.schema.*;
6 |
7 | import java.util.Set;
8 |
9 | /**
10 | * @author panlf
11 | * @date 2021/12/25
12 | */
13 | @Data
14 | @Node(labels = "minFamily")
15 | @NoArgsConstructor
16 | public class MinFamily {
17 |
18 | @Id
19 | @GeneratedValue
20 | private Long id;
21 | @Property
22 | private String name;
23 |
24 | public MinFamily(String name){
25 | this.name = name;
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/springboot-learn-mybatis-plus/src/main/java/com/plf/learn/mybatisplus/entity/User.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.mybatisplus.entity;
2 |
3 | import java.util.Date;
4 |
5 | import com.baomidou.mybatisplus.annotation.TableField;
6 | import com.baomidou.mybatisplus.annotation.TableId;
7 | import com.baomidou.mybatisplus.annotation.TableName;
8 | import lombok.Data;
9 |
10 | @TableName
11 | @Data
12 | public class User {
13 | @TableId
14 | private Integer id;
15 | @TableField
16 | private String username;
17 | @TableField
18 | private Date birthday;
19 | @TableField
20 | private Integer sex;
21 | @TableField
22 | private String address;
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/springboot-learn-sharding-jdbc/src/main/java/com/plf/learn/sharding/test/SnowTest.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.sharding.test;
2 |
3 | import org.apache.shardingsphere.core.strategy.keygen.SnowflakeShardingKeyGenerator;
4 |
5 | /**
6 | * @author Panlf
7 | * @date 2019/6/12
8 | */
9 | public class SnowTest {
10 | public static void main(String[] args) {
11 | SnowflakeShardingKeyGenerator keyGenerator = new SnowflakeShardingKeyGenerator();
12 | System.out.println(keyGenerator.generateKey());
13 | System.out.println(keyGenerator.generateKey());
14 | System.out.println(keyGenerator.generateKey());
15 |
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/springboot-learn-document/src/main/java/com/plf/learn/document/utils/CloseUtils.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.document.utils;
2 |
3 | import java.io.Closeable;
4 | import java.io.IOException;
5 | /**
6 | * @author Panlf
7 | * @date 2020/2/13
8 | */
9 | public class CloseUtils {
10 | public static void close(Closeable...closeables) {
11 | if(closeables==null) {
12 | return;
13 | }
14 | for(Closeable closeable:closeables) {
15 | try {
16 | closeable.close();
17 | } catch (IOException e) {
18 | e.printStackTrace();
19 | }
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/springboot-learn-shiro/src/main/java/com/plf/learn/shiro/service/UserService.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.shiro.service;
2 |
3 | import com.plf.learn.shiro.bean.User;
4 | import com.plf.learn.shiro.repository.UserRepository;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.stereotype.Service;
7 |
8 | /**
9 | * @author Panlf
10 | * @date 2019/6/6
11 | */
12 | @Service
13 | public class UserService {
14 |
15 | @Autowired
16 | private UserRepository userRepository;
17 |
18 | public User findByUsername(String username){
19 | return userRepository.findDistinctByUsername(username);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/springboot-learn-druid-monitor/src/main/java/com/plf/learn/monitor/SpringBootMonitorApplication.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.monitor;
2 |
3 | import org.mybatis.spring.annotation.MapperScan;
4 | import org.springframework.boot.SpringApplication;
5 | import org.springframework.boot.autoconfigure.SpringBootApplication;
6 |
7 |
8 | /**
9 | * @author Panlf
10 | * @date 2019/7/11
11 | */
12 | @SpringBootApplication
13 | @MapperScan(basePackages={"com.plf.learn.monitor.mapper"})
14 | public class SpringBootMonitorApplication {
15 | public static void main(String[] args) {
16 | SpringApplication.run(SpringBootMonitorApplication.class,args);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/springboot-learn-jpa/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8002
3 | servlet:
4 | context-path: /jpa
5 |
6 | spring:
7 | datasource:
8 | url: jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8&useSSL=true&serverTimezone=GMT%2B8
9 | username: root
10 | password: root
11 | driver-class-name: com.mysql.cj.jdbc.Driver
12 | jpa:
13 | database: MYSQL
14 | show-sql: true
15 | hibernate:
16 | ddl-auto: update
17 | naming:
18 | physical-strategy: org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy
19 | database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
--------------------------------------------------------------------------------
/springboot-learn-log/src/main/java/com/plf/learn/log/service/LogMessageService.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.log.service;
2 |
3 | import com.plf.learn.log.entity.LogMessage;
4 | import com.plf.learn.log.repository.LogMessageRepository;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.stereotype.Service;
7 |
8 | /**
9 | * @author Panlf
10 | * @date 2020/3/18
11 | */
12 | @Service
13 | public class LogMessageService {
14 | @Autowired
15 | private LogMessageRepository logMessageRepository;
16 |
17 | public void save(LogMessage logMessage){
18 | logMessageRepository.save(logMessage);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/springboot-learn-mybatis-plus/src/main/java/com/plf/learn/mybatisplus/entity/Log.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.mybatisplus.entity;
2 |
3 | import java.util.Date;
4 |
5 | import com.baomidou.mybatisplus.annotation.*;
6 | import lombok.Data;
7 |
8 | @TableName
9 | @Data
10 | public class Log {
11 | @TableId
12 | private Integer id;
13 |
14 | @TableId
15 | private Integer userId;
16 |
17 | @TableField
18 | private String content;
19 |
20 | @TableField(fill = FieldFill.INSERT)
21 | private Date createtime;
22 |
23 | @TableField(fill=FieldFill.UPDATE)
24 | private Date updatetime;
25 |
26 | @TableField
27 | @TableLogic
28 | private Integer delstatus;
29 | }
30 |
--------------------------------------------------------------------------------
/springboot-learn-aop-multidata/src/main/java/com/plf/learn/aop/multidata/config/DynamicDataSourceHolder.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.aop.multidata.config;
2 |
3 | /**
4 | * 动态数据源的增加获取删除
5 | * @author Panlf
6 | * @date 2019/8/7
7 | */
8 | public class DynamicDataSourceHolder {
9 | private static final ThreadLocal THREAD_LOCAL = new ThreadLocal<>();
10 |
11 | public static void putDataSource(String name) {
12 | THREAD_LOCAL.set(name);
13 | }
14 |
15 | public static String getDataSource() {
16 | return THREAD_LOCAL.get();
17 | }
18 |
19 | public static void removeDataSource() {
20 | THREAD_LOCAL.remove();
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/springboot-learn-mybatis-plus/src/main/java/com/plf/learn/mybatisplus/service/LogService.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.mybatisplus.service;
2 |
3 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
4 | import com.baomidou.mybatisplus.extension.service.IService;
5 | import com.plf.learn.mybatisplus.dto.LogDto;
6 | import com.plf.learn.mybatisplus.entity.Log;
7 |
8 | public interface LogService extends IService{
9 |
10 | public void insertLog(Log log);
11 |
12 | public void deleteLog(Integer id);
13 |
14 | public Page getPageLog(Page page, String strattime);
15 |
16 | public Page getLogAndName(Page page, String username);
17 | }
18 |
--------------------------------------------------------------------------------
/springboot-learn-distributed-lock/src/main/java/com/plf/learn/lock/config/RedissonConfig.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.lock.config;
2 |
3 | import org.redisson.Redisson;
4 | import org.redisson.config.Config;
5 | import org.springframework.context.annotation.Bean;
6 | import org.springframework.context.annotation.Configuration;
7 |
8 | /**
9 | * @author Panlf
10 | * @date 2019/5/20
11 | */
12 | @Configuration
13 | public class RedissonConfig {
14 |
15 | @Bean
16 | public Redisson redisson(){
17 | Config config = new Config();
18 | config.useSingleServer().setAddress("redis://127.0.0.1:6379").setDatabase(0);
19 | return (Redisson)Redisson.create(config);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/springboot-learn-log/src/main/java/com/plf/learn/log/entity/LogMessage.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.log.entity;
2 |
3 | import lombok.Data;
4 |
5 | import java.util.Date;
6 |
7 | /**
8 | * @author Panlf
9 | * @date 2020/3/18
10 | */
11 | @Data
12 | public class LogMessage {
13 | private String id;
14 | /**
15 | * 操作描述
16 | */
17 | private String description;
18 | private String ip;
19 | /**
20 | * 操作人
21 | */
22 | private String operateName;
23 | private String uri;
24 | private String url;
25 | /**
26 | * 操作花费的时间
27 | */
28 | private Long duration;
29 |
30 | private Date startTime;
31 |
32 | private Date endTime;
33 | }
34 |
--------------------------------------------------------------------------------
/springboot-learn-share-session/src/main/java/com/plf/learn/share/session/SpringBootShareSessionApplication.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.share.session;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
6 |
7 | /**
8 | * @author Panlf
9 | * @date 2019/4/19
10 | */
11 | @SpringBootApplication
12 | @EnableRedisHttpSession
13 | public class SpringBootShareSessionApplication {
14 | public static void main(String[] args) {
15 | SpringApplication.run(SpringBootShareSessionApplication.class, args);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/springboot-learn-shiro/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8006
3 | servlet:
4 | context-path: /shiro
5 |
6 | spring:
7 | datasource:
8 | url: jdbc:mysql://localhost:3306/bootlearn?useUnicode=true&characterEncoding=UTF-8&useSSL=true&serverTimezone=GMT%2B8
9 | username: root
10 | password: root
11 | driver-class-name: com.mysql.cj.jdbc.Driver
12 | jpa:
13 | database: MYSQL
14 | show-sql: true
15 | hibernate:
16 | ddl-auto: update
17 | naming:
18 | physical-strategy: org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy
19 | database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
20 |
21 |
22 |
--------------------------------------------------------------------------------
/springboot-learn-custom-event/src/main/java/com/plf/learn/custom/event/emailevents/EmailEventPublish.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.custom.event.emailevents;
2 |
3 | import org.springframework.beans.factory.annotation.Autowired;
4 | import org.springframework.context.ApplicationContext;
5 | import org.springframework.stereotype.Component;
6 |
7 | /**
8 | * @author Panlf
9 | * @date 2019/4/19
10 | */
11 | @Component
12 | public class EmailEventPublish {
13 | @Autowired
14 | private ApplicationContext applicationContext;
15 |
16 | public void publishEvent(String emailAddress) {
17 | EmailEvent event = new EmailEvent(emailAddress);
18 | applicationContext.publishEvent(event);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/springboot-learn-threadlocal/src/main/java/com/plf/learn/thread/base/Message.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.thread.base;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Data;
5 | import lombok.NoArgsConstructor;
6 |
7 | /**
8 | * @author Panlf
9 | * @date 2020/3/20
10 | */
11 | @Data
12 | @AllArgsConstructor
13 | @NoArgsConstructor
14 | public class Message {
15 | private Integer code;
16 | private String message;
17 | private Object data;
18 |
19 | public static Message success(String message,Object data){
20 | return new Message(200,message,data);
21 | }
22 |
23 | public static Message fail(String message,Object data){
24 | return new Message(500,message,data);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/springboot-learn-custom-event/src/main/java/com/plf/learn/custom/event/emailevents/EmailEvent.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.custom.event.emailevents;
2 |
3 | import org.springframework.context.ApplicationEvent;
4 |
5 | /**
6 | * @author Panlf
7 | * @date 2019/4/19
8 | */
9 | public class EmailEvent extends ApplicationEvent {
10 |
11 | private String emailAddress;
12 |
13 | public EmailEvent(String emailAddress) {
14 | super(emailAddress);
15 | this.emailAddress = emailAddress;
16 | }
17 |
18 | public String getEmailAddress() {
19 | return emailAddress;
20 | }
21 |
22 | public void setEmailAddress(String emailAddress) {
23 | this.emailAddress = emailAddress;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/springboot-learn-distributed-lock/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8004
3 | servlet:
4 | context-path: /lock
5 |
6 | spring:
7 | redis:
8 | #数据库索引
9 | database: 0
10 | host: 127.0.0.1
11 | port: 6379
12 | lettuce:
13 | pool:
14 | #最大连接数
15 | max-active: 8
16 | #最大阻塞等待时间(负数表示没限制)
17 | max-wait: -1
18 | #最大空闲
19 | max-idle: 8
20 | #最小空闲
21 | min-idle: 0
22 | #连接超时时间
23 | timeout: 10000
24 |
25 |
26 | curator:
27 | retryCount: 5 #重试次数
28 | elapsedTimeMs: 5000 #重试间隔时间
29 | connectString: 127.0.0.1:2181 # zookeeper 地址
30 | sessionTimeoutMs: 60000 # session超时时间
31 | connectionTimeoutMs: 5000 # 连接超时时间
32 |
33 |
--------------------------------------------------------------------------------
/springboot-learn-sharding-jdbc/src/main/java/com/plf/learn/sharding/mapper/OrderMapper.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.sharding.mapper;
2 |
3 | import com.plf.learn.sharding.bean.Order;
4 | import org.apache.ibatis.annotations.Insert;
5 | import org.apache.ibatis.annotations.Mapper;
6 | import org.apache.ibatis.annotations.Param;
7 | import org.apache.ibatis.annotations.Select;
8 |
9 | /**
10 | * @author Panlf
11 | * @date 2019/6/12
12 | */
13 | @Mapper
14 | public interface OrderMapper {
15 |
16 | @Insert("insert into t_order values(#{id},#{orderId},#{userId},#{username})")
17 | public void insertOrder(Order order);
18 |
19 | @Select("select * from t_order where id=#{id}")
20 | public Order findById(@Param("id") long id);
21 | }
22 |
--------------------------------------------------------------------------------
/springboot-learn-distributed-lock/src/main/java/com/plf/learn/lock/utils/StringUtils.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.lock.utils;
2 |
3 | /**
4 | * @author Panlf
5 | * @date 2019/5/20
6 | */
7 | public class StringUtils {
8 |
9 | /**
10 | * 判断字符串是否为空
11 | * @param str
12 | * @return Null或者空串返回false,否则返回true
13 | */
14 | public static boolean isNotEmpty(String str){
15 | if(str==null || str.trim().length()<=0){
16 | return false;
17 | }
18 | return true;
19 | }
20 |
21 | /**
22 | * 判断字符串是否为空
23 | * @param str
24 | * @return Null或者空串返回true,否则返回false
25 | */
26 | public static boolean isEmpty(String str){
27 | return !isNotEmpty(str);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/springboot-learn-api-limiter/src/main/java/com/plf/learn/limiter/controller/ApiController.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.limiter.controller;
2 |
3 | import com.plf.learn.limiter.annotations.ApiRateLimiter;
4 | import org.springframework.web.bind.annotation.GetMapping;
5 | import org.springframework.web.bind.annotation.RestController;
6 |
7 | import java.util.concurrent.atomic.AtomicInteger;
8 |
9 | /**
10 | * @author panlf
11 | * @date 2021/9/1
12 | */
13 | @RestController
14 | public class ApiController {
15 |
16 | private AtomicInteger num = new AtomicInteger(0);
17 |
18 | @ApiRateLimiter(token = 1,timeout = 1)
19 | @GetMapping("hello")
20 | public String hello(){
21 | return "处理成功 --- "+num.incrementAndGet();
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/springboot-learn-jwt/src/main/java/com/plf/learn/jwt/service/PersonService.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.jwt.service;
2 |
3 | import com.plf.learn.jwt.bean.Person;
4 | import com.plf.learn.jwt.repository.PersonRepository;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.stereotype.Service;
7 |
8 | /**
9 | * @author Panlf
10 | * @date 2019/5/16
11 | */
12 | @Service
13 | public class PersonService {
14 |
15 | @Autowired
16 | private PersonRepository personRepository;
17 |
18 | /**
19 | * 根据用户名查找用户
20 | * @param username
21 | * @return
22 | */
23 | public Person findPersonByUsername(String username){
24 | return personRepository.findPersonByUsername(username);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/springboot-learn-mybatis-plus/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8003
3 | servlet:
4 | context-path: /mybatisplus
5 |
6 | spring:
7 | datasource:
8 | url: jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8&useSSL=true&serverTimezone=GMT%2B8
9 | username: root
10 | password: root
11 | driver-class-name: com.mysql.cj.jdbc.Driver
12 | logging:
13 | level:
14 | com:
15 | plf:
16 | learn:
17 | mybatisplus:
18 | mapper: debug
19 |
20 | mybatis-plus:
21 | type-aliases-package: com.plf.learn.mybatisplus.entity
22 | global-config:
23 | db-config:
24 | id-type: AUTO
25 | table-underline: true
26 | logic-delete-value: 1
27 | logic-not-delete-value: 0
--------------------------------------------------------------------------------
/springboot-learn-jetcache/src/main/java/com/plf/learn/jetcache/SpringBootJetcacheApplication.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.jetcache;
2 |
3 | import com.alicp.jetcache.anno.config.EnableCreateCacheAnnotation;
4 | import com.alicp.jetcache.anno.config.EnableMethodCache;
5 | import org.springframework.boot.SpringApplication;
6 | import org.springframework.boot.autoconfigure.SpringBootApplication;
7 |
8 | /**
9 | * @author Panlf
10 | * @date 2019/5/24
11 | */
12 | @SpringBootApplication
13 | @EnableMethodCache(basePackages = "com.plf.learn.jetcache")
14 | @EnableCreateCacheAnnotation
15 | public class SpringBootJetcacheApplication {
16 |
17 | public static void main(String[] args) {
18 | SpringApplication.run(SpringBootJetcacheApplication.class,args);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/springboot-learn-staticftl/src/main/java/com/plf/learn/staticftl/component/ActiveMQProducer.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.staticftl.component;
2 |
3 | import org.springframework.beans.factory.annotation.Autowired;
4 | import org.springframework.jms.core.JmsMessagingTemplate;
5 | import org.springframework.stereotype.Component;
6 |
7 | /**
8 | * @author Panlf
9 | * @date 2019/11/18
10 | */
11 | @Component
12 | public class ActiveMQProducer {
13 |
14 | @Autowired
15 | private JmsMessagingTemplate jmsMessagingTemplate;
16 |
17 | /**
18 | *
19 | * @param destination 队列
20 | * @param message 信息
21 | */
22 | public void sendMessage(String destination,String message){
23 | jmsMessagingTemplate.convertAndSend(destination,message);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/springboot-learn-shiro/src/main/java/com/plf/learn/shiro/utils/KeyDecode.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.shiro.utils;
2 |
3 | import org.apache.shiro.codec.Base64;
4 |
5 | import javax.crypto.KeyGenerator;
6 | import javax.crypto.SecretKey;
7 | import java.security.NoSuchAlgorithmException;
8 |
9 | /**
10 | * @author Panlf
11 | * @date 2019/6/5
12 | */
13 | public class KeyDecode {
14 | public static void main(String[] args) {
15 | KeyGenerator keygen = null;
16 | try {
17 | keygen = KeyGenerator.getInstance("AES");
18 | } catch (NoSuchAlgorithmException e) {
19 | e.printStackTrace();
20 | }
21 | SecretKey deskey = keygen.generateKey();
22 | System.out.println(Base64.encodeToString(deskey.getEncoded()));
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/springboot-learn-api-limiter/src/main/java/com/plf/learn/limiter/annotations/ApiRateLimiter.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.limiter.annotations;
2 |
3 | import java.lang.annotation.*;
4 | import java.util.concurrent.TimeUnit;
5 |
6 | /**
7 | * @author panlf
8 | * @date 2021/9/1
9 | */
10 | @Documented
11 | @Target(ElementType.METHOD)
12 | @Retention(RetentionPolicy.RUNTIME)
13 | public @interface ApiRateLimiter {
14 | String value() default "";
15 |
16 | /**
17 | * 每秒令牌数
18 | * @return
19 | */
20 | long token() default Long.MAX_VALUE;
21 |
22 | /**
23 | * 获取令牌的等待时间
24 | * @return
25 | */
26 | int timeout() default 1;
27 |
28 | /**
29 | * 超时时间单位
30 | * @return
31 | */
32 | TimeUnit timeunit() default TimeUnit.SECONDS;
33 | }
34 |
35 |
--------------------------------------------------------------------------------
/springboot-learn-kafka/src/main/java/com/plf/learn/kafka/consumer/KafkaConsumer.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.kafka.consumer;
2 |
3 | import lombok.extern.slf4j.Slf4j;
4 | import org.apache.kafka.clients.consumer.ConsumerRecord;
5 | import org.springframework.kafka.annotation.KafkaListener;
6 | import org.springframework.stereotype.Component;
7 |
8 | /**
9 | * @author Panlf
10 | * @date 2019/12/26
11 | */
12 | @Component
13 | @Slf4j
14 | public class KafkaConsumer {
15 |
16 | @KafkaListener(topics = "kafka-test")
17 | public void receive(ConsumerRecord, ?> consumer){
18 | log.info("topic name:{},key:{},partition:{},offset:{},message:{}",
19 | consumer.topic(),consumer.key(),
20 | consumer.partition(),consumer.offset(),consumer.value());
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/springboot-learn-shiro/src/main/java/com/plf/learn/shiro/config/GlobalDefaultExceptionHandler.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.shiro.config;
2 |
3 | import javax.servlet.http.HttpServletRequest;
4 |
5 | import org.apache.shiro.authz.UnauthorizedException;
6 | import org.springframework.web.bind.annotation.ControllerAdvice;
7 | import org.springframework.web.bind.annotation.ExceptionHandler;
8 | /**
9 | * @author Panlf
10 | * @date 2019/6/5
11 | */
12 | @ControllerAdvice
13 | public class GlobalDefaultExceptionHandler {
14 |
15 | @ExceptionHandler(Exception.class)
16 | public String defaultExceptionHandler(HttpServletRequest req,Exception e){
17 | if(e instanceof UnauthorizedException){
18 | return "noperssion";
19 | }
20 | return "defaultException";
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/springboot-learn-shiro/src/main/java/com/plf/learn/shiro/bean/User.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.shiro.bean;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.*;
6 | import java.io.Serializable;
7 |
8 | /**
9 | * @author Panlf
10 | * @date 2019/6/5
11 | */
12 | @Data
13 | @Entity
14 | public class User implements Serializable {
15 |
16 | private static final long serialVersionUID = -9043123869071313256L;
17 |
18 | @Id
19 | @GeneratedValue(strategy = GenerationType.IDENTITY)
20 | private Integer id;
21 |
22 | @Column
23 | private String username;
24 |
25 | @Column
26 | private String password;
27 |
28 | @Column
29 | private String salt;
30 |
31 | @Column
32 | private String permissions;
33 |
34 | @Column
35 | private String roles;
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/springboot-learn-log/src/main/java/com/plf/learn/log/controller/LogController.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.log.controller;
2 |
3 | import com.plf.learn.log.annotation.Loggable;
4 | import org.springframework.web.bind.annotation.PathVariable;
5 | import org.springframework.web.bind.annotation.RequestMapping;
6 | import org.springframework.web.bind.annotation.RestController;
7 |
8 | /**
9 | * @author Panlf
10 | * @date 2020/3/18
11 | */
12 | @RestController
13 | public class LogController {
14 |
15 | @Loggable(value = "日志查询操作")
16 | @RequestMapping("/get")
17 | public String getLog(){
18 | return "success";
19 | }
20 |
21 | @Loggable(value = "带参数日志查询操作")
22 | @RequestMapping("/get/{name}")
23 | public String getLogWithValue(@PathVariable String name){
24 | return name;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/springboot-learn-log/src/main/java/com/plf/learn/log/annotation/Loggable.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.log.annotation;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | /**
9 | * 注解作用于方法级别且运行时起作用
10 | * @author Panlf
11 | * @date 2020/3/18
12 | */
13 | @Target({ElementType.METHOD})
14 | @Retention(RetentionPolicy.RUNTIME)
15 | public @interface Loggable {
16 |
17 | /**
18 | * 日志信息描述
19 | * @return
20 | */
21 | String value() default "";
22 |
23 |
24 | /**
25 | * 是否保存到数据库
26 | * @return
27 | */
28 | boolean save() default true;
29 |
30 | /**
31 | * 是否输出到控制台
32 | * @return
33 | */
34 | boolean console() default true;
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/springboot-learn-redis/src/main/java/com/plf/learn/redis/configuration/GlobalExceptionHandler.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.redis.configuration;
2 |
3 | import lombok.extern.slf4j.Slf4j;
4 | import org.springframework.web.bind.annotation.ControllerAdvice;
5 | import org.springframework.web.bind.annotation.ExceptionHandler;
6 | import org.springframework.web.bind.annotation.ResponseBody;
7 | import org.springframework.web.bind.annotation.RestController;
8 |
9 | /**
10 | * 全局异常类
11 | * @author Panlf
12 | * @date 2019/12/26
13 | */
14 | @ControllerAdvice
15 | @Slf4j
16 | public class GlobalExceptionHandler {
17 |
18 | @ResponseBody
19 | @ExceptionHandler(value =Exception.class)
20 | public String exceptionHandler(Exception e){
21 | log.error("捕获异常为{}",e.getMessage());
22 | return e.getMessage();
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/springboot-learn-mybatis-plus/src/main/java/com/plf/learn/mybatisplus/service/impl/UserServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.mybatisplus.service.impl;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.stereotype.Service;
6 |
7 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
8 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
9 | import com.plf.learn.mybatisplus.entity.User;
10 | import com.plf.learn.mybatisplus.mapper.UserMapper;
11 | import com.plf.learn.mybatisplus.service.UserService;
12 |
13 | @Service
14 | public class UserServiceImpl extends ServiceImpl implements UserService {
15 |
16 | @Override
17 | public List listUser(String username) {
18 | return baseMapper.selectList(new QueryWrapper().like("username", username));
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/springboot-learn-jwt/src/main/java/com/plf/learn/jwt/common/ResponseData.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.jwt.common;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Data;
5 | import lombok.NoArgsConstructor;
6 |
7 | /**
8 | * @author Panlf
9 | * @date 2019/5/14
10 | */
11 | @Data
12 | @AllArgsConstructor
13 | @NoArgsConstructor
14 | public class ResponseData {
15 | /**
16 | * 返回码
17 | */
18 | private Integer code;
19 |
20 | /**
21 | * 业务数据
22 | */
23 | private Object data;
24 |
25 | /**
26 | * 返回描述
27 | */
28 | private String msg;
29 |
30 | /**
31 | * 身份标识
32 | */
33 | private String token;
34 |
35 | public static ResponseData result(Integer code,Object data,String msg,String token){
36 | return new ResponseData(code,data,msg,token);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/springboot-learn-sharding-jdbc/src/main/java/com/plf/learn/sharding/service/OrderService.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.sharding.service;
2 |
3 | import com.plf.learn.sharding.bean.Order;
4 | import com.plf.learn.sharding.mapper.OrderMapper;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.stereotype.Service;
7 | import org.springframework.transaction.annotation.Transactional;
8 |
9 | /**
10 | * @author Panlf
11 | * @date 2019/6/12
12 | */
13 | @Service
14 | public class OrderService {
15 |
16 | @Autowired
17 | private OrderMapper orderMapper;
18 |
19 | @Transactional(rollbackFor = Exception.class)
20 | public void save(Order order){
21 | orderMapper.insertOrder(order);
22 | }
23 |
24 | public Order findById(Long id){
25 | return orderMapper.findById(id);
26 | }
27 |
28 | }
--------------------------------------------------------------------------------
/springboot-learn-threadlocal/src/main/java/com/plf/learn/thread/interceptor/UserContextHolder.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.thread.interceptor;
2 |
3 | import com.plf.learn.thread.entity.User;
4 |
5 | /**
6 | * @author Panlf
7 | * @date 2020/3/20
8 | */
9 | public class UserContextHolder {
10 | private static final ThreadLocal USER_CONTEXT_HOLDER = new ThreadLocal<>();
11 |
12 | /**
13 | * 填入User
14 | * @param user
15 | */
16 | public static void setUser(User user){
17 | USER_CONTEXT_HOLDER.set(user);
18 | }
19 |
20 | /**
21 | * 擦除User
22 | */
23 | public static void remove(){
24 | USER_CONTEXT_HOLDER.remove();
25 | }
26 |
27 | /**
28 | * 获取User
29 | * @return
30 | */
31 | public static User getUser(){
32 | return USER_CONTEXT_HOLDER.get();
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/springboot-learn-custom-event/src/main/java/com/plf/learn/custom/event/controller/GlobalExceptionController.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.custom.event.controller;
2 |
3 | import java.util.HashMap;
4 | import java.util.Map;
5 |
6 | import org.springframework.web.bind.annotation.ControllerAdvice;
7 | import org.springframework.web.bind.annotation.ExceptionHandler;
8 | import org.springframework.web.bind.annotation.ResponseBody;
9 |
10 | /**
11 | * 全局捕获异常控制器
12 | * @author Panlf
13 | * @date 2019/4/19
14 | */
15 | public class GlobalExceptionController {
16 |
17 | @ExceptionHandler(RuntimeException.class)
18 | @ResponseBody
19 | public Map resultError(){
20 | Map result = new HashMap<>();
21 | result.put("errCode", "500");
22 | result.put("errMsg", "系统错误");
23 | return result;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/springboot-learn-staticftl/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8015
3 | servlet:
4 | context-path: /staticftl
5 |
6 | # freemarker静态资源配置
7 | # 文件路径
8 | spring:
9 | freemarker:
10 | tempalte-loader-path: classpath:/templates
11 | # 关闭缓存,及时刷新
12 | cache: false
13 | charset: UTF-8
14 | content-type: text/html
15 | suffix: .html
16 | mvc:
17 | static-path-pattern: /static/**
18 | data:
19 | mongodb:
20 | host: 127.0.0.1
21 | port: 27017
22 | database: staticftl
23 | activemq:
24 | broker-url: tcp://localhost:61616
25 | #true 表示使用内置的MQ,false则连接服务器
26 | in-memory: false
27 | #true表示使用连接池;false时,每发送一条数据创建一个连接
28 | pool:
29 | enabled: true
30 | #连接池最大连接数
31 | max-connections: 10
32 | idle-timeout: 30000
33 | user: admin
34 | password: admin
35 |
36 |
37 |
--------------------------------------------------------------------------------
/springboot-learn-elastic-job/src/main/java/com/plf/learn/elastic/service/FileCustomService.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.elastic.service;
2 |
3 | import com.plf.learn.elastic.bean.FileCustom;
4 | import com.plf.learn.elastic.mapper.FileCustomMapper;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.stereotype.Service;
7 |
8 | import java.util.List;
9 |
10 | /**
11 | * @author Panlf
12 | * @date 2019/12/2
13 | */
14 | @Service
15 | public class FileCustomService {
16 |
17 | @Autowired
18 | private FileCustomMapper fileCustomMapper;
19 |
20 | public List findFileCustomList(String type,int limitnum){
21 | return fileCustomMapper.findFileCustomByTypeLimit(type,limitnum);
22 | }
23 |
24 | public void updateFileCustom(String id){
25 | fileCustomMapper.updateBackUp(id);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/springboot-learn-dataway/src/main/java/com/plf/learn/dataway/hasor/module/HasorModule.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.dataway.hasor.module;
2 |
3 | import net.hasor.core.ApiBinder;
4 | import net.hasor.core.DimModule;
5 | import net.hasor.db.JdbcModule;
6 | import net.hasor.db.Level;
7 | import net.hasor.spring.SpringModule;
8 | import org.springframework.beans.factory.annotation.Autowired;
9 | import org.springframework.stereotype.Component;
10 |
11 | import javax.sql.DataSource;
12 |
13 |
14 | @DimModule
15 | @Component
16 | public class HasorModule implements SpringModule {
17 | @Autowired
18 | private DataSource dataSource = null;
19 |
20 | @Override
21 | public void loadModule(ApiBinder apiBinder) throws Throwable {
22 | // DataSource form Spring boot into Hasor
23 | apiBinder.installModule(new JdbcModule(Level.Full, this.dataSource));
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/springboot-learn-mybatis-plus/src/main/java/com/plf/learn/mybatisplus/mapper/LogMapper.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.mybatisplus.mapper;
2 |
3 | import java.util.List;
4 |
5 | import org.apache.ibatis.annotations.Param;
6 | import org.apache.ibatis.annotations.Select;
7 | import org.springframework.stereotype.Repository;
8 |
9 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
10 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
11 | import com.plf.learn.mybatisplus.dto.LogDto;
12 | import com.plf.learn.mybatisplus.entity.Log;
13 |
14 | @Repository
15 | public interface LogMapper extends BaseMapper{
16 |
17 | @Select("select l.content,u.username,l.createtime from log l"
18 | + " left join user u on l.user_id=u.id"
19 | + " where u.username=#{username}")
20 | public List getLogAndName(Page page, @Param("username") String username);
21 | }
22 |
--------------------------------------------------------------------------------
/springboot-learn-mybatis-plus/src/main/java/com/plf/learn/mybatisplus/config/MybatisPlusConfig.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.mybatisplus.config;
2 |
3 | import org.mybatis.spring.annotation.MapperScan;
4 | import org.springframework.context.annotation.Bean;
5 | import org.springframework.context.annotation.Configuration;
6 |
7 | import com.baomidou.mybatisplus.core.injector.ISqlInjector;
8 | import com.baomidou.mybatisplus.extension.injector.LogicSqlInjector;
9 | import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
10 |
11 | @Configuration
12 | @MapperScan("com.plf.learn.mybatisplus.mapper*")
13 | public class MybatisPlusConfig {
14 | @Bean
15 | public PaginationInterceptor paginationInterceptor() {
16 | return new PaginationInterceptor();
17 | }
18 |
19 | @Bean
20 | public ISqlInjector sqlInjector(){
21 | return new LogicSqlInjector();
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/springboot-learn-druid-monitor/src/main/java/com/plf/learn/monitor/service/PersonService.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.monitor.service;
2 |
3 | import com.plf.learn.monitor.bean.Person;
4 | import com.plf.learn.monitor.mapper.PersonMapper;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.stereotype.Service;
7 |
8 | import com.github.pagehelper.PageHelper;
9 | import com.github.pagehelper.PageInfo;
10 |
11 | import java.util.List;
12 |
13 | /**
14 | * @author Panlf
15 | * @date 2019/7/11
16 | */
17 | @Service
18 | public class PersonService {
19 | @Autowired
20 | private PersonMapper personMapper;
21 |
22 | public PageInfo findPerson(Integer pageNum, Integer pageSize){
23 | PageHelper.startPage(pageNum, pageSize);
24 | List list = personMapper.findPerson();
25 | return PageInfo.of(list);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/springboot-learn-elastic-job/src/main/java/com/plf/learn/elastic/mapper/FileCustomMapper.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.elastic.mapper;
2 |
3 | import com.plf.learn.elastic.bean.FileCustom;
4 | import org.apache.ibatis.annotations.Mapper;
5 | import org.apache.ibatis.annotations.Param;
6 | import org.apache.ibatis.annotations.Select;
7 | import org.apache.ibatis.annotations.Update;
8 |
9 | import java.util.List;
10 |
11 | /**
12 | * @author Panlf
13 | * @date 2019/12/2
14 | */
15 | @Mapper
16 | public interface FileCustomMapper {
17 |
18 | @Select("select id,name,type,path,backup from filecustom where type=#{type} and backup=0 limit #{limitnum}")
19 | public List findFileCustomByTypeLimit(@Param("type") String type,@Param("limitnum") int limitnum);
20 |
21 | @Update("update filecustom set backup=1 where id=#{id}")
22 | public void updateBackUp(@Param("id") String id);
23 |
24 | }
--------------------------------------------------------------------------------
/springboot-learn-neo4j/src/main/java/com/plf/learn/neo4j/controllrt/Neo4jController.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.neo4j.controllrt;
2 |
3 | import com.plf.learn.neo4j.dao.MinFamilyRepository;
4 | import com.plf.learn.neo4j.entity.MinFamily;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.web.bind.annotation.GetMapping;
7 | import org.springframework.web.bind.annotation.RestController;
8 |
9 | import javax.annotation.Resource;
10 |
11 | /**
12 | * @author panlf
13 | * @date 2021/12/25
14 | */
15 | @RestController
16 | public class Neo4jController {
17 | @Resource
18 | private MinFamilyRepository minFamilyRepository;
19 |
20 | @GetMapping("create")
21 | public String testCreate(String name){
22 | MinFamily minFamily = new MinFamily(name);
23 | minFamilyRepository.save(minFamily);
24 | return "success";
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/springboot-learn-shiro/src/main/java/com/plf/learn/shiro/utils/EncryptionPassword.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.shiro.utils;
2 |
3 | import org.apache.shiro.crypto.hash.SimpleHash;
4 |
5 | /**
6 | * @author Panlf
7 | * @date 2019/6/5
8 | */
9 | public class EncryptionPassword {
10 |
11 | public static void main(String[] args) {
12 | /**
13 | * 加密密码
14 | */
15 | String password = "qwer";
16 |
17 | /**
18 | * 加密算法
19 | */
20 | String algorithmName = "MD5";
21 |
22 | /**
23 | * 盐值
24 | */
25 | Object salt = "1a2b3c";
26 | /**
27 | * 加密次数
28 | */
29 | int hashIterations = 1024;
30 |
31 | SimpleHash simpleHash = new SimpleHash(algorithmName,password,salt,hashIterations);
32 | /**
33 | * 加密后密码
34 | */
35 | System.out.println(simpleHash);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/springboot-learn-elasticsearch/src/main/java/com/plf/learn/elasticsearch/bean/Book.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.elasticsearch.bean;
2 |
3 | import lombok.Data;
4 | import org.springframework.data.annotation.Id;
5 | import org.springframework.data.elasticsearch.annotations.Document;
6 | import org.springframework.data.elasticsearch.annotations.Field;
7 | import org.springframework.data.elasticsearch.annotations.FieldType;
8 |
9 | /**
10 | * 单机测试,所以设置es的分片数量为1(默认5),设置副本数量为1(默认1)
11 | * @author Panlf
12 | * @date 2019/12/27
13 | */
14 | @Data
15 | @Document(indexName = "culture",type = "book",shards = 1,replicas = 0)
16 | public class Book {
17 | @Id
18 | private Long id;
19 |
20 | @Field(type = FieldType.Text, analyzer = "standard")
21 | private String name;
22 |
23 | @Field(type = FieldType.Keyword)
24 | private String description;
25 |
26 | @Field(type = FieldType.Double)
27 | private Double price;
28 | }
29 |
--------------------------------------------------------------------------------
/springboot-learn-staticftl/src/main/java/com/plf/learn/staticftl/controller/BlogController.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.staticftl.controller;
2 |
3 | import com.plf.learn.staticftl.bean.Blog;
4 | import com.plf.learn.staticftl.service.BlogService;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.web.bind.annotation.GetMapping;
7 | import org.springframework.web.bind.annotation.RequestMapping;
8 | import org.springframework.web.bind.annotation.RestController;
9 |
10 | /**
11 | * @author Panlf
12 | * @date 2019/11/15
13 | */
14 | @RequestMapping("/blog")
15 | @RestController
16 | public class BlogController {
17 |
18 | @Autowired
19 | private BlogService blogService;
20 |
21 |
22 | @GetMapping("save")
23 | public String saveBlog(Blog blog){
24 | blog.setId(System.currentTimeMillis()+"");
25 | blogService.save(blog);
26 | return "success";
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/springboot-learn-elasticsearch/src/main/java/com/plf/learn/elasticsearch/service/IndexService.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.elasticsearch.service;
2 |
3 | import org.springframework.beans.factory.annotation.Autowired;
4 | import org.springframework.data.elasticsearch.core.ElasticsearchTemplate;
5 | import org.springframework.stereotype.Service;
6 |
7 | /**
8 | * @author Panlf
9 | * @date 2019/12/27
10 | */
11 | @Service
12 | public class IndexService {
13 |
14 | @Autowired
15 | private ElasticsearchTemplate elasticsearchTemplate;
16 |
17 |
18 | public void createIndex(Class> indexClass){
19 | // 创建索引,会根据对应类的@Document注解信息来创建
20 | elasticsearchTemplate.createIndex(indexClass);
21 | // 配置映射,会根据对应类中的id、Field等字段来自动完成映射
22 | elasticsearchTemplate.putMapping(indexClass);
23 | }
24 |
25 | public void deleteIndex(Class> indexClass){
26 | elasticsearchTemplate.deleteIndex(indexClass);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/springboot-learn-sharding-jdbc/src/main/java/com/plf/learn/sharding/SpringBootShardingApplication.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.sharding;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
5 | import org.springframework.boot.autoconfigure.SpringBootApplication;
6 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
7 | import org.springframework.transaction.annotation.EnableTransactionManagement;
8 |
9 | /**
10 | * @author Panlf
11 | * @date 2019/6/12
12 | */
13 | @SpringBootApplication
14 | @EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class}) //排除DataSourceConfiguratrion
15 | @EnableTransactionManagement(proxyTargetClass = true) //开启事物管理功能
16 | public class SpringBootShardingApplication {
17 | public static void main(String[] args) {
18 | SpringApplication.run(SpringBootShardingApplication.class,args);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/springboot-learn-aop-multidata/src/main/java/com/plf/learn/aop/multidata/service/CountTablesService.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.aop.multidata.service;
2 |
3 | import com.plf.learn.aop.multidata.annotation.TargetDataSource;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.jdbc.core.JdbcTemplate;
6 | import org.springframework.stereotype.Service;
7 |
8 | /**
9 | * 测试库
10 | * @author Panlf
11 | * @date 2019/8/7
12 | */
13 | @Service
14 | public class CountTablesService {
15 |
16 | @Autowired
17 | private JdbcTemplate jdbcTemplate;
18 |
19 | @TargetDataSource("house_user")
20 | public Integer countUser(){
21 | return jdbcTemplate.queryForObject("select count(*) from user",Integer.class);
22 | }
23 |
24 | @TargetDataSource("house_comment")
25 | public Integer countComment(){
26 | return jdbcTemplate.queryForObject("select count(*) from comment",Integer.class);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/springboot-learn-mybatis-plus/src/main/java/com/plf/learn/mybatisplus/config/MyMetaObjectHandler.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.mybatisplus.config;
2 |
3 | import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
4 | import lombok.extern.slf4j.Slf4j;
5 | import org.apache.ibatis.reflection.MetaObject;
6 | import org.springframework.stereotype.Component;
7 |
8 | import java.sql.Timestamp;
9 |
10 | @Slf4j
11 | @Component
12 | public class MyMetaObjectHandler implements MetaObjectHandler {
13 | @Override
14 | public void insertFill(MetaObject metaObject) {
15 | log.info("start insert fill ....");
16 | setFieldValByName("createtime", new Timestamp(System.currentTimeMillis()), metaObject);
17 | }
18 |
19 | @Override
20 | public void updateFill(MetaObject metaObject) {
21 | log.info("start update fill ....");
22 | setFieldValByName("updatetime", new Timestamp(System.currentTimeMillis()), metaObject);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/springboot-learn-elastic-job/src/main/resources/readme.txt:
--------------------------------------------------------------------------------
1 | Elastic-job
2 |
3 | 任务调度是指系统为了自动完成特定任务,在约定的特定时刻去执行任务的过程。
4 |
5 | 1)、Elastic-job 当当网基于quartz二次开发的弹性分布式任务调度系统,采用Zookeeper实现分布式协调,实现任务高可用以及分片
6 | 2)、Saturn 唯品会开源的一个分布式调度平台,可以全域统一配置,统一监控,实现任务高可用以及分片并发处理。
7 | 3)、xxl-job大众点评的分布式任务调度平台,是一个轻量级分布式任务调度平台。
8 | 4)、TBSchedule 淘宝非常优秀高性能分布式调度框架
9 |
10 | 分布式系统具体特点
11 | 1、分布性 每个部分都可以独立部署,服务之间交互通过网络进行通信
12 | 2、伸缩性 每个部分都可以集群方式部署
13 | 3、高可用 每个部分都可以集群部分,保证高可用
14 |
15 | 分布式调度实现的目标
16 | 1、并行任务调度
17 | 并行任务调度实现靠多线程。
18 | 将任务调度程序分布式部署,每个节点还可以部署为集群。
19 | 将任务分割成若干个分片,由不同的实例并行执行
20 |
21 | 2、高可用
22 | 若某一个实例宕机,不影响其他实例来执行任务。
23 |
24 | 3、弹性扩容
25 | 当集群中增加实例就可以提高并执行任务的处理效率。
26 |
27 | 4、任务管理与检测
28 | 对系统中存在的所有定时任务统一的管理及监测。
29 |
30 | 5、避免任务重复执行
31 | 分布式锁
32 |
33 |
34 | Zookeeper的两个作用
35 | Elastic-job依赖Zookeeper完成对执行任务信息的存储(如任务名称、任务参与实例、任务执行策略等)
36 | Elastic-job依赖Zookeeper实现选举机制,在任务执行实例数量变化时(如在快速上手中的启动新实例或停止实例)
37 | 会触发选举机制来决定让哪个实例去执行该任务。
38 |
39 |
40 | 分片概念
41 | 作业分片是指任务的分布式执行,需要将一个任务拆分为多个独立的任务项,然后由分布式的应用实例分别执行某一个或几个分片项。
42 |
43 |
--------------------------------------------------------------------------------
/springboot-learn-dataway/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8066
3 | servlet:
4 | context-path: /dataway
5 |
6 | spring:
7 | datasource:
8 | url: jdbc:mysql://localhost:3306/springboot?useUnicode=true&characterEncoding=UTF-8&useSSL=true&serverTimezone=GMT%2B8
9 | username: root
10 | password: root
11 | driver-class-name: com.mysql.cj.jdbc.Driver
12 | druid:
13 | initial-size: 3
14 | min-idle: 3
15 | max-active: 10
16 | max-wait: 60000
17 | filter:
18 | stat:
19 | log-slow-sql: true
20 | slow-sql-millis: 1
21 |
22 | # 是否启用 Dataway 功能(必选:默认false)
23 | HASOR_DATAQL_DATAWAY: true
24 |
25 | # 是否开启 Dataway 后台管理界面(必选:默认false)
26 | HASOR_DATAQL_DATAWAY_ADMIN: true
27 |
28 | # dataway API工作路径(可选,默认:/api/)
29 | HASOR_DATAQL_DATAWAY_API_URL: /api/
30 |
31 | # dataway-ui 的工作路径(可选,默认:/interface-ui/)
32 | HASOR_DATAQL_DATAWAY_UI_URL: /interface-ui/
33 |
34 | # SQL执行器方言设置(可选,建议设置)
35 | HASOR_DATAQL_FX_PAGE_DIALECT: mysql
36 |
37 |
--------------------------------------------------------------------------------
/springboot-learn-jwt/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8003
3 | servlet:
4 | context-path: /jwt
5 |
6 | spring:
7 | datasource:
8 | url: jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8&useSSL=true&serverTimezone=GMT%2B8
9 | username: root
10 | password: root
11 | driver-class-name: com.mysql.cj.jdbc.Driver
12 | jpa:
13 | database: MYSQL
14 | show-sql: true
15 | hibernate:
16 | ddl-auto: update
17 | naming:
18 | physical-strategy: org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy
19 | database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
20 | redis:
21 | #数据库索引
22 | database: 0
23 | host: 127.0.0.1
24 | port: 6379
25 | jedis:
26 | pool:
27 | #最大连接数
28 | max-active: 8
29 | #最大阻塞等待时间(负数表示没限制)
30 | max-wait: -1
31 | #最大空闲
32 | max-idle: 8
33 | #最小空闲
34 | min-idle: 0
35 | #连接超时时间
36 | timeout: 10000
--------------------------------------------------------------------------------
/springboot-learn-custom-event/src/main/java/com/plf/learn/custom/event/controller/MailEventController.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.custom.event.controller;
2 |
3 | import com.plf.learn.custom.event.emailevents.EmailEventPublish;
4 | import lombok.extern.slf4j.Slf4j;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.web.bind.annotation.RequestMapping;
7 | import org.springframework.web.bind.annotation.RequestParam;
8 | import org.springframework.web.bind.annotation.RestController;
9 |
10 | /**
11 | * @author Panlf
12 | * @date 2019/4/19
13 | */
14 | @RestController
15 | @Slf4j
16 | public class MailEventController {
17 |
18 | @Autowired
19 | private EmailEventPublish emailEventPublish;
20 |
21 | @RequestMapping("/event")
22 | public void publishEvent(@RequestParam String emailAddress) {
23 | // 发布事件 -- 采用异步处理
24 | emailEventPublish.publishEvent(emailAddress);
25 |
26 | // 正常该语句先执行
27 | log.info("Controller业务处理");
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/springboot-learn-aop-multidata/src/main/java/com/plf/learn/aop/multidata/controller/CountTablesController.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.aop.multidata.controller;
2 |
3 | import com.plf.learn.aop.multidata.service.CountTablesService;
4 | import lombok.extern.slf4j.Slf4j;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.web.bind.annotation.GetMapping;
7 | import org.springframework.web.bind.annotation.RestController;
8 |
9 | /**
10 | * @author Panlf
11 | * @date 2019/8/7
12 | */
13 | @RestController
14 | @Slf4j
15 | public class CountTablesController {
16 |
17 | @Autowired
18 | private CountTablesService countTablesService;
19 |
20 | @GetMapping("count")
21 | public String getCount(){
22 | Integer userCount = countTablesService.countUser();
23 | Integer commentCount = countTablesService.countComment();
24 | log.info("house_user中的用户表总量为{}",userCount);
25 | log.info("house_comment中的评价表总量为{}",commentCount);
26 | return "success";
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/springboot-learn-document/src/main/java/com/plf/learn/document/service/AnalysisFileService.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.document.service;
2 |
3 | import java.util.concurrent.TimeUnit;
4 |
5 | import com.plf.learn.document.container.DocumentContext;
6 | import com.plf.learn.document.utils.interfaces.OperateDocument;
7 | import lombok.extern.slf4j.Slf4j;
8 | import org.springframework.beans.factory.annotation.Autowired;
9 | import org.springframework.context.annotation.Bean;
10 | import org.springframework.scheduling.annotation.Async;
11 | import org.springframework.stereotype.Service;
12 |
13 | import javax.annotation.Resource;
14 |
15 | /**
16 | * 解析文档,将文档数据保存到数据库
17 | * @author Panlf
18 | * @date 2020/2/13
19 | */
20 | @Slf4j
21 | @Service
22 | public class AnalysisFileService {
23 |
24 | @Async
25 | public void insertdb() {
26 | try {
27 | TimeUnit.SECONDS.sleep(5);
28 | } catch (InterruptedException e) {
29 | e.printStackTrace();
30 | }
31 | for(int i=0;i<10;i++) {
32 | log.info("正在处理+++{}",i);
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/springboot-learn-jpa/src/main/java/com/plf/learn/jpa/repository/StudentRepository.java:
--------------------------------------------------------------------------------
1 | package com.plf.learn.jpa.repository;
2 |
3 | import java.util.List;
4 | import java.util.Map;
5 |
6 | import com.plf.learn.jpa.bean.Student;
7 | import com.plf.learn.jpa.dto.StudentDto;
8 | import org.springframework.data.jpa.repository.JpaRepository;
9 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
10 | import org.springframework.data.jpa.repository.Query;
11 |
12 |
13 | public interface StudentRepository extends JpaRepository,JpaSpecificationExecutor{
14 | @Query(value="select new com.plf.learn.jpa.dto.StudentDto(st.id,st.name,st.age,st.schoolId,sc.schoolName) from Student st left join School sc on sc.id=st.schoolId")
15 | public List findStudentDto();
16 |
17 |
18 | @Query(value="select st.id,st.name,st.age,st.school_id,sc.school_name from student st left join school sc on sc.id=st.school_id",nativeQuery=true)
19 | public List