question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is it possible add a global @SingleUse for spring boot application?

See original GitHub issue

Hope add global definition for spring-boot application. For example, if I add annotation at spring boot launch class, will guard all task execute once in nodes:

@SpringBootAppliction  
@EnableScheduling  
@SingleUse  

Thanks for any reply

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
lukas-krecancommented, Aug 19, 2018

Hi, thanks for feedback and sorry for the delay. If I understand you correctly, you want to add one annotation which would automatically put lock on all scheduled tasks? It is quite easy to implement but I am afraid that it’s a bit dangerous. We need a name for each lock and the only way to generated it automatically is to use method signature - ClassName.methodName(). In my opinion it’s quite fragile since you can rename the class or the method and when you deploy the change only to part of the cluster, the task will be executed twice. That’s why I hesitate to add it.

0reactions
ivaylo5evcommented, Jul 13, 2020

@zHaytam , yes it would and this is NOT the desired behaviour indeed. I have misread / misunderstood the initial request, so ignore my comment above.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developing with Spring Boot
Spring Boot favors Java-based configuration. Although it is possible to use SpringApplication with XML sources, we generally recommend that your ...
Read more >
Topical Guide | Spring Security Architecture
In a Spring Boot application, you can @Autowired the global one into another bean, but you cannot do that with the local one...
Read more >
Spring Boot Reference Documentation
Spring Boot dependencies can be declared by using the org.springframework.boot group . Typically, your project declares dependencies to one or more “Starters”.
Read more >
20. Developer tools - Spring
20.4 Global settings ... You can configure global devtools settings by adding a file named .spring-boot-devtools.properties to your $HOME folder (note that the ......
Read more >
24. Externalized Configuration - Spring
Spring Boot lets you externalize your configuration so that you can work with the same application code in different environments. You can use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found