Unable to register MBean [HikariDataSource (HikariPool-0)] with key ‘dataSource’

I was having a similar issue, with 2 jhipster application instances running alongside on a single tomcat server. I posted this also in https://github.com/jhipster/generator-jhipster/issues/874#issuecomment-113023849 From https://docs.oracle.com/javase/tutorial/jmx/mbeans/standard.html Every JMX MBean must have an object name. The object name is an instance of the JMX class ?ObjectName and must conform to the syntax defined by the JMX … Read more

Why use spring.factories for Spring Boot auto-configuration instead of annotations?

Because we are not going to scan the world to figure out what auto-configuration classes exist in your project. For one, an auto-configuration is just a regular @Configuration class. The way a Spring component is found is via explicit declaration or component scan but we need to know the list of auto-configuration classes way before … Read more

Spring boot Webclient’s retrieve vs exchange

Adding to @JArgente’s answer. According to the official documentation of the retrieve() method: Perform the HTTP request and retrieve the response body. … This method is a shortcut to using exchange() and decoding the response body through ClientResponse. and the exchange() method Perform the HTTP request and return a ClientResponse with the response status and … Read more

Spring Cloud or Spring Boot? what is right spring project for developing Biz API’s?

Spring Boot is app-centric. As @kryger said, Spring Cloud builds on boot. It solves higher level problems, such as: Distributed configuration: How to configure every instance of all of your services (standard boot config files checked into git or svn and distributed via config server). Service registration and discovery: how to locate a specific instance … Read more

SpringBoot error: Registered driver with driverClassName=oracle.jdbc.driver.OracleDriver was not found, trying direct instantiation

Regarding the warning message from the question’s title : Registered driver with driverClassName=oracle.jdbc.driver.OracleDriver was not found, trying direct instantiation That is because you used the wrong value for spring.datasource.driver-class-name. Use oracle.jdbc.OracleDriver instead of oracle.jdbc.driver.OracleDriver. See detailed answer here: Difference between Oracle jdbc driver classes?.

Eureka and Kubernetes

How can I setup something like eureka.client.serviceUri? You have to have a Kubernetes service on top of the eureka pods/deployments which then will provide you a referable IP address and port number. And then use that referable address to look up the Eureka service, instead of “8761”. To address further question about HA configuration of … Read more

How to define Servlet filter order of execution in Spring Boot application

setOrder(int) method does the job. below is an example @Configuration @EnableAutoConfiguration @EnableWebMvc @ComponentScan public class Application { @Bean public FilterRegistrationBean filterRegistrationBean() { FilterRegistrationBean registrationBean = new FilterRegistrationBean(); SecurityFilter securityFilter = new SecurityFilter(); registrationBean.setFilter(securityFilter); registrationBean.setOrder(2); return registrationBean; } @Bean public FilterRegistrationBean contextFilterRegistrationBean() { FilterRegistrationBean registrationBean = new FilterRegistrationBean(); RequestContextFilter contextFilter = new RequestContextFilter(); registrationBean.setFilter(contextFilter); registrationBean.setOrder(1); return … Read more

How to get the SPRING Boot HOST and PORT address during run time?

You can get this information via Environment for the port and the host you can obtain by using InternetAddress. @Autowired Environment environment; // Port via annotation @Value(“${server.port}”) int aPort; …… public void somePlaceInTheCode() { // Port environment.getProperty(“server.port”); // Local address InetAddress.getLocalHost().getHostAddress(); InetAddress.getLocalHost().getHostName(); // Remote address InetAddress.getLoopbackAddress().getHostAddress(); InetAddress.getLoopbackAddress().getHostName(); }

Precedence order among properties file, YAML file, and Command Line arguments in SpringBoot

Spring Boot property resolution property order is described here. Use of application.properties and application.yaml is not expected. Use one format or the other but not both. Whichever one you use will be handled at position 12 or 13 (depending on whether the file is packaged in the application JAR or not) in property precedence order. … Read more