We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@PostConstructor
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.PostConstruct; @Service public class UserService { @Autowired private UserRepository userRepository; /* 생성자에서는 주입이 안되어서 에러 발생 */ // public UserService() { // User admin = new User("admin", "password1"); // userRepository.save(admin); // } @PostConstruct private void init() { User admin = new User("admin", "password1"); User normalUser = new User("user", "password2"); userRepository.save(admin); userRepository.save(normalUser); } }
@PreDestory
@PreDestroy public void dataSourceDestroy() throws SQLException { rollbackUnCommittedTransaction(); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
@PostConstructor
@PreDestory
The text was updated successfully, but these errors were encountered: