Java Vaadin无弹簧靴问题
我目前正在做一个不使用Spring Boot的Vaadin Spring应用程序。我已按照说明加载带注释的Spring设置。已加载设置,但随后会弹出此异常: 严重:路径为[/dashboard]的上下文中Servlet[poc.spring.vaadin.dashboard.config.SpringVaadinServlet]的Servlet.service()引发异常[com.vaadin.server.ServiceException:org.springframework.beans.factory.BeanCreationException:创建名为'poc.spring.vaadin.dashboard.DashboardUI'的bean时出错:自动关联依赖项的注入失败;嵌套异常为org.springframework.beans.factory.BeanCreationException:无法自动关联字段:private com.vaadin.spring.navigator.SpringViewProvider poc.spring.vaadin.dashboard.DashboardUI.viewProvider;嵌套异常为java.lang.IllegalArgumentException:未找到具有根本原因的有效com.vaadin.spring.internal.UIID实例!] java.lang.IllegalArgumentException:未找到有效的com.vaadin.spring.internal.UIID实例 这是我的主要UI代码:Java Vaadin无弹簧靴问题,java,spring,vaadin,Java,Spring,Vaadin,我目前正在做一个不使用Spring Boot的Vaadin Spring应用程序。我已按照说明加载带注释的Spring设置。已加载设置,但随后会弹出此异常: 严重:路径为[/dashboard]的上下文中Servlet[poc.spring.vaadin.dashboard.config.SpringVaadinServlet]的Servlet.service()引发异常[com.vaadin.server.ServiceException:org.springframework.beans.f
@SuppressWarnings("serial")
@Theme("dashboardTheme")
@SpringUI()
public class DashboardUI extends UI {
@Autowired
private SpringViewProvider springViewProvider;
@Autowired
private PostValuesService postValuesService;
SampleSideBar sampleSideBar = new SampleSideBar();
LoginComponent loginComponent = new LoginComponent();
private TransMonitoring getTransGrid() throws ParseException {
Collection<PostValue> transList = postValuesService.getAllPostValues(null, null, null, null, null, null, null,
null, null, null, 100);
System.out.println(transList.size());
BeanItemContainer<PostValue> container = new BeanItemContainer<PostValue>(PostValue.class, transList);
return new TransMonitoring(container);
}
@Override
protected void init(VaadinRequest request) {
final VerticalLayout root = new VerticalLayout();
// root.setSizeFull();
root.setMargin(true);
root.setSpacing(true);
root.addComponent(loginComponent);
root.setComponentAlignment(loginComponent, Alignment.MIDDLE_CENTER);
setContent(root);
Navigator navigator = new Navigator(this, root);
navigator.addProvider(springViewProvider);
}
希望这里有人能帮助我
谢谢!请不要添加代码的截图。只需将代码放入文本中(用四个字符缩进)即可显示为ok。然后,其他人可以编辑该代码,将其用于答案,并可以进行搜索。已将更改的截图更新为代码。
@SuppressWarnings("serial")
@UIScope
@SpringView(name = "")
public class LoginView extends VerticalLayout implements View {
public static final String VIEW_NAME = "";
@Autowired
private LoginService loginService;
@PostConstruct
void init() {
Button navBtn = new Button("Test");
navBtn.addClickListener(e -> getUI().getNavigator().navigateTo("dashboard"));
setSizeFull();
TextField textField = new TextField("UserName");
PasswordField passwordField = new PasswordField("Password");
Button loginBtn = new Button("Login");
Button cancelBtn = new Button("Cancel");
VerticalLayout layout = new VerticalLayout();
HorizontalLayout horizontalLayout = new HorizontalLayout();
// layout.setSizeFull();
horizontalLayout.addComponent(navBtn);
horizontalLayout.addComponent(loginBtn);
horizontalLayout.addComponent(cancelBtn);
layout.addComponent(textField);
layout.addComponent(passwordField);
layout.addComponent(horizontalLayout);
User user = loginService.getDetailsByUserName("h.sipalay");
loginBtn.addClickListener(e -> new Notification(user.toString()).show(Page.getCurrent()));
addComponent(layout);
}
@Override
public void enter(ViewChangeEvent event) {
// the view is constructed in the init() method()
}