There are different ways to execute code once Spring Boot has started:
@Component
public class MyCommandLineRunner implements CommandLineRunner {
@Override
public void run(String... args) throws Exception {
// Your code here
}
}
@Component
public class MyApplicationRunner implements ApplicationRunner {
@Override
public void run(ApplicationArguments args) throws Exception {
// Your code here
}
}
@Component
public class MyComponent {
@PostConstruct
public void init() {
// Your code here
}
}
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2021-11-02 11:00:00 +0000
Seen: 13 times
Last updated: Nov 25 '22
Can the admin UI interface created using electron.js draw over an existing app in Windows?
How do you call a method in a custom view from a ViewModel?
What is the proper way to utilize the type map[string]interface {} in Golang?
Why isn't the user interface updating when adding a custom object with data binding in .NET MAUI?
How can you convert an interface to a specific type if all available types have identical methods?
How can the network interface name be changed using the command line?