Skip to content

Commit

Permalink
finish minix jar with dubbo
Browse files Browse the repository at this point in the history
  • Loading branch information
Percy0601 committed May 28, 2015
1 parent 00fc800 commit 431a348
Show file tree
Hide file tree
Showing 19 changed files with 366 additions and 2 deletions.
1 change: 1 addition & 0 deletions boot-dubbo-simple-client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target/
23 changes: 23 additions & 0 deletions boot-dubbo-simple-client/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>cn.creditease</groupId>
<artifactId>boot-dubbo</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>boot-dubbo-simple-client</artifactId>
<name>boot-dubbo-simple-client</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package boot.dubbo.simple;
package boot.dubbo.simple.client;

/**
* Hello world!
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package boot.dubbo.simple.client;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}

/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}

/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}
75 changes: 75 additions & 0 deletions boot-dubbo-simple/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,81 @@
<start-class>demo.DemoApplication</start-class>
</properties>
<dependencies>
<dependency>
<groupId>cn.creditease</groupId>
<artifactId>boot-dubbo-api</artifactId>
<version>0.0.1-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>resteasy-jaxrs</artifactId>
<groupId>org.jboss.resteasy</groupId>
</exclusion>
<exclusion>
<artifactId>resteasy-jackson-provider</artifactId>
<groupId>org.jboss.resteasy</groupId>
</exclusion>
<exclusion>
<artifactId>resteasy-jaxb-provider</artifactId>
<groupId>org.jboss.resteasy</groupId>
</exclusion>
<exclusion>
<artifactId>validation-api</artifactId>
<groupId>javax.validation</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>dubbo</artifactId>
<version>2.8.4</version>
<exclusions>
<exclusion>
<artifactId>guava</artifactId>
<groupId>com.google.guava</groupId>
</exclusion>
<exclusion>
<artifactId>curator-framework</artifactId>
<groupId>org.apache.curator</groupId>
</exclusion>
<exclusion>
<artifactId>curator-client</artifactId>
<groupId>org.apache.curator</groupId>
</exclusion>
<exclusion>
<artifactId>aopalliance</artifactId>
<groupId>aopalliance</groupId>
</exclusion>
<exclusion>
<artifactId>javax.servlet-api</artifactId>
<groupId>javax.servlet</groupId>
</exclusion>
<exclusion>
<artifactId>httpclient</artifactId>
<groupId>org.apache.httpcomponents</groupId>
</exclusion>
<exclusion>
<artifactId>commons-pool</artifactId>
<groupId>commons-pool</groupId>
</exclusion>
<exclusion>
<artifactId>commons-codec</artifactId>
<groupId>commons-codec</groupId>
</exclusion>
<exclusion>
<artifactId>httpcore</artifactId>
<groupId>org.apache.httpcomponents</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.el</groupId>
<artifactId>jboss-el-api_3.0_spec</artifactId>
<version>1.0.0.Final</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package boot.dubbo.simple;

import java.io.IOException;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class ApplicationBootstrap {

public static void main(String[] args) {
SpringApplication.run(ApplicationBootstrap.class, args);
try {
System.in.read();
} catch (IOException e) {
e.printStackTrace();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package boot.dubbo.simple.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;

@Configuration
@ImportResource("classpath:META-INF/spring/applicationContext.xml")
public class DubboConfig {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package boot.dubbo.simple.config;

//import org.springframework.boot.autoconfigure.SpringBootApplication;
//import org.springframework.context.annotation.ComponentScan;
//import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
//
//@SpringBootApplication
//@ComponentScan(basePackages = "boot")
//public class WebConfig extends WebMvcConfigurerAdapter {
//
//}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
*
*/
/**
* @author percy
*
*/
package boot.dubbo.simple.config;
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package boot.dubbo.simple.service;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import boot.dubbo.api.DemoService;

public class DemoServiceImpl implements DemoService {
private Logger log = LoggerFactory.getLogger(DemoServiceImpl.class);
public DemoServiceImpl() {
log.debug("测试注解启动加载。。。");
}

@Override
public String sayHello(String name) {
return "Hello " + name;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package boot.dubbo.simple.service;

import java.util.ArrayList;
import java.util.List;

import boot.dubbo.api.User;
import boot.dubbo.api.UserService;

import com.alibaba.dubbo.config.annotation.Service;

@Service(protocol = { "dubbo" })
public class UserServiceImpl implements UserService {

@Override
public List<User> findAll() {
List<User> users = new ArrayList<User>();
User user = new User();
user.setId(1);
user.setName("Percy Mutils");
users.add(user);
return users;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
*
*/
/**
* @author percy
*
*/
package boot.dubbo.simple.service;
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package boot.dubbo.simple.starter;

//import javax.servlet.ServletContext;
//import javax.servlet.ServletException;
//
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.autoconfigure.SpringBootApplication;
//import org.springframework.boot.builder.SpringApplicationBuilder;
//import org.springframework.boot.context.web.SpringBootServletInitializer;
//import org.springframework.context.annotation.ComponentScan;
//import org.springframework.core.env.Environment;

//@SpringBootApplication
//@ComponentScan(basePackages = "boot")
//public class SpringBootStarter extends SpringBootServletInitializer {
// private Logger log = LoggerFactory.getLogger(SpringBootStarter.class);
//
// @Autowired
// private Environment env;
//
// @Override
// protected SpringApplicationBuilder configure(
// SpringApplicationBuilder application) {
// log.info("=============容器启动(Spring Boot Container Start...)=============");
// return application.sources(WebConfig.class);
// }
//
// /**
// * Config ServletListener, ServletFilter
// */
// @Override
// public void onStartup(ServletContext servletContext)
// throws ServletException {
// log.info("+++++++++++++容器启动(Web Container Servetlet Start...)+++++++++++++");
// log.info("++++++++++++++++++++++++++{}" + (env == null));
//
// super.onStartup(servletContext);
// }
//
//}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?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"
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">

<dubbo:annotation package="boot.dubbo" />
<!--<dubbo:service interface="boot.dubbo.api.UserService" ref="userService" protocol="rest"/>
<bean id="userService" class="boot.dubbo.service.UserServiceImpl" />-->
<dubbo:protocol name="dubbo" />
</beans>
13 changes: 13 additions & 0 deletions boot-dubbo-simple/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# DataSource Config
spring.datasource.url=jdbc:h2:~/h2/uaas/test;MODE=PostgreSQL;LOCK_MODE=3
spring.datasource.username=sa
spring.datasource.password=123456
spring.datasource.driver-class-name=org.h2.Driver

# JPA (JpaBaseConfiguration, HibernateJpaAutoConfiguration)
spring.jpa.hibernate.ddl-auto=update
spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy
spring.jpa.database=H2
spring.jpa.show-sql=true
# MyBatis Config
mybatis.configLocationXml=mybatis/MyBatis-Configuration.xml
31 changes: 31 additions & 0 deletions boot-dubbo-simple/src/main/resources/dubbo.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
##
# Copyright 1999-2011 Alibaba Group.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
##
dubbo.container=log4j,spring
dubbo.application.name=demo-provider
dubbo.application.owner=percy
dubbo.registry.address=multicast://224.5.6.7:1234
#dubbo.registry.address=zookeeper://10.10.108.132:2181
#dubbo.registry.address=redis://127.0.0.1:6379
#dubbo.registry.address=dubbo://127.0.0.1:9090
#dubbo.monitor.protocol=registry
dubbo.protocol.name=dubbo
dubbo.protocol.dubbo.port=20880
dubbo.protocol.name=rest
dubbo.protocol.rest.port=9090
dubbo.protocol.rest.server=netty
dubbo.service.loadbalance=roundrobin
#dubbo.log4j.file=logs/dubbo-demo-consumer.log
#dubbo.log4j.level=WARN
30 changes: 30 additions & 0 deletions boot-dubbo-simple/src/main/resources/logback.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<contextName>UAAS-CONSOLE</contextName>

<include resource="org/springframework/boot/logging/logback/base.xml" />
<!-- include resource="org/springframework/boot/logging/logback/console-appender.xml"
/> -->

<!-- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern> %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
</pattern>
</encoder>
</appender> -->


<root level="INFO">
<appender-ref ref="CONSOLE" />
</root>

<!-- logback为java中的包 -->
<logger name="uaas" />

<!--logback.LogbackDemo:类的全路径 -->
<logger name="uaas.controller.RoleController" level="DEBUG"
additivity="false">
<appender-ref ref="CONSOLE" />
</logger>

</configuration>
Empty file.
Loading

0 comments on commit 431a348

Please sign in to comment.