How to set up datasource with Spring for HikariCP?

you need to write this structure on your bean configuration (this is your datasource): <bean id=”hikariConfig” class=”com.zaxxer.hikari.HikariConfig”> <property name=”poolName” value=”springHikariCP” /> <property name=”connectionTestQuery” value=”SELECT 1″ /> <property name=”dataSourceClassName” value=”${hibernate.dataSourceClassName}” /> <property name=”maximumPoolSize” value=”${hibernate.hikari.maximumPoolSize}” /> <property name=”idleTimeout” value=”${hibernate.hikari.idleTimeout}” /> <property name=”dataSourceProperties”> <props> <prop key=”url”>${dataSource.url}</prop> <prop key=”user”>${dataSource.username}</prop> <prop key=”password”>${dataSource.password}</prop> </props> </property> </bean> <!– HikariCP configuration –> <bean … Read more

Spring Security circular bean dependency

You could replace constructor-based dependency injection with setter-based dependency injection to resolve the cycle, see Spring Framework Reference Documentation: Circular dependencies If you use predominantly constructor injection, it is possible to create an unresolvable circular dependency scenario. For example: Class A requires an instance of class B through constructor injection, and class B requires an … Read more

Spring JDBC Template for calling Stored Procedures

There are a number of ways to call stored procedures in Spring. If you use CallableStatementCreator to declare parameters, you will be using Java’s standard interface of CallableStatement, i.e register out parameters and set them separately. Using SqlParameter abstraction will make your code cleaner. I recommend you looking at SimpleJdbcCall. It may be used like … Read more