Skip to content

Tag: spring

Spring DeferredResult setResult causing 404

I am using the new spring 3.2 async servlet requests. All works well except in this one scenario… When someTest() is true spring/tomcat returns a 404. I am not sure how I should go about this or why this happens? I assume it might be because the Servlet Async Context has already been created. Is this a …

Thymeleaf: how to get URL attribute value

I can’t find any solution for getting attribute from URL using Thymeleaf. For example, for URL: I need to get “error” attribute value. Also I’m using SpringMVC, if it could be helpful. Answer After some investigation I found that it was Spring EL issue actually. So complete answer with…

How to close a spring ApplicationContext?

After my application finishes I want to close the spring context. The relevant code has an ApplicationContext reference but I couldn’t find a close method. Answer Downcast your ApplicationContext to ConfigurableApplicationContext which defines close() method:

MySQL Batchupdate() with ON DUPLICATE KEY UPDATE

I am using batchUpdate() to insert multiple records in a table. As per the requirement, if there is a duplicate value for a primary key while inserting it should be updated with the latest received data, hence I was trying to use ON DUPLICATE KEY UPDATE in INSERT statement. The ON DUPLICATE KEY UPDATE works g…

alternative to GrantedAuthorityImpl() class

I want an alternative to GrantedAuthorityImpl() class. I want this in spring security implementation. GrantedAuthorityImpl() class is deprecated. Hence I want an alternative solution to it. My code : Answer The class GrantedAuthorityImpl has been deprecated – you can use SimpleGrantedAuthority instead:

SpringJUnit4ClassRunner class not found

i am trying to create a unit test using SpringJUnit4ClassRunner but everytime i execute the test it says it cannot find SpringJUnit4ClassRunner using mvn install. here is my code Here is my POM file: i am using springSource tool suit IDE to develop this spring mvc app and on the IDE it highlights SpringJUnit4…