I am developing an application using Spring and Waddin in the SpringVaadinIntegration add-on, now when I am in my main plaintiff Inject the service. Public Micev () {/ TODO Automatic : Generator creator stub} public string getLabel () {return "This is my label"; } Public Zero save user (utent use) {System.out.println ("Save User"); }} This is my main wadine UI class In reality, Microsoft @Netowword is not working while the main panel does not work in MyUI Here, where I try to save the user, the service is zero. What am i doing wrong You have created the main panel as "new menpanel"; " So the main panel is not a spring bean, so will not take any injection. Replace the pitototype scope with spots injection with the spring injection and fix any injection inside the main paneel. @Component @Scope ("session") Public class MISSEV {/}
@Component @Scope ("prototype") public class MyUI UI {@Autowired Private transient ApplicationContext applicationContext ; @ Owned Private MySwive My Service; Private MainPanel MainPanel; Personal vertical layout vertical layout; @ Override protected zero init (VaadinRequest request) {// TODO auto generated method stub vertical layout = new vertical layout (); Mainpayel = new menpanel (); VerticalLayout.addComponent (mainPanel); SetContent (verticalLayout); }}
@Component public class extends MainPanel CustomComponent Apply {Personal Vertical Layout Main Layout; Private button button; @AwardsWorld MySwive Second Service; Public Menapenel () {buildMainLayout (); SetCompositionRoot (mainLayout); // TODO user code add here} @ Auto generated personal vertical layout build buildout () {// normal part: create layout button = new button (); MainLayout = new vertical layout (); MainLayout.addComponent (button); button. Click AddClickListener (New Button. ClickList () {@ Override Public Zero Button (click Event Event) {// TODO auto-generated method stub second.Service.saveUser (new Utente ());}}); Return main layout; }}
No comments:
Post a Comment