findByBookNameLike(String bookName);
17 | }
18 |
--------------------------------------------------------------------------------
/springboot-11-elastic/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | spring.data.elasticsearch.cluster-name=elasticsearch
2 | spring.data.elasticsearch.cluster-nodes=10.138.223.126:9301
--------------------------------------------------------------------------------
/springboot-11-elastic/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | elasticsearch:
3 | jest:
4 | uris: http://10.138.223.126:9200
5 |
6 |
--------------------------------------------------------------------------------
/springboot-11-elastic/src/test/java/com/cuzz/elastic/Springboot11ElasticApplicationTests.java:
--------------------------------------------------------------------------------
1 | package com.cuzz.elastic;
2 |
3 | import com.cuzz.elastic.bean.Article;
4 | import com.cuzz.elastic.bean.Book;
5 | import com.cuzz.elastic.repository.BookRepository;
6 | import io.searchbox.client.JestClient;
7 | import io.searchbox.core.Index;
8 | import io.searchbox.core.Search;
9 | import io.searchbox.core.SearchResult;
10 | import org.junit.Test;
11 | import org.junit.runner.RunWith;
12 | import org.springframework.beans.factory.annotation.Autowired;
13 | import org.springframework.boot.test.context.SpringBootTest;
14 | import org.springframework.test.context.junit4.SpringRunner;
15 |
16 | import java.io.IOException;
17 |
18 | @RunWith(SpringRunner.class)
19 | @SpringBootTest
20 | public class Springboot11ElasticApplicationTests {
21 |
22 | @Autowired
23 | JestClient jestClient;
24 |
25 | @Test
26 | public void contextLoads() {
27 | // 给Es中索引(保存)一个文档
28 | Article article = new Article();
29 | article.setId(1);
30 | article.setTitle("Effect Java");
31 | article.setAutor("Joshua Bloch");
32 | article.setContent("Hello World");
33 | // 构建一个索引功能
34 | Index index = new Index.Builder(article).index("cuzz").type("article").build();
35 |
36 | try {
37 | //执行
38 | jestClient.execute(index);
39 | } catch (IOException e) {
40 | e.printStackTrace();
41 | }
42 | }
43 |
44 | @Test
45 | public void search(){
46 | //查询表达式
47 | String json = "{\n" +
48 | " \"query\" : {\n" +
49 | " \"match\" : {\n" +
50 | " \"content\" : \"Hello\"\n" +
51 | " }\n" +
52 | " }\n" +
53 | "}";
54 | //构建搜索操作
55 | Search search = new Search.Builder(json).addIndex("cuzz").addType("article").build();
56 |
57 | //执行
58 | try {
59 | SearchResult result = jestClient.execute(search);
60 | System.out.println(result.getJsonString());
61 | } catch (IOException e) {
62 | e.printStackTrace();
63 | }
64 | }
65 |
66 | @Autowired
67 | BookRepository bookRepository;
68 |
69 | @Test
70 | public void testBook() {
71 | Book book = new Book();
72 | bookRepository.index(book);
73 | }
74 |
75 | @Test
76 | public void testSearch(){
77 | for (Book book : bookRepository.findByBookNameLike("Effect")) {
78 | System.out.println(book);
79 | }
80 |
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/springboot-12-task/.gitignore:
--------------------------------------------------------------------------------
1 | /target/
2 | !.mvn/wrapper/maven-wrapper.jar
3 |
4 | ### STS ###
5 | .apt_generated
6 | .classpath
7 | .factorypath
8 | .project
9 | .settings
10 | .springBeans
11 | .sts4-cache
12 |
13 | ### IntelliJ IDEA ###
14 | .idea
15 | *.iws
16 | *.iml
17 | *.ipr
18 |
19 | ### NetBeans ###
20 | /nbproject/private/
21 | /build/
22 | /nbbuild/
23 | /dist/
24 | /nbdist/
25 | /.nb-gradle/
--------------------------------------------------------------------------------
/springboot-12-task/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cuzz1/springboot-learning/28dee449c1aafe89a24c5f2d312fa4b1d923388b/springboot-12-task/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/springboot-12-task/.mvn/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip
2 |
--------------------------------------------------------------------------------
/springboot-12-task/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.cuzz
7 | springboot-12-task
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | springboot-12-task
12 | Demo project for Spring Boot
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 2.0.5.RELEASE
18 |
19 |
20 |
21 |
22 | UTF-8
23 | UTF-8
24 | 1.8
25 |
26 |
27 |
28 |
29 | org.springframework.boot
30 | spring-boot-starter-web
31 |
32 |
33 | org.springframework.boot
34 | spring-boot-starter-mail
35 |
36 |
37 |
38 | org.springframework.boot
39 | spring-boot-starter-test
40 | test
41 |
42 |
43 |
44 |
45 |
46 |
47 | org.springframework.boot
48 | spring-boot-maven-plugin
49 |
50 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/springboot-12-task/src/main/java/com/cuzz/task/Springboot12TaskApplication.java:
--------------------------------------------------------------------------------
1 | package com.cuzz.task;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.scheduling.annotation.Async;
6 | import org.springframework.scheduling.annotation.EnableAsync;
7 | import org.springframework.scheduling.annotation.EnableScheduling;
8 |
9 |
10 | @EnableAsync
11 | @EnableScheduling
12 | @SpringBootApplication
13 | public class Springboot12TaskApplication {
14 |
15 | public static void main(String[] args) {
16 | SpringApplication.run(Springboot12TaskApplication.class, args);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/springboot-12-task/src/main/java/com/cuzz/task/controller/AsynController.java:
--------------------------------------------------------------------------------
1 | package com.cuzz.task.controller;
2 |
3 | import com.cuzz.task.service.AsynSerivce;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.web.bind.annotation.GetMapping;
6 | import org.springframework.web.bind.annotation.RestController;
7 |
8 | /**
9 | * @Author: cuzz
10 | * @Date: 2018/9/28 17:51
11 | * @Description:
12 | */
13 | @RestController
14 | public class AsynController {
15 |
16 | @Autowired
17 | AsynSerivce asynSerivce;
18 |
19 | @GetMapping("/hello")
20 | public String hello() {
21 | asynSerivce.hello();
22 | return "success";
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/springboot-12-task/src/main/java/com/cuzz/task/service/AsynSerivce.java:
--------------------------------------------------------------------------------
1 | package com.cuzz.task.service;
2 |
3 | import org.springframework.scheduling.annotation.Async;
4 | import org.springframework.stereotype.Service;
5 |
6 | /**
7 | * @Author: cuzz
8 | * @Date: 2018/9/28 17:49
9 | * @Description:
10 | */
11 | @Service
12 | public class AsynSerivce {
13 |
14 | @Async
15 | public void hello() {
16 | try {
17 | Thread.sleep(3);
18 | } catch (InterruptedException e) {
19 | e.printStackTrace();
20 | }
21 | System.out.println("处理数据中...");
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/springboot-12-task/src/main/java/com/cuzz/task/service/ScheduledService.java:
--------------------------------------------------------------------------------
1 | package com.cuzz.task.service;
2 |
3 | import com.sun.media.jfxmedia.logging.Logger;
4 | import org.springframework.scheduling.annotation.Scheduled;
5 | import org.springframework.stereotype.Service;
6 |
7 | import java.text.SimpleDateFormat;
8 | import java.util.Date;
9 |
10 | /**
11 | * @Author: cuzz
12 | * @Date: 2018/9/29 10:25
13 | * @Description:
14 | */
15 | @Service
16 | public class ScheduledService {
17 |
18 | // 表示周一到周六当秒为0时执行一次
19 | @Scheduled(cron = "0 * * * * MON-SAT")
20 | public void hello() {
21 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
22 | String date = sdf.format(new Date());
23 | System.out.println(date + " hello...");
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/springboot-12-task/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | spring.mail.username=214769277@qq.com
2 | spring.mail.password=xxxxxxxxxxx
3 | spring.mail.host=smtp.qq.com
4 | spring.mail.properties.mail.stmp.ssl.enable=true
--------------------------------------------------------------------------------
/springboot-12-task/src/test/java/com/cuzz/task/Springboot12TaskApplicationTests.java:
--------------------------------------------------------------------------------
1 | package com.cuzz.task;
2 |
3 | import org.junit.Test;
4 | import org.junit.runner.RunWith;
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.boot.test.context.SpringBootTest;
7 | import org.springframework.mail.SimpleMailMessage;
8 | import org.springframework.mail.javamail.JavaMailSenderImpl;
9 | import org.springframework.test.context.junit4.SpringRunner;
10 |
11 | @RunWith(SpringRunner.class)
12 | @SpringBootTest
13 | public class Springboot12TaskApplicationTests {
14 |
15 | @Autowired
16 | JavaMailSenderImpl mailSender;
17 |
18 | @Test
19 | public void contextLoads() {
20 | SimpleMailMessage message = new SimpleMailMessage();
21 |
22 | message.setSubject("Hello World");
23 | message.setText("text");
24 |
25 | message.setTo("cuzz1234@163.com");
26 | message.setFrom("214769277@qq.com");
27 |
28 | mailSender.send(message);
29 |
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/springboot-13-security/.gitignore:
--------------------------------------------------------------------------------
1 | /target/
2 | !.mvn/wrapper/maven-wrapper.jar
3 |
4 | ### STS ###
5 | .apt_generated
6 | .classpath
7 | .factorypath
8 | .project
9 | .settings
10 | .springBeans
11 | .sts4-cache
12 |
13 | ### IntelliJ IDEA ###
14 | .idea
15 | *.iws
16 | *.iml
17 | *.ipr
18 |
19 | ### NetBeans ###
20 | /nbproject/private/
21 | /build/
22 | /nbbuild/
23 | /dist/
24 | /nbdist/
25 | /.nb-gradle/
--------------------------------------------------------------------------------
/springboot-13-security/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cuzz1/springboot-learning/28dee449c1aafe89a24c5f2d312fa4b1d923388b/springboot-13-security/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/springboot-13-security/.mvn/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip
2 |
--------------------------------------------------------------------------------
/springboot-13-security/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.cuzz
7 | springboot-13-security
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | springboot-13-security
12 | Demo project for Spring Boot
13 |
14 | org.springframework.boot
15 | spring-boot-starter-parent
16 | 1.5.12.RELEASE
17 |
18 |
19 |
20 |
21 | UTF-8
22 | UTF-8
23 | 1.8
24 | 3.0.9.RELEASE
25 | 2.3.0
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | org.springframework.boot
37 | spring-boot-starter-thymeleaf
38 |
39 |
40 | org.springframework.boot
41 | spring-boot-starter-security
42 |
43 |
44 | org.springframework.boot
45 | spring-boot-starter-web
46 |
47 |
48 |
49 | org.springframework.boot
50 | spring-boot-starter-test
51 | test
52 |
53 |
54 |
55 |
56 |
57 |
58 | org.springframework.boot
59 | spring-boot-maven-plugin
60 |
61 |
62 |
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/springboot-13-security/src/main/java/com/cuzz/security/Springboot13SecurityApplication.java:
--------------------------------------------------------------------------------
1 | package com.cuzz.security;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class Springboot13SecurityApplication {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(Springboot13SecurityApplication.class, args);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/springboot-13-security/src/main/java/com/cuzz/security/config/MySecurityConfig.java:
--------------------------------------------------------------------------------
1 | package com.cuzz.security.config;
2 |
3 |
4 | import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
5 | import org.springframework.security.config.annotation.web.builders.HttpSecurity;
6 | import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
7 | import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
8 |
9 | /**
10 | * @Author: cuzz
11 | * @Date: 2018/9/29 12:51
12 | * @Description:
13 | */
14 | @EnableWebSecurity
15 | public class MySecurityConfig extends WebSecurityConfigurerAdapter{
16 |
17 |
18 | @Override
19 | protected void configure(HttpSecurity http) throws Exception {
20 | // super.configure(http);
21 | // 定制请求的授权规则
22 | http.authorizeRequests().antMatchers("/").permitAll()
23 | .antMatchers("/level1/**").hasRole("VIP1")
24 | .antMatchers("/level2/**").hasRole("VIP2")
25 | .antMatchers("/level3/**").hasRole("VIP3");
26 | // 开启登入功能,如果权限就来到登入页面
27 | http.formLogin();
28 | // 开启注销功能,成功注销后回到首页
29 | http.logout().logoutSuccessUrl("/");
30 | }
31 |
32 | // 定义认证规则
33 | @Override
34 | protected void configure(AuthenticationManagerBuilder auth) throws Exception {
35 | // super.configure(auth);
36 | auth.inMemoryAuthentication()
37 | .withUser("cuzz").password("123456").roles("VIP1","VIP2")
38 | .and()
39 | .withUser("cuxx").password("123456").roles("VIP3");
40 | }
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/springboot-13-security/src/main/java/com/cuzz/security/controller/KungfuController.java:
--------------------------------------------------------------------------------
1 | package com.cuzz.security.controller;
2 |
3 | import org.springframework.stereotype.Controller;
4 | import org.springframework.web.bind.annotation.GetMapping;
5 | import org.springframework.web.bind.annotation.PathVariable;
6 |
7 | /**
8 | * @Author: cuzz
9 | * @Date: 2018/9/29 12:25
10 | * @Description:
11 | */
12 | @Controller
13 | public class KungfuController {
14 | private final String PREFIX = "pages/";
15 | /**
16 | * 欢迎页
17 | * @return
18 | */
19 | @GetMapping("/")
20 | public String index() {
21 | return "welcome";
22 | }
23 |
24 | /**
25 | * 登陆页
26 | * @return
27 | */
28 | @GetMapping("/userlogin")
29 | public String loginPage() {
30 | return PREFIX+"login";
31 | }
32 |
33 |
34 | /**
35 | * level1页面映射
36 | * @param path
37 | * @return
38 | */
39 | @GetMapping("/level1/{path}")
40 | public String level1(@PathVariable("path")String path) {
41 | return PREFIX+"level1/"+path;
42 | }
43 |
44 | /**
45 | * level2页面映射
46 | * @param path
47 | * @return
48 | */
49 | @GetMapping("/level2/{path}")
50 | public String level2(@PathVariable("path")String path) {
51 | return PREFIX+"level2/"+path;
52 | }
53 |
54 | /**
55 | * level3页面映射
56 | * @param path
57 | * @return
58 | */
59 | @GetMapping("/level3/{path}")
60 | public String level3(@PathVariable("path")String path) {
61 | return PREFIX+"level3/"+path;
62 | }
63 |
64 |
65 | }
66 |
--------------------------------------------------------------------------------
/springboot-13-security/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | spring.thymeleaf.prefix=classpath:/templates/
2 | spring.thymeleaf.suffix=.html
3 | security.user.name=root
4 | security.user.password=root
5 | security.user.role=ADMIN
--------------------------------------------------------------------------------
/springboot-13-security/src/main/resources/templates/pages/level1/1.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Insert title here
6 |
7 |
8 | 返回
9 | 罗汉拳
10 | 罗汉拳站当央,打起来不要慌
11 |
12 |
--------------------------------------------------------------------------------
/springboot-13-security/src/main/resources/templates/pages/level1/2.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Insert title here
6 |
7 |
8 | 返回
9 | 武当长拳
10 | 长一点在长一点
11 |
12 |
--------------------------------------------------------------------------------
/springboot-13-security/src/main/resources/templates/pages/level1/3.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Insert title here
6 |
7 |
8 | 返回
9 | 全真剑法
10 | 全都是真的
11 |
12 |
--------------------------------------------------------------------------------
/springboot-13-security/src/main/resources/templates/pages/level2/1.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Insert title here
6 |
7 |
8 | 返回
9 | 太极拳
10 |
11 | 一个西瓜圆又圆 劈它一刀成两半 你一半来 给你你不要 给他他不收 那就不给 把两人撵走 他们不走你走 走啦,一挥手,伤自尊
12 | 不买西瓜别缠我,缓慢纠缠様 两人缠我赖皮,手慢动作左右挥动 看我厉害,转头缓步拍苍蝇状 拍死了,手抱西瓜状+奥特曼十字手+广播操准备运动的站立
13 |
14 |
15 |
--------------------------------------------------------------------------------
/springboot-13-security/src/main/resources/templates/pages/level2/2.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Insert title here
6 |
7 |
8 | 返回
9 | 七伤拳
10 | 练这拳的人全都死了
11 |
12 |
--------------------------------------------------------------------------------
/springboot-13-security/src/main/resources/templates/pages/level2/3.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Insert title here
6 |
7 |
8 | 返回
9 | 梯云纵
10 | 踩自己的脚往上跳
11 |
12 |
--------------------------------------------------------------------------------
/springboot-13-security/src/main/resources/templates/pages/level3/1.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Insert title here
6 |
7 |
8 | 返回
9 | 葵花宝典
10 | 欲练神功,挥刀自宫
11 |
12 |
--------------------------------------------------------------------------------
/springboot-13-security/src/main/resources/templates/pages/level3/2.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Insert title here
6 |
7 |
8 | 返回
9 | 龟派气功
10 | 龟-派-气-功-波
11 |
12 |
--------------------------------------------------------------------------------
/springboot-13-security/src/main/resources/templates/pages/level3/3.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Insert title here
6 |
7 |
8 | 返回
9 | 独孤九剑
10 | 欲练此剑,必先犯贱
11 |
12 |
--------------------------------------------------------------------------------
/springboot-13-security/src/main/resources/templates/pages/login.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Insert title here
6 |
7 |
8 | 欢迎登陆武林秘籍管理系统
9 |
10 |
11 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/springboot-13-security/src/main/resources/templates/welcome.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Insert title here
6 |
7 |
8 | 欢迎光临武林秘籍管理系统
9 | 游客您好,如果想查看武林秘籍 请登录
10 |
13 |
14 |
15 | 普通武功秘籍
16 |
21 |
22 | 高级武功秘籍
23 |
28 |
29 | 绝世武功秘籍
30 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/springboot-13-security/src/test/java/com/cuzz/security/Springboot13SecurityApplicationTests.java:
--------------------------------------------------------------------------------
1 | package com.cuzz.security;
2 |
3 | import org.junit.Test;
4 | import org.junit.runner.RunWith;
5 | import org.springframework.boot.test.context.SpringBootTest;
6 | import org.springframework.test.context.junit4.SpringRunner;
7 |
8 | @RunWith(SpringRunner.class)
9 | @SpringBootTest
10 | public class Springboot13SecurityApplicationTests {
11 |
12 | @Test
13 | public void contextLoads() {
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/springboot-14-consumer-user/.mvn/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip
2 |
--------------------------------------------------------------------------------
/springboot-14-consumer-user/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.cuzz
7 | springboot-14-consumer-user
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | springboot-14-consumer-user
12 | Demo project for Spring Boot
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 1.5.16.RELEASE
18 |
19 |
20 |
21 |
22 | UTF-8
23 | UTF-8
24 | 1.8
25 |
26 |
27 |
28 |
29 | org.springframework.boot
30 | spring-boot-starter-web
31 |
32 |
33 | com.alibaba.boot
34 | dubbo-spring-boot-starter
35 | 0.1.0
36 |
37 |
38 |
39 | com.github.sgroschupf
40 | zkclient
41 | 0.1
42 |
43 |
44 | org.springframework.boot
45 | spring-boot-starter-test
46 | test
47 |
48 |
49 |
50 |
51 |
52 |
53 | org.springframework.boot
54 | spring-boot-maven-plugin
55 |
56 |
57 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/springboot-14-consumer-user/src/main/java/com/cuzz/ticket/service/TicketService.java:
--------------------------------------------------------------------------------
1 | package com.cuzz.ticket.service;
2 |
3 | /**
4 | * @Author: cuzz
5 | * @Date: 2018/9/30 12:26
6 | * @Description:
7 | */
8 | public interface TicketService {
9 | String getTicket();
10 | }
11 |
--------------------------------------------------------------------------------
/springboot-14-consumer-user/src/main/java/com/cuzz/user/Springboot14ConsumerUserApplication.java:
--------------------------------------------------------------------------------
1 | package com.cuzz.user;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class Springboot14ConsumerUserApplication {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(Springboot14ConsumerUserApplication.class, args);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/springboot-14-consumer-user/src/main/java/com/cuzz/user/service/UserService.java:
--------------------------------------------------------------------------------
1 | package com.cuzz.user.service;
2 |
3 | import com.alibaba.dubbo.config.annotation.Reference;
4 | import com.cuzz.ticket.service.TicketService;
5 | import org.springframework.stereotype.Service;
6 |
7 | /**
8 | * @Author: cuzz
9 | * @Date: 2018/9/30 12:32
10 | * @Description:
11 | */
12 | @Service
13 | public class UserService {
14 |
15 | @Reference
16 | TicketService ticketService;
17 |
18 | public void hello(){
19 | String ticket = ticketService.getTicket();
20 | System.out.println("您已经成功买票:"+ticket);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/springboot-14-consumer-user/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | # \u540D\u79F0
2 | dubbo.application.name=consumer-user
3 | # \u5730\u5740
4 | dubbo.registry.address=zookeeper://10.138.223.126:2181
5 |
--------------------------------------------------------------------------------
/springboot-14-consumer-user/src/test/java/com/cuzz/user/Springboot14ConsumerUserApplicationTests.java:
--------------------------------------------------------------------------------
1 | package com.cuzz.user;
2 |
3 | import com.cuzz.user.service.UserService;
4 | import org.junit.Test;
5 | import org.junit.runner.RunWith;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.boot.test.context.SpringBootTest;
8 | import org.springframework.test.context.junit4.SpringRunner;
9 |
10 | @RunWith(SpringRunner.class)
11 | @SpringBootTest
12 | public class Springboot14ConsumerUserApplicationTests {
13 |
14 | @Autowired
15 | UserService userService;
16 |
17 | @Test
18 | public void contextLoads() {
19 | userService.hello();
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/springboot-14-provider-ticket/.gitignore:
--------------------------------------------------------------------------------
1 | /target/
2 | !.mvn/wrapper/maven-wrapper.jar
3 |
4 | ### STS ###
5 | .apt_generated
6 | .classpath
7 | .factorypath
8 | .project
9 | .settings
10 | .springBeans
11 | .sts4-cache
12 |
13 | ### IntelliJ IDEA ###
14 | .idea
15 | *.iws
16 | *.iml
17 | *.ipr
18 |
19 | ### NetBeans ###
20 | /nbproject/private/
21 | /build/
22 | /nbbuild/
23 | /dist/
24 | /nbdist/
25 | /.nb-gradle/
--------------------------------------------------------------------------------
/springboot-14-provider-ticket/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.cuzz
7 | springboot-14-provider-ticket
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | springboot-14-provider-ticket
12 | Demo project for Spring Boot
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 1.5.16.RELEASE
18 |
19 |
20 |
21 |
22 | UTF-8
23 | UTF-8
24 | 1.8
25 |
26 |
27 |
28 |
29 | org.springframework.boot
30 | spring-boot-starter-web
31 |
32 |
33 |
34 | com.alibaba.boot
35 | dubbo-spring-boot-starter
36 | 0.1.0
37 |
38 |
39 |
40 | com.github.sgroschupf
41 | zkclient
42 | 0.1
43 |
44 |
45 |
46 | org.springframework.boot
47 | spring-boot-starter-test
48 | test
49 |
50 |
51 |
52 |
53 |
54 |
55 | org.springframework.boot
56 | spring-boot-maven-plugin
57 |
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/springboot-14-provider-ticket/src/main/java/com/cuzz/ticket/Springboot14ProviderTicketApplication.java:
--------------------------------------------------------------------------------
1 | package com.cuzz.ticket;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class Springboot14ProviderTicketApplication {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(Springboot14ProviderTicketApplication.class, args);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/springboot-14-provider-ticket/src/main/java/com/cuzz/ticket/service/TicketService.java:
--------------------------------------------------------------------------------
1 | package com.cuzz.ticket.service;
2 |
3 | /**
4 | * @Author: cuzz
5 | * @Date: 2018/9/30 12:26
6 | * @Description:
7 | */
8 | public interface TicketService {
9 | String getTicket();
10 | }
11 |
--------------------------------------------------------------------------------
/springboot-14-provider-ticket/src/main/java/com/cuzz/ticket/service/TicketServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.cuzz.ticket.service;
2 |
3 | import com.alibaba.dubbo.config.annotation.Service;
4 | import org.springframework.stereotype.Component;
5 |
6 | /**
7 | * @Author: cuzz
8 | * @Date: 2018/9/30 12:28
9 | * @Description:
10 | */
11 | @Component
12 | @Service // 这个是dubbo @Service
13 | public class TicketServiceImpl implements TicketService{
14 |
15 | @Override
16 | public String getTicket() {
17 | return "《大话西游》";
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/springboot-14-provider-ticket/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | # \u540D\u79F0
2 | dubbo.application.name=provider-ticket
3 | # \u5730\u5740
4 | dubbo.registry.address=zookeeper://10.138.223.126:2181
5 | # \u626B\u63CF\u54EA\u4E9B\u5305
6 | dubbo.scan.base-packages=com.cuzz.ticket.service
--------------------------------------------------------------------------------
/springboot-14-provider-ticket/src/test/java/com/cuzz/ticket/Springboot14ProviderTicketApplicationTests.java:
--------------------------------------------------------------------------------
1 | package com.cuzz.ticket;
2 |
3 | import org.junit.Test;
4 | import org.junit.runner.RunWith;
5 | import org.springframework.boot.test.context.SpringBootTest;
6 | import org.springframework.test.context.junit4.SpringRunner;
7 |
8 | @RunWith(SpringRunner.class)
9 | @SpringBootTest
10 | public class Springboot14ProviderTicketApplicationTests {
11 |
12 | @Test
13 | public void contextLoads() {
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/springboot-14-springcloud-consumer-user/.gitignore:
--------------------------------------------------------------------------------
1 | /target/
2 | !.mvn/wrapper/maven-wrapper.jar
3 |
4 | ### STS ###
5 | .apt_generated
6 | .classpath
7 | .factorypath
8 | .project
9 | .settings
10 | .springBeans
11 | .sts4-cache
12 |
13 | ### IntelliJ IDEA ###
14 | .idea
15 | *.iws
16 | *.iml
17 | *.ipr
18 |
19 | ### NetBeans ###
20 | /nbproject/private/
21 | /build/
22 | /nbbuild/
23 | /dist/
24 | /nbdist/
25 | /.nb-gradle/
--------------------------------------------------------------------------------
/springboot-14-springcloud-consumer-user/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cuzz1/springboot-learning/28dee449c1aafe89a24c5f2d312fa4b1d923388b/springboot-14-springcloud-consumer-user/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/springboot-14-springcloud-consumer-user/.mvn/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip
2 |
--------------------------------------------------------------------------------
/springboot-14-springcloud-consumer-user/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.cuzz
7 | springboot-14-springcloud-consumer-user
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | springboot-14-springcloud-consumer-user
12 | Demo project for Spring Boot
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 2.0.5.RELEASE
18 |
19 |
20 |
21 |
22 | UTF-8
23 | UTF-8
24 | 1.8
25 | Finchley.SR1
26 |
27 |
28 |
29 |
30 | org.springframework.boot
31 | spring-boot-starter-web
32 |
33 |
34 | org.springframework.cloud
35 | spring-cloud-starter-netflix-eureka-client
36 |
37 |
38 |
39 | org.springframework.boot
40 | spring-boot-starter-test
41 | test
42 |
43 |
44 |
45 |
46 |
47 |
48 | org.springframework.cloud
49 | spring-cloud-dependencies
50 | ${spring-cloud.version}
51 | pom
52 | import
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 | org.springframework.boot
61 | spring-boot-maven-plugin
62 |
63 |
64 |
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/springboot-14-springcloud-consumer-user/src/main/java/com/cuzz/consumeruser/Springboot14SpringcloudConsumerUserApplication.java:
--------------------------------------------------------------------------------
1 | package com.cuzz.consumeruser;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
6 | import org.springframework.cloud.client.loadbalancer.LoadBalanced;
7 | import org.springframework.context.annotation.Bean;
8 | import org.springframework.web.client.RestTemplate;
9 |
10 | @EnableDiscoveryClient // 开启发现服务
11 | @SpringBootApplication
12 | public class Springboot14SpringcloudConsumerUserApplication {
13 |
14 | public static void main(String[] args) {
15 | SpringApplication.run(Springboot14SpringcloudConsumerUserApplication.class, args);
16 | }
17 |
18 | @LoadBalanced //使用负载均衡机制
19 | @Bean
20 | public RestTemplate restTemplate(){
21 | return new RestTemplate();
22 | }
23 | }
24 |
25 |
--------------------------------------------------------------------------------
/springboot-14-springcloud-consumer-user/src/main/java/com/cuzz/consumeruser/controller/UserController.java:
--------------------------------------------------------------------------------
1 | package com.cuzz.consumeruser.controller;
2 |
3 | import org.springframework.beans.factory.annotation.Autowired;
4 | import org.springframework.web.bind.annotation.GetMapping;
5 | import org.springframework.web.bind.annotation.RestController;
6 | import org.springframework.web.client.RestTemplate;
7 |
8 | /**
9 | * @Author: cuzz
10 | * @Date: 2018/10/9 11:55
11 | * @Description:
12 | */
13 | @RestController
14 | public class UserController {
15 |
16 | @Autowired
17 | RestTemplate restTemplate;
18 |
19 | @GetMapping("/buy")
20 | public String buyTicket(String name){
21 | String s = restTemplate.getForObject("http://PROVIDER-TICKET/ticket", String.class);
22 | return name+"购买了"+" "+s;
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/springboot-14-springcloud-consumer-user/src/main/resources/application.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cuzz1/springboot-learning/28dee449c1aafe89a24c5f2d312fa4b1d923388b/springboot-14-springcloud-consumer-user/src/main/resources/application.properties
--------------------------------------------------------------------------------
/springboot-14-springcloud-consumer-user/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | application:
3 | name: consumer-user
4 | server:
5 | port: 8200
6 | eureka:
7 | instance:
8 | prefer-ip-address: true
9 | client:
10 | service-url:
11 | defaultZone: http://localhost:8761/eureka/
--------------------------------------------------------------------------------
/springboot-14-springcloud-consumer-user/src/test/java/com/cuzz/consumeruser/Springboot14SpringcloudConsumerUserApplicationTests.java:
--------------------------------------------------------------------------------
1 | package com.cuzz.consumeruser;
2 |
3 | import org.junit.Test;
4 | import org.junit.runner.RunWith;
5 | import org.springframework.boot.test.context.SpringBootTest;
6 | import org.springframework.test.context.junit4.SpringRunner;
7 |
8 | @RunWith(SpringRunner.class)
9 | @SpringBootTest
10 | public class Springboot14SpringcloudConsumerUserApplicationTests {
11 |
12 | @Test
13 | public void contextLoads() {
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/springboot-14-springcloud-eureka-server/.gitignore:
--------------------------------------------------------------------------------
1 | /target/
2 | !.mvn/wrapper/maven-wrapper.jar
3 |
4 | ### STS ###
5 | .apt_generated
6 | .classpath
7 | .factorypath
8 | .project
9 | .settings
10 | .springBeans
11 | .sts4-cache
12 |
13 | ### IntelliJ IDEA ###
14 | .idea
15 | *.iws
16 | *.iml
17 | *.ipr
18 |
19 | ### NetBeans ###
20 | /nbproject/private/
21 | /build/
22 | /nbbuild/
23 | /dist/
24 | /nbdist/
25 | /.nb-gradle/
--------------------------------------------------------------------------------
/springboot-14-springcloud-eureka-server/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cuzz1/springboot-learning/28dee449c1aafe89a24c5f2d312fa4b1d923388b/springboot-14-springcloud-eureka-server/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/springboot-14-springcloud-eureka-server/.mvn/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip
2 |
--------------------------------------------------------------------------------
/springboot-14-springcloud-eureka-server/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.cuzz
7 | springboot-14-springcloud-eureka-server
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | springboot-14-springcloud-eureka-server
12 | Demo project for Spring Boot
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 2.0.5.RELEASE
18 |
19 |
20 |
21 |
22 | UTF-8
23 | UTF-8
24 | 1.8
25 | Finchley.SR1
26 |
27 |
28 |
29 |
30 | org.springframework.cloud
31 | spring-cloud-starter-netflix-eureka-server
32 |
33 |
34 |
35 | org.springframework.boot
36 | spring-boot-starter-test
37 | test
38 |
39 |
40 |
41 |
42 |
43 |
44 | org.springframework.cloud
45 | spring-cloud-dependencies
46 | ${spring-cloud.version}
47 | pom
48 | import
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 | org.springframework.boot
57 | spring-boot-maven-plugin
58 |
59 |
60 |
61 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/springboot-14-springcloud-eureka-server/src/main/java/com/cuzz/eurekaserver/Springboot14SpringcloudEurekaServerApplication.java:
--------------------------------------------------------------------------------
1 | package com.cuzz.eurekaserver;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
6 |
7 | @EnableEurekaServer
8 | @SpringBootApplication
9 | public class Springboot14SpringcloudEurekaServerApplication {
10 |
11 | public static void main(String[] args) {
12 | SpringApplication.run(Springboot14SpringcloudEurekaServerApplication.class, args);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/springboot-14-springcloud-eureka-server/src/main/resources/application.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cuzz1/springboot-learning/28dee449c1aafe89a24c5f2d312fa4b1d923388b/springboot-14-springcloud-eureka-server/src/main/resources/application.properties
--------------------------------------------------------------------------------
/springboot-14-springcloud-eureka-server/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8761
3 | eureka:
4 | instance:
5 | hostname: eureka-server #实例的主机名
6 | client:
7 | register-with-eureka: false #不把自己注册到euraka上
8 | fetch-registry: false #不从euraka上来获取服务的注册信息
9 | service-url:
10 | defaultZone: http://localhost:8761/eureka/
--------------------------------------------------------------------------------
/springboot-14-springcloud-eureka-server/src/test/java/com/cuzz/eurekaserver/Springboot14SpringcloudEurekaServerApplicationTests.java:
--------------------------------------------------------------------------------
1 | package com.cuzz.eurekaserver;
2 |
3 | import org.junit.Test;
4 | import org.junit.runner.RunWith;
5 | import org.springframework.boot.test.context.SpringBootTest;
6 | import org.springframework.test.context.junit4.SpringRunner;
7 |
8 | @RunWith(SpringRunner.class)
9 | @SpringBootTest
10 | public class Springboot14SpringcloudEurekaServerApplicationTests {
11 |
12 | @Test
13 | public void contextLoads() {
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/springboot-14-springcloud-provider-ticket/.gitignore:
--------------------------------------------------------------------------------
1 | /target/
2 | !.mvn/wrapper/maven-wrapper.jar
3 |
4 | ### STS ###
5 | .apt_generated
6 | .classpath
7 | .factorypath
8 | .project
9 | .settings
10 | .springBeans
11 | .sts4-cache
12 |
13 | ### IntelliJ IDEA ###
14 | .idea
15 | *.iws
16 | *.iml
17 | *.ipr
18 |
19 | ### NetBeans ###
20 | /nbproject/private/
21 | /build/
22 | /nbbuild/
23 | /dist/
24 | /nbdist/
25 | /.nb-gradle/
--------------------------------------------------------------------------------
/springboot-14-springcloud-provider-ticket/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cuzz1/springboot-learning/28dee449c1aafe89a24c5f2d312fa4b1d923388b/springboot-14-springcloud-provider-ticket/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/springboot-14-springcloud-provider-ticket/.mvn/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip
2 |
--------------------------------------------------------------------------------
/springboot-14-springcloud-provider-ticket/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.cuzz
7 | springboot-14-springcloud-provider-ticket
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | springboot-14-springcloud-provider-ticket
12 | Demo project for Spring Boot
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 1.5.16.RELEASE
18 |
19 |
20 |
21 |
22 | UTF-8
23 | UTF-8
24 | 1.8
25 | Edgware.SR4
26 |
27 |
28 |
29 |
30 | org.springframework.cloud
31 | spring-cloud-starter-eureka
32 |
33 |
34 |
35 | org.springframework.boot
36 | spring-boot-starter-test
37 | test
38 |
39 |
40 |
41 |
42 |
43 |
44 | org.springframework.cloud
45 | spring-cloud-dependencies
46 | ${spring-cloud.version}
47 | pom
48 | import
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 | org.springframework.boot
57 | spring-boot-maven-plugin
58 |
59 |
60 |
61 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/springboot-14-springcloud-provider-ticket/src/main/java/com/cuzz/providerticket/Springboot14SpringcloudProviderTicketApplication.java:
--------------------------------------------------------------------------------
1 | package com.cuzz.providerticket;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class Springboot14SpringcloudProviderTicketApplication {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(Springboot14SpringcloudProviderTicketApplication.class, args);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/springboot-14-springcloud-provider-ticket/src/main/java/com/cuzz/providerticket/controller/TicketController.java:
--------------------------------------------------------------------------------
1 | package com.cuzz.providerticket.controller;
2 |
3 | import com.cuzz.providerticket.service.TicketSerivce;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.stereotype.Controller;
6 | import org.springframework.web.bind.annotation.GetMapping;
7 | import org.springframework.web.bind.annotation.RestController;
8 |
9 | /**
10 | * @Author: cuzz
11 | * @Date: 2018/10/9 11:04
12 | * @Description:
13 | */
14 | @RestController
15 | public class TicketController {
16 |
17 | @Autowired
18 | TicketSerivce ticketSerivce;
19 |
20 | @GetMapping("/ticket")
21 | public String getTicket() {
22 | return ticketSerivce.getTicket();
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/springboot-14-springcloud-provider-ticket/src/main/java/com/cuzz/providerticket/service/TicketSerivce.java:
--------------------------------------------------------------------------------
1 | package com.cuzz.providerticket.service;
2 |
3 | import org.springframework.stereotype.Service;
4 |
5 | /**
6 | * @Author: cuzz
7 | * @Date: 2018/10/9 11:02
8 | * @Description:
9 | */
10 | @Service
11 | public class TicketSerivce {
12 | public String getTicket() {
13 | return "《大话西游》";
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/springboot-14-springcloud-provider-ticket/src/main/resources/application.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cuzz1/springboot-learning/28dee449c1aafe89a24c5f2d312fa4b1d923388b/springboot-14-springcloud-provider-ticket/src/main/resources/application.properties
--------------------------------------------------------------------------------
/springboot-14-springcloud-provider-ticket/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8001
3 | spring:
4 | application:
5 | name: provider-ticket
6 | eureka:
7 | instance:
8 | prefer-ip-address: true #注册是服务使用IP地址
9 | client:
10 | service-url:
11 | defaultZone: http://localhost:8761/eureka/
--------------------------------------------------------------------------------
/springboot-14-springcloud-provider-ticket/src/test/java/com/cuzz/providerticket/Springboot14SpringcloudProviderTicketApplicationTests.java:
--------------------------------------------------------------------------------
1 | package com.cuzz.providerticket;
2 |
3 | import org.junit.Test;
4 | import org.junit.runner.RunWith;
5 | import org.springframework.boot.test.context.SpringBootTest;
6 | import org.springframework.test.context.junit4.SpringRunner;
7 |
8 | @RunWith(SpringRunner.class)
9 | @SpringBootTest
10 | public class Springboot14SpringcloudProviderTicketApplicationTests {
11 |
12 | @Test
13 | public void contextLoads() {
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/supporting/SpringBoot初级.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cuzz1/springboot-learning/28dee449c1aafe89a24c5f2d312fa4b1d923388b/supporting/SpringBoot初级.pdf
--------------------------------------------------------------------------------
/supporting/SpringBoot高级.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cuzz1/springboot-learning/28dee449c1aafe89a24c5f2d312fa4b1d923388b/supporting/SpringBoot高级.pdf
--------------------------------------------------------------------------------
/supporting/SpringSecurity实验/java/KungfuController.java:
--------------------------------------------------------------------------------
1 | package com.atguigu.security.controller;
2 |
3 | import org.springframework.stereotype.Controller;
4 | import org.springframework.web.bind.annotation.GetMapping;
5 | import org.springframework.web.bind.annotation.PathVariable;
6 |
7 | @Controller
8 | public class KungfuController {
9 | private final String PREFIX = "pages/";
10 | /**
11 | * 欢迎页
12 | * @return
13 | */
14 | @GetMapping("/")
15 | public String index() {
16 | return "welcome";
17 | }
18 |
19 | /**
20 | * 登陆页
21 | * @return
22 | */
23 | @GetMapping("/userlogin")
24 | public String loginPage() {
25 | return PREFIX+"login";
26 | }
27 |
28 |
29 | /**
30 | * level1页面映射
31 | * @param path
32 | * @return
33 | */
34 | @GetMapping("/level1/{path}")
35 | public String level1(@PathVariable("path")String path) {
36 | return PREFIX+"level1/"+path;
37 | }
38 |
39 | /**
40 | * level2页面映射
41 | * @param path
42 | * @return
43 | */
44 | @GetMapping("/level2/{path}")
45 | public String level2(@PathVariable("path")String path) {
46 | return PREFIX+"level2/"+path;
47 | }
48 |
49 | /**
50 | * level3页面映射
51 | * @param path
52 | * @return
53 | */
54 | @GetMapping("/level3/{path}")
55 | public String level3(@PathVariable("path")String path) {
56 | return PREFIX+"level3/"+path;
57 | }
58 |
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/supporting/SpringSecurity实验/templates/pages/level1/1.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Insert title here
6 |
7 |
8 | 返回
9 | 罗汉拳
10 | 罗汉拳站当央,打起来不要慌
11 |
12 |
--------------------------------------------------------------------------------
/supporting/SpringSecurity实验/templates/pages/level1/2.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Insert title here
6 |
7 |
8 | 返回
9 | 武当长拳
10 | 长一点在长一点
11 |
12 |
--------------------------------------------------------------------------------
/supporting/SpringSecurity实验/templates/pages/level1/3.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Insert title here
6 |
7 |
8 | 返回
9 | 全真剑法
10 | 全都是真的
11 |
12 |
--------------------------------------------------------------------------------
/supporting/SpringSecurity实验/templates/pages/level2/1.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Insert title here
6 |
7 |
8 | 返回
9 | 太极拳
10 |
11 | 一个西瓜圆又圆 劈它一刀成两半 你一半来 给你你不要 给他他不收 那就不给 把两人撵走 他们不走你走 走啦,一挥手,伤自尊
12 | 不买西瓜别缠我,缓慢纠缠様 两人缠我赖皮,手慢动作左右挥动 看我厉害,转头缓步拍苍蝇状 拍死了,手抱西瓜状+奥特曼十字手+广播操准备运动的站立
13 |
14 |
15 |
--------------------------------------------------------------------------------
/supporting/SpringSecurity实验/templates/pages/level2/2.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Insert title here
6 |
7 |
8 | 返回
9 | 七伤拳
10 | 练这拳的人全都死了
11 |
12 |
--------------------------------------------------------------------------------
/supporting/SpringSecurity实验/templates/pages/level2/3.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Insert title here
6 |
7 |
8 | 返回
9 | 梯云纵
10 | 踩自己的脚往上跳
11 |
12 |
--------------------------------------------------------------------------------
/supporting/SpringSecurity实验/templates/pages/level3/1.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Insert title here
6 |
7 |
8 | 返回
9 | 葵花宝典
10 | 欲练神功,挥刀自宫
11 |
12 |
--------------------------------------------------------------------------------
/supporting/SpringSecurity实验/templates/pages/level3/2.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Insert title here
6 |
7 |
8 | 返回
9 | 龟派气功
10 | 龟-派-气-功-波
11 |
12 |
--------------------------------------------------------------------------------
/supporting/SpringSecurity实验/templates/pages/level3/3.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Insert title here
6 |
7 |
8 | 返回
9 | 独孤九剑
10 | 欲练此剑,必先犯贱
11 |
12 |
--------------------------------------------------------------------------------
/supporting/SpringSecurity实验/templates/pages/login.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Insert title here
6 |
7 |
8 | 欢迎登陆武林秘籍管理系统
9 |
10 |
11 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/supporting/SpringSecurity实验/templates/welcome.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Insert title here
6 |
7 |
8 | 欢迎光临武林秘籍管理系统
9 | 游客您好,如果想查看武林秘籍 请登录
10 |
11 |
12 | 普通武功秘籍
13 |
18 |
19 | 高级武功秘籍
20 |
25 |
26 | 绝世武功秘籍
27 |
32 |
33 |
34 |
--------------------------------------------------------------------------------