I know that I know nothing

Custom Hikari Datasource in Spring Boot

clock August 14, 2017 22:40 by author Administrator


when i using default Spring Boot datasource that create by DataSourceAutoConfiguration hikari pool is correct and max size is ok but i want  create custom datasource to set that @primary .

there are some way to create custom Datasource, one of that is


@ConfigurationProperties(prefix = "spring.datasource")

publicDataSourcedataSource() {

    return DataSourceBuilder.create().build();



        jdbc-url: jdbc:mysql://localhost:3306/ihs?useUnicode=yes&characterEncoding=utf8&useSSL=false





when create datasource by this way max pool size is not set ,after google, i fount that DataSourceBuilder dose not set Hikari prop 


2017-08-14 22:51:22.844 DEBUG 31814 --- [l-1 housekeeper] com.zaxxer.hikari.pool.HikariPool        : HikariPool-1 - Pool stats (total=10, active=0, idle=50, waiting=0)

Another way for create custom datasource is like this :





publicDataSourcePropertiesdataSourceProperties() {







publicDataSourcedataSource() {



2017-08-14 22:51:22.844 DEBUG 31814 --- [l-1 housekeeper] com.zaxxer.hikari.pool.HikariPool        : HikariPool-1 - Pool stats (total=50, active=0, idle=50, waiting=0)


Enable log in CXF to see request and response body

clock October 29, 2016 21:48 by author Administrator

Some time we need to see request and response body in soap for trace 

by this code when using in java api call we can enable that 

final Client client = ClientProxy.getClient(service);

client.getInInterceptors().add(new LoggingInInterceptor());

client.getOutInterceptors().add(new LoggingOutInterceptor());

angular $broadcast

clock October 24, 2016 20:14 by author Administrator

AngularJS applications may need to communicate across the controllers. Such a communication might be needed to send notifications or to pass data between the controllers. Although there can be different approaches to achieve this goal, one that is readily available is the event system of $scope and $rootScope. Both of these objects - $scope and $rootScope - support three methods namely $broadcast(), $emit() and $on() that facilitate event driven publisher-subscriber model for sending notifications and passing data between the controllers. In this article I will discuss how to raise events using $broadcast() and $emit() and then how to handle those events using $on().

one of solution to raise authenticate success in web app is to used this feature 

after authenticationSuccess call this :


and listen to that event 

 $scope.$on('authenticationSuccess', function() {





clock October 4, 2016 21:53 by author Administrator

Using angular.module() with two parameters (e.g. angular.module('aziz-module', [])) would result in setting a new module with its corresponding dependencies. In contrast, when using angular.module('aziz') the corresponding module is looked up internally and returned to the caller (getting).

The means when you first define you application you might just create the following files and structure.







If you now include these files in your html document in this particularly order (at least app.js has to come first), your application works just fine with two separate controllers in two separate files.

datasource Initializer for run sql script

clock July 21, 2016 23:40 by author Administrator

some time our application have initial data or sometimes needs to run sql script to create tables or other database object when application init.


in this code when can do that very simple and easy by spring boot 



private DataSource dataSource;



 private Resource schemaScript;


public DataSourceInitializer dataSourceInitializer(final DataSource dataSource) {

         final DataSourceInitializer initializer = new DataSourceInitializer();





private DatabasePopulator databasePopulator() {

        final ResourceDatabasePopulator populator = new ResourceDatabasePopulator();




localStorage JSON

clock June 10, 2016 19:21 by author Administrator

when set and get  json in localStorage will add this type 


var authToken = JSON.parse(localStorage.getItem("authenticationToken"));


localStorage.setItem("authenticationToken",JSON.stringify( token));

request oauth token by jquery ajax

clock June 10, 2016 15:08 by author Administrator
            var atoken;
			  url: "<c:url value = '/api/oauth/token' />",
			  type: 'POST',
			  crossDomain: true,
		      async: false,
		      cache: false,
			  data: {
			  success: function(token, status) {
				  //store.set('token', token);
			  beforeSend: function (xhr) {
				 xhr.setRequestHeader ("Authorization", "Basic " + btoa("acme:acmesecret" ));


spring security oauth2 change default prefix path

clock June 8, 2016 23:40 by author Administrator

when add oauth to your project 

oauth library create some endpoint for get token .get authorize code ,get refresh token and some other oauth protocol

this endpoint has rest url s in this url


Mapped "{[/oauth/authorize]}


Mapped "{[/oauth/token],methods=[GET]}"


Mapped "{[/oauth/check_token]}"



when your project run in root servlet-path every thing is ok .but when using servlet-path:/api or other name 

request to /api/oauth/token for get token is get exception

for solve this problem need to change default configuration for oauth path for change it nee write this configuration code


public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {




handle nvl in postgres

clock June 5, 2016 19:51 by author Administrator
CREATE OR REPLACE FUNCTION nvl(expr1 text, expr2 text)
  SELECT coalesce($1, $2);

testing tools

clock March 11, 2016 21:19 by author Administrator

About the author

 Welcome to this web site . This page has two purposes: Sharing information about my professional life such as articles, presentations, etc.
This website is also a place where I would like to share content I enjoy with the rest of the world. Feel free to take a look around, read my blog

Java,J2EE,Spring Framework,JQuery,

Hibernate,NoSql,Cloud,SOA,Rest WebService and Web Stack tech...


Month List

Sign In