forked from Percy0601/boot-dubbo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
366 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/target/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
2 changes: 1 addition & 1 deletion
2
.../src/main/java/boot/dubbo/simple/App.java → ...in/java/boot/dubbo/simple/client/App.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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! | ||
|
38 changes: 38 additions & 0 deletions
38
boot-dubbo-simple-client/src/test/java/boot/dubbo/simple/client/AppTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
boot-dubbo-simple/src/main/java/boot/dubbo/simple/ApplicationBootstrap.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
boot-dubbo-simple/src/main/java/boot/dubbo/simple/config/DubboConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { | ||
|
||
} |
11 changes: 11 additions & 0 deletions
11
boot-dubbo-simple/src/main/java/boot/dubbo/simple/config/WebConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { | ||
// | ||
//} |
8 changes: 8 additions & 0 deletions
8
boot-dubbo-simple/src/main/java/boot/dubbo/simple/config/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* | ||
*/ | ||
/** | ||
* @author percy | ||
* | ||
*/ | ||
package boot.dubbo.simple.config; |
19 changes: 19 additions & 0 deletions
19
boot-dubbo-simple/src/main/java/boot/dubbo/simple/service/DemoServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
boot-dubbo-simple/src/main/java/boot/dubbo/simple/service/UserServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
|
||
} |
8 changes: 8 additions & 0 deletions
8
boot-dubbo-simple/src/main/java/boot/dubbo/simple/service/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* | ||
*/ | ||
/** | ||
* @author percy | ||
* | ||
*/ | ||
package boot.dubbo.simple.service; |
42 changes: 42 additions & 0 deletions
42
boot-dubbo-simple/src/main/java/boot/dubbo/simple/starter/SpringBootStarter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
// } | ||
// | ||
//} |
11 changes: 11 additions & 0 deletions
11
boot-dubbo-simple/src/main/resources/META-INF/spring/applicationContext.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
13
boot-dubbo-simple/src/main/resources/application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Oops, something went wrong.