Skip to content

Commit 5dea4b7

Browse files
authored
Merge pull request #472 from yidongnan/docs/client-imports
Fix bad imports in client getting started docs
2 parents 4264a7f + 8031dfb commit 5dea4b7

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

docs/en/client/getting-started.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,17 @@ This section assumes that you have already defined and generated your [Protobuf
9999

100100
### Explaining the Client Components
101101

102+
The following list contains all features that you might encounter on the client side.
103+
If you don't wish to use any advanced features, then the first element is probably all you need to use.
104+
105+
- [`@GrpcClient`](https://javadoc.io/page/net.devh/grpc-client-spring-boot-autoconfigure/latest/net/devh/boot/grpc/client/inject/GrpcClient.html):
106+
The annotation that marks fields and setters for auto injection of clients.
107+
Supports `Channel`s, and all kinds of `Stub`s.
108+
Do not use `@GrpcClient` in conjunction with `@Autowired` or `@Inject`.
109+
Currently it isn't supported for constructor and `@Bean` method parameters. \
110+
**Note:** Services provided by the same application can only be accessed/called in/after the
111+
`ApplicationStartedEvent`. Stubs connecting to services outside of the application can be used earlier; starting with
112+
`@PostConstruct` / `InitializingBean#afterPropertiesSet()`.
102113
- [`Channel`](https://javadoc.io/page/io.grpc/grpc-all/latest/io/grpc/Channel.html):
103114
The Channel is a connection pool for a single address. The target servers might serve multiple grpc-services though.
104115
The address will be resolved using a `NameResolver` and might point to a fixed or dynamic number of servers.
@@ -132,9 +143,6 @@ This section assumes that you have already defined and generated your [Protobuf
132143
- [`StubTransformer`](https://javadoc.io/page/net.devh/grpc-client-spring-boot-autoconfigure/latest/net/devh/boot/grpc/client/inject/StubTransformer.html):
133144
A transformer that will be applied to all client `Stub`s before they are injected.
134145
See also [Configuration -> StubTransformer](configuration.md#stubtransformer).
135-
- [`@GrpcClient`](https://javadoc.io/page/net.devh/grpc-client-spring-boot-autoconfigure/latest/net/devh/boot/grpc/client/inject/GrpcClient.html):
136-
The annotation that marks fields and setters for auto injection of clients. Supports `Channel`s, and all kind of
137-
`Stub`s. Do not use `@GrpcClient` in conjunction with `@Autowired` or `@Inject`.
138146

139147
### Accessing the Client
140148

@@ -143,13 +151,12 @@ We recommended to inject (`@GrpcClient`) `Stub`s instead of plain `Channel`s.
143151
> **Note:** There are different types of `Stub`s. Not all of them support all request types (streaming calls).
144152
145153
````java
146-
import example.HelloReply;
147154
import example.HelloRequest;
148-
import example.MyServiceGrpc;
155+
import example.MyServiceGrpc.MyServiceBlockingStub;
149156

150-
import io.grpc.stub.StreamObserver;
157+
import net.devh.boot.grpc.client.inject.GrpcClient;
151158

152-
import net.devh.boot.grpc.server.service.GrpcService;
159+
import org.springframework.stereotype.Service;
153160

154161
@Service
155162
public class FoobarService {

0 commit comments

Comments
 (0)