Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

spring boot call method after startup with repository

import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

@Component
public class Initializer implements CommandLineRunner {

    private final YourRepository yourRepository;

    public Initializer(YourRepository yourRepository) {
        this.yourRepository = yourRepository;
    }

    @Override
    public void run(String... args) throws Exception {
      // your logic, for example:
      yourRepository.findAll();
    }
}
Comment

PREVIOUS NEXT
Code Example
Java :: regex java email validation 
Java :: circular imageview android 
Java :: gson java maven dependency script google json repository 
Java :: properties java 8 maven in pom xml 
Java :: bootstrap center text vertically 
Java :: hello world in java 
Java :: cordova android.useandroidx 
Java :: spring cors allow all origins 
Java :: seconds to hours java 
Java :: java setinterval equivalent 
Java :: how to generate random numbers in java within range 
Java :: allow internet permission android 
Java :: java remove non numeric characters from string 
Java :: java random 6 digit number 
Java :: get tfidf score for a sentence 
Java :: concatenating two int in java 
Java :: JFrame Exit oon close Java15 
Java :: stream distinct by property 
Java :: java selenium wait 
Java :: java get ram usage 
Java :: testing if editText is empty java 
Java :: how to randomize an array java 
Java :: java stream collect to string 
Java :: Xlint:deprecation android studio 
Java :: clsoe keyboard android studio 
Java :: java number of days between dates 
Java :: java joptionpane input 
Java :: plus one leetcode 
Java :: como printar o valor de um campo em um jtextfield 
Java :: Spring Boot Hibernate remove underscore naming strategy 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =