本文使用的是dubbo提供的主类com.alibaba.dubbo.container.Main启动容器。
主要区别是提供不同插件的的启动方式。

目录

一、项目内容
 1.1、目录结构图
 1.2、相关文件配置
二、运行容器方式
 2.1 使用Java命令启动(手动)
  2.1.1 使用maven-shade-plugin 插件打包运行
  2.1.2 使用 maven-jar-plugin 插件和 maven-dependency-plugin 插件打包运行
 2.2 使用脚本启动
  2.2.1 windows启动脚本start.bat
  2.2.2 linux启动脚本start.sh
  2.2.3 linux停止脚本stop.sh
  2.2.4 linux重启脚本restart.sh

一、项目内容

1.1 目录结构如图:

 
 

1.2 相关文件的配置

  • DemoService
package com.test.provider;

/**
* Created by Administrator on 2018/2/1.
*/
public interface DemoService { String sayHello(String word);
}
  • DemoServiceImpl
package com.test.provider;

import org.springframework.stereotype.Service;

/**
* Created by Administrator on 2018/2/1.
*/
@Service("demoService")
public class DemoServiceImpl implements DemoService { public String sayHello(String word) {
return "hello " + word + ",I'm provider \r\n";
}
}
  • assemble-descriptor.xml
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>bin</id>
<formats>
<format>tar.gz</format>
<format>zip</format>
</formats>
<includeBaseDirectory>true</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>src/main/resources/bin</directory>
<outputDirectory>bin</outputDirectory>
<includes>
<include>*</include>
</includes>
<fileMode>0755</fileMode>
<filtered>true</filtered>
</fileSet>
<fileSet>
<directory>src/main/resources/cconf</directory>
<outputDirectory>cconf</outputDirectory>
<includes>
<include>*</include>
</includes>
<fileMode>0755</fileMode>
<filtered>true</filtered>
</fileSet>
</fileSets>
<dependencySets>
<dependencySet>
<outputDirectory>lib</outputDirectory>
<useProjectArtifact>true</useProjectArtifact>
<unpack>false</unpack>
<scope>runtime</scope>
</dependencySet>
</dependencySets>
</assembly>
  • application.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <import resource="classpath:cconf/dubbo-provider.xml"/> </beans>
  • dubbo-provider.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <context:component-scan base-package="com.test.provider"/> <!--IP 为zookeeper 地址-->
<dubbo:registry protocol="zookeeper" address="47.93.200.10:2181"/> <dubbo:service interface="com.test.provider.DemoService" ref="demoService" /> </beans>
  • dubbo.properties
#把属行放在该文件主要是为了方便使用脚本启动时,获取以下的信息
dubbo.application.name=hello-provider
dubbo.protocol.name=dubbo
dubbo.protocol.port=20880
  • pom.xml
<?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>com.jay.test.dubbo-zookeeper</groupId>
<artifactId>hello-provider</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging> <properties>
<spring.version>4.3.8.RELEASE</spring.version>
</properties> <dependencies> <dependency>
<groupId>com.alibaba</groupId>
<artifactId>dubbo</artifactId>
<version>2.5.9</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
</exclusion>
</exclusions>
</dependency>
<!--dubbo注册中心-->
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<version>3.4.10</version>
</dependency>
<!--zookeeper客户端-->
<dependency>
<groupId>com.github.sgroschupf</groupId>
<artifactId>zkclient</artifactId>
<version>0.1</version>
</dependency> <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
</dependency>
</dependencies> <build>
<resources>
<resource>
<targetPath>${project.build.directory}/classes</targetPath>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/*.*</include>
</includes>
</resource>
<!--dubbo 容器配置-->
<!-- 把 directory 下的 include 文件 复制到 targetPath-->
<resource>
<!--dubbo 默认指定的容器启动目录-->
<targetPath>${project.build.directory}/classes/META-INF/spring</targetPath>
<directory>src/main/resources/cconf</directory>
<filtering>true</filtering>
<includes>
<include>application.xml</include>
</includes>
</resource>
</resources>
<plugins> <!--java命令启动:第一种打包方式-->
<!--<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.alibaba.dubbo.container.Main</mainClass>
</transformer>
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.handlers</resource>
</transformer>
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.schemas</resource>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>--> <!--分————————————割——————————————————线--> <!--java命令:第二种打包方式-->
<!--<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
&lt;!&ndash; <classesDirectory>target/classes/</classesDirectory>&ndash;&gt;
<archive>
<manifest>
<mainClass>com.alibaba.dubbo.container.Main</mainClass>
&lt;!&ndash; 打包时 MANIFEST.MF文件不记录的时间戳版本 &ndash;&gt;
<useUniqueVersions>false</useUniqueVersions>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
<manifestEntries>
<Class-Path>.</Class-Path>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<type>jar</type>
<includeTypes>jar</includeTypes>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>--> <!--分————————————割——————————————————线--> <!--脚本启动使用的插件-->
<!--该插件可以做额外的文件打包,比如bin目录,conf配置文件夹。使用java 命令启动可忽略该插件-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>make-binary-pacakge</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<!--打包后的报名-->
<finalName>deploy-jar</finalName>
<!-- 包名是否追加assemble-descriptor.xml中的id-->
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/main/resources/assemble/assemble-descriptor.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

二、运行容器方式

2.1、使用java命令启动(手动)

2.1.1 方法一:使用maven-shade-plugin 插件打包运行

pom主要使用如下配置

<build>
<resources>
<!--主要是把src/main/resources下的所有的文件中的变量替换-->
<!--如:dubbo.properties 中的prop.log.dir=${pom.log.dir},pom.log.dir配置在pom.xml文件中-->
<resource>
<targetPath>${project.build.directory}/classes</targetPath>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/*.*</include>
</includes>
</resource>
<!--dubbo 容器配置-->
<!-- 把 directory 下的 include 文件 复制到 targetPath-->
<resource>
<!--dubbo 默认指定的容器启动目录-->
<targetPath>${project.build.directory}/classes/META-INF/spring</targetPath>
<directory>src/main/resources/cconf</directory>
<filtering>true</filtering>
<includes>
<include>application.xml</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.alibaba.dubbo.container.Main</mainClass>
</transformer>
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.handlers</resource>
</transformer>
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.schemas</resource>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

打包完成后target如下

 
 

在jar包的目录打开cmd,运行命令 java -jar hello-provider-1.0-SNAPSHOT.jar,如下图即启动成功

 
 

在dubbo-ammin 也能看到对应的注册信息

 
 
2.1.2 使用 maven-jar-plugin 插件和 maven-dependency-plugin 插件

pom主要使用如下配置

<build>
<resources>
<resource>
<targetPath>${project.build.directory}/classes</targetPath>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/*.*</include>
</includes>
</resource>
<!--dubbo 容器配置-->
<!-- 把 directory 下的 include 文件 复制到 targetPath-->
<resource>
<!--dubbo 默认指定的容器启动目录-->
<targetPath>${project.build.directory}/classes/META-INF/spring</targetPath>
<directory>src/main/resources/cconf</directory>
<filtering>true</filtering>
<includes>
<include>application.xml</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<!-- <classesDirectory>target/classes/</classesDirectory>-->
<archive>
<manifest>
<mainClass>com.alibaba.dubbo.container.Main</mainClass>
<!-- 打包时 MANIFEST.MF文件不记录的时间戳版本 -->
<useUniqueVersions>false</useUniqueVersions>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
<manifestEntries>
<Class-Path>.</Class-Path>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<type>jar</type>
<includeTypes>jar</includeTypes>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

打包完成后target如下图

 
 

打开target目录,运行 java -jar hello-provider-1.0-SNAPSHOT.jar 即可,是否注册成功参照2.1.1图
注:该方式jar包和lib包必须在同一目录下运行java命令才能启动spring容器

2.2 使用脚本启动

dubbo也提供脚本启动方式,在dubbo-2.5.9.jar中的META-INF/assembly.bin下有提供模板文件。

 
 

使用脚本启动容器只需要使用 maven-assembly-plugin 插件即可。主要配置如下:

<build>
<resources>
<resource>
<targetPath>${project.build.directory}/classes</targetPath>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/*.*</include>
</includes>
</resource>
<!--dubbo 容器配置-->
<!-- 把 directory 下的 include 文件 复制到 targetPath-->
<resource>
<!--dubbo 默认指定的容器启动目录-->
<targetPath>${project.build.directory}/classes/META-INF/spring</targetPath>
<directory>src/main/resources/cconf</directory>
<filtering>true</filtering>
<includes>
<include>application.xml</include>
</includes>
</resource>
</resources>
<plugins>
<!--脚本启动使用的插件-->
<!--该插件可以做额外的文件打包,比如bin目录,conf配置文件夹。使用java 命令启动可忽略该插件-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>make-binary-pacakge</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<!--打包后的报名-->
<finalName>deploy-jar</finalName>
<!-- 包名是否追加assemble-descriptor.xml中的id-->
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/main/resources/assemble/assemble-descriptor.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

重新编译打包项目,在target下会出现两个文件:deploy-jar.zip和deploy-jar.tar.gz。windows使用deploy-jar.zip,linux使用deploy-jar.tar.gz。再上传到对应服务器上解压内容如下:

 
 

进入bin目录,windows启动使用bat,linux使用sh脚本

2.2.1 windows启动脚本start.bat

内容如下,双击start.bat即可运行,验证方式如方法一

@echo off & setlocal enabledelayedexpansion

set LIB_JARS=..\cconf
cd ..\lib
for %%i in (*) do set LIB_JARS=!LIB_JARS!;..\lib\%%i
cd ..\bin echo Starting the server [服务名] ...... java -classpath %LIB_JARS% com.alibaba.dubbo.container.Main endlocal
2.2.2 linux启动脚本start.sh

进入bin目录,执行./start.sh,验证方式如方法一

#!/bin/bash
cd `dirname $0`
BIN_DIR=`pwd`
cd ..
DEPLOY_DIR=`pwd`
CONF_DIR=$DEPLOY_DIR/cconf # =======================================================================================
# 检测操作系统类型
# =======================================================================================
OS=`uname -s | tr [:upper:] [:lower:] | tr -d [:blank:]`
case "$OS" in
'sunos')
# OS="solaris"
;;
'hp-ux' | 'hp-ux64') # 未经过验证
# OS="linux"
;;
'darwin') # Mac OSX
OS="unix"
;;
'unix_sv')
OS="unix"
;;
esac
# 该脚本目前只支持linux、Mac OSX
if [ "$OS" != "linux" ] && [ "$OS" != "unix" ]; then
echo "Unsupported OS: $OS"
exit 1
fi # =======================================================================================
# 检测服务是否已经启动,或者端口号是否已经被占用
# Mac OSX支持: ps -e -o 'pid=,command=',但linux必须写成: ps -e -o 'pid=' -o 'command='
# =======================================================================================
PIDS=`ps -e -o 'pid=' -o 'command='|grep java|grep "$CONF_DIR"|awk '{print $1}'`
if [ -n "$PIDS" ]; then
# 服务已经启动
echo "ERROR: The $SERVER_NAME already started!"
echo "PID: $PIDS"
exit 1
fi
if [ -n "$SERVER_PORT" ]; then
# 端口号是否被占用
# netstat的输出格式:
# linux: 192.168.169.1:10050
# Mac OSX: 192.168.169.2.56508
if [ "$OS" == "unix" ]; then
SERVER_PORT_COUNT=`netstat -ant -p tcp|tail -n +3|awk '{print $4}'|grep '[.:]$SERVER_PORT' -c`
else
SERVER_PORT_COUNT=`netstat -ant|tail -n +3|awk '{print $4}'|grep '[.:]$SERVER_PORT' -c`
fi
if [ $SERVER_PORT_COUNT -gt 0 ]; then
echo "ERROR: The $SERVER_NAME port $SERVER_PORT already used!"
exit 1
fi
fi # =======================================================================================
# 启动服务
# =======================================================================================
# dubbo服务配置参数
SERVER_NAME=`sed '/^#/d;/dubbo.application.name/!d;s/.*=//' cconf/dubbo.properties | tr -d '\r'`
if [ -z "$SERVER_NAME" ]; then
SERVER_NAME=`hostname`
fi
SERVER_PORT=`sed '/^#/d;/dubbo.protocol.port/!d;s/.*=//' cconf/dubbo.properties | tr -d '\r'`
SERVER_HOST=`sed '/^#/d;/dubbo.protocol.host/!d;s/.*=//' cconf/dubbo.properties | tr -d '\r'`
if [ -z "$SERVER_HOST" ]; then
SERVER_HOST=127.0.0.1
fi # 日志:log4j.xml文件路径、日志路径、stdout日志文件名
LOG4J_XML=`sed '/^#/d;/prop.log.log4j-xml/!d;s/.*=//' cconf/dubbo.properties | tr -d '\r'`
LOG_DIR=`sed '/^#/d;/prop.log.dir/!d;s/.*=//' cconf/dubbo.properties | tr -d '\r'`
if [ -n "$LOG_DIR" ]; then
LOG_DIR=`dirname $LOG_DIR/stdout.log`
else
LOG_DIR=$DEPLOY_DIR/logs
fi
if [ ! -d $LOG_DIR ]; then
# 日志目录不存在,创建这个目录
mkdir -p $LOG_DIR
fi
LOG_STDOUT=`sed '/^#/d;/prop.log.stdout-file/!d;s/.*=//' cconf/dubbo.properties | tr -d '\r'`
if [ -z "$LOG_STDOUT" ]; then
LOG_STDOUT=$LOG_DIR/stdout.log
else
OG_STDOUT=$LOG_DIR/$LOG_STDOUT
fi # classpath设置
LIB_DIR=$DEPLOY_DIR/lib
LIB_JARS=`ls $LIB_DIR|grep .jar|awk '{print "'$LIB_DIR'/"$0}'|tr "\n" ":"`
CLASS_PATH=$CONF_DIR:$LIB_JARS JAVA_OPTS=" -Dfile.encoding=utf-8 -Duser.language=en -Duser.country=US -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dlog4j.configuration=$LOG4J_XML " echo "Starting the $SERVER_NAME, $SERVER_HOST:$SERVER_PORT" nohup java $JAVA_OPTS -classpath $CLASS_PATH com.alibaba.dubbo.container.Main > $LOG_STDOUT 2>&1 & # =======================================================================================
# 检测服务状态,服务启动状态OK之后再退出
# =======================================================================================
echo -e " Waiting for service [$SERVER_HOST $SERVER_PORT] status OK ...\c"
COUNT=0
while [ $COUNT -lt 1 ]; do
echo -e ".\c"
sleep 1
# 能够连通服务端口号,则服务启动完成
COUNT=`echo status | nmap $SERVER_HOST -p $SERVER_PORT | grep -c open`
done
echo "OK!"
# 下面ps命令参数兼容linux、Mac OSX(Free BSD)
PIDS=`ps -e -o 'pid=' -o 'command='|grep java|grep "$CONF_DIR"|awk '{print $1}'`
echo " PID: $PIDS"
echo " STDOUT: $LOG_STDOUT"
2.2.3 linux停止脚本stop.sh
#!/bin/bash
cd `dirname $0`
BIN_DIR=`pwd`
cd ..
DEPLOY_DIR=`pwd`
CONF_DIR=$DEPLOY_DIR/cconf SERVER_NAME=`sed '/^#/d;/dubbo.application.name/!d;s/.*=//' cconf/dubbo.properties | tr -d '\r'`
if [ -z "$SERVER_NAME" ]; then
SERVER_NAME=`hostname`
fi PIDS=`ps -e -o 'pid=' -o 'command='|grep java|grep "$CONF_DIR"|awk '{print $1}'`
if [ -z "$PIDS" ]; then
echo "ERROR: The $SERVER_NAME does not started!"
exit 1
fi echo "Stopping the $SERVER_NAME ..."
for PID in $PIDS ; do
kill $PID > /dev/null 2>&1
echo " PID: $PID"
done echo -e " Waiting PIDS to quit ...\c"
COUNT=0
while [ $COUNT -lt 1 ]; do
echo -e ".\c"
sleep 1
COUNT=1
for PID in $PIDS ; do
PID_EXIST=`ps -p $PID|tail -n +2|wc -l`
if [ "$PID_EXIST" -gt 0 ]; then
COUNT=0
break
fi
done
done
echo "OK!"
2.2.4 linux重启脚本restart.sh
#!/bin/bash
cd `dirname $0`
./stop.sh
./start.sh

原文链接:https://www.jianshu.com/p/34464216a293
来源:简书

dubbo框架提供Main方法运行容器的几种方式(转)的更多相关文章

  1. 右击main 方法运行正常,启动tomcat 后,spring boot 项目 出现参数字符串是乱码的情况

    PrintWriter out = new PrintWriter(new OutputStreamWriter(conn.getOutputStream(), "utf-8")) ...

  2. 进入Docker容器的4种方式

    进入Docker容器的4种方式 在使用Docker创建了容器之后,大家比较关心的就是如何进入该容器了,其实进入Docker容器有好几多种方式,这里我们就讲一下常用的几种进入Docker容器的方法. 进 ...

  3. 普通java类加入spring容器的四种方式

    今天在自己开发的工具类中使用了spring注入的方式调用了其他类,但是发生的报错,在整理了后今天小结一下. 首先简单介绍下spring容器,spring容器是整个spring框架的核心,通常我们说的s ...

  4. Docker容器互访三种方式

    我们都知道docker容器之间是互相隔离的,不能互相访问,但如果有些依赖关系的服务要怎么办呢.下面介绍三种方法解决容器互访问题. 方式一.虚拟ip访问 安装docker时,docker会默认创建一个内 ...

  5. 【HttpRunner v3.x】笔记—8.运行testcase的几种方式

    在之前的demo过程中,已经运行过testcase了,那这篇就也来汇总一下,运行case相关的知识点. 一.运行testcase的几种场景 1. 运行单个case 通常单个case的话我会在编辑器里用 ...

  6. day2 编程语言介绍、Python运行程序的两种方式、变量

    一 编程语言介绍 1. 机器语言 用计算机能理解的二进制指令直接编写程序,直接控制硬件 2. 汇编语言 用英文标签取代二进制指令编写程序,本质也是直接控制硬件 3. 高级语言 用人能理解的表达方式去编 ...

  7. dubbo框架的使用方法。。。

    图解. 一.dubbo使用须知. 1.所有的service层必须要使用service注解(之前用的spring框架的,现在用dubbo框架所提供的@Service注解) // @Service(tim ...

  8. Docker 进入正在运行的容器的4种方式

    在使用Docker创建了容器之后,如何进入该容器呢? 进入Docker容器比较常见的几种做法如下: 使用docker attach 使用SSH 使用nsenter 使用exec 一.使用docker ...

  9. Docker 进入容器的几种方式

    进入Docker容器比较常见的几种做法如下: 使用docker attach 使用SSH 使用nsenter 使用exec 一.使用docker attach进入Docker容器 Docker提供了a ...

随机推荐

  1. 委托(2).net 1.x中的委托

    上一篇已经演示了使用委托实现一个多语言问候的程序,这一篇文章来总结一下在.net 1.x中委托的使用方法. 既然委托是一个类型(class),那么它就要经历像类一个先声明,然后new一个对象,最后调用 ...

  2. Djang之cookie和session

    一 会话跟踪 我们需要先了解一下什么是会话!可以把会话理解为客户端与服务器之间的一次会晤,在一次会晤中可能会包含多次请求和响应.例如你给10086打个电话,你就是客户端,而10086服务人员就是服务器 ...

  3. 12月16日广州.NET俱乐部下午4点爬白云山活动

    正如我们在<广州.NET微软技术俱乐部与其他技术群的区别>和<广州.NET微软技术俱乐部每周三五晚周日下午爬白云山活动>里面提到的, 我们会在每周三五晚和周日下午爬白云山.   ...

  4. 关于Skyline沿对象画boundingbox的探讨

    先来说说为什么要搞这个?项目中经常遇到的一个操作就是选定对象,以前都是通过Tint设置对象颜色来标识选定对象,但是随着图层中模型增多,模型色彩丰富,会出现选定色与对象颜色对比不明显的情况.因为看到Te ...

  5. Apex 中文件夹相关的单元测试

    Salesforce 中的文件夹 在 Salesforce 中,我们可以建立各种文档.报表.仪表板.电子邮件模板等.它们都被保存在相应的文件夹中. Salesforce 的后端将这些文件夹保存为 Fo ...

  6. [伟哥开源项目基金会](https://github.com/AspNetCoreFoundation)

    伟哥开源项目基金会 GitHub_base=> 伟哥开源项目基金会 该项目作者为伟哥,GitHub地址:https://github.com/amh1979: 该项目维护者为鸟窝,GitHub地 ...

  7. Redis订阅与发布

    发布与订阅模型在许多编程语言中都有实现,也就是我们经常说的设计模式中的一种--观察者模式.在一些应用场合,例如发送方并不是以固定频率发送消息,如果接收方频繁去咨询发送方,这种操作无疑是很麻烦并且不友好 ...

  8. JMeter中文返回乱码

    JMeter中文返回乱码 结果树响应数据中文返回乱码 其实有几个方法: 在线程组->http请求的字符集里设置 ​ 在http 消息管理头中设置 ​ 3.如果以上方法还没有解决,请打开安装目录 ...

  9. Ext.grid.panel 改变某一行的字体颜色

    grid.getStore().addListener('load', handleGridLoadEvent); function handleGridLoadEvent(store, record ...

  10. MySQL常用命令汇总(偏向运维管理)

    基础部分 1. select @@version; ##查询当前mysql的版本. 2. show variables like 'port';##查看mysql实例的端口. 3. show vari ...