I know that I know nothing

how to change default redis ip in spring boot

clock September 4, 2015 16:26 by author Administrator

i run redis in docker .my docker ip is and redis port 32768

but my spring session default host & port is and 6379 

for change redis port in docker i run container by " docker-compose up " command

using this file docker-compose.yml


  image: redis


     - "6379:6379"

after run docker i can monitor to redis by this command
telnet 6379
and redis is ok

but after run spring session and redis i can not connect to them 
after search i know that how change default host in spring boot application.yml




screenshot on mac

clock July 30, 2015 11:38 by author Administrator

change default tomcat webapp directory in maven tomcat 7 plugin

clock July 29, 2015 18:53 by author Administrator









Don’t jump on the microservices

clock July 24, 2015 20:40 by author Administrator
  • Start with a monolith first

  • Clearly define your bounded contexts

  • Cloud infrastructure and DevOps teams

  • Deconstruct the database

  • WTFM

tinymce Editor

clock June 20, 2015 21:00 by author Administrator

if you use tinyMCE  in ajax you will use mce api to get content and set content 

this example show how can use it 

function loadComplete(entity){




function beforeSave(entity){



         return entity;



<form id="frm_main" data-options="onLoadComplete:loadComplete,beforeSave:beforeSave'">

    <textareaid="editor"data-bind="informationText"  class="editor"style="height: 200px;direction: rtl" ></textarea>


remote debug in tomcat

clock May 9, 2015 19:12 by author Administrator

add this line jvm args


create jndi in tomcat

clock May 9, 2015 18:55 by author Administrator

Create META-INF/context.xml

<Context  docBase="appName" path="/" reloadable="true" >

    <Resource name="develop" auth="Container" type="javax.sql.DataSource" maxActive="50        
          maxIdle="30" maxWait="10000" username="test"    password="test"

        driverClassName="oracle.jdbc.OracleDriver" url="jdbc:oracle:thin:@" />



web.xml configuration


        <description>jdbc Datasource example</description>

The value of attribute "formula" must not contain the '<' character.

clock May 8, 2015 12:43 by author Administrator

hibernate formula dosenot allow user < in select for example i use this formula and get this exception

  <property name="debitPrice"  not-null="true"   formula="(  select nvl(sum(d.cost_price),0) from ihs_flat_cost_assign d where d.flat_id=Id  and d.cost_price <=0   )  "   />


and i change that to this

        <property name="debitPrice"  not-null="true"   formula="(  select nvl(sum(d.cost_price),0) from ihs_flat_cost_assign d where d.flat_id=Id  and 0>=d.cost_price    )  "   />

and problem solve

crazyyyyy bug i dont know whyyyyy

send email after commit using spring transaction

clock May 6, 2015 21:22 by author Administrator

Sometimes you want a little more control over transaction but at the same time you don't want to switch to programmatic transaction management. I'm talking about cases when you want to execute some activities only when transaction was completed successfully. For example: send an email with registration details, update a cache, send a message over network, etc. The tricky part here is that you want to perform these activities from a transactional method (a method marked with @Transactional which automatically will start and end the transaction).


public class AfterCommitExecutorImpl extends TransactionSynchronizationAdapter implements AfterCommitExecutor {
    private static final Logger LOGGER = LoggerFactory.getLogger(AfterCommitExecutorImpl.class);
    private static final ThreadLocal<List<Runnable>> RUNNABLES = new ThreadLocal<List<Runnable>>();

    public void execute(Runnable runnable) {"Submitting new runnable {} to run after commit", runnable);
        if (!TransactionSynchronizationManager.isSynchronizationActive()) {
  "Transaction synchronization is NOT ACTIVE. Executing right now runnable {}", runnable);
        List<Runnable> threadRunnables = RUNNABLES.get();
        if (threadRunnables == null) {
            threadRunnables = new ArrayList<Runnable>();

    public void afterCommit() {
        List<Runnable> threadRunnables = RUNNABLES.get();"Transaction successfully committed, executing {} runnables", threadRunnables.size());
        for (int i = 0; i < threadRunnables.size(); i++) {
            Runnable runnable = threadRunnables.get(i);
  "Executing runnable {}", runnable);
            try {
            } catch (RuntimeException e) {
                LOGGER.error("Failed to execute runnable " + runnable, e);

    public void afterCompletion(int status) {"Transaction completed with status {}", status == STATUS_COMMITTED ? "COMMITTED" : "ROLLED_BACK");




final String email = user.getEmail();
            afterCommitExecutor.execute(new Runnable() {
                public void run() {
                    mailService.sendMail(email, "CreateUser", params, "templates/email/CreateUser.ftl");


clock May 2, 2015 22:09 by author Administrator

“I’m the smartest man in Athens because I know that I know nothing.” —Socrates 470-399 BC

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