├── .gitignore
├── README.md
├── pom.xml
├── springboot-cache-redis
├── .gitignore
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── cn
│ │ │ └── happyjava
│ │ │ └── hello
│ │ │ └── springboot
│ │ │ └── springbootcacheredis
│ │ │ ├── MockService.java
│ │ │ ├── SpringbootCacheRedisApplication.java
│ │ │ ├── TestController.java
│ │ │ └── config
│ │ │ └── RedisCacheConfig.java
│ └── resources
│ │ └── application.properties
│ └── test
│ └── java
│ └── cn
│ └── happyjava
│ └── hello
│ └── springboot
│ └── springbootcacheredis
│ └── SpringbootCacheRedisApplicationTests.java
├── springboot-docker
├── .gitignore
├── pom.xml
└── src
│ ├── main
│ ├── docker
│ │ └── Dockerfile
│ ├── java
│ │ └── cn
│ │ │ └── happyjava
│ │ │ └── springbootdocker
│ │ │ └── SpringbootDockerApplication.java
│ └── resources
│ │ └── application.properties
│ └── test
│ └── java
│ └── cn
│ └── happyjava
│ └── springbootdocker
│ └── SpringbootDockerApplicationTests.java
├── springboot-initialise
├── .gitignore
├── pom.xml
├── src
│ ├── main
│ │ ├── java
│ │ │ └── cn
│ │ │ │ └── happyjava
│ │ │ │ └── springbootinitialise
│ │ │ │ └── SpringbootInitialiseApplication.java
│ │ └── resources
│ │ │ └── application.properties
│ └── test
│ │ └── java
│ │ └── cn
│ │ └── happyjava
│ │ └── springbootinitialise
│ │ └── SpringbootInitialiseApplicationTests.java
└── 【快学springboot】1.快速创建springboot项目.md
├── springboot-security
├── .gitignore
├── pom.xml
├── src
│ ├── main
│ │ ├── java
│ │ │ └── cn
│ │ │ │ └── happyjava
│ │ │ │ └── springbootsecurity
│ │ │ │ ├── SpringbootSecurityApplication.java
│ │ │ │ ├── TestController.java
│ │ │ │ └── config
│ │ │ │ ├── AdminUser.java
│ │ │ │ ├── AdminUserEntity.java
│ │ │ │ ├── AuthFilter.java
│ │ │ │ ├── SecurityConfig.java
│ │ │ │ └── UserDetailsServiceImpl.java
│ │ └── resources
│ │ │ └── application.properties
│ └── test
│ │ └── java
│ │ └── cn
│ │ └── happyjava
│ │ └── springbootsecurity
│ │ └── SpringbootSecurityApplicationTests.java
└── 「快学springboot」集成Spring Security实现鉴权功能.md
├── springboot-slimming
├── core
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── java
│ │ └── cn
│ │ └── happyjava
│ │ └── core
│ │ ├── package-info.java
│ │ └── utils
│ │ └── TestUtils.java
├── pom.xml
└── server
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ ├── main
│ ├── java
│ │ └── cn
│ │ │ └── happyjava
│ │ │ └── server
│ │ │ ├── ServerApplication.java
│ │ │ └── controller
│ │ │ └── TestController.java
│ └── resources
│ │ └── application.properties
│ └── test
│ └── java
│ └── cn
│ └── happyjava
│ └── server
│ └── ServerApplicationTests.java
├── springboot-springcache
├── .gitignore
├── 14【快学SpringBoot】快速上手好用方便的Spring Cache缓存框架.md
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── cn
│ │ │ └── happyjava
│ │ │ └── springbootspringcache
│ │ │ ├── MockService.java
│ │ │ ├── SpringbootSpringcacheApplication.java
│ │ │ ├── TestController.java
│ │ │ └── config
│ │ │ └── CacheConfig.java
│ └── resources
│ │ └── application.properties
│ └── test
│ └── java
│ └── cn
│ └── happyjava
│ └── springbootspringcache
│ └── SpringbootSpringcacheApplicationTests.java
├── springboot-springsecurity-jwt-mybatis-plus
├── .gitignore
├── SpringBoot+JWT+SpringSecurity+MybatisPlus实现Restful鉴权脚手架.md
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── cn
│ │ │ └── happyjava
│ │ │ └── springbootspringsecurityjwtmybatisplus
│ │ │ ├── SpringbootSpringsecurityJwtMybatisPlusApplication.java
│ │ │ ├── controller
│ │ │ ├── AdminController.java
│ │ │ └── AuthController.java
│ │ │ ├── entity
│ │ │ └── AdminEntity.java
│ │ │ ├── exception
│ │ │ └── ExceptionHandlerAdvice.java
│ │ │ ├── mapper
│ │ │ └── AdminMapper.java
│ │ │ ├── security
│ │ │ ├── AdminUser.java
│ │ │ ├── AuthenticationEntryPoint.java
│ │ │ ├── AuthenticationFilter.java
│ │ │ ├── JwtHelp.java
│ │ │ ├── SecurityConfig.java
│ │ │ └── UserDetailsServiceImpl.java
│ │ │ ├── service
│ │ │ ├── AdminService.java
│ │ │ └── impl
│ │ │ │ └── AdminServiceImpl.java
│ │ │ └── utils
│ │ │ └── CookiesUtils.java
│ └── resources
│ │ ├── application.properties
│ │ └── mappers
│ │ └── adminMapper.xml
│ └── test
│ └── java
│ └── cn
│ └── happyjava
│ └── springbootspringsecurityjwtmybatisplus
│ └── SpringbootSpringsecurityJwtMybatisPlusApplicationTests.java
└── transaction-propagation
├── .gitignore
├── Spring中的事务传播行为.md
├── pom.xml
└── src
├── main
├── java
│ └── cn
│ │ └── happyjava
│ │ └── transactionpropagation
│ │ ├── TransactionPropagationApplication.java
│ │ ├── entity
│ │ └── UserEntity.java
│ │ ├── repo
│ │ └── UserRepo.java
│ │ └── service
│ │ ├── UserService.java
│ │ └── UserService2.java
└── resources
│ └── application.properties
└── test
└── java
└── cn
└── happyjava
└── transactionpropagation
└── TransactionPropagationApplicationTests.java
/.gitignore:
--------------------------------------------------------------------------------
1 | # Created by .ignore support plugin (hsz.mobi)
2 | ### JetBrains template
3 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
4 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
5 |
6 | # User-specific stuff
7 | .idea/**/tasks.xml
8 | .idea/**/dictionaries
9 | .idea/**/shelf
10 |
11 | # Sensitive or high-churn files
12 | .idea/**/dataSources/
13 | .idea/**/dataSources.ids
14 | .idea/**/dataSources.local.xml
15 | .idea/**/sqlDataSources.xml
16 | .idea/**/dynamic.xml
17 | .idea/**/uiDesigner.xml
18 | .idea/**/dbnavigator.xml
19 |
20 | # Gradle
21 | .idea/**/gradle.xml
22 | .idea/**/libraries
23 |
24 | # CMake
25 | cmake-build-debug/
26 | cmake-build-release/
27 |
28 | # Mongo Explorer plugin
29 | .idea/**/mongoSettings.xml
30 |
31 | # File-based project format
32 | *.iws
33 |
34 | # IntelliJ
35 | out/
36 |
37 | # maven
38 | .mvn/
39 | mvnw
40 | mvnw.cmd
41 |
42 | .idea/
43 | housingfund.iml
44 | core/target/*
45 | client/target/*
46 | host/target/*
47 | target/
48 | **/target/*
49 | *.dl
50 | *.iml
51 | *.pri
52 | *.pub
53 | *.exe
54 | *.ca
55 | *.priv
56 | certgen
57 | certFile.json
58 | hyperAccount.json
59 | key.json
60 | orgData.json
61 | account.conf
62 | *.prop
63 | *.csr
64 | *.originKey
65 | *.pem
66 | *.cnf
67 | *.cert
68 | !**/server.key
69 | !**/server.cert
70 | !**/client.pem
71 | !**/client.cert
72 | /data
73 | /logs/
74 | **/logs/**
75 | *-dev.properties
76 |
77 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # hello-springboot
2 | about learning Spring Boot via examples. Spring Boot 教程、SpringBoot代码示例
3 |
4 |
5 |
6 | Spring Boot教程大全,Spring Boot知识点样例代码。
7 |
8 |
9 |
10 | 我会不断补全SpringBoot的相关知识,希望对大家有所帮助~~~
11 |
12 |
13 |
14 | 每一个项目的 README.md 都有讲解文章~
15 |
16 |
17 |
18 | 本人博客地址:http://blog.happyjava.cn
19 |
20 | 本人掘金地址:https://juejin.im/user/5cc2895df265da03a630ddca
21 |
22 | 本人公众号:happyjavashare
23 |
24 | 本人头条号:Happyjava
25 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 | pom
6 |
7 | org.springframework.boot
8 | spring-boot-starter-parent
9 | 2.1.6.RELEASE
10 |
11 |
12 | cn.happyjava
13 | hello-springboot
14 | 0.0.1-SNAPSHOT
15 | hello-springboot
16 | example for spring boot
17 |
18 |
19 | springboot-initialise
20 | springboot-security
21 | springboot-springsecurity-jwt-mybatis-plus
22 | transaction-propagation
23 | springboot-docker
24 | springboot-springcache
25 | springboot-cache-redis
26 | springboot-slimming
27 |
28 |
29 |
30 | 11
31 | true
32 |
33 |
34 |
35 |
36 | org.springframework.boot
37 | spring-boot-starter
38 |
39 |
40 |
41 | org.springframework.boot
42 | spring-boot-starter-test
43 | test
44 |
45 |
46 |
47 |
48 |
49 |
50 | org.springframework.boot
51 | spring-boot-maven-plugin
52 |
53 |
54 |
55 |
56 |
57 |
58 | aliyun
59 | https://maven.aliyun.com/repository/public
60 |
61 | true
62 |
63 |
64 | false
65 |
66 |
67 |
68 |
69 |
70 | aliyun-plugin
71 | https://maven.aliyun.com/repository/public
72 |
73 | true
74 |
75 |
76 | false
77 |
78 |
79 |
80 |
81 |
82 |
--------------------------------------------------------------------------------
/springboot-cache-redis/.gitignore:
--------------------------------------------------------------------------------
1 | HELP.md
2 | target/
3 | !.mvn/wrapper/maven-wrapper.jar
4 | !**/src/main/**
5 | !**/src/test/**
6 |
7 | ### STS ###
8 | .apt_generated
9 | .classpath
10 | .factorypath
11 | .project
12 | .settings
13 | .springBeans
14 | .sts4-cache
15 |
16 | ### IntelliJ IDEA ###
17 | .idea
18 | *.iws
19 | *.iml
20 | *.ipr
21 |
22 | ### NetBeans ###
23 | /nbproject/private/
24 | /nbbuild/
25 | /dist/
26 | /nbdist/
27 | /.nb-gradle/
28 | build/
29 |
30 | ### VS Code ###
31 | .vscode/
32 |
--------------------------------------------------------------------------------
/springboot-cache-redis/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | org.springframework.boot
7 | spring-boot-starter-parent
8 | 2.1.6.RELEASE
9 |
10 |
11 | cn.happyjava.hello.springboot
12 | springboot-cache-redis
13 | 0.0.1-SNAPSHOT
14 | springboot-cache-redis
15 | spring cache redis
16 |
17 |
18 | 11
19 |
20 |
21 |
22 |
23 | org.springframework.boot
24 | spring-boot-starter-web
25 |
26 |
27 |
28 | org.springframework.boot
29 | spring-boot-devtools
30 | runtime
31 | true
32 |
33 |
34 | org.springframework.boot
35 | spring-boot-configuration-processor
36 | true
37 |
38 |
39 | org.projectlombok
40 | lombok
41 | true
42 |
43 |
44 | org.springframework.boot
45 | spring-boot-starter-test
46 | test
47 |
48 |
49 | org.springframework.boot
50 | spring-boot-starter-cache
51 |
52 |
53 | org.springframework.boot
54 | spring-boot-starter-data-redis
55 |
56 |
57 |
58 |
59 |
60 |
61 | org.springframework.boot
62 | spring-boot-maven-plugin
63 |
64 |
65 |
66 |
67 |
68 |
69 | aliyun
70 | https://maven.aliyun.com/repository/public
71 |
72 | true
73 |
74 |
75 | false
76 |
77 |
78 |
79 |
80 |
81 | aliyun-plugin
82 | https://maven.aliyun.com/repository/public
83 |
84 | true
85 |
86 |
87 | false
88 |
89 |
90 |
91 |
92 |
93 |
--------------------------------------------------------------------------------
/springboot-cache-redis/src/main/java/cn/happyjava/hello/springboot/springbootcacheredis/MockService.java:
--------------------------------------------------------------------------------
1 | package cn.happyjava.hello.springboot.springbootcacheredis;
2 |
3 | import org.springframework.cache.annotation.Cacheable;
4 | import org.springframework.stereotype.Service;
5 |
6 | import java.util.Arrays;
7 | import java.util.List;
8 |
9 | @Service
10 | public class MockService {
11 |
12 | /**
13 | * value 缓存的名字,与cacheName是一个东西
14 | * key 需要缓存的键,如果为空,则会根据参数自动拼接
15 | * 写法:SpEL 表达式
16 | */
17 | @Cacheable(value = "listUsers", key = "#username")
18 | public List listUsers(String username) {
19 | System.out.println("执行了listUsers方法");
20 | return Arrays.asList("Happyjava", "Hello-SpringBoot", System.currentTimeMillis() + "");
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/springboot-cache-redis/src/main/java/cn/happyjava/hello/springboot/springbootcacheredis/SpringbootCacheRedisApplication.java:
--------------------------------------------------------------------------------
1 | package cn.happyjava.hello.springboot.springbootcacheredis;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class SpringbootCacheRedisApplication {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(SpringbootCacheRedisApplication.class, args);
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/springboot-cache-redis/src/main/java/cn/happyjava/hello/springboot/springbootcacheredis/TestController.java:
--------------------------------------------------------------------------------
1 | package cn.happyjava.hello.springboot.springbootcacheredis;
2 |
3 | import org.springframework.web.bind.annotation.GetMapping;
4 | import org.springframework.web.bind.annotation.RestController;
5 |
6 | @RestController
7 | public class TestController {
8 |
9 | private final MockService mockService;
10 |
11 | public TestController(MockService mockService) {
12 | this.mockService = mockService;
13 | }
14 |
15 | @GetMapping(value = "/listUsers")
16 | public Object listUsers(String username) {
17 | return mockService.listUsers(username);
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/springboot-cache-redis/src/main/java/cn/happyjava/hello/springboot/springbootcacheredis/config/RedisCacheConfig.java:
--------------------------------------------------------------------------------
1 | package cn.happyjava.hello.springboot.springbootcacheredis.config;
2 |
3 | import org.springframework.cache.CacheManager;
4 | import org.springframework.cache.annotation.EnableCaching;
5 | import org.springframework.context.annotation.Bean;
6 | import org.springframework.context.annotation.Configuration;
7 | import org.springframework.data.redis.cache.RedisCacheConfiguration;
8 | import org.springframework.data.redis.cache.RedisCacheManager;
9 | import org.springframework.data.redis.cache.RedisCacheWriter;
10 | import org.springframework.data.redis.connection.RedisConnectionFactory;
11 | import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
12 | import org.springframework.data.redis.serializer.RedisSerializationContext;
13 | import org.springframework.data.redis.serializer.RedisSerializer;
14 |
15 | import java.time.Duration;
16 |
17 | /**
18 | * RedisConfig
19 | *
20 | * @author detectiveHLH
21 | * @date 2018-10-11 14:39
22 | **/
23 | @Configuration
24 | @EnableCaching
25 | public class RedisCacheConfig {
26 |
27 | /**
28 | * 缓存管理器
29 | */
30 | @Bean
31 | public CacheManager cacheManager(RedisConnectionFactory redisConnectionFactory) {
32 | //初始化一个RedisCacheWriter
33 | RedisCacheWriter redisCacheWriter = RedisCacheWriter.nonLockingRedisCacheWriter(redisConnectionFactory);
34 | //设置CacheManager的值序列化方式为json序列化
35 | RedisSerializer