如何启动已在使用的Spring使用宏可以启动其他应用程序吗地址

Spring Boot的应用启动与关闭
1. Spring Boot应用打包
Spring Boot应用可以打成jar包,其中内嵌tomcat,因此可以直接启动使用。但是在Spring Boot应用启动之前,首先需要进行打包,本文讲述的是Maven工程的打包,打包需要的前提条件(pom.xml文件中的内容)是:
&packaging&jar&/packaging&
&dependency&
&groupId&org.springframework.boot&/groupId&
&artifactId&spring-boot-starter-web&/artifactId&
&/dependency&
&groupId&org.springframework.boot&/groupId&
&artifactId&spring-boot-maven-plugin&/artifactId&
&configuration&
&mainClass&com.***.Application&/mainClass&
&/configuration&
&executions&
&execution&
&goal&repackage&/goal&
&/execution&
&/executions&
&/plugins&
打包命令为:
mvn clean package -Dmaven.test.skip=true
$ mvn clean package -Dmaven.test.skip=true
[INFO] Scanning for projects...
[WARNING] Some problems were encountered while building the effective model for com.example:myproject:jar:0.0.1-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.springframework.boot:spring-boot-maven-plugin is missing. @ line 38, column 17
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[INFO] ------------------------------------------------------------------------
[INFO] Building myproject 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ myproject ---
[INFO] Deleting /Users/ltc/Spring Boot Demo/target
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ myproject ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ myproject ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 1 source file to /Users/ltc/Spring Boot Demo/target/classes
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ myproject ---
[INFO] Not copying test resources
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ myproject ---
[INFO] Not compiling test sources
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ myproject ---
[INFO] Tests are skipped.
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ myproject ---
[INFO] Building jar: /Users/ltc/Spring Boot Demo/target/myproject-0.0.1-SNAPSHOT.jar
[INFO] --- spring-boot-maven-plugin:1.5.0.RC1:repackage (default) @ myproject ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.861 s
[INFO] Finished at: 2017-01-13T15:31:32+08:00
[INFO] Final Memory: 26M/308M
[INFO] ------------------------------------------------------------------------
或在eclipse中运行run -& Maven build...,在Goals中填写clean
package -Dmaven.test.skip=true,运行,打包完成。
2. Spring Boot应用启动
Spring Boot的启动命令为:
java -jar application.jar
$ java -jar target/myproject-0.0.1-SNAPSHOT.jar
( ( )\___ |
___)| |_)| | | | | || (_| |
=========|_|==============|___/=/_/_/_/
:: Spring Boot ::
(v1.4.3.RELEASE)
2017-01-13 15:31:36.911
INFO 62119 --- [
main] com.test.Example
: Starting Example on local with PID 62119 (/Users/ltc/Spring Boot Demo/target/myproject-0.0.1-SNAPSHOT.jar started by liutianchi in /Users/ltc/Spring Boot Demo)
2017-01-13 15:31:36.916
INFO 62119 --- [
main] com.test.Example
: No active profile set, falling back to default profiles: default
2017-01-13 15:31:36.981
INFO 62119 --- [
main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@b1a58a3: startup date [Fri Jan 13 15:31:36 CST 2017]; root of context hierarchy
2017-01-13 15:31:38.602
INFO 62119 --- [
main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2017-01-13 15:31:38.615
INFO 62119 --- [
main] o.apache.catalina.core.StandardService
: Starting service Tomcat
2017-01-13 15:31:38.616
INFO 62119 --- [
main] org.apache.catalina.core.StandardEngine
: Starting Servlet Engine: Apache Tomcat/8.5.6
2017-01-13 15:31:38.718
INFO 62119 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]
: Initializing Spring embedded WebApplicationContext
2017-01-13 15:31:38.718
INFO 62119 --- [ost-startStop-1] o.s.web.context.ContextLoader
: Root WebApplicationContext: initialization completed in 1740 ms
2017-01-13 15:31:38.927
INFO 62119 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean
: Mapping servlet:
2017-01-13 15:31:38.932
INFO 62119 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean
: Mapping filter:
2017-01-13 15:31:38.932
INFO 62119 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean
: Mapping filter:
2017-01-13 15:31:38.932
INFO 62119 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean
: Mapping filter:
2017-01-13 15:31:38.932
INFO 62119 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean
: Mapping filter:
2017-01-13 15:31:38.932
INFO 62119 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean
: Mapping filter:
2017-01-13 15:31:38.932
INFO 62119 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean
: Mapping filter:
2017-01-13 15:31:38.932
INFO 62119 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean
: Mapping filter:
2017-01-13 15:31:39.217
INFO 62119 --- [
main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@b1a58a3: startup date [Fri Jan 13 15:31:36 CST 2017]; root of context hierarchy
2017-01-13 15:31:39.310
INFO 62119 --- [
main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/]}" onto java.lang.String com.test.Example.home()
2017-01-13 15:31:39.313
INFO 62119 --- [
main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity&java.util.Map&java.lang.String, java.lang.Object&& org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2017-01-13 15:31:39.313
INFO 62119 --- [
main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2017-01-13 15:31:39.338
INFO 62119 --- [
main] o.s.w.s.handler.SimpleUrlHandlerMapping
: Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-01-13 15:31:39.338
INFO 62119 --- [
main] o.s.w.s.handler.SimpleUrlHandlerMapping
: Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-01-13 15:31:39.378
INFO 62119 --- [
main] o.s.w.s.handler.SimpleUrlHandlerMapping
: Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-01-13 15:31:39.665
INFO 62119 --- [
main] o.s.b.a.e.mvc.EndpointHandlerMapping
: Mapped "{[/manage/metrics/{name:.*}],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.MetricsMvcEndpoint.value(java.lang.String)
2017-01-13 15:31:39.665
INFO 62119 --- [
main] o.s.b.a.e.mvc.EndpointHandlerMapping
: Mapped "{[/manage/metrics || /manage/metrics.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2017-01-13 15:31:39.666
INFO 62119 --- [
main] o.s.b.a.e.mvc.EndpointHandlerMapping
: Mapped "{[/manage/mappings || /manage/mappings.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2017-01-13 15:31:39.667
INFO 62119 --- [
main] o.s.b.a.e.mvc.EndpointHandlerMapping
: Mapped "{[/manage/trace || /manage/trace.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2017-01-13 15:31:39.667
INFO 62119 --- [
main] o.s.b.a.e.mvc.EndpointHandlerMapping
: Mapped "{[/manage/info || /manage/info.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2017-01-13 15:31:39.668
INFO 62119 --- [
main] o.s.b.a.e.mvc.EndpointHandlerMapping
: Mapped "{[/manage/configprops || /manage/configprops.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2017-01-13 15:31:39.669
INFO 62119 --- [
main] o.s.b.a.e.mvc.EndpointHandlerMapping
: Mapped "{[/manage/heapdump || /manage/heapdump.json],methods=[GET],produces=[application/octet-stream]}" onto public void org.springframework.boot.actuate.endpoint.mvc.HeapdumpMvcEndpoint.invoke(boolean,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) throws java.io.IOException,javax.servlet.ServletException
2017-01-13 15:31:39.669
INFO 62119 --- [
main] o.s.b.a.e.mvc.EndpointHandlerMapping
: Mapped "{[/manage/autoconfig || /manage/autoconfig.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2017-01-13 15:31:39.673
INFO 62119 --- [
main] o.s.b.a.e.mvc.EndpointHandlerMapping
: Mapped "{[/manage/env/{name:.*}],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EnvironmentMvcEndpoint.value(java.lang.String)
2017-01-13 15:31:39.673
INFO 62119 --- [
main] o.s.b.a.e.mvc.EndpointHandlerMapping
: Mapped "{[/manage/env || /manage/env.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2017-01-13 15:31:39.674
INFO 62119 --- [
main] o.s.b.a.e.mvc.EndpointHandlerMapping
: Mapped "{[/manage/health || /manage/health.json],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.invoke(java.security.Principal)
2017-01-13 15:31:39.675
INFO 62119 --- [
main] o.s.b.a.e.mvc.EndpointHandlerMapping
: Mapped "{[/manage/dump || /manage/dump.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2017-01-13 15:31:39.677
INFO 62119 --- [
main] o.s.b.a.e.mvc.EndpointHandlerMapping
: Mapped "{[/manage/shutdown || /manage/shutdown.json],methods=[POST]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.ShutdownMvcEndpoint.invoke()
2017-01-13 15:31:39.678
INFO 62119 --- [
main] o.s.b.a.e.mvc.EndpointHandlerMapping
: Mapped "{[/manage/beans || /manage/beans.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2017-01-13 15:31:39.799
INFO 62119 --- [
main] o.s.j.e.a.AnnotationMBeanExporter
: Registering beans for JMX exposure on startup
2017-01-13 15:31:39.809
INFO 62119 --- [
main] o.s.c.support.DefaultLifecycleProcessor
: Starting beans in phase 0
2017-01-13 15:31:39.944
INFO 62119 --- [
main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2017-01-13 15:31:39.949
INFO 62119 --- [
main] com.test.Example
: Started Example in 4.292 seconds (JVM running for 4.726)
3. Spring Boot应用关闭
Spring Boot应用关闭的前提条件是POM.xml添加以下内容:
&org.springframework.boot&
&spring-boot-starter-actuator&
application.properties中添加:
#启用shutdown
endpoints.shutdown.enabled=true
#禁用密码验证
endpoints.shutdown.sensitive=false
关闭命令为:
curl -X POST host:port/shutdown
$ curl -X POST http:
{"message":"Shutting down, bye..."}
$ curl -X POST http:
{"message":"Shutting down, bye..."}
如果要配置路径,需要在application.properties中添加management.context-path=/manage,则关闭命令变为curl
-X POST host:port/manage/shutdown。
4. 安全验证
如果在关闭时需要安全验证,则在pom.xml文件中添加:
&org.springframework.boot&
&spring-boot-starter-security&
application.properties中添加:
#开启shutdown的安全验证
endpoints.shutdown.sensitive=true
#验证用户名
security.user.name=admin
security.user.password=admin
management.security.role=SUPERUSER
# 指定端口
management.port=8081
# 指定地址
management.address=127.0.0.1
关闭命令为:
curl -u admin:admin -X POST http:
$ curl -u admin:admin -X POST http:
{"message":"Shutting down, bye..."}
没有更多推荐了,
(window.slotbydup=window.slotbydup || []).push({
id: '4770930',
container: s,
size: '300,250',
display: 'inlay-fix'Spring/SpringMVC在启动完成后执行方法
转载地址:
关键字:spring容器加载完毕做一件事情(利用ContextRefreshedEvent事件)
应用场景:很多时候我们想要在某个类加载完毕时干某件事情,但是使用了spring管理对象,我们这个类引用了其他类(可能是更复杂的关联),所以当我们去使用这个类做事情时发现包空指针错误,这是因为我们这个类有可能已经初始化完成,但是引用的其他类不一定初始化完成,所以发生了空指针错误,解决方案如下:
1、写一个类继承spring的ApplicationListener监听,并监控ContextRefreshedEvent事件(容易初始化完成事件)
2、定义简单的bean:&bean id="beanDefineConfigue" class="com.creatar.portal.webservice.BeanDefineConfigue"&&/bean&
或者直接使用@Component("BeanDefineConfigue")注解方式
完整的类如下:
package com.creatar.portal.
import org.springframework.context.ApplicationL
import org.springframework.context.event.ContextRefreshedE
import org.springframework.stereotype.C
@Component("BeanDefineConfigue")
public class BeanDefineConfigue implements
ApplicationListener&ContextRefreshedEvent& {//ContextRefreshedEvent为初始化完毕事件,spring还有很多事件可以利用
// @Autowired
// private IRoleDao roleD
* 当一个ApplicationContext被初始化或刷新触发
public void onApplicationEvent(ContextRefreshedEvent event) {
// roleDao.getUserList();//spring容器初始化完毕加载用户列表到内存
System.out.println("spring容易初始化完毕================================================");
或者使用xml配置方式(非注解),简单配置个bean即可
&bean id="beanDefineConfigue" class="com.creatar.portal.webservice.BeanDefineConfigue"&&/bean&
其他定义方式:
完整的类如下:
package com.creatar.portal.
import java.util.ArrayL
import java.util.L
import org.springframework.context.ApplicationE
import org.springframework.context.ApplicationL
import org.springframework.context.event.ContextRefreshedE
import org.springframework.stereotype.C
@Component("BeanDefineConfigue2")
public class BeanDefineConfigue2 implements ApplicationListener&ApplicationEvent& {
List&String& list = new ArrayList&String&();
* 当一个ApplicationContext被初始化或刷新触发
public void onApplicationEvent(ApplicationEvent event) {
if (event instanceof ContextRefreshedEvent) {
System.out.println("spring容易初始化完毕================================================888");
spring其他事件:
spring中已经内置的几种事件:
ContextClosedEvent
、ContextRefreshedEvent
、ContextStartedEvent
、ContextStoppedEvent
、RequestHandleEvent后续研究:
applicationontext和使用MVC之后的webApplicationontext会两次调用上面的方法,如何区分这个两种容器呢?
但是这个时候,会存在一个问题,在web 项目中(spring mvc),系统会存在两个容器,一个是root application context ,另一个就是我们自己的 projectName-servlet context(作为root application context的子容器)。
这种情况下,就会造成onApplicationEvent方法被执行两次。为了避免上面提到的问题,我们可以只在root application context初始化完成后调用逻辑代码,其他的容器的初始化完成,则不做任何处理,修改后代码
public void onApplicationEvent(ContextRefreshedEvent event) {
if(event.getApplicationContext().getParent() == null){//root application context 没有parent,他就是老大.
//需要执行的逻辑代码,当spring容器初始化完成后就会执行该方法。
后续发现加上以上判断还是能执行两次,不加的话三次,最终研究结果使用以下判断更加准确:event.getApplicationContext().getDisplayName().equals("Root WebApplicationContext")
没有更多推荐了,&nbsp>&nbsp
&nbsp>&nbsp
&nbsp>&nbsp
Spring系列,第3部分:进入Spring MVC - 用Spring MVC轻松进行应用程序开发
摘要:SpringMVC框架Spring框架提供了构建Web应用程序的全功能MVC模块。使用Spring可插入的MVC架构,可以选择是使用内置的SpringWeb框架还是Struts这样的Web框架。通过策略接口,Spring框架是高度可配置的,而且包含多种视图技术,例如JavaServerPages(JSP)技术、Velocity、Tiles、iText和POI。SpringMVC框架并不知道使用的视图,所以不会强迫您只使用JSP技术。SpringMVC分离了控制器、模型对象、分
Spring MVC 框架
Spring 框架提供了构建 Web 应用程序的全功能 MVC 模块。使用 Spring 可插入的 MVC 架构,可以选择是使用内置的 Spring Web 框架还是 Struts 这样的 Web 框架。通过策略接口,Spring 框架是高度可配置的,而且包含多种视图技术,例如 JavaServer Pages(JSP)技术、Velocity、Tiles、iText 和 POI。Spring MVC 框架并不知道使用的视图,所以不会强迫您只使用 JSP 技术。Spring MVC 分离了控制器、模型对象、分派器以及处理程序对象的角色,这种分离让它们更容易进行定制。
Spring 的 Web MVC 框架是围绕 DispatcherServlet 设计的,它把请求分派给处理程序,同时带有可配置的处理程序映射、视图解析、本地语言、主题解析以及上载文件支持。默认的处理程序是非常简单的 Controller 接口,只有一个方法 ModelAndView handleRequest(request, response)。Spring 提供了一个控制器层次结构,可以派生子类。如果应用程序需要处理用户输入表单,那么可以继承 AbstractFormController。如果需要把多页输入处理到一个表单,那么可以继承 AbstractWizardFormController。
示例应用程序有助于直观地学习这些特性。银行应用程序允许用户检索他们的帐户信息。在构建银行应用程序的过程中,可以学到如何配置 Spring MVC 框架和实现框架的视图层,视图层包括 JSTL 标记(用于显示输出的数据)和JavaServer Pages 技术。
配置 Spring MVC
要开始构建示例应用程序,请配置 Spring MVC 的 DispatcherServlet。请在 web.xml 文件中注册所有配置。清单 1 显示了如何配置 sampleBankingServlet。
清单 1. 配置 Spring MVC DispatcherServlet
&servlet& &servlet-name&sampleBankingServlet&/servlet-name& &servlet-class& org.springframework.we.servlet.DispatcherServlet &servlet-class& &load-on-startup&1&load-on-startup&&servlet&
DispatcherServlet 从一个 XML 文件装入 Spring 应用程序上下文,XML 文件的名称是 servlet 的名称后面加上 -servlet 。在这个示例中,DispatcherServlet 会从 sampleBankingServlet-servlet.xml 文件装入应用程序上下文。
配置应用程序的 URL
下一步是配置想让 sampleBankingServlet 处理的 URL。同样,还是要在 web.xml 中注册所有这些信息。
清单 2. 配置想要处理的 URL
&servlet-mapping&&servlet-name& sampleBankingServlet&servlet-name&&url-pattern&*.jsp&/url-pattern&&/servlet-mapping&
以上是的内容,更多
的内容,请您使用右上方搜索功能获取相关信息。
若你要投稿、删除文章请联系邮箱:zixun-group@service.aliyun.com,工作人员会在五个工作日内给你回复。
云服务器 ECS
可弹性伸缩、安全稳定、简单易用
&40.8元/月起
预测未发生的攻击
&24元/月起
邮箱低至5折
推荐购买再奖现金,最高25%
&200元/3月起
你可能还喜欢
你可能感兴趣
阿里云教程中心为您免费提供
Spring系列,第3部分:进入Spring MVC - 用Spring MVC轻松进行应用程序开发相关信息,包括
的信息,所有Spring系列,第3部分:进入Spring MVC - 用Spring MVC轻松进行应用程序开发相关内容均不代表阿里云的意见!投稿删除文章请联系邮箱:zixun-group@service.aliyun.com,工作人员会在五个工作日内答复
售前咨询热线
支持与服务
资源和社区
关注阿里云
International15:55 提问
2个dubbo应用存在互相调用,怎么启动?
现在给公司的一个大项目做水平拆分,拆成2个web项目,其中共用的部分使用dubbo调用,都拆完了突然发现一个问题
这2个项目a和b,相互之间都有调用,a项目提供接口供b调用,同时a也调用b项目提供的接口,那么问题来了
我启动a的时候,由于b还没有启动,在spring加载的时候会报错
No provider available for the service
同样我单独启动b的时候也是一样,这样就造成了单独启动哪个都启动不来的情况。。这个怎么解决?
按赞数排序
dubbo:reference
id="layoutService" interface="com.ehualu.alarm.interfaces.LayoutInterface" check="false"
check=false配上
将依赖项提取出来放在第三个项目中,启动它,再分别启动那两个项目。
互相依赖的设计本身就是错误的,你这样搞,以后也无法做到对用户透明发布。
把check=false写上就可以了。
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!
其他相关推荐
随着项目的精分,以及小型化,一个大的项目会被拆分为数个小而精简的项目。会分为前端项目,接口项目以及服务项目等等。那么前端接口怎么来调用其他的服务项目呢,这时就需要用到dubbo服务来调用这些服务。
2.在使用dubbo服务之前,需要先了解dubbo服务的运行原理。dubbo服务主要分为四个模块,有三大主要功能模块:提供者,使用者,注册中心,如下图:
图中server就是服务提供者,...
本文基于上一篇文章,介绍了如何在web项目中调用提供者的接口
31、搭建生产者
1)创建maven程序
这里以quickstart为例
2)引入依赖,
3)编写实体类
4)编写接口
5)编写实现类
6)编写配置
2、编写消费者
代码如下:
project xmlns=&http://maven.apache.org/POM/4.0
#!/bin/bash
cd `dirname $0`
BIN_DIR=`pwd`
DEPLOY_DIR=`pwd`
CONF_DIR=$DEPLOY_DIR/conf
SERVER_NAME=`echo ${DEPLOY_DIR}`
if [ -z &$SERVER_NAME& ]; then
SERVER_NAME=`hostname`
服务端启动过程分析1
触发服务注册过程服务端的启动过程中,对服务暴露由ServiceBean类开始处理逻辑,该类继承了&dubbo:service&标签对应的配置类ServiceConfig,还实现了一系列Spring接口用于参与Spring容器的启动以及bean的创建过程中去。ServiceBean类实现了InitializingBean接口的afterPropertiesSet方...
ERROR context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'uriBrokerService': Cannot create inner bean '(inner
修改阿里官方脚本,保证脚本的可执行性,应用于dubbo服务的启动和停止,文档目录应该符合bin、log、lib、conf结构,bin中放置脚本
开发时遇到一个dubbo子系统之间循环调用的问题,纠结了好几天,今天发现官网是这么说的:
启动时检查
Dubbo缺省会在启动时检查依赖的服务是否可用,不可用时会抛出异常,阻止Spring初始化完成,以便上线时,能及早发现问题,默认check=true。
如果你的Spring容器
1.访问地址
https://github.com/alibaba/dubbo(https://github.com/apache/incubator-dubbo)下载源码注:如下页面中直接下载的源码版本为2.0.0,选择其他版本时点击“ 51 releases”2.选择需要的版本,下载源码!注:这里选择2.5.8版本的为例!3.解压源码文件到当前目录4.进入dubbo-admin的目录下执行...
dubbo服务发布之后,我们可以利用telnet命令进行调试、管理。
Dubbo2.0.5以上版本服务提供端口支持telnet命令,下面我以通过实例抛砖引玉一下:
1.连接服务
测试对应IP和端口下的dubbo服务是否连通,cmd命令如下,这里的端口号是dubbo服务注册的zookeeper端口
telnet localhost 20880}

我要回帖

更多关于 不能启动此对象的源应用程序 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信