Skip to content

Latest commit

 

History

History
45 lines (31 loc) · 1.97 KB

File metadata and controls

45 lines (31 loc) · 1.97 KB

Java Maven Central Spring Boot License

Quick start RPC in spring web

  • If proxy the interfaces from another repo, make sure turn on -parameters on that repo to keep parameter's name of methods. so the parameters of post/get can against methods on interfaces.
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.13.0</version>
				<configuration>
					<compilerArgs>
						<arg>-parameters</arg>
					</compilerArgs>
				</configuration>
			</plugin>
		</plugins>
  • The class name and method will be translated to path string:

AccountServiceImpl.login(String username, String password) -> account/login. method name in the service should be different. so client and server can communicate through HTTP, like the app/h5/SDKs call to the service.

  • The parameters right on the method in types of primitives will be in the URL as query string.

keeping the parameter names by [-parameters].

  • Configure serializer and deserializer if needed or leave it to default jackson ObjectMapper

See RestClient.builder().messageConverters(HttpMessageConverter)

  • Examples:

Server side: ExampleServiceProvider

Client side: ExampleServiceSubscriber