Close

Spring Framework - javax.inject.Provider Examples

Spring Framework 

import org.springframework.beans.factory.annotation.Autowired;
import jakarta.inject.Provider;

public class MySingletonBean {

@Autowired
private Provider<MyPrototypeBean> myPrototypeBeanProvider;

public void showMessage () {
MyPrototypeBean bean = myPrototypeBeanProvider.get();
System.out.println("Hi, the time is " + bean.getDateTime());
}
}
Original Post




See Also