Skip to content

Tag: spring

How to inject property value using @Value into static fields

I have one property file config.properties which is configured using spring property placeholder. This is how it’s configured in my spring configuration file: Now I need to set its value to static field using @Value annotation. How can I achieve this? Answer The only way is to use setter for this value …

Spring Batch Item Reader is executing only once

Trying to implement Spring batch,but facing a strange problem,Our ItemReader class is executing only once. Here below is the detail. If we have 1000 rows in DB. Our Item reader fetch 1000 rows from DB,and pass list to ItemWriter ItemWriter successfully delete all items. Now ItemReader again tries to fetch the…

Spring Boot Actuator without Spring Boot

I’ve been working on a Spring/Spring MVC application and I’m looking to add performance metrics. I’ve come across Spring Boot Actuator and it looks like a great solution. However my application is not a Spring Boot application. My application is running in a traditional container Tomcat 8. I…

Change deferredResult HTTP status code on timeout

I am using deferredResult on Spring MVC, but using this code, the timeout still are sending back the HTTP code 503 to the client. Any idea what else to try? Answer I ran into the same issue. My Spring MVC Controller method originally returned DeferredResult<Object>, but then I realised I wanted to contr…