import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
public class MyService {
@PostConstruct
public void init() {
}
@PreDestroy
public void destroy() {
}
}
import org.springframework.stereotype.Service;
@Service
public class MyBusinessService {
public void doSomething() {
}
}
import jakarta.annotation.PostConstruct;
import jakarta.annotation.PreDestroy;
public class MyService {
@PostConstruct
public void init() {
}
@PreDestroy
public void destroy() {
}
}