同志们,java世界中巨人spring有个项目叫boot,现在很火,已经有公司在使用,能快速的搭建WEB应用,比传统的spring mvc搭建要快很多.不熟悉的同志们,看了我这篇日志,就会快自己搭建一个应用.闲话少说,上代码.
一,项目概述
1,IDE:eclipse Neon.1a Release (4.6.1)
2,Maven
3,Linux主机
二,项目结构
三,Pom配置
4.0.0
com.ishowact
callback
war
0.0.1-SNAPSHOT
org.springframework.boot
spring-boot-starter-parent
1.4.2.RELEASE
com.ishowact
ishowact-core
0.0.1-SNAPSHOT
org.springframework.boot
spring-boot-starter-web
org.springframework.boot
spring-boot-starter-jdbc
mysql
mysql-connector-java
com.alibaba
dubbo
2.5.3
org.apache.zookeeper
zookeeper
3.4.9
com.101tec
zkclient
0.3
org.springframework.boot
spring-boot-starter-tomcat
provided
org.springframework.boot
spring-boot-maven-plugin
package callback.boot.controller;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
@Configuration //配置注解
@SpringBootApplication //springboot的注解
@ComponentScan(basePackages = "callback.boot") //扫描组件的包名
@ImportResource(locations={"classpath:dubbo.xml"})//加载配置文件
public abstract class BaseController {
}
package callback.boot.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ishowact.core.service.UserService;
@RestController
public class DubboController extends BaseController{
/**bubbo的服务的实现类*/
@Autowired
private UserService userService;
@RequestMapping("dubbo")
public String dubbo(){
String userName = userService.getUser(2250);
System.out.println(userName);
return "my Dubbo";
}
}
五,使用jdbcTemplate的Dao类
package callback.boot.dao.impl;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import callback.boot.domain.Callback;
@Component
public class CallbackDao{
private Logger logger = LoggerFactory.getLogger(CallbackDao.class);
/**在pom.xml中加入jdbc的依赖,在这里直接注入*/
@Autowired
private JdbcTemplate jdbcTemplate;
public int save(Callback t) {
logger.info("callDao...........................");
String sql = "select count(*) from t_app";
int num = (Integer) jdbcTemplate.queryForObject(sql, Integer.class);
System.out.println(num+">>>>>>>>>>>>>>>>>>>>>>>>>>>");
return num;
}
public List findById() {
return null;
}
}
1,自己本地测试启动服务
package callback.boot;
import org.springframework.boot.SpringApplication;
import callback.boot.controller.CallbackController;
import callback.boot.controller.DubboController;
import callback.boot.controller.MailController;
public class BootMain {
public static void main(String[] args) {
Object[] sources = new Object[]{
CallbackController.class,
MailController.class,
DubboController.class
};
//可以启动单个,也可以启动多个,本地启动服务,直接执行这个main方法即可
SpringApplication.run(sources, args);
}
}
2,部署war包到tomcat的启动类
package callback.boot;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import callback.boot.controller.CallbackController;
import callback.boot.controller.DubboController;
import callback.boot.controller.MailController;
/**
* Spring Boot启动类
* @author del
*/
public class ServletInitializer extends SpringBootServletInitializer{
private static Logger logger = LoggerFactory.getLogger(ServletInitializer.class);
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
logger.info("============应用启动了!!!=================");
return builder.sources(loadSources(null));
}
/**
* 便于以后改变加载策略
*/
private static Object[] loadSources(String controllerPackage){
List> sourceList = new ArrayList>();
sourceList.add(CallbackController.class);
sourceList.add(MailController.class);
sourceList.add(DubboController.class);
return sourceList.toArray();
}
}
七,各种配置文件
1,application.properties
#使用test配置,生产环境切换成product,很方便的撒
spring.profiles.active=test
2,application-product.properties(生产环境略)
3,application-test.properties(测试环境)
注意命名:application-xxx.properties,这关系到application.properties中的spring.profiles.active的参数设置
#仅仅本地内嵌的tomcat的配置,部署到外部tomcat,这个设置是没用的
server.port=8090
server.context-path=/boot
server.tomcat.max-threads=150
server.tomcat.uri-encoding=UTF-8
#logback的设置(本地,部署到外部tomcat有用)
logging.config=classpath:logback-spring.xml
#数据源(本地,部署外部都有用)
spring.datasource.url=jdbc:mysql://192.168.1.112:3306/test?useUnicode=true&characterEncoding=UTF-8
spring.datasource.username=root
spring.datasource.password=1234
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
4,logback-spring.xml
我没有梳理这个日志配置,同志们自己研究吧
%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg %n
/data/log/app.log
rest-demo.%d{yyyy-MM-dd}.log
30
%d{HH:mm:ss.SSS} [%thread] %-5level %logger{35} - %msg %n
5,banner,txt
这个是启动图案,可以去制作启动图案网站,制作好,拷贝到这个文件里即可,都是文本的
6,dubbo.xml
这是消费方的配置,关于dubbo的配置,不详说了
1,本地
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/F:/m2/repository/ch/qos/logback/logback-classic/1.1.7/logback-classic-1.1.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/F:/m2/repository/org/slf4j/slf4j-log4j12/1.7.21/slf4j-log4j12-1.7.21.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
___________ __
\_ _____/_ __ ____ | | __ ___.__. ____ __ __
| __)| | \/ \| |/ / < | |/ _ \| | \
| \ | | / | \ < \___ ( <_> ) | /
\___ / |____/|___| /__|_ \ / ____|\____/|____/
\/ \/ \/ \/
2016-11-27 13:51:43.187 INFO 21072 --- [ main] callback.boot.BootMain : Starting BootMain on dell with PID 21072 (D:\workspace\callback\target\classes started by del in D:\workspace\callback)
2016-11-27 13:51:43.243 INFO 21072 --- [ main] callback.boot.BootMain : The following profiles are active: test
2016-11-27 13:51:43.565 INFO 21072 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@29a0cdb: startup date [Sun Nov 27 13:51:43 CST 2016]; root of context hierarchy
2016-11-27 13:51:45.903 INFO 21072 --- [ main] o.s.b.f.xml.XmlBeanDefinitionReader : Loading XML bean definitions from class path resource [dubbo.xml]
2016-11-27 13:51:46.107 INFO 21072 --- [ main] c.a.dubbo.common.logger.LoggerFactory : using logger: com.alibaba.dubbo.common.logger.log4j.Log4jLoggerAdapter
2016-11-27 13:51:47.282 INFO 21072 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'dubbo-consumer' of type [class com.alibaba.dubbo.config.ApplicationConfig] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-11-27 13:51:47.306 INFO 21072 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'com.alibaba.dubbo.config.RegistryConfig' of type [class com.alibaba.dubbo.config.RegistryConfig] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-11-27 13:51:47.310 INFO 21072 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'userService' of type [class com.alibaba.dubbo.config.spring.ReferenceBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-11-27 13:51:47.430 INFO 21072 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$5ace086] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-11-27 13:51:48.740 INFO 21072 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8090 (http)
2016-11-27 13:51:48.773 INFO 21072 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat
2016-11-27 13:51:48.778 INFO 21072 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.6
2016-11-27 13:51:49.003 INFO 21072 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/boot] : Initializing Spring embedded WebApplicationContext
2016-11-27 13:51:49.004 INFO 21072 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 5439 ms
2016-11-27 13:51:49.411 INFO 21072 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2016-11-27 13:51:49.419 INFO 21072 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2016-11-27 13:51:49.422 INFO 21072 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2016-11-27 13:51:49.422 INFO 21072 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2016-11-27 13:51:49.422 INFO 21072 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2016-11-27 13:51:50.120 INFO 21072 --- [ main] c.a.d.r.zookeeper.ZookeeperRegistry : [DUBBO] Load registry store file C:\Users\del\.dubbo\dubbo-registry-192.168.1.112.cache, data: {com.ishowact.core.service.UserService=empty://192.168.1.111/com.ishowact.core.service.UserService?application=dubbo-consumer&category=configurators&dubbo=2.5.3&interface=com.ishowact.core.service.UserService&methods=getUser&pid=17228&side=consumer×tamp=1480225803386 empty://192.168.1.111/com.ishowact.core.service.UserService?application=dubbo-consumer&category=routers&dubbo=2.5.3&interface=com.ishowact.core.service.UserService&methods=getUser&pid=17228&side=consumer×tamp=1480225803386 dubbo://192.168.1.111:20880/com.ishowact.core.service.UserService?anyhost=true&application=dubbo-provider&dubbo=2.5.3&interface=com.ishowact.core.service.UserService&methods=getUser&pid=16524&revision=0.0.1-SNAPSHOT&side=provider×tamp=1480225783589}, dubbo version: 2.5.3, current host: 127.0.0.1
2016-11-27 13:51:50.167 INFO 21072 --- [.168.1.112:2181] org.I0Itec.zkclient.ZkEventThread : Starting ZkClient event thread.
2016-11-27 13:51:50.181 INFO 21072 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:zookeeper.version=3.4.9-1757313, built on 08/23/2016 06:50 GMT
2016-11-27 13:51:50.182 INFO 21072 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:host.name=dell
2016-11-27 13:51:50.182 INFO 21072 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:java.version=1.8.0_101
2016-11-27 13:51:50.183 INFO 21072 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:java.vendor=Oracle Corporation
2016-11-27 13:51:50.183 INFO 21072 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:java.home=D:\Program Files\Java\jdk1.8.0_101\jre
2016-11-27 13:51:50.183 INFO 21072 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:java.class.path=D:\workspace\callback\target\classes;D:\workspace\ishowact-core\target\classes;F:\m2\repository\org\springframework\boot\spring-boot-starter-web\1.4.2.RELEASE\spring-boot-starter-web-1.4.2.RELEASE.jar;F:\m2\repository\org\springframework\boot\spring-boot-starter\1.4.2.RELEASE\spring-boot-starter-1.4.2.RELEASE.jar;F:\m2\repository\org\springframework\boot\spring-boot\1.4.2.RELEASE\spring-boot-1.4.2.RELEASE.jar;F:\m2\repository\org\springframework\boot\spring-boot-autoconfigure\1.4.2.RELEASE\spring-boot-autoconfigure-1.4.2.RELEASE.jar;F:\m2\repository\org\springframework\boot\spring-boot-starter-logging\1.4.2.RELEASE\spring-boot-starter-logging-1.4.2.RELEASE.jar;F:\m2\repository\ch\qos\logback\logback-classic\1.1.7\logback-classic-1.1.7.jar;F:\m2\repository\ch\qos\logback\logback-core\1.1.7\logback-core-1.1.7.jar;F:\m2\repository\org\slf4j\jcl-over-slf4j\1.7.21\jcl-over-slf4j-1.7.21.jar;F:\m2\repository\org\slf4j\jul-to-slf4j\1.7.21\jul-to-slf4j-1.7.21.jar;F:\m2\repository\org\slf4j\log4j-over-slf4j\1.7.21\log4j-over-slf4j-1.7.21.jar;F:\m2\repository\org\springframework\spring-core\4.3.4.RELEASE\spring-core-4.3.4.RELEASE.jar;F:\m2\repository\org\yaml\snakeyaml\1.17\snakeyaml-1.17.jar;F:\m2\repository\org\hibernate\hibernate-validator\5.2.4.Final\hibernate-validator-5.2.4.Final.jar;F:\m2\repository\javax\validation\validation-api\1.1.0.Final\validation-api-1.1.0.Final.jar;F:\m2\repository\org\jboss\logging\jboss-logging\3.3.0.Final\jboss-logging-3.3.0.Final.jar;F:\m2\repository\com\fasterxml\classmate\1.3.3\classmate-1.3.3.jar;F:\m2\repository\com\fasterxml\jackson\core\jackson-databind\2.8.4\jackson-databind-2.8.4.jar;F:\m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.8.4\jackson-annotations-2.8.4.jar;F:\m2\repository\com\fasterxml\jackson\core\jackson-core\2.8.4\jackson-core-2.8.4.jar;F:\m2\repository\org\springframework\spring-web\4.3.4.RELEASE\spring-web-4.3.4.RELEASE.jar;F:\m2\repository\org\springframework\spring-aop\4.3.4.RELEASE\spring-aop-4.3.4.RELEASE.jar;F:\m2\repository\org\springframework\spring-beans\4.3.4.RELEASE\spring-beans-4.3.4.RELEASE.jar;F:\m2\repository\org\springframework\spring-context\4.3.4.RELEASE\spring-context-4.3.4.RELEASE.jar;F:\m2\repository\org\springframework\spring-webmvc\4.3.4.RELEASE\spring-webmvc-4.3.4.RELEASE.jar;F:\m2\repository\org\springframework\spring-expression\4.3.4.RELEASE\spring-expression-4.3.4.RELEASE.jar;F:\m2\repository\org\springframework\boot\spring-boot-starter-jdbc\1.4.2.RELEASE\spring-boot-starter-jdbc-1.4.2.RELEASE.jar;F:\m2\repository\org\apache\tomcat\tomcat-jdbc\8.5.6\tomcat-jdbc-8.5.6.jar;F:\m2\repository\org\apache\tomcat\tomcat-juli\8.5.6\tomcat-juli-8.5.6.jar;F:\m2\repository\org\springframework\spring-jdbc\4.3.4.RELEASE\spring-jdbc-4.3.4.RELEASE.jar;F:\m2\repository\org\springframework\spring-tx\4.3.4.RELEASE\spring-tx-4.3.4.RELEASE.jar;F:\m2\repository\org\jooq\jooq\3.8.5\jooq-3.8.5.jar;F:\m2\repository\mysql\mysql-connector-java\5.1.40\mysql-connector-java-5.1.40.jar;F:\m2\repository\com\jolbox\bonecp\0.8.0.RELEASE\bonecp-0.8.0.RELEASE.jar;F:\m2\repository\com\google\guava\guava\15.0\guava-15.0.jar;F:\m2\repository\org\slf4j\slf4j-api\1.7.21\slf4j-api-1.7.21.jar;F:\m2\repository\com\alibaba\dubbo\2.5.3\dubbo-2.5.3.jar;F:\m2\repository\org\springframework\spring\2.5.6.SEC03\spring-2.5.6.SEC03.jar;F:\m2\repository\commons-logging\commons-logging\1.1.1\commons-logging-1.1.1.jar;F:\m2\repository\org\javassist\javassist\3.20.0-GA\javassist-3.20.0-GA.jar;F:\m2\repository\org\jboss\netty\netty\3.2.5.Final\netty-3.2.5.Final.jar;F:\m2\repository\org\apache\zookeeper\zookeeper\3.4.9\zookeeper-3.4.9.jar;F:\m2\repository\org\slf4j\slf4j-log4j12\1.7.21\slf4j-log4j12-1.7.21.jar;F:\m2\repository\log4j\log4j\1.2.16\log4j-1.2.16.jar;F:\m2\repository\jline\jline\0.9.94\jline-0.9.94.jar;F:\m2\repository\io\netty\netty\3.10.5.Final\netty-3.10.5.Final.jar;F:\m2\repository\com\101tec\zkclient\0.3\zkclient-0.3.jar;F:\m2\repository\org\springframework\boot\spring-boot-starter-tomcat\1.4.2.RELEASE\spring-boot-starter-tomcat-1.4.2.RELEASE.jar;F:\m2\repository\org\apache\tomcat\embed\tomcat-embed-core\8.5.6\tomcat-embed-core-8.5.6.jar;F:\m2\repository\org\apache\tomcat\embed\tomcat-embed-el\8.5.6\tomcat-embed-el-8.5.6.jar;F:\m2\repository\org\apache\tomcat\embed\tomcat-embed-websocket\8.5.6\tomcat-embed-websocket-8.5.6.jar
2016-11-27 13:51:50.184 INFO 21072 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:java.library.path=D:\Program Files\Java\jdk1.8.0_101\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;D:\Program Files\Java\jdk1.8.0_101\jre\bin;D:/Program Files/Java/jdk1.8.0_101/bin/../jre/bin/server;D:/Program Files/Java/jdk1.8.0_101/bin/../jre/bin;D:/Program Files/Java/jdk1.8.0_101/bin/../jre/lib/amd64;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;D:\Program Files\Java\jdk1.8.0_101\bin;D:\apache-maven-3.3.9\bin;D:\MinGW\bin;D:\eclipse-jee;;.
2016-11-27 13:51:50.184 INFO 21072 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:java.io.tmpdir=C:\Users\del\AppData\Local\Temp\
2016-11-27 13:51:50.185 INFO 21072 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:java.compiler=
2016-11-27 13:51:50.185 INFO 21072 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:os.name=Windows 8.1
2016-11-27 13:51:50.185 INFO 21072 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:os.arch=amd64
2016-11-27 13:51:50.185 INFO 21072 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:os.version=6.3
2016-11-27 13:51:50.185 INFO 21072 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:user.name=del
2016-11-27 13:51:50.186 INFO 21072 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:user.home=C:\Users\del
2016-11-27 13:51:50.186 INFO 21072 --- [ main] org.apache.zookeeper.ZooKeeper : Client environment:user.dir=D:\workspace\callback
2016-11-27 13:51:50.188 INFO 21072 --- [ main] org.apache.zookeeper.ZooKeeper : Initiating client connection, connectString=192.168.1.112:2181 sessionTimeout=30000 watcher=org.I0Itec.zkclient.ZkClient@36ab3814
2016-11-27 13:51:50.257 INFO 21072 --- [168.1.112:2181)] org.apache.zookeeper.ClientCnxn : Opening socket connection to server 192.168.1.112/192.168.1.112:2181. Will not attempt to authenticate using SASL (unknown error)
2016-11-27 13:51:50.264 INFO 21072 --- [168.1.112:2181)] org.apache.zookeeper.ClientCnxn : Socket connection established to 192.168.1.112/192.168.1.112:2181, initiating session
2016-11-27 13:51:50.293 INFO 21072 --- [168.1.112:2181)] org.apache.zookeeper.ClientCnxn : Session establishment complete on server 192.168.1.112/192.168.1.112:2181, sessionid = 0x158a45324cf0003, negotiated timeout = 30000
2016-11-27 13:51:50.296 INFO 21072 --- [ain-EventThread] org.I0Itec.zkclient.ZkClient : zookeeper state changed (SyncConnected)
2016-11-27 13:51:50.350 INFO 21072 --- [ main] c.a.d.r.zookeeper.ZookeeperRegistry : [DUBBO] Register: consumer://192.168.1.111/com.ishowact.core.service.UserService?application=dubbo-consumer&category=consumers&check=false&dubbo=2.5.3&interface=com.ishowact.core.service.UserService&methods=getUser&pid=21072&side=consumer×tamp=1480225909946, dubbo version: 2.5.3, current host: 192.168.1.111
2016-11-27 13:51:50.493 INFO 21072 --- [ main] c.a.d.r.zookeeper.ZookeeperRegistry : [DUBBO] Subscribe: consumer://192.168.1.111/com.ishowact.core.service.UserService?application=dubbo-consumer&category=providers,configurators,routers&dubbo=2.5.3&interface=com.ishowact.core.service.UserService&methods=getUser&pid=21072&side=consumer×tamp=1480225909946, dubbo version: 2.5.3, current host: 192.168.1.111
2016-11-27 13:51:50.727 INFO 21072 --- [ main] c.a.d.r.zookeeper.ZookeeperRegistry : [DUBBO] Notify urls for subscribe url consumer://192.168.1.111/com.ishowact.core.service.UserService?application=dubbo-consumer&category=providers,configurators,routers&dubbo=2.5.3&interface=com.ishowact.core.service.UserService&methods=getUser&pid=21072&side=consumer×tamp=1480225909946, urls: [dubbo://192.168.1.111:20880/com.ishowact.core.service.UserService?anyhost=true&application=dubbo-provider&dubbo=2.5.3&interface=com.ishowact.core.service.UserService&methods=getUser&pid=16524&revision=0.0.1-SNAPSHOT&side=provider×tamp=1480225783589, empty://192.168.1.111/com.ishowact.core.service.UserService?application=dubbo-consumer&category=configurators&dubbo=2.5.3&interface=com.ishowact.core.service.UserService&methods=getUser&pid=21072&side=consumer×tamp=1480225909946, empty://192.168.1.111/com.ishowact.core.service.UserService?application=dubbo-consumer&category=routers&dubbo=2.5.3&interface=com.ishowact.core.service.UserService&methods=getUser&pid=21072&side=consumer×tamp=1480225909946], dubbo version: 2.5.3, current host: 192.168.1.111
2016-11-27 13:51:51.215 INFO 21072 --- [ main] c.a.d.remoting.transport.AbstractClient : [DUBBO] Successed connect to server /192.168.1.111:20880 from NettyClient 192.168.1.111 using dubbo version 2.5.3, channel is NettyChannel [channel=[id: 0x52d3fafd, /192.168.1.111:50822 => /192.168.1.111:20880]], dubbo version: 2.5.3, current host: 192.168.1.111
2016-11-27 13:51:51.216 INFO 21072 --- [ main] c.a.d.remoting.transport.AbstractClient : [DUBBO] Start NettyClient dell/192.168.1.111 connect to the server /192.168.1.111:20880, dubbo version: 2.5.3, current host: 192.168.1.111
2016-11-27 13:51:51.339 INFO 21072 --- [ main] com.alibaba.dubbo.config.AbstractConfig : [DUBBO] Refer dubbo service com.ishowact.core.service.UserService from url zookeeper://192.168.1.112:2181/com.alibaba.dubbo.registry.RegistryService?anyhost=true&application=dubbo-consumer&check=false&dubbo=2.5.3&interface=com.ishowact.core.service.UserService&methods=getUser&pid=21072&revision=0.0.1-SNAPSHOT&side=consumer×tamp=1480225909946, dubbo version: 2.5.3, current host: 192.168.1.111
2016-11-27 13:51:51.978 INFO 21072 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@29a0cdb: startup date [Sun Nov 27 13:51:43 CST 2016]; root of context hierarchy
2016-11-27 13:51:52.175 INFO 21072 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/callback]}" onto public java.lang.String callback.boot.controller.CallbackController.hello(javax.servlet.http.HttpServletRequest) throws java.lang.IllegalArgumentException,java.lang.IllegalAccessException
2016-11-27 13:51:52.178 INFO 21072 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/mail]}" onto public java.lang.String callback.boot.controller.MailController.mail()
2016-11-27 13:51:52.180 INFO 21072 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/dubbo]}" onto public java.lang.String callback.boot.controller.DubboController.dubbo()
2016-11-27 13:51:52.189 INFO 21072 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2016-11-27 13:51:52.194 INFO 21072 --- [ 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)
2016-11-27 13:51:52.304 INFO 21072 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-11-27 13:51:52.306 INFO 21072 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-11-27 13:51:52.478 INFO 21072 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-11-27 13:51:54.772 INFO 21072 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2016-11-27 13:51:54.951 INFO 21072 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8090 (http)
2016-11-27 13:51:54.962 INFO 21072 --- [ main] callback.boot.BootMain : Started BootMain in 12.802 seconds (JVM running for 13.451)
2016-11-27 13:52:00.278 INFO 21072 --- [nio-8090-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/boot] : Initializing Spring FrameworkServlet 'dispatcherServlet'
2016-11-27 13:52:00.279 INFO 21072 --- [nio-8090-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization started
2016-11-27 13:52:00.320 INFO 21072 --- [nio-8090-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization completed in 41 ms
哈哈,启动好了,你就可以访问了
2,jar包启动
本地与linux主机启动一样的命令:java -jar callback.jar
3,部署到linux主机
略,与常的部署一样
同志们,你们学会了吗????