Spring Boot – how to communicate between microservices?

Of course you can. Microservices are just REST-Services. You need to understand how REST-Services work. After that just write 2 Microservices (2 Rest-Services: producer-service and consumer-service) with Spring-boot, let them run under different server-ports, call the consumer-service from the other, and that’s it: you have your Microservices. Now this is the primitive way to write … Read more

Spring Webflux + JPA: Reactive Repositories are not supported by JPA

If you want all the benefits of reactive, async / non-blocking, you’ll need to make the whole stack async / non-blocking. JDBC is indeed inherently a blocking API, so you can’t build a fully reactive / non-blocking app if you need to access the database through JDBC. But you still you need relational database then … Read more

How to add self signed SSL certificate to jHipster sample app?

These instructions are applicable for all Spring Boot applications, on which JHipster is based. I have tested this on a newly generated JHipster 2.7 project. You need to complete these steps when starting from scratch: Generate a self-signed certificate Add the SSL properties to your application.properties or application.yml as mentioned in the Spring Boot documentation … Read more

Spring Boot & Swagger UI. Set JWT token

Original answer Support for Authorization: Bearer [JWT_TOKEN] header is working as of version 2.9.2 Added the following dependencies to build.gradle compile(“io.springfox:springfox-swagger2:2.9.2”) { exclude module: ‘mapstruct’ // necessary in my case to not end up with multiple mapstruct versions } compile “io.springfox:springfox-bean-validators:2.9.2” compile “io.springfox:springfox-swagger-ui:2.9.2” Configured Swagger via @Configuration @EnableSwagger2 @Import(springfox.bean.validators.configuration.BeanValidatorPluginsConfiguration.class) public class SwaggerConfiguration { public static … Read more

Invalid character found in the request target in spring boot

According to https://tomcat.apache.org/tomcat-8.5-doc/config/systemprops.html, requestTargetAllow is deprecated. For me, the other solutions presented here did not work either. According to the Tomcat documentation I found a way to set the property relaxedQueryChars instead: @Bean public ConfigurableServletWebServerFactory webServerFactory() { TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory(); factory.addConnectorCustomizers(new TomcatConnectorCustomizer() { @Override public void customize(Connector connector) { connector.setProperty(“relaxedQueryChars”, “|{}[]”); } }); … Read more

Difference between @RibbonClient and @LoadBalanced

TL;DR: @LoadBalanced is a marker annotation & @RibbonClient is used for configuration purposes. @LoadBalanced Used as a marker annotation indicating that the annotated RestTemplate should use a RibbonLoadBalancerClient for interacting with your service(s). In turn, this allows you to use “logical identifiers” for the URLs you pass to the RestTemplate. These logical identifiers are typically … Read more