【JAVA】cxf使用springboot与xml配置的差别所导致的问题。
使用xml时使用以下配置使报文没有加上命名空间时也能正常访问接口。bean定义的前后顺序不影响程序正常注册对象。
<!-- 通过Spring创建数据绑定的类 -->
<bean id="aegisBean" class="org.apache.cxf.aegis.databinding.AegisDatabinding" />
<bean id="jaxWsServiceFactoryBean" class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean" scope="prototype">
<property name="wrapped" value="true" />
<property name="dataBinding" ref="aegisBean" />
</bean>
<jaxws:endpoint id="imSendWXModelMessageServicews"
implementor="#imSendWXModelMessageService" address="/imSendWXModelMessageService.ws">
<jaxws:serviceFactory>
<ref bean="jaxWsServiceFactoryBean" />
</jaxws:serviceFactory>
</jaxws:endpoint>
但是如果使用springboot的话,使用注解方式配置,需要注意的是,需要使用到的类一定要放在前面先初始化。不然会没有效果。
例如下面代码红色部分。如果放在endpoint.publish()后面则不会生效。
@Bean
public AegisDatabinding aegisDatabinding() {
return new AegisDatabinding();
} @Bean
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public JaxWsServiceFactoryBean jaxWsServiceFactoryBean() {
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean sf = new JaxWsServiceFactoryBean();
sf.setWrapped(true);
sf.setDataBinding(aegisDatabinding());
return sf;
} @Bean
public Endpoint sendMessageEndpoint(SendMessageService sendMessageService) {
EndpointImpl endpoint = new EndpointImpl(sendMessageService);
endpoint.setServiceFactory(jaxWsServiceFactoryBean());
endpoint.publish("/imSendWXModelMessageService.ws");
return endpoint;
}
【JAVA】cxf使用springboot与xml配置的差别所导致的问题。的更多相关文章
- SpringBoot零XML配置的Spring Boot Application
Spring Boot 提供了一种统一的方式来管理应用的配置,允许开发人员使用属性properties文件.YAML 文件.环境变量和命令行参数来定义优先级不同的配置值.零XML配置的Spring B ...
- SpringBoot无XML配置
SpringBoot,自己研究了好几天,以前也是没有接触过这类的框架,不过原理吧,也就是那么些个原理,毕竟都是Spring开源下的子框架. 好了,回归正题,今天晚上研究了好久,写出来了无配置文件的ja ...
- springboot中xml配置之@ImportResource
springboot中进行相关的配置往往有java配置和xml配置两种方式. 使用java的方式配置只需要使用@configuration注解即可,而使用xml的方式配置的话需要使用@ImportRe ...
- Java Servlet的配置文件web.xml配置内容和具体含义
文件名:“SimpleServlet.java” package cn.mldn.lxh.servlet ;//定义包 import java.io.* ; // HttpServlet属于javax ...
- java框架之SpringBoot(2)-配置
规范 SpringBoot 使用一个全局的配置文件,配置文件名固定为 application.properties 或 application.yml .比如我们要配置程序启动使用的端口号,如下: s ...
- Springboot 日志管理配置logback-spring.xml
几种常见的日志 Log4j:是最早的日志框架,是apach旗下的,可以单独使用,也可配合日志框架JCL使用: Log4j2:apach旗下的关于log4j的升级版: Logback:是基于slf4j接 ...
- 模拟Springboot一:(零xml配置搭建SSM项目)
在spring官网文档中无论是spring的基础文档,还是spring-mvc文档都推荐我们使用javaconfig的方式来搭建项目 间接说明 (优点:javaconfig配置>xml配置) 其 ...
- SpringBoot整合MyBatis之xml配置
现在业界比较流行的数据操作层框架 MyBatis,下面就讲解下 Springboot 如何整合 MyBatis,这里使用的是xml配置SQL而不是用注解.主要是 SQL 和业务代码应该隔离,方便和 D ...
- SpringBoot系列-整合Mybatis(XML配置方式)
目录 一.什么是 MyBatis? 二.整合方式 三.实战 四.测试 本文介绍下SpringBoot整合Mybatis(XML配置方式)的过程. 一.什么是 MyBatis? MyBatis 是一款优 ...
随机推荐
- SpringMVC(一) 基础知识+入门案例
SpringMVC基础知识 1.什么是Springmvc 2.springmvc 框架的原理(必须掌握) 前端控制器.处理器映射器.处理器适配器.视图解析器 3.SpringMVC 入门程序 目的:对 ...
- Hadoop InputFormat详解
InputFormat是MapReduce编程模型包括5个可编程组件之一,其余4个是Mapper.Partitioner.Reducer和OutputFormat. 新版Hadoop InputFor ...
- 图片的回显。js
l <tr><td></td> <td> <c:if test="${editVo.pic!=''}"><img ...
- P1681 最大正方形 Iand II
题目描述 在一个n*m的只包含0和1的矩阵里找出一个不包含0的最大正方形,输出边长. 输入输出格式 输入格式: 输入文件第一行为两个整数n,m(1<=n,m<=100),接下来n行,每行m ...
- 【解决】Git failed with a fatal error. Authentication failed for ‘http://......’
今天在visual studio中运行项目,打算pull最新的代码的时候,报错: Git failed with a fatal error. Authentication failed for ‘h ...
- c语言数据结构:用标志位实现循环队列
#include<stdio.h> #include<stdlib.h> #define MAXSIZE 10//定义队列长度 ;//定义标志位 typedef struct ...
- FreeMarker基本语法的使用
参考博客: http://www.cnblogs.com/panchanggui/p/9346574.html https://blog.csdn.net/zyy88886666/article/de ...
- sublimetext3安装配置
官网:http://www.sublimetext.com/ 中文官网:http://www.sublimetextcn.com/ 包管理器:https://packagecontrol.io/ins ...
- 一篇文章读懂JSON
什么是json? W3C JSON定义修改版: JSON 指的是 JavaScript 对象表示法(JavaScript Object Notation) JSON 是轻量级的文本数据交换格式,并不是 ...
- python3基础08(exec、bytearray使用等)
#!/usr/bin/env python# -*- coding:utf-8 -*- str="test"print(ascii(str))a=bytearray("a ...