spring boot配置service发布服务
在application.yml中配置
server:
port: 8080
context-path: /crm
spring:
datasource:
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/crm
username: root
password: 136735
jpa:
show-sql: true
jackson:
default-property-inclusion: non_null
devtools:
restart:
enabled: true
cxf:
path: /services #使用service发布服务,需要在/crm后面加上/service,
#要添加依赖:否则解析不了,做不了映射 "org.apache.cxf:cxf-spring-boot-starter-jaxrs:$boot_starter_jaxrs_version"
servlet.init: service-list-path: /info jaxrs: component-scan: true
service发布服务
package top.kylewang.crm.controller; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.ResponseBody; import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path; @Path("path")
@Service
@Transactional(rollbackFor = Exception.class)
public class TestPath {
@Path("/p1")
@GET
@Consumes({"application/xml", "application/json"})
public String getString() {
return "path";
}
}
访问 http://localhost:8080//crm/services/path/p1
返回path
带参数的请求。
@Path("QueryProductService")
public interface QueryProductService {
/**
* 查询商品根据Uid
* @return
*/
@Path("/QueryProductBypid")
@GET //post 参数在请求体中,get在url中
@Consumes({"application/xml", "application/json"}) //返回void用consumes
Product QueryProductBypid(@QueryParam("id") String id);
}
url http://127.0.0.1:9001/background/services/QueryProductService/QueryProductBypid?id=556556887752
spring boot配置service发布服务的更多相关文章
- Spring Boot+CXF搭建WebService服务参考资料
pom.xml文件引入包: <!--WerbService CXF依赖--> <dependency> <groupId>org.apache.cxf</gr ...
- spring boot 配置访问其他模块包中的mapper和xml
maven项目结构如下,这里只是简单测试demo,使用的springboot版本为2.1.3.RELEASE 1.comm模块主要是一些mybatis的mapper接口和对应的xml文件,以及数据库表 ...
- Spring Boot 配置 - Consul 配置中心
▶ Spring Boot 依赖与配置 Maven 依赖 <dependencyManagement> <dependencies> <dependency> &l ...
- Redis篇之操作、lettuce客户端、Spring集成以及Spring Boot配置
Redis篇之操作.lettuce客户端.Spring集成以及Spring Boot配置 目录 一.Redis简介 1.1 数据结构的操作 1.2 重要概念分析 二.Redis客户端 2.1 简介 2 ...
- Spring Boot 配置优先级顺序
一般在一个项目中,总是会有好多个环境.比如: 开发环境 -> 测试环境 -> 预发布环境 -> 生产环境 每个环境上的配置文件总是不一样的,甚至开发环境中每个开发者的环境可能也会有一 ...
- Springboot监控之二:Spring Boot Admin对Springboot服务进行监控
概述 Spring Boot 监控核心是 spring-boot-starter-actuator 依赖,增加依赖后, Spring Boot 会默认配置一些通用的监控,比如 jvm 监控.类加载.健 ...
- Spring boot配置多个Redis数据源操作实例
原文:https://www.jianshu.com/p/c79b65b253fa Spring boot配置多个Redis数据源操作实例 在SpringBoot是项目中整合了两个Redis的操作实例 ...
- spring boot配置mybatis和事务管理
spring boot配置mybatis和事务管理 一.spring boot与mybatis的配置 1.首先,spring boot 配置mybatis需要的全部依赖如下: <!-- Spri ...
- Spring boot 配置异步处理执行器
示例如下: 1. 新建Maven 项目 async-executor 2.pom.xml <project xmlns="http://maven.apache.org/POM/4.0 ...
随机推荐
- 【Java知识点专项练习】之 Java鲁棒性的特点
Java鲁棒性的特点如下: Java在编译和运行程序时都要对可能出现的问题进行检查,以防止错误的产生. Java编译器可以查出许多其他语言运行时才能发现的错误. Java不支持指针操作,大大减少了错误 ...
- Material Design系列第七篇——Maintaining Compatibility
Maintaining Compatibility This lesson teaches you to Define Alternative Styles Provide Alternative L ...
- chrome 安装页面编码选择插件
https://chrome.google.com/webstore/detail/set-character-encoding/bpojelgakakmcfmjfilgdlmhefphglae se ...
- React组件设计(转)
React组件设计 组件分类 展示组件和容器组件 展示组件 容器组件 关注事物的展示 关注事物如何工作 可能包含展示和容器组件,并且一般会有DOM标签和css样式 可能包含展示和容器组件,并且不会有D ...
- Makefile Demo案例
# Comments can be written like this. # File should be named Makefile and then can be run as `make &l ...
- vue生成路由实例, 使用单个vue文件模板生成路由
一.vue-loader与vue-router配合 $ cnpm install vue-router --save 二.生成vue-webpack模板 $ vue init webpack-simp ...
- Implicit conversion from enumeration type 'enum CGImageAlphaInfo' to different enumeration type 'CGBitmapinfo' (aka) 'enum CGBitmapInfo')
The constants for specifying the alpha channel information are declared with the CGImageAlphaInfo ty ...
- idea如何打war包?(部署tomcat后具有class文件)
- vue--使用过滤器
有个项目需要可以添加和删除选项,但是左侧要显示的 A,B,C,D.... 解决思路: 循环的时候
- ubuntu下中文乱码解决方案(全)
转自 http://www.cnblogs.com/end/archive/2011/04/19/2021507.html 1.ibus输入法 Ubuntu 系统安装后已经自带了ibus输入法,在 ...