I have created a simple scheduled task using Spring Framework’s @Scheduled annotation. Now I want to stop this task, when no longer needed. I know there could be one alternative to check one conditional flag at the start of this method, but this will not stop execution of this method. Is there anything Spring provides to stop @Scheduled task ?
Tag: spring
Spring Data Redis JedisConnectionException: Unexpected end of stream
Redis 3.0.5 Spring Data Redis 1.3.6 jedis 2.6.3 – Our is web application which receives data from redis over pub/sub. – Also performs read/write of data on redis as key/value pairs. – read/write happens on listener thread, independent monitoring thread and http request threads. – We have used a same connection factory for Listener and redis template – Our redis
Clarify a situation with a cleaning Spring Prototype-beans from memory
I would like to understand whether I should clean prototype-beans from memory manually by myself. In the Spring documentation you can see: “The client code must clean up prototype-scoped objects and release expensive resources that the prototype bean(s) are holding.” So from this it seems that you should clean prototype-beans by yourself. However. I’m using VisualVM memory profiler. I have
CORS interfering with Spring Security oauth2
I’m having problems trying to get a token from oauth/token from the browser. I have a Spring Boot application with Spring Security and Spring Security oauth, and I’m trying to authenticate from a javascript SPA in a different port. When CORS is disabled in the backend, I can get tokens from the oauth endpoints no problem, using either Postman or
Spring boot: how to match all routes?
I’m developing a simple web application on Spring boot 1.5.3 and I need all the routes to send static index.html file. Now, I have this: My application contains only static assets and REST API. But the problem is that the controller shown above only matches the first-level url like /index, /department etc. I want to match all url levels like
ORA-02289: sequence does not exist – when using Spring Data JPA with Spring boot
Database being used is Oracle 11g The sequence is present in the specified schema in the database and the same query returns proper value when executed via sql developer. The Auto generation configuration is as follow: Spring JPA configuration is as follow: Answer Kindly check if the user which you are using has the read/write privilege
Change Spring boot folder structure for source code and resources
How can I change the path where spring boot is looking for the source code and resources. I want to move from src/main to src/server/main. In pom I put: Error: Could not find or load main class ema.Application Answer Here is a sample build section of a POM that can be used to configure the directories. Below Sample:
How to get ‘now time’ from database using CrudRepository?
I have this example of entity: and this example of repo: But when I need to do: I cant get creationDate anymore from: Because some people are changing the time from OS, and the time of the creation are being persisted wrong. so I need some: To set the creationDate from user. Do I need a new repo to get
Spring Boot not recognizing application.properties file
I’m trying to configure a DynamoDb client with Spring Boot, and placed my endpoints and configuration information in my resources/application.properties file. However, Spring Boot does not seem to pick up these properties. It does pick up the “server.default” key that I have stored in the same file, so it is definitely recognizing the the file itself. Here is my application.properties
How to abstract away java.time.Clock for testing purposes in Spring
I have a question with regards to the question Time dependent unit tests Let’s say I build Spring application which contains service interface and its implementation If I want to change clock in test, I would have to “pollute” production code and interface with e.g. setClock method as follows: In test, I can invoke, e.g.: How can I abstract away