diff --git a/README.md b/README.md index e1e4c69..6d39d15 100644 --- a/README.md +++ b/README.md @@ -21,11 +21,14 @@ Open it in your IDE in the usual way. E.g. if you’re using IntelliJ IDEA: `ide Define a `.proto` service definition file `src/main/proto/hello.proto` with the following contents: +**❗ IMPORTANT**\ + Be sure to change the `java_package` to the one you chose in Spring Initializr + ```proto syntax = "proto3"; option java_multiple_files = true; -option java_package = "org.springframework.grpc.sample.proto"; +option java_package = ".proto"; option java_outer_classname = "HelloWorldProto"; // The greeting service definition. @@ -58,7 +61,15 @@ or ./gradlew build ``` -You’ll get two new folders in the `target` directory (or `build` for Gradle): `target/target/generated-sources/protobuf/grpc-java` and `target/target/generated-sources/protobuf/java`. You may need to instruct your IDE to mark them as source roots. In IntelliJ IDEA, you’d right click the folder, choose `Mark Directory As` -> `Generated Source Root`. Eclipse or VSCode will add them automatically for you. +Two new folders will be generated containing the source code for the stubs. + +_For Maven_: `target/generated-sources/protobuf/grpc-java` and `target/generated-sources/protobuf/java`. + +_For Gradle_: `build/generated/source/proto/main/grpc` and `build/generated/source/proto/main/java`) + +You may need to instruct your IDE to mark them as source roots. +In IntelliJ IDEA, right-click the folder, choose `Mark Directory As` -> `Generated Source Root`. +Eclipse or VSCode will add them automatically for you. Now you can implement a service based on the generated stubs: @@ -112,7 +123,7 @@ Run the program in the usual way: or ```shell -./gradle bootRun +./gradlew bootRun ``` You can try it out using a gRPC client like `grpcurl`: @@ -244,7 +255,7 @@ public class GrpcServerApplication { } ``` -Run it from your IDE, or on the command line with `mvn spring-boot:run` or `gradle bootRun`. +Run it from your IDE, or on the command line with `./mvnw spring-boot:run` or `./gradlew bootRun`. ### gRPC Client diff --git a/spring-grpc-docs/src/main/antora/modules/ROOT/pages/getting-started.adoc b/spring-grpc-docs/src/main/antora/modules/ROOT/pages/getting-started.adoc index fe4fc70..a563c0e 100644 --- a/spring-grpc-docs/src/main/antora/modules/ROOT/pages/getting-started.adoc +++ b/spring-grpc-docs/src/main/antora/modules/ROOT/pages/getting-started.adoc @@ -13,12 +13,14 @@ Open it in your IDE in the usual way. E.g. if you're using IntelliJ IDEA: `idea Define a `.proto` service definition file `src/main/proto/hello.proto` with the following contents: +IMPORTANT: Be sure to change the `java_package` to the one you chose in Spring Initializr + [source,proto] ---- syntax = "proto3"; option java_multiple_files = true; -option java_package = "org.springframework.grpc.sample.proto"; +option java_package = ".proto"; option java_outer_classname = "HelloWorldProto"; // The greeting service definition. @@ -53,7 +55,15 @@ or ./gradlew build ---- -You'll get two new folders in the `target` directory (or `build` for Gradle): `target/target/generated-sources/protobuf/grpc-java` and `target/target/generated-sources/protobuf/java`. You may need to instruct your IDE to mark them as source roots. In IntelliJ IDEA, you'd right click the folder, choose `Mark Directory As` -> `Generated Source Root`. Eclipse or VSCode will add them automatically for you. +Two new folders will be generated containing the source code for the stubs. + +_For Maven_: `target/generated-sources/protobuf/grpc-java` and `target/generated-sources/protobuf/java`. + +_For Gradle_: `build/generated/source/proto/main/grpc` and `build/generated/source/proto/main/java`) + +You may need to instruct your IDE to mark them as source roots. +In IntelliJ IDEA, right-click the folder, choose `Mark Directory As` -> `Generated Source Root`. +Eclipse or VSCode will add them automatically for you. Now you can implement a service based on the generated stubs: @@ -110,7 +120,7 @@ or [source,shell] ---- -./gradle bootRun +./gradlew bootRun ---- You can try it out using a gRPC client like `grpcurl`: @@ -252,7 +262,7 @@ public class GrpcServerApplication { } ---- -Run it from your IDE, or on the command line with `mvn spring-boot:run` or `gradle bootRun`. +Run it from your IDE, or on the command line with `./mvnw spring-boot:run` or `./gradlew bootRun`. === gRPC Client diff --git a/spring-grpc-docs/src/main/antora/modules/ROOT/partials/_configprops.adoc b/spring-grpc-docs/src/main/antora/modules/ROOT/partials/_configprops.adoc index 534518f..cf80801 100644 --- a/spring-grpc-docs/src/main/antora/modules/ROOT/partials/_configprops.adoc +++ b/spring-grpc-docs/src/main/antora/modules/ROOT/partials/_configprops.adoc @@ -3,6 +3,7 @@ |spring.grpc.client.channels | | Map of channels configured by name. |spring.grpc.client.default-channel.address | `+++static://localhost:9090+++` | The target address uri to connect to. +|spring.grpc.client.default-channel.default-deadline | | The default deadline for RPCs performed on this channel. |spring.grpc.client.default-channel.default-load-balancing-policy | `+++round_robin+++` | The default load balancing policy the channel should use. |spring.grpc.client.default-channel.enable-keep-alive | `+++false+++` | Whether keep alive is enabled on the channel. |spring.grpc.client.default-channel.health.enabled | `+++false+++` | Whether to enable client-side health check for the channel. @@ -43,11 +44,11 @@ |spring.grpc.server.port | `+++9090+++` | Server port to listen on. When the value is 0, a random available port is selected. The default is 9090. |spring.grpc.server.reflection.enabled | `+++true+++` | Whether to enable Reflection on the gRPC server. |spring.grpc.server.security.csrf.enabled | `+++false+++` | Whether to enable CSRF protection on gRPC requests. -|spring.grpc.server.servlet.enabled | `+++true+++` | Whether to use a servlet server in a servlet-based web application. When the value is false, a native gRPC server will be forced. +|spring.grpc.server.servlet.enabled | `+++true+++` | Whether to use a servlet server in a servlet-based web application. When the value is false, a native gRPC server will be created as long as one is available, and it will listen on its own port. Should only be needed if the GrpcServlet is on the classpath |spring.grpc.server.shutdown-grace-period | `+++30s+++` | Maximum time to wait for the server to gracefully shutdown. When the value is negative, the server waits forever. When the value is 0, the server will force shutdown immediately. The default is 30 seconds. -|spring.grpc.server.ssl.bundle | | SSL bundle name. +|spring.grpc.server.ssl.bundle | | SSL bundle name. Should match a bundle configured in spring.ssl.bundle. |spring.grpc.server.ssl.client-auth | `+++none+++` | Client authentication mode. |spring.grpc.server.ssl.enabled | | Whether to enable SSL support. Enabled automatically if "bundle" is provided unless specified otherwise. |spring.grpc.server.ssl.secure | `+++true+++` | Flag to indicate that client authentication is secure (i.e. certificates are checked). Do not set this to false in production. -|=== +|=== \ No newline at end of file