- 浏览: 188305 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (321)
- eclipse (4)
- idea (2)
- Html (8)
- Css (14)
- Javascript (8)
- Jquery (6)
- Ajax Json (4)
- Bootstrap (0)
- EasyUI (0)
- Layui (0)
- 数据结构 (0)
- Java (46)
- DesPattern (24)
- Algorithm (2)
- Jdbc (8)
- Jsp servlet (13)
- Struts2 (17)
- Hibernate (11)
- Spring (5)
- S2SH (1)
- SpringMVC (4)
- SpringBoot (11)
- WebService CXF (4)
- Poi (2)
- JFreeChart (0)
- Shiro (6)
- Lucene (5)
- ElasticSearch (0)
- JMS ActiveMQ (3)
- HttpClient (5)
- Activiti (0)
- SpringCloud (11)
- Dubbo (6)
- Docker (0)
- MySQL (27)
- Oracle (18)
- Redis (5)
- Mybatis (11)
- SSM (1)
- CentOS (10)
- Ant (2)
- Maven (4)
- Log4j (7)
- XML (5)
最新评论
1. 服务提供者项目microservice-student-provider-1001搭建
1.1) 服务提供者项目microservice-student-provider-1001增加pom.xml依赖
1.2) 服务提供者项目microservice-student-provider-1001增加application.yml配置
1.3) 服务提供者项目microservice-student-provider-1001增加com.andrew.StudentProviderApplication_1001.java启动类
1.4) 服务提供者项目microservice-student-provider-1001增加com.andrew.repository.StudentRepository.java
1.5) 服务提供者项目microservice-student-provider-1001增加com.andrew.service.StudentService.java
1.6) 服务提供者项目microservice-student-provider-1001增加com.andrew.service.impl.StudentServiceImpl.java
1.7) 服务提供者项目microservice-student-provider-1001增加com.andrew.controller.StudentProviderController.java
chrome安装postman插件
postman下载地址:https://pan.baidu.com/share/init?surl=io52U6OD6Rb7CWIrjAn3Pw
postman下载密码:oul9
新建服务提供者项目microservice-student-provider-1001 new -> Maven Module -> create a simple project Module Name:microservice-student-provider-1001 Parent Project:microservice Working set:SpringCloud -> Artifact Group Id:com.andrew.springcloud Artifact Id:microservice-student-provider-1001 Version:0.0.1-SNAPSHOT Packaging:jar
1.1) 服务提供者项目microservice-student-provider-1001增加pom.xml依赖
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>com.andrew.springcloud</groupId> <artifactId>microservice</artifactId> <version>0.0.1-SNAPSHOT</version> </parent> <artifactId>microservice-student-provider-1001</artifactId> <dependencies> <dependency> <groupId>com.andrew.springcloud</groupId> <artifactId>microservice-common</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> </dependency> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid</artifactId> </dependency> <!-- 修改后立即生效,热部署 --> <dependency> <groupId>org.springframework</groupId> <artifactId>springloaded</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> </dependency> </dependencies> </project>
1.2) 服务提供者项目microservice-student-provider-1001增加application.yml配置
server: port: 1001 context-path: / # 数据源配置 spring: datasource: type: com.alibaba.druid.pool.DruidDataSource driver-class-name: com.mysql.jdbc.Driver url: jdbc:mysql://localhost:3306/springcloud username: root password: root jpa: hibernate: ddl-auto: update show-sql: true thymeleaf: cache: false
1.3) 服务提供者项目microservice-student-provider-1001增加com.andrew.StudentProviderApplication_1001.java启动类
package com.andrew; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class StudentProviderApplication_1001 { public static void main(String[] args) { SpringApplication.run(StudentProviderApplication_1001.class, args); } }
1.4) 服务提供者项目microservice-student-provider-1001增加com.andrew.repository.StudentRepository.java
package com.andrew.repository; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import com.andrew.entity.Student; public interface StudentRepository extends JpaRepository<Student, Integer>,JpaSpecificationExecutor<Student> { }
1.5) 服务提供者项目microservice-student-provider-1001增加com.andrew.service.StudentService.java
package com.andrew.service; import java.util.List; import com.andrew.entity.Student; public interface StudentService { public void save(Student student); public Student findById(Integer id); public List<Student> list(); public void delete(Integer id); }
1.6) 服务提供者项目microservice-student-provider-1001增加com.andrew.service.impl.StudentServiceImpl.java
package com.andrew.service.impl; import java.util.List; import javax.annotation.Resource; import org.springframework.stereotype.Service; import com.andrew.entity.Student; import com.andrew.repository.StudentRepository; import com.andrew.service.StudentService; @Service("studentService") public class StudentServiceImpl implements StudentService { @Resource private StudentRepository studentRepository; @Override public void save(Student student) { studentRepository.save(student); } @Override public Student findById(Integer id) { return studentRepository.findOne(id); } @Override public List<Student> list() { return studentRepository.findAll(); } @Override public void delete(Integer id) { studentRepository.delete(id); } }
1.7) 服务提供者项目microservice-student-provider-1001增加com.andrew.controller.StudentProviderController.java
package com.andrew.controller; import java.util.List; import javax.annotation.Resource; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.andrew.entity.Student; import com.andrew.service.StudentService; @RestController @RequestMapping("/student") public class StudentProviderController { @Resource private StudentService studentService; @PostMapping(value = "/save") public boolean save(Student student) { try { studentService.save(student); return true; } catch (Exception e) { return false; } } @GetMapping(value = "/list") public List<Student> list() { return studentService.list(); } @GetMapping(value = "/get/{id}") public Student get(@PathVariable("id") Integer id) { return studentService.findById(id); } @GetMapping(value = "/delete/{id}") public boolean delete(@PathVariable("id") Integer id) { try { studentService.delete(id); return true; } catch (Exception e) { return false; } } }
chrome安装postman插件
postman下载地址:https://pan.baidu.com/share/init?surl=io52U6OD6Rb7CWIrjAn3Pw
postman下载密码:oul9
插入测试数据 insert into t_student values(1, "11", "zhangsan"); insert into t_student values(2, "12", "lisi"); insert into t_student values(3, "13", "wangwu");
启动microservice-student-provider-1001 http://localhost:1001/student/list [{"id":1,"name":"zhangsan","grade":"11"},{"id":2,"name":"lisi","grade":"12"},{"id":3,"name":"wangwu","grade":"13"}] http://localhost:1001/student/get/1 {"id":1,"name":"zhangsan","grade":"11"} post http://localhost:1001/student/save id 4 grade 14 name student04 true
发表评论
-
Config Server使用
2019-03-21 10:31 4771. SpringCloud Config简介 Spri ... -
Zuul API路由网关服务
2019-03-20 14:09 4871. Zuul API路由网关服务简介 这里的API路由 ... -
Feign与Hystrix服务熔断服务降级解耦
2019-03-20 13:56 6171. Feign与Hystrix服务熔断服务降级解耦 用 ... -
Hystrix的Dashboard仪表盘与turbine集群监控
2019-03-20 13:39 5271. Hystrix服务监控Dashboard仪表盘 H ... -
Hystrix断路器
2019-03-20 09:14 3481. Hystrix断路器简介 hystrix对应的中文 ... -
Feign声明式服务调用
2019-03-20 09:09 4031. Feign声明式服务调用简介 Feign是一个声明 ... -
Ribbon负载均衡器
2019-03-19 15:19 3771. Ribbon简介 Ribbon是Netflix发布 ... -
Eureka服务注册与发现组件
2019-03-19 14:22 3851. 服务注册与发现组件Eureka简介 Eureka gi ... -
服务消费者microservice-student-consumer-80
2019-03-19 13:17 3551. 服务消费者项目microservice-student- ... -
SpringCloud建立父项目、公共模块项目
2019-03-19 09:54 13091. SpringCloud简介 springcloud项目 ...
相关推荐
总的来说,"microservice-student-provider-1002.zip"提供了一个基于SpringBoot和Mybatis的微服务实例,可以帮助开发者了解如何在微服务架构下构建和部署服务。通过解压并运行此项目,我们可以学习到如何整合这些...
netclass-student-v16.exenetclass-student-v16.exenetclass-student-v16.exenetclass-student-v16.exenetclass-student-v16.exenetclass-student-v16.exe
Welcome to spring-microservice-exam :waving_hand: 硕果云,基于Spring Cloud搭建的新一代微服务教学管理平台,提供多租户、权限管理、在线考试、练习等功能 题型支持单选题、多选题、不定项选择题、判断题、简答...
标题 "tutor-student.zip" 暗示我们关注的是一个与教学或学生辅导相关的压缩文件,而描述 "惠普1020" 提到的可能是该教学资源与惠普1020打印机有关,或者是在这个设备上使用或创建的。标签 "hg" 无法直接明确其含义...
饮酒与在校表现-student-alcohol-consumption.zip饮酒与在校表现-student-alcohol-consumption.zip饮酒与在校表现-student-alcohol-consumption.zip饮酒与在校表现-student-alcohol-consumption.zip饮酒与在校表现-...
app-development-with-swift-student-guide.ibooks 《app-development-with-swift-student-guide》
标题中的"Class-Demo---student-achievement.zip_DEMO_class StudentDemo_stud"表明这是一个关于学生成就的Java类演示示例,可能包含一个名为"StudentDemo"的类,用于处理学生成绩相关的操作。描述中提到"Class Demo...
omnebus-Student Exercises 实验文档
8-2-student.sql
实验9-PCA-student.ipynb
我的python课设_flask-vue-student-information-manager
【微信小程序源码- student-information-system-wechat-applet-master】是一个专门为学校教务管理设计的微信小程序项目。这个源码提供了完整的开发框架和功能模块,旨在帮助开发者快速构建一个高效、便捷的学生信息...
"python-student-list"这个主题恰好涉及到如何使用列表来管理学生信息。在本篇文章中,我们将深入探讨Python列表的相关知识点,并结合“student”这一文件名,假设这是一个包含学生信息的列表,以此为实例进行讲解。...
在这个过程中,JWT提供了一些优势,如: - 无状态:服务器不需存储Session信息,降低了服务器压力。 - 跨域支持:Token可以在不同的域名下使用,适合微服务架构。 - 安全性:JWT可以通过算法加密,确保数据传输过程...
sailing-student
这种系统通常由软件应用程序支持,为学生和考生提供了在网上参加考试的机会。在线考试系统可以用于各种教育和培训场景,包括学校教育、职业资格认证、招聘考试等。 【主要特点和优势】: 灵活性和便利性:学生和考生...
在IT行业中,SSH(Secure Shell)通常用于提供安全的远程登录和其他网络服务。"ssh-student.zip_book_ssh" 的标题暗示这是一个与SSH相关的学习资源,可能是书籍或教程,专门讲解如何利用SSH进行学生信息管理,包括增...
Ajax-Student-Management-System.zip,使用python django构建的简单学生管理网站,ajax代表异步javascript和xml。它是多种web技术的集合,包括html、css、json、xml和javascript。它用于创建动态网页,其中网页的小...
顺序表-student.cpp
题目2.1 - student.asm