File tree Expand file tree Collapse file tree 2 files changed +39
-1
lines changed
springboot-dubbo-client/src/main
java/org/spring/springboot/controller Expand file tree Collapse file tree 2 files changed +39
-1
lines changed Original file line number Diff line number Diff line change
1
+ package org .spring .springboot .controller ;
2
+
3
+ import org .slf4j .Logger ;
4
+ import org .slf4j .LoggerFactory ;
5
+ import org .spring .springboot .dubbo .CityDubboConsumerService ;
6
+ import org .springframework .beans .factory .annotation .Autowired ;
7
+ import org .springframework .web .bind .annotation .RequestMapping ;
8
+ import org .springframework .web .bind .annotation .RestController ;
9
+
10
+
11
+ /**
12
+ * Spring Boot HelloWorld 案例
13
+ *
14
+ * Created by bysocket on 16/4/26.
15
+ */
16
+ @ RestController
17
+ public class HelloWorldController {
18
+
19
+
20
+ @ Autowired
21
+ public CityDubboConsumerService cityService ;
22
+
23
+ private static final Logger logger = LoggerFactory .getLogger (HelloWorldController .class );
24
+
25
+ @ RequestMapping ("/" )
26
+ public String sayHello () {
27
+ logger .info ("invoke HelloWorldController # sayHello" );
28
+ cityService .printCity ();
29
+ logger .info (":::cityService.printCity() has been invoked" );
30
+ return "Hello,World!" ;
31
+ }
32
+
33
+ @ RequestMapping ("/hi" )
34
+ public String sayHi () {
35
+ logger .info ("invoke HelloWorldController # sayHi" );
36
+ return "Hi,World!" ;
37
+ }
38
+ }
Original file line number Diff line number Diff line change @@ -5,4 +5,4 @@ server.port=8081
5
5
6
6
spring.dubbo.application.name =consumer
7
7
spring.dubbo.registry.address =zookeeper://127.0.0.1:2181
8
- spring.dubbo.scan =org.spring.springboot.dubbo
8
+ spring.dubbo.scan =org.spring.springboot
You can’t perform that action at this time.
0 commit comments