跳过正文

Java

2、Object
·2946 字·6 分钟· loading · loading
Java 常用API JDK原生
java.lang.Object # Object类是所有Java类的根父类 如果在类的声明中未使用extends关键字指明其父类,则默认父类为java.lang.Object类 Object类中的功能(方法)具有通用性。 Object类只声明了一个空参的构造器 registerNatives() # native方法,让程序主动将本地方法链接到调用方,当Java程序需要调用本地方法时就可以直接调用,而不需要虚拟机再去定位并链接。
2、Java操作RabbitMQ
·4303 字·9 分钟· loading · loading
Java 组件与中间件 RabbitMQ
准备工作 # 1、查看数据端口,默认5672 #
2、Http协议
·4476 字·9 分钟· loading · loading
Java JavaEE JavaWeb
HTTP协议 # 超文本传输协议(hypertext transport protocol),服务端和客户端发送数据,需要遵守的协议,传递的数据又称为报文
2、ELK安装
·541 字·2 分钟· loading · loading
Java 组件与中间件 ElasticSearch
ELK # ELK是ElasiticSearch+LogStash+Kibana的三合一版本
2、CXF
·922 字·2 分钟· loading · loading
Java JavaEE WebService
整合SpringBoot+CXF # 1、添加依赖 # <?xml version="1.0" encoding="UTF-8"?> <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> <groupId>top.ygang</groupId> <artifactId>cxfdemo</artifactId> <version>1.0-SNAPSHOT</version> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-parent</artifactId> <version>2.2.0.RELEASE</version> </parent> <properties> <maven.compiler.source>8</maven.compiler.source> <maven.compiler.target>8</maven.compiler.target> <cxf.version>3.2.1</cxf.version> </properties> <dependencies> <!-- webService--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web-services</artifactId> </dependency> <!-- CXF webservice --> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-spring-boot-starter-jaxws</artifactId> <version>${cxf.version}</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-transports-http</artifactId> <version>${cxf.version}</version> </dependency> </dependencies> </project> 2、编写服务接口和服务实现类 # @WebService( name = "testService", targetNamespace = "http://top.ygang.test/service", serviceName = "testService" ) public interface TestService { @WebMethod(operationName = "testMethod") @WebResult(name = "message") String testMethod(@WebParam(name = "name") String name); } @Component @WebService( name = "testService", targetNamespace = "http://top.ygang.test/service", serviceName = "testService" ) public class TestServiceImpl implements TestService{ @Override @WebMethod(operationName = "testMethod") @WebResult(name = "message") public String testMethod(@WebParam(name = "name")String name) { return "accept success : " + name; } } 3、编写配置类 # @Configuration public class WSConfig { @Autowired private TestService testService; /** * Apache CXF 核心架构是以BUS为核心,整合其他组件。 * Bus是CXF的主干, 为共享资源提供一个可配置的场所,作用类似于Spring的ApplicationContext,这些共享资源包括 * WSDl管理器、绑定工厂等。通过对BUS进行扩展,可以方便地容纳自己的资源,或者替换现有的资源。默认Bus实现基于Spring架构, * 通过依赖注入,在运行时将组件串联起来。BusFactory负责Bus的创建。默认的BusFactory是SpringBusFactory,对应于默认 * 的Bus实现。在构造过程中,SpringBusFactory会搜索META-INF/cxf(包含在 CXF 的jar中)下的所有bean配置文件。 * 根据这些配置文件构建一个ApplicationContext。开发者也可以提供自己的配置文件来定制Bus。 */ @Bean(name = Bus.DEFAULT_BUS_ID) public SpringBus springBus() { return new SpringBus(); } /** * 此方法作用是改变项目中服务名的前缀名,此处127.0.0.1或者localhost不能访问时,请使用ipconfig查看本机ip来访问 * 此方法被注释后, 即不改变前缀名(默认是services) * * 如果启动时出现错误:not loaded because DispatcherServlet Registration found non dispatcher servlet dispatcherServlet * 可能是springboot与cfx版本不兼容。 * 同时在spring boot2.0.6之后的版本与xcf集成,不需要在定义以下方法,直接在application.properties配置文件中添加: * cxf.path=/service(默认是services) */ // @Bean // public ServletRegistrationBean dispatcherServlet() { // return new ServletRegistrationBean(new CXFServlet(), "/services/*"); // } /** * 此方法的作用是发布服务 */ @Bean public Endpoint endpoint() { EndpointImpl endpoint = new EndpointImpl(springBus(), testService); endpoint.publish("/"); return endpoint; } } 4、启动类 # @SpringBootApplication public class Start { public static void main(String[] args) { SpringApplication.run(Start.class,args); } } 5、访问浏览器查看wsdl # 访问地址:http://127.0.0.1:8080/services/testService?wsdl
1、微服务
·2712 字·6 分钟· loading · loading
Java SpringFramework SpringCloud
微服务简介 # 倡导者:Martin Fowler,文章网址:http://martinfowler.com/articles/microservices.html
1、设计模式概述
·374 字·1 分钟· loading · loading
Java 设计模式
设计模式是在大量的实践中总结和理论化之后优的代码结构、编程风格、以及解决问题的思考方式。
1、枚举类
·1335 字·3 分钟· loading · loading
Java JavaSE JavaSE高级
枚举,顾名思义:就是一个一个列举出来 当需要定义一组常量时,强烈建议使用枚举类
1、基于springboot项目构建
·1360 字·3 分钟· loading · loading
Java JavaFX 项目构建和打包
准备工作 # 项目采用idea开发,所以不需要插件,使用spring-boot+javaFx,实现MVC结构,整体项目结构类似于spirngboot项目
1、单例模式
·811 字·2 分钟· loading · loading
Java 设计模式 创建型模式
要解决的问题: # 所谓类的单例设计模式,就是采取一定的方法保证在整个的软件系统中,对某个类只能存在一个对象实例。