diff --git a/pom.xml b/pom.xml index cf6f3914..40f8684e 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 com.giffing.wicket.spring.boot.starter wicket-spring-boot-starter-parent - 4.1.1 + 5.0.0 pom Wicket Spring Boot Starter Parent @@ -22,7 +22,7 @@ org.springframework.boot spring-boot-starter-parent - 3.5.5 + 4.0.6 @@ -36,7 +36,7 @@ https://github.com/MarcGiffing/wicket-spring-boot/ scm:git:https://github.com/MarcGiffing/wicket-spring-boot.git - wicket-spring-boot-starter-parent-3.1.2 + wicket-spring-boot-starter-parent-5.0.0 @@ -53,9 +53,10 @@ UTF-8 17 - 2.0.5 - 10.6.0 - 10.6.0 + 2.1.0 + 10.8.0 + 10.8.0 + 4.0.14 @@ -168,7 +169,7 @@ de.agilecoders.wicket.webjars wicket-webjars - 4.0.11 + ${wicket-webjars.version} diff --git a/wicket-spring-boot-context/pom.xml b/wicket-spring-boot-context/pom.xml index d6ed0486..9a272271 100644 --- a/wicket-spring-boot-context/pom.xml +++ b/wicket-spring-boot-context/pom.xml @@ -4,7 +4,7 @@ com.giffing.wicket.spring.boot.starter wicket-spring-boot-starter-parent - 4.1.1 + 5.0.0 wicket-spring-boot-context diff --git a/wicket-spring-boot-context/src/main/java/com/giffing/wicket/spring/boot/context/extensions/types/TypeParser.java b/wicket-spring-boot-context/src/main/java/com/giffing/wicket/spring/boot/context/extensions/types/TypeParser.java index 0ce2ec95..0e79c86e 100644 --- a/wicket-spring-boot-context/src/main/java/com/giffing/wicket/spring/boot/context/extensions/types/TypeParser.java +++ b/wicket-spring-boot-context/src/main/java/com/giffing/wicket/spring/boot/context/extensions/types/TypeParser.java @@ -4,7 +4,6 @@ import lombok.NoArgsConstructor; import org.apache.wicket.util.lang.Bytes; -import com.giffing.wicket.spring.boot.context.exceptions.WicketSpringBootException; import java.time.Duration; @NoArgsConstructor(access = AccessLevel.PRIVATE) diff --git a/wicket-spring-boot-starter-example/pom.xml b/wicket-spring-boot-starter-example/pom.xml index 42ff4770..a20d5f7f 100644 --- a/wicket-spring-boot-starter-example/pom.xml +++ b/wicket-spring-boot-starter-example/pom.xml @@ -6,7 +6,7 @@ com.giffing.wicket.spring.boot.starter wicket-spring-boot-starter-parent - 4.1.1 + 5.0.0 .. @@ -18,8 +18,9 @@ true true - 7.0.11 - 7.1.0.Final + 7.0.14 + 7.3.2.Final + 4.0.14 @@ -109,11 +110,11 @@ de.agilecoders.wicket jquery-selectors - 4.0.6 + ${jquery-selectors.version} - org.liquibase - liquibase-core + org.springframework.boot + spring-boot-liquibase org.apache.commons @@ -214,7 +215,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.13.0 + 3.14.1 17 17 diff --git a/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/repository/services/customer/CustomerRepositoryServiceImpl.java b/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/repository/services/customer/CustomerRepositoryServiceImpl.java index 1e419f21..14c2e5c8 100644 --- a/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/repository/services/customer/CustomerRepositoryServiceImpl.java +++ b/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/repository/services/customer/CustomerRepositoryServiceImpl.java @@ -71,16 +71,9 @@ private Specification filter(CustomerFilter filter) { specs.add(CustomerSpecs.hasActive(filter.isActive())); } - Specification spec = null; - for (Specification specification : specs) { - if (spec == null) { - spec = Specification.where(specification); - } else { - spec = spec.and(specification); - } - } - - return spec; + return specs.stream() + .reduce(Specification::and) + .orElse(Specification.unrestricted()); } boolean isNotEmpty(String toCheck) { diff --git a/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/html/modal/YesNoModal.html b/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/html/modal/YesNoModal.html index 3c88c17f..c7463964 100644 --- a/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/html/modal/YesNoModal.html +++ b/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/html/modal/YesNoModal.html @@ -1,4 +1,4 @@ - + TextContentModal diff --git a/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/html/modal/YesNoPanel.html b/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/html/modal/YesNoPanel.html index 7120ddad..77fd6aeb 100644 --- a/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/html/modal/YesNoPanel.html +++ b/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/html/modal/YesNoPanel.html @@ -1,4 +1,4 @@ - + TextContentModal diff --git a/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/html/panel/FeedbackPanel.html b/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/html/panel/FeedbackPanel.html index 5b854a9c..646820c2 100644 --- a/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/html/panel/FeedbackPanel.html +++ b/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/html/panel/FeedbackPanel.html @@ -1,5 +1,5 @@ - +
diff --git a/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/BaseAuthenticatedPage.java b/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/BaseAuthenticatedPage.java index 10bcb638..9651cc70 100644 --- a/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/BaseAuthenticatedPage.java +++ b/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/BaseAuthenticatedPage.java @@ -11,7 +11,7 @@ import de.agilecoders.wicket.core.markup.html.bootstrap.navbar.*; import de.agilecoders.wicket.core.markup.html.bootstrap.utilities.BackgroundColorBehavior; import de.agilecoders.wicket.core.settings.ITheme; -import de.agilecoders.wicket.extensions.markup.html.bootstrap.icon.FontAwesome6IconType; +import de.agilecoders.wicket.extensions.markup.html.bootstrap.icon.FontAwesome7IconType; import org.apache.wicket.Component; import org.apache.wicket.markup.html.WebMarkupContainer; import org.apache.wicket.markup.html.link.AbstractLink; @@ -39,12 +39,12 @@ protected Navbar newNavbar(String markupId) { navbar.setBrandName(Model.of("Wicket")); navbar.addComponents(NavbarComponents.transform( Navbar.ComponentPosition.LEFT, - new NavbarButton(CustomerListPage.class, Model.of("Customers")).setIconType(FontAwesome6IconType.person_s), - new NavbarButton(ChatPage.class, Model.of("Chat")).setIconType(FontAwesome6IconType.rocketchat), + new NavbarButton(CustomerListPage.class, Model.of("Customers")).setIconType(FontAwesome7IconType.person_s), + new NavbarButton(ChatPage.class, Model.of("Chat")).setIconType(FontAwesome7IconType.rocketchat), new NavbarExternalLink(Model.of("https://github.com/MarcGiffing/wicket-spring-boot")) .setLabel(Model.of("Github")) .setTarget(BootstrapExternalLink.Target.blank) - .setIconType(FontAwesome6IconType.upload_s)) + .setIconType(FontAwesome7IconType.upload_s)) ); var dropdown = new NavbarDropDownButton(Model.of("Themes")) { @@ -70,7 +70,7 @@ protected List newSubMenuButtons(final String buttonMarkupId) { return subMenu; } - }.setIconType(FontAwesome6IconType.book_s); + }.setIconType(FontAwesome7IconType.book_s); navbar.addComponents(new ImmutableNavbarComponent(dropdown, Navbar.ComponentPosition.RIGHT)); return navbar; diff --git a/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/BasePage.html b/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/BasePage.html index 24afbcba..16f7ddda 100644 --- a/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/BasePage.html +++ b/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/BasePage.html @@ -1,5 +1,5 @@ - + Apache Wicket & Spring Bootstrap diff --git a/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/BasePage.java b/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/BasePage.java index caf7ac61..97ead45c 100644 --- a/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/BasePage.java +++ b/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/BasePage.java @@ -10,7 +10,7 @@ import de.agilecoders.wicket.core.markup.html.bootstrap.html.MetaTag; import de.agilecoders.wicket.core.markup.html.bootstrap.html.MobileViewportMetaTag; import de.agilecoders.wicket.core.markup.html.references.BootlintHeaderItem; -import de.agilecoders.wicket.extensions.markup.html.bootstrap.icon.FontAwesome6CssReference; +import de.agilecoders.wicket.extensions.markup.html.bootstrap.icon.FontAwesome7CssReference; import org.apache.wicket.MarkupContainer; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.markup.head.CssHeaderItem; @@ -51,7 +51,7 @@ public void renderHead(IHeaderResponse response) { super.renderHead(response); response.render(CssHeaderItem.forReference(CustomStylesCssRessourceReference.INSTANCE)); - response.render(CssHeaderItem.forReference(FontAwesome6CssReference.instance())); + response.render(CssHeaderItem.forReference(FontAwesome7CssReference.instance())); response.render(JavaScriptHeaderItem.forReference(NotyJSReference.INSTANCE)); response.render(JavaScriptHeaderItem.forReference(NotyPackagedJSReference.INSTANCE)); response.render(JavaScriptHeaderItem.forReference(NotyThemeBootstrapJSReference.INSTANCE)); diff --git a/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/customers/CustomerListPage.html b/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/customers/CustomerListPage.html index 623adf82..115efa6e 100644 --- a/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/customers/CustomerListPage.html +++ b/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/customers/CustomerListPage.html @@ -1,51 +1,74 @@ - + -
-
-

Customers - -

-
-
- -
-
- -
-
-
-
- -
-
- -
-
-
-
- -
-
- -
-
-
-
- -
-
-
- - - -
-
-
-
-
-
+ +
+
+

+ Customers + +

+
+
+ +
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+ + +
+
+ +
+ +
+ +
+ + +
+ +
+ +
+ +
+
+
+ +
+
- - + \ No newline at end of file diff --git a/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/customers/CustomerListPage.java b/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/customers/CustomerListPage.java index 758e12e4..5ae3d875 100644 --- a/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/customers/CustomerListPage.java +++ b/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/customers/CustomerListPage.java @@ -1,281 +1,281 @@ -package com.giffing.wicket.spring.boot.example.web.pages.customers; - -import java.util.ArrayList; -import java.util.List; - -import com.giffing.wicket.spring.boot.context.scan.WicketHomePage; -import com.giffing.wicket.spring.boot.example.web.general.action.panel.items.AbstrractActionItem; -import com.giffing.wicket.spring.boot.example.web.pages.BaseAuthenticatedPage; -import com.giffing.wicket.spring.boot.example.web.pages.customers.events.CustomerDeletedEvent; -import com.giffing.wicket.spring.boot.starter.web.servlet.websocket.WebSocketMessageBroadcaster; -import de.agilecoders.wicket.core.markup.html.bootstrap.button.BootstrapBookmarkablePageLink; -import de.agilecoders.wicket.core.markup.html.bootstrap.button.Buttons; -import de.agilecoders.wicket.extensions.markup.html.bootstrap.icon.FontAwesome6IconType; -import org.apache.wicket.Component; -import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.authroles.authorization.strategies.role.annotations.AuthorizeInstantiation; -import org.apache.wicket.extensions.ajax.markup.html.repeater.data.table.AjaxFallbackDefaultDataTable; -import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator; -import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn; -import org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable; -import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn; -import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn; -import org.apache.wicket.extensions.markup.html.repeater.data.table.filter.FilterForm; -import org.apache.wicket.extensions.markup.html.repeater.data.table.filter.FilterToolbar; -import org.apache.wicket.extensions.markup.html.repeater.data.table.filter.FilteredPropertyColumn; -import org.apache.wicket.markup.html.form.Button; -import org.apache.wicket.markup.html.form.CheckBox; -import org.apache.wicket.markup.html.form.TextField; -import org.apache.wicket.markup.html.link.BookmarkablePageLink; -import org.apache.wicket.markup.repeater.Item; -import org.apache.wicket.model.CompoundPropertyModel; -import org.apache.wicket.model.IModel; -import org.apache.wicket.model.Model; -import org.apache.wicket.model.PropertyModel; -import org.apache.wicket.model.ResourceModel; -import org.apache.wicket.protocol.ws.api.WebSocketBehavior; -import org.apache.wicket.protocol.ws.api.WebSocketRequestHandler; -import org.apache.wicket.protocol.ws.api.message.IWebSocketPushMessage; -import org.apache.wicket.request.mapper.parameter.PageParameters; -import org.apache.wicket.spring.injection.annot.SpringBean; -import org.apache.wicket.validation.validator.StringValidator; -import org.wicketstuff.annotation.mount.MountPath; - -import com.giffing.wicket.spring.boot.example.model.Customer; -import com.giffing.wicket.spring.boot.example.repository.services.customer.CustomerRepositoryService; -import com.giffing.wicket.spring.boot.example.repository.services.customer.filter.CustomerFilter; -import com.giffing.wicket.spring.boot.example.repository.services.customer.filter.CustomerSort; -import com.giffing.wicket.spring.boot.example.web.general.action.panel.ActionPanel; -import com.giffing.wicket.spring.boot.example.web.general.action.panel.items.links.ActionItemLink; -import com.giffing.wicket.spring.boot.example.web.general.action.panel.items.yesno.YesNoLink; -import com.giffing.wicket.spring.boot.example.web.html.basic.YesNoLabel; -import com.giffing.wicket.spring.boot.example.web.html.form.ValidationForm; -import com.giffing.wicket.spring.boot.example.web.html.panel.FeedbackPanel; -import com.giffing.wicket.spring.boot.example.web.html.repeater.data.table.filter.AbstractCheckBoxFilter; -import com.giffing.wicket.spring.boot.example.web.html.repeater.data.table.filter.AbstractTextFieldFilter; -import com.giffing.wicket.spring.boot.example.web.pages.customers.create.CustomerCreatePage; -import com.giffing.wicket.spring.boot.example.web.pages.customers.edit.CustomerEditPage; -import com.giffing.wicket.spring.boot.example.web.pages.customers.events.CustomerChangedEvent; -import com.giffing.wicket.spring.boot.example.web.pages.customers.model.CustomerDataProvider; -import com.giffing.wicket.spring.boot.example.web.pages.customers.model.UsernameSearchTextField; - -@WicketHomePage -@MountPath("custsomers") -@AuthorizeInstantiation("USER") -public class CustomerListPage extends BaseAuthenticatedPage { - - @SpringBean - private CustomerRepositoryService customerRepositoryService; - - @SpringBean - private WebSocketMessageBroadcaster webSocketMessageBroadcaster; - - private IModel customerFilterModel; - - private FilterForm filterForm; - - DataTable dataTable; - - public CustomerListPage() { - super(new PageParameters()); - FeedbackPanel feedbackPanel = new FeedbackPanel("feedback"); - feedbackPanel.setOutputMarkupId(true); - add(feedbackPanel); - - add(getWebSocketBehavior(feedbackPanel)); - - customerFilterModel = new CompoundPropertyModel<>(new CustomerFilter()); - CustomerDataProvider customerDataProvider = new CustomerDataProvider(customerFilterModel); - - queue(new BootstrapBookmarkablePageLink("create", CustomerCreatePage.class, Buttons.Type.Link) - .setIconType(FontAwesome6IconType.plus_s) - .setSize(Buttons.Size.Large)); - - queue(new ValidationForm<>("form", customerFilterModel)); - queueFormComponent(new TextField<>("id")); - queueFormComponent(new UsernameSearchTextField("usernameLike")); - queueFormComponent(new TextField("firstnameLike").add(StringValidator.minimumLength(3))); - queueFormComponent(new TextField("lastnameLike").add(StringValidator.minimumLength(3))); - queueFormComponent(new CheckBox("active")); - queue(cancelButton()); - - customerDataTable(customerDataProvider); - - } - - private WebSocketBehavior getWebSocketBehavior(FeedbackPanel feedbackPanel) { - return new WebSocketBehavior() { - - @Override - protected void onPush(WebSocketRequestHandler handler, IWebSocketPushMessage message) { - if (message instanceof CustomerChangedEvent event) { - info("Customer changed " + event.getCustomer().getFirstname() + " " + event.getCustomer().getLastname()); - handler.add(feedbackPanel); - } - if (message instanceof CustomerDeletedEvent event) { - warn("Customer deleted: " + event.getCustomer().getFirstname() + " " + event.getCustomer().getLastname()); - handler.add(feedbackPanel); - } - } - - }; - } - - private Button cancelButton() { - Button cancelButton = new Button("cancel") { - - @Override - public void onSubmit() { - customerFilterModel.setObject(new CustomerFilter()); - getForm().clearInput(); - filterForm.clearInput(); - } - - }; - cancelButton.setDefaultFormProcessing(false); - return cancelButton; - } - - private void customerDataTable(CustomerDataProvider customerDataProvider) { - - filterForm = new FilterForm<>("filterForm", customerDataProvider); - queue(filterForm); - - List> columns = new ArrayList<>(); - columns.add(idColumn()); - columns.add(usernameColumn()); - columns.add(firstnameColumn()); - columns.add(lastnameColumn()); - columns.add(activeColumn()); - columns.add(actionColumn()); - - dataTable = new AjaxFallbackDefaultDataTable<>("table", columns, - customerDataProvider, 10); - dataTable.setOutputMarkupId(true); - FilterToolbar filterToolbar = new FilterToolbar(dataTable, filterForm); - - dataTable.addTopToolbar(filterToolbar); - queue(dataTable); - } - - private PropertyColumn idColumn() { - return new PropertyColumn<>(Model.of("Id"), CustomerSort.ID, - CustomerSort.ID.getFieldName()); - } - - private FilteredPropertyColumn usernameColumn() { - return new FilteredPropertyColumn<>(new ResourceModel("username"), CustomerSort.USERNAME, - CustomerSort.USERNAME.getFieldName()) { - - @Override - public Component getFilter(String componentId, FilterForm form) { - return new AbstractTextFieldFilter(componentId, - new PropertyModel<>(form.getModel(), "usernameLike"), form) { - - @Override - public TextField createTextFieldComponent(String componentId, IModel model) { - return new UsernameSearchTextField(componentId, model); - } - - }; - } - - }; - } - - private FilteredPropertyColumn firstnameColumn() { - return new FilteredPropertyColumn<>(new ResourceModel("firstname"), - CustomerSort.FIRSTNAME, CustomerSort.FIRSTNAME.getFieldName()) { - - @Override - public Component getFilter(String componentId, FilterForm form) { - return new AbstractTextFieldFilter(componentId, - new PropertyModel<>(form.getModel(), "firstnameLike"), form) { - - @Override - public TextField createTextFieldComponent(String componentId, IModel model) { - return new TextField<>(componentId, model); - } - - }; - } - - }; - } - - private FilteredPropertyColumn lastnameColumn() { - return new FilteredPropertyColumn<>(new ResourceModel("lastname"), CustomerSort.LASTNAME, - CustomerSort.LASTNAME.getFieldName()) { - - @Override - public Component getFilter(String componentId, FilterForm form) { - return new AbstractTextFieldFilter(componentId, - new PropertyModel<>(form.getModel(), "lastnameLike"), form) { - - @Override - public TextField createTextFieldComponent(String componentId, IModel model) { - return new TextField<>(componentId, model); - } - - }; - } - - }; - } - - private FilteredPropertyColumn activeColumn() { - return new FilteredPropertyColumn<>(new ResourceModel("active"), CustomerSort.ACTIVE, - CustomerSort.ACTIVE.getFieldName()) { - - @Override - public Component getFilter(String componentId, FilterForm form) { - return new AbstractCheckBoxFilter(componentId, new PropertyModel<>(form.getModel(), "active"), form); - } - - @Override - public void populateItem(Item> item, String componentId, - IModel rowModel) { - item.add(new YesNoLabel(componentId, (IModel) getDataModel(rowModel))); - } - - }; - } - - private AbstractColumn actionColumn() { - return new AbstractColumn<>(Model.of("Action")) { - - @Override - public void populateItem(Item> cellItem, String componentId, - IModel rowModel) { - List abstractItems = new ArrayList<>(); - var params = new PageParameters(); - params.add(CustomerEditPage.CUSTOMER_ID_PARAM, rowModel.getObject().getId()); - params.add(CustomerEditPage.PAGE_REFERENCE_ID, getPageId()); - - abstractItems.add(editActionItem(params)); - abstractItems.add(deleteActionItem(rowModel)); - cellItem.add(new ActionPanel(componentId, abstractItems)); - } - - private static ActionItemLink editActionItem(PageParameters params) { - return new ActionItemLink( - FontAwesome6IconType.pen_s, - new BookmarkablePageLink("link", CustomerEditPage.class, params) - ); - } - - private YesNoLink deleteActionItem(IModel rowModel) { - return new YesNoLink<>(FontAwesome6IconType.trash_s) { - - @Override - protected void yesClicked(AjaxRequestTarget target) { - customerRepositoryService.delete(rowModel.getObject().getId()); - webSocketMessageBroadcaster.sendToAll(new CustomerDeletedEvent(rowModel.getObject())); - target.add(dataTable); - } - }; - } - }; - } - -} +package com.giffing.wicket.spring.boot.example.web.pages.customers; + +import java.util.ArrayList; +import java.util.List; + +import com.giffing.wicket.spring.boot.context.scan.WicketHomePage; +import com.giffing.wicket.spring.boot.example.web.general.action.panel.items.AbstrractActionItem; +import com.giffing.wicket.spring.boot.example.web.pages.BaseAuthenticatedPage; +import com.giffing.wicket.spring.boot.example.web.pages.customers.events.CustomerDeletedEvent; +import com.giffing.wicket.spring.boot.starter.web.servlet.websocket.WebSocketMessageBroadcaster; +import de.agilecoders.wicket.core.markup.html.bootstrap.button.BootstrapBookmarkablePageLink; +import de.agilecoders.wicket.core.markup.html.bootstrap.button.Buttons; +import de.agilecoders.wicket.extensions.markup.html.bootstrap.icon.FontAwesome7IconType; +import org.apache.wicket.Component; +import org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.authroles.authorization.strategies.role.annotations.AuthorizeInstantiation; +import org.apache.wicket.extensions.ajax.markup.html.repeater.data.table.AjaxFallbackDefaultDataTable; +import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator; +import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn; +import org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable; +import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn; +import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn; +import org.apache.wicket.extensions.markup.html.repeater.data.table.filter.FilterForm; +import org.apache.wicket.extensions.markup.html.repeater.data.table.filter.FilterToolbar; +import org.apache.wicket.extensions.markup.html.repeater.data.table.filter.FilteredPropertyColumn; +import org.apache.wicket.markup.html.form.Button; +import org.apache.wicket.markup.html.form.CheckBox; +import org.apache.wicket.markup.html.form.TextField; +import org.apache.wicket.markup.html.link.BookmarkablePageLink; +import org.apache.wicket.markup.repeater.Item; +import org.apache.wicket.model.CompoundPropertyModel; +import org.apache.wicket.model.IModel; +import org.apache.wicket.model.Model; +import org.apache.wicket.model.PropertyModel; +import org.apache.wicket.model.ResourceModel; +import org.apache.wicket.protocol.ws.api.WebSocketBehavior; +import org.apache.wicket.protocol.ws.api.WebSocketRequestHandler; +import org.apache.wicket.protocol.ws.api.message.IWebSocketPushMessage; +import org.apache.wicket.request.mapper.parameter.PageParameters; +import org.apache.wicket.spring.injection.annot.SpringBean; +import org.apache.wicket.validation.validator.StringValidator; +import org.wicketstuff.annotation.mount.MountPath; + +import com.giffing.wicket.spring.boot.example.model.Customer; +import com.giffing.wicket.spring.boot.example.repository.services.customer.CustomerRepositoryService; +import com.giffing.wicket.spring.boot.example.repository.services.customer.filter.CustomerFilter; +import com.giffing.wicket.spring.boot.example.repository.services.customer.filter.CustomerSort; +import com.giffing.wicket.spring.boot.example.web.general.action.panel.ActionPanel; +import com.giffing.wicket.spring.boot.example.web.general.action.panel.items.links.ActionItemLink; +import com.giffing.wicket.spring.boot.example.web.general.action.panel.items.yesno.YesNoLink; +import com.giffing.wicket.spring.boot.example.web.html.basic.YesNoLabel; +import com.giffing.wicket.spring.boot.example.web.html.form.ValidationForm; +import com.giffing.wicket.spring.boot.example.web.html.panel.FeedbackPanel; +import com.giffing.wicket.spring.boot.example.web.html.repeater.data.table.filter.AbstractCheckBoxFilter; +import com.giffing.wicket.spring.boot.example.web.html.repeater.data.table.filter.AbstractTextFieldFilter; +import com.giffing.wicket.spring.boot.example.web.pages.customers.create.CustomerCreatePage; +import com.giffing.wicket.spring.boot.example.web.pages.customers.edit.CustomerEditPage; +import com.giffing.wicket.spring.boot.example.web.pages.customers.events.CustomerChangedEvent; +import com.giffing.wicket.spring.boot.example.web.pages.customers.model.CustomerDataProvider; +import com.giffing.wicket.spring.boot.example.web.pages.customers.model.UsernameSearchTextField; + +@WicketHomePage +@MountPath("customers") +@AuthorizeInstantiation("USER") +public class CustomerListPage extends BaseAuthenticatedPage { + + @SpringBean + private CustomerRepositoryService customerRepositoryService; + + @SpringBean + private WebSocketMessageBroadcaster webSocketMessageBroadcaster; + + private IModel customerFilterModel; + + private FilterForm filterForm; + + DataTable dataTable; + + public CustomerListPage() { + super(new PageParameters()); + FeedbackPanel feedbackPanel = new FeedbackPanel("feedback"); + feedbackPanel.setOutputMarkupId(true); + add(feedbackPanel); + + add(getWebSocketBehavior(feedbackPanel)); + + customerFilterModel = new CompoundPropertyModel<>(new CustomerFilter()); + CustomerDataProvider customerDataProvider = new CustomerDataProvider(customerFilterModel); + + queue(new BootstrapBookmarkablePageLink("create", CustomerCreatePage.class, Buttons.Type.Primary) + .setIconType(FontAwesome7IconType.plus_s) + .setSize(Buttons.Size.Large)); + + queue(new ValidationForm<>("form", customerFilterModel)); + queueFormComponent(new TextField<>("id")); + queueFormComponent(new UsernameSearchTextField("usernameLike")); + queueFormComponent(new TextField("firstnameLike").add(StringValidator.minimumLength(3))); + queueFormComponent(new TextField("lastnameLike").add(StringValidator.minimumLength(3))); + queueFormComponent(new CheckBox("active")); + queue(cancelButton()); + + customerDataTable(customerDataProvider); + + } + + private WebSocketBehavior getWebSocketBehavior(FeedbackPanel feedbackPanel) { + return new WebSocketBehavior() { + + @Override + protected void onPush(WebSocketRequestHandler handler, IWebSocketPushMessage message) { + if (message instanceof CustomerChangedEvent event) { + info("Customer changed " + event.getCustomer().getFirstname() + " " + event.getCustomer().getLastname()); + handler.add(feedbackPanel); + } + if (message instanceof CustomerDeletedEvent event) { + warn("Customer deleted: " + event.getCustomer().getFirstname() + " " + event.getCustomer().getLastname()); + handler.add(feedbackPanel); + } + } + + }; + } + + private Button cancelButton() { + Button cancelButton = new Button("cancel") { + + @Override + public void onSubmit() { + customerFilterModel.setObject(new CustomerFilter()); + getForm().clearInput(); + filterForm.clearInput(); + } + + }; + cancelButton.setDefaultFormProcessing(false); + return cancelButton; + } + + private void customerDataTable(CustomerDataProvider customerDataProvider) { + + filterForm = new FilterForm<>("filterForm", customerDataProvider); + queue(filterForm); + + List> columns = new ArrayList<>(); + columns.add(idColumn()); + columns.add(usernameColumn()); + columns.add(firstnameColumn()); + columns.add(lastnameColumn()); + columns.add(activeColumn()); + columns.add(actionColumn()); + + dataTable = new AjaxFallbackDefaultDataTable<>("table", columns, + customerDataProvider, 10); + dataTable.setOutputMarkupId(true); + FilterToolbar filterToolbar = new FilterToolbar(dataTable, filterForm); + + dataTable.addTopToolbar(filterToolbar); + queue(dataTable); + } + + private PropertyColumn idColumn() { + return new PropertyColumn<>(Model.of("Id"), CustomerSort.ID, + CustomerSort.ID.getFieldName()); + } + + private FilteredPropertyColumn usernameColumn() { + return new FilteredPropertyColumn<>(new ResourceModel("username"), CustomerSort.USERNAME, + CustomerSort.USERNAME.getFieldName()) { + + @Override + public Component getFilter(String componentId, FilterForm form) { + return new AbstractTextFieldFilter(componentId, + new PropertyModel<>(form.getModel(), "usernameLike"), form) { + + @Override + public TextField createTextFieldComponent(String componentId, IModel model) { + return new UsernameSearchTextField(componentId, model); + } + + }; + } + + }; + } + + private FilteredPropertyColumn firstnameColumn() { + return new FilteredPropertyColumn<>(new ResourceModel("firstname"), + CustomerSort.FIRSTNAME, CustomerSort.FIRSTNAME.getFieldName()) { + + @Override + public Component getFilter(String componentId, FilterForm form) { + return new AbstractTextFieldFilter(componentId, + new PropertyModel<>(form.getModel(), "firstnameLike"), form) { + + @Override + public TextField createTextFieldComponent(String componentId, IModel model) { + return new TextField<>(componentId, model); + } + + }; + } + + }; + } + + private FilteredPropertyColumn lastnameColumn() { + return new FilteredPropertyColumn<>(new ResourceModel("lastname"), CustomerSort.LASTNAME, + CustomerSort.LASTNAME.getFieldName()) { + + @Override + public Component getFilter(String componentId, FilterForm form) { + return new AbstractTextFieldFilter(componentId, + new PropertyModel<>(form.getModel(), "lastnameLike"), form) { + + @Override + public TextField createTextFieldComponent(String componentId, IModel model) { + return new TextField<>(componentId, model); + } + + }; + } + + }; + } + + private FilteredPropertyColumn activeColumn() { + return new FilteredPropertyColumn<>(new ResourceModel("active"), CustomerSort.ACTIVE, + CustomerSort.ACTIVE.getFieldName()) { + + @Override + public Component getFilter(String componentId, FilterForm form) { + return new AbstractCheckBoxFilter(componentId, new PropertyModel<>(form.getModel(), "active"), form); + } + + @Override + public void populateItem(Item> item, String componentId, + IModel rowModel) { + item.add(new YesNoLabel(componentId, (IModel) getDataModel(rowModel))); + } + + }; + } + + private AbstractColumn actionColumn() { + return new AbstractColumn<>(Model.of("Action")) { + + @Override + public void populateItem(Item> cellItem, String componentId, + IModel rowModel) { + List abstractItems = new ArrayList<>(); + var params = new PageParameters(); + params.add(CustomerEditPage.CUSTOMER_ID_PARAM, rowModel.getObject().getId()); + params.add(CustomerEditPage.PAGE_REFERENCE_ID, getPageId()); + + abstractItems.add(editActionItem(params)); + abstractItems.add(deleteActionItem(rowModel)); + cellItem.add(new ActionPanel(componentId, abstractItems)); + } + + private static ActionItemLink editActionItem(PageParameters params) { + return new ActionItemLink( + FontAwesome7IconType.pen_s, + new BookmarkablePageLink("link", CustomerEditPage.class, params) + ); + } + + private YesNoLink deleteActionItem(IModel rowModel) { + return new YesNoLink<>(FontAwesome7IconType.trash_s) { + + @Override + protected void yesClicked(AjaxRequestTarget target) { + customerRepositoryService.delete(rowModel.getObject().getId()); + webSocketMessageBroadcaster.sendToAll(new CustomerDeletedEvent(rowModel.getObject())); + target.add(dataTable); + } + }; + } + }; + } + +} diff --git a/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/customers/create/CustomerCreatePage.html b/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/customers/create/CustomerCreatePage.html index b7de841f..5a9f3354 100644 --- a/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/customers/create/CustomerCreatePage.html +++ b/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/customers/create/CustomerCreatePage.html @@ -1,44 +1,55 @@ - + -
-
-

Customer Create

-
-
- -
-
-
-
- -
-
-
-
- -
-
-
-
- -
-
-
-
- -
-
-
-
-
-
- - -
-
-
+
+
+

Customer Create

+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+ + +
+
+
+ +
+ +
+
+ + +
+
+ +
+
+
- + \ No newline at end of file diff --git a/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/customers/edit/CustomerEditPage.java b/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/customers/edit/CustomerEditPage.java index cfd1a534..325d44ab 100644 --- a/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/customers/edit/CustomerEditPage.java +++ b/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/customers/edit/CustomerEditPage.java @@ -1,6 +1,5 @@ package com.giffing.wicket.spring.boot.example.web.pages.customers.edit; -import com.giffing.wicket.spring.boot.example.model.Customer; import com.giffing.wicket.spring.boot.example.repository.services.customer.CustomerRepositoryService; import com.giffing.wicket.spring.boot.example.web.pages.customers.CustomerListPage; import com.giffing.wicket.spring.boot.example.web.pages.customers.create.CustomerCreatePage; @@ -8,7 +7,6 @@ import org.apache.wicket.authroles.authorization.strategies.role.annotations.AuthorizeInstantiation; import org.apache.wicket.request.mapper.parameter.PageParameters; import org.apache.wicket.spring.injection.annot.SpringBean; -import org.apache.wicket.util.string.StringValue; import org.wicketstuff.annotation.mount.MountPath; import java.text.MessageFormat; diff --git a/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/errors/AccessDeniedPage.html b/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/errors/AccessDeniedPage.html index 33c207c9..5f0c121d 100644 --- a/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/errors/AccessDeniedPage.html +++ b/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/errors/AccessDeniedPage.html @@ -1,5 +1,5 @@ - + Access Denied! diff --git a/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/errors/ExpiredPage.html b/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/errors/ExpiredPage.html index 3dd5fe5c..8a972ef0 100644 --- a/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/errors/ExpiredPage.html +++ b/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/errors/ExpiredPage.html @@ -1,5 +1,5 @@ - + Expired diff --git a/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/errors/InternalErrorPage.html b/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/errors/InternalErrorPage.html index 8b9ba325..1c5125bf 100644 --- a/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/errors/InternalErrorPage.html +++ b/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/errors/InternalErrorPage.html @@ -1,5 +1,5 @@ - + Internal Error diff --git a/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/footer/Footer.html b/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/footer/Footer.html index f232bb47..16173956 100644 --- a/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/footer/Footer.html +++ b/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/footer/Footer.html @@ -1,4 +1,4 @@ - + Footer diff --git a/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/login/LoginPage.html b/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/login/LoginPage.html index 676436a3..c9a817dc 100644 --- a/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/login/LoginPage.html +++ b/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/login/LoginPage.html @@ -1,5 +1,5 @@ - + Spring Boot - Apache Wicket Quickstart diff --git a/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/websocket/ChatPage.html b/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/websocket/ChatPage.html index 41a9e7e2..d3cfaf05 100644 --- a/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/websocket/ChatPage.html +++ b/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/pages/websocket/ChatPage.html @@ -1,62 +1,78 @@ - - - - - Chat - - - -
-
-

Chat

-
-
-
-
-
-
-
-
-
-
-
- - - - -
-
- - - - - - - -
-
-
-
-
-

- : -

-
-
-
-
-
-
-
-
-
- + + + + + Chat + + + + +
+
+

Chat

+
+
+
+ +
+ +
+
+
+ +
+ +
+ +
+ + + +
+ + +
+ + + + + +
+
+ + +
+
+
+
+ + + : + +
+
+
+
+
+
+
+
+
+
+ \ No newline at end of file diff --git a/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/security/SpringSecurityWicketSessionResolver.java b/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/security/SpringSecurityWicketSessionResolver.java index 539bcef8..e534fe4a 100644 --- a/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/security/SpringSecurityWicketSessionResolver.java +++ b/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/security/SpringSecurityWicketSessionResolver.java @@ -2,7 +2,6 @@ import com.giffing.wicket.spring.boot.starter.web.servlet.websocket.WicketSessionResolver; import lombok.RequiredArgsConstructor; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.session.FindByIndexNameSessionRepository; import org.springframework.session.Session; diff --git a/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/security/WicketWebSecurityAdapterConfig.java b/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/security/WicketWebSecurityAdapterConfig.java index dc4316b2..6cf7f3e3 100644 --- a/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/security/WicketWebSecurityAdapterConfig.java +++ b/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/security/WicketWebSecurityAdapterConfig.java @@ -33,13 +33,13 @@ public class WicketWebSecurityAdapterConfig { @ConditionalOnMissingBean @Bean - public AuthenticationManager authenticationManager(AuthenticationConfiguration authenticationConfiguration) throws Exception { + AuthenticationManager authenticationManager(AuthenticationConfiguration authenticationConfiguration) throws Exception { return authenticationConfiguration.getAuthenticationManager(); } @ConditionalOnMissingBean @Bean - public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { + SecurityFilterChain filterChain(HttpSecurity http) throws Exception { return http .securityContext(ctx -> ctx.requireExplicitSave(false)) .csrf(AbstractHttpConfigurer::disable) @@ -51,13 +51,13 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { } @Bean - public static BCryptPasswordEncoder passwordEncoder() { + static BCryptPasswordEncoder passwordEncoder() { return new BCryptPasswordEncoder(); } @Bean //TODO Add Wicket Issue - problem with semicolon in wicket websocket url. Allow semicolon. - public HttpFirewall allowUrlEncodedSlashHttpFirewall() { + HttpFirewall allowUrlEncodedSlashHttpFirewall() { StrictHttpFirewall fw = new StrictHttpFirewall(); fw.setAllowSemicolon(true); return fw; @@ -65,7 +65,7 @@ public HttpFirewall allowUrlEncodedSlashHttpFirewall() { @ConditionalOnMissingBean @Bean - public UserDetailsService userDetailsService(final PasswordEncoder passwordEncoder) { + UserDetailsService userDetailsService(final PasswordEncoder passwordEncoder) { InMemoryUserDetailsManager manager = new InMemoryUserDetailsManager(); manager.createUser( User.withUsername("admin") @@ -81,7 +81,7 @@ public UserDetailsService userDetailsService(final PasswordEncoder passwordEncod } //@Bean - //public WicketSessionResolver springSecurityWicketSessionResolver() { + //WicketSessionResolver springSecurityWicketSessionResolver() { // return new SpringSecurityWicketSessionResolver(); //} diff --git a/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/wicket/dataprovider/DefaultDataProvider.java b/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/wicket/dataprovider/DefaultDataProvider.java index 98de541a..2ec34dea 100644 --- a/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/wicket/dataprovider/DefaultDataProvider.java +++ b/wicket-spring-boot-starter-example/src/main/java/com/giffing/wicket/spring/boot/example/web/wicket/dataprovider/DefaultDataProvider.java @@ -1,7 +1,6 @@ package com.giffing.wicket.spring.boot.example.web.wicket.dataprovider; import java.util.Iterator; -import java.util.List; import org.apache.wicket.extensions.markup.html.repeater.data.sort.ISortState; import org.apache.wicket.extensions.markup.html.repeater.data.table.ISortableDataProvider; diff --git a/wicket-spring-boot-starter-example/src/test/java/com/giffing/wicket/spring/boot/example/web/WicketBaseIntTest.java b/wicket-spring-boot-starter-example/src/test/java/com/giffing/wicket/spring/boot/example/web/WicketBaseIntTest.java index 73eb994b..beffe320 100644 --- a/wicket-spring-boot-starter-example/src/test/java/com/giffing/wicket/spring/boot/example/web/WicketBaseIntTest.java +++ b/wicket-spring-boot-starter-example/src/test/java/com/giffing/wicket/spring/boot/example/web/WicketBaseIntTest.java @@ -37,7 +37,7 @@ public abstract class WicketBaseIntTest { public static class TestConfig { @Bean @Primary - public WebSocketMessageBroadcaster webSocketMessageBroadcaster() { + WebSocketMessageBroadcaster webSocketMessageBroadcaster() { return Mockito.mock(WebSocketMessageBroadcaster.class); } } diff --git a/wicket-spring-boot-starter-example/src/test/java/com/giffing/wicket/spring/boot/example/web/WicketBaseTest.java b/wicket-spring-boot-starter-example/src/test/java/com/giffing/wicket/spring/boot/example/web/WicketBaseTest.java index 32e6e650..405f0753 100644 --- a/wicket-spring-boot-starter-example/src/test/java/com/giffing/wicket/spring/boot/example/web/WicketBaseTest.java +++ b/wicket-spring-boot-starter-example/src/test/java/com/giffing/wicket/spring/boot/example/web/WicketBaseTest.java @@ -8,7 +8,6 @@ import org.apache.wicket.util.tester.WicketTester; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.ApplicationContext; @@ -17,7 +16,6 @@ import org.springframework.security.core.Authentication; import org.springframework.security.core.AuthenticationException; import org.springframework.test.context.bean.override.mockito.MockitoBean; -import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.util.ReflectionTestUtils; import test.com.giffing.wicket.spring.boot.example.web.WicketWebApplicationConfig; @@ -28,7 +26,6 @@ * @author Marc Giffing * */ -@ExtendWith(SpringExtension.class) @SpringBootTest(classes = WicketWebApplicationConfig.class) @Disabled public class WicketBaseTest { diff --git a/wicket-spring-boot-starter-example/src/test/java/com/giffing/wicket/spring/boot/example/web/pages/customers/CustomerListIntTest.java b/wicket-spring-boot-starter-example/src/test/java/com/giffing/wicket/spring/boot/example/web/pages/customers/CustomerListIntTest.java index 6959bbee..eefaf047 100644 --- a/wicket-spring-boot-starter-example/src/test/java/com/giffing/wicket/spring/boot/example/web/pages/customers/CustomerListIntTest.java +++ b/wicket-spring-boot-starter-example/src/test/java/com/giffing/wicket/spring/boot/example/web/pages/customers/CustomerListIntTest.java @@ -45,7 +45,7 @@ public void assert_delete_customer_method_called_once() { getTester().startPage(CustomerListPage.class); getTester().assertRenderedPage(CustomerListPage.class); - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) DataTable dataTable = (DataTable) getTester().getComponentFromLastRenderedPage( "filterForm:table"); assertThat(dataTable.getItemCount(), equalTo(5L)); diff --git a/wicket-spring-boot-starter-example/src/test/java/test/com/giffing/wicket/spring/boot/example/web/WicketWebApplicationConfig.java b/wicket-spring-boot-starter-example/src/test/java/test/com/giffing/wicket/spring/boot/example/web/WicketWebApplicationConfig.java index e820f437..6cfce520 100644 --- a/wicket-spring-boot-starter-example/src/test/java/test/com/giffing/wicket/spring/boot/example/web/WicketWebApplicationConfig.java +++ b/wicket-spring-boot-starter-example/src/test/java/test/com/giffing/wicket/spring/boot/example/web/WicketWebApplicationConfig.java @@ -5,9 +5,9 @@ import org.apache.wicket.markup.html.WebPage; import org.apache.wicket.resource.loader.ClassStringResourceLoader; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration; -import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; -import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; +import org.springframework.boot.data.jpa.autoconfigure.DataJpaRepositoriesAutoConfiguration; +import org.springframework.boot.hibernate.autoconfigure.HibernateJpaAutoConfiguration; +import org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration; import org.springframework.context.annotation.ComponentScan; import org.springframework.transaction.annotation.EnableTransactionManagement; @@ -21,7 +21,7 @@ //TODO move to test @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class, - JpaRepositoriesAutoConfiguration.class, + DataJpaRepositoriesAutoConfiguration.class, HibernateJpaAutoConfiguration.class, }) @ComponentScan(basePackageClasses = SpringBootWebPackageIdentifier.class) diff --git a/wicket-spring-boot-starter-example/src/test/resources/db/changelog/db.changelog-master-test.xml b/wicket-spring-boot-starter-example/src/test/resources/db/changelog/db.changelog-master-test.xml index d1f8733e..76b5d324 100644 --- a/wicket-spring-boot-starter-example/src/test/resources/db/changelog/db.changelog-master-test.xml +++ b/wicket-spring-boot-starter-example/src/test/resources/db/changelog/db.changelog-master-test.xml @@ -3,7 +3,7 @@ xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog - http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd"> + http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-5.0.xsd"> diff --git a/wicket-spring-boot-starter/pom.xml b/wicket-spring-boot-starter/pom.xml index 9b87ddf3..51cfba58 100644 --- a/wicket-spring-boot-starter/pom.xml +++ b/wicket-spring-boot-starter/pom.xml @@ -4,7 +4,7 @@ com.giffing.wicket.spring.boot.starter wicket-spring-boot-starter-parent - 4.1.1 + 5.0.0 .. @@ -48,6 +48,21 @@ spring-boot-actuator provided + + org.springframework.boot + spring-boot-cassandra + provided + + + org.springframework.boot + spring-boot-hazelcast + provided + + + org.springframework.boot + spring-boot-data-redis + provided + diff --git a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/WicketBootWebApplicationAutoConfiguration.java b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/WicketBootWebApplicationAutoConfiguration.java index 020263d2..f46c1b7f 100644 --- a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/WicketBootWebApplicationAutoConfiguration.java +++ b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/WicketBootWebApplicationAutoConfiguration.java @@ -22,7 +22,7 @@ public class WicketBootWebApplicationAutoConfiguration { @Bean - public WicketBootStandardWebApplication wicketBootWebApplication() { + WicketBootStandardWebApplication wicketBootWebApplication() { return new WicketBootStandardWebApplication(); } diff --git a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/app/WicketBootSecuredWebApplication.java b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/app/WicketBootSecuredWebApplication.java index 9461a8bb..0d78b2f0 100644 --- a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/app/WicketBootSecuredWebApplication.java +++ b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/app/WicketBootSecuredWebApplication.java @@ -13,8 +13,6 @@ import org.apache.wicket.markup.html.WebPage; import org.apache.wicket.spring.injection.annot.SpringBean; import org.apache.wicket.spring.injection.annot.SpringComponentInjector; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; @@ -100,7 +98,6 @@ protected Class getWebSessionClass() return applicationContext.getBean(AuthenticatedWebSessionConfig.class).getAuthenticatedWebSessionClass(); } - @SuppressWarnings("unchecked") @Override protected Class getSignInPageClass() { if(classCandidates.getSignInPageCandidates().isEmpty()){ @@ -118,7 +115,6 @@ protected Class getSignInPageClass() { return classCandidates.getSignInPageCandidates().iterator().next().getCandidate(); } - @SuppressWarnings("unchecked") @Override public Class getHomePage() { if(classCandidates.getHomePageCandidates().isEmpty()){ diff --git a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/app/WicketBootStandardWebApplication.java b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/app/WicketBootStandardWebApplication.java index ed7b3ac7..4e2675f5 100644 --- a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/app/WicketBootStandardWebApplication.java +++ b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/app/WicketBootStandardWebApplication.java @@ -10,8 +10,6 @@ import org.apache.wicket.protocol.http.WebApplication; import org.apache.wicket.spring.injection.annot.SpringBean; import org.apache.wicket.spring.injection.annot.SpringComponentInjector; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Lazy; @@ -20,7 +18,6 @@ import com.giffing.wicket.spring.boot.context.extensions.boot.actuator.WicketAutoConfig; import com.giffing.wicket.spring.boot.context.extensions.boot.actuator.WicketEndpointRepository; import com.giffing.wicket.spring.boot.context.scan.WicketHomePage; -import com.giffing.wicket.spring.boot.starter.app.classscanner.candidates.WicketClassCandidate; import com.giffing.wicket.spring.boot.starter.app.classscanner.candidates.WicketClassCandidatesHolder; import com.giffing.wicket.spring.boot.starter.configuration.extensions.core.settings.general.GeneralSettingsProperties; @@ -88,7 +85,6 @@ public RuntimeConfigurationType getConfigurationType() { return generalSettingsProperties.getConfigurationType(); } - @SuppressWarnings("unchecked") @Override public Class getHomePage() { if(classCandidates.getHomePageCandidates().isEmpty()){ diff --git a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/app/classscanner/ClassCandidateScannerConfiguration.java b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/app/classscanner/ClassCandidateScannerConfiguration.java index a89ea17a..0a582e6d 100644 --- a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/app/classscanner/ClassCandidateScannerConfiguration.java +++ b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/app/classscanner/ClassCandidateScannerConfiguration.java @@ -2,7 +2,6 @@ import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.env.Environment; @@ -21,7 +20,7 @@ public class ClassCandidateScannerConfiguration { private final BeanFactory beanFactory; @Bean - public WicketClassCandidatesHolder pageCandidates() { + WicketClassCandidatesHolder pageCandidates() { var result = new WicketClassCandidatesHolder(); // TODO Why is the ClassCandidateScanner initialized? new ClassCandidateScanner(environment, diff --git a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/app/verifier/WicketDependencyVersionChecker.java b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/app/verifier/WicketDependencyVersionChecker.java index 11557207..363e79cc 100644 --- a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/app/verifier/WicketDependencyVersionChecker.java +++ b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/app/verifier/WicketDependencyVersionChecker.java @@ -11,7 +11,6 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.ResourceLoaderAware; @@ -39,7 +38,6 @@ public class WicketDependencyVersionChecker implements ResourceLoaderAware { private final WicketDependencyVersionCheckerProperties props; - @Autowired public WicketDependencyVersionChecker(WicketDependencyVersionCheckerProperties props) { this.props = props; } diff --git a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/core/serializer/deflated/DeflatedJavaSerializerConfig.java b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/core/serializer/deflated/DeflatedJavaSerializerConfig.java index 7de7add8..87d63158 100644 --- a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/core/serializer/deflated/DeflatedJavaSerializerConfig.java +++ b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/core/serializer/deflated/DeflatedJavaSerializerConfig.java @@ -2,10 +2,8 @@ import lombok.RequiredArgsConstructor; import org.apache.wicket.protocol.http.WebApplication; -import org.apache.wicket.serialize.ISerializer; import org.apache.wicket.serialize.java.DeflatedJavaSerializer; import org.apache.wicket.serialize.java.JavaSerializer; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.properties.EnableConfigurationProperties; diff --git a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/core/settings/debug/DebugSettingsConfig.java b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/core/settings/debug/DebugSettingsConfig.java index 797bba67..1c8488d5 100644 --- a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/core/settings/debug/DebugSettingsConfig.java +++ b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/core/settings/debug/DebugSettingsConfig.java @@ -7,6 +7,7 @@ import lombok.RequiredArgsConstructor; import org.apache.wicket.protocol.http.WebApplication; import org.apache.wicket.settings.DebugSettings; +import org.apache.wicket.settings.DebugSettings.ClassOutputStrategy; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.properties.EnableConfigurationProperties; @@ -36,7 +37,11 @@ public void init(WebApplication webApplication) { debugSettings.setComponentUseCheck(properties.isComponentUseCheck()); debugSettings.setLinePreciseReportingOnAddComponentEnabled(properties.isLinePreciseReportingOnAddComponentEnabled()); debugSettings.setLinePreciseReportingOnNewComponentEnabled(properties.isLinePreciseReportingOnNewComponentEnabled()); - debugSettings.setOutputMarkupContainerClassName(properties.isOutputMarkupContainerClassName()); + debugSettings.setOutputMarkupContainerClassNameStrategy( + properties.isOutputMarkupContainerClassName() + ? ClassOutputStrategy.HTML_COMMENT + : ClassOutputStrategy.NONE + ); debugSettings.setComponentPathAttributeName(properties.getComponentPathAttributeName()); } diff --git a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/core/settings/exceptions/ExceptionSettingsConfig.java b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/core/settings/exceptions/ExceptionSettingsConfig.java index 301af048..e5065004 100644 --- a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/core/settings/exceptions/ExceptionSettingsConfig.java +++ b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/core/settings/exceptions/ExceptionSettingsConfig.java @@ -2,8 +2,6 @@ import lombok.RequiredArgsConstructor; import org.apache.wicket.protocol.http.WebApplication; -import org.apache.wicket.settings.ExceptionSettings; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.properties.EnableConfigurationProperties; diff --git a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/core/settings/markup/MarkupSettingsConfig.java b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/core/settings/markup/MarkupSettingsConfig.java index fc596e98..910ed47b 100644 --- a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/core/settings/markup/MarkupSettingsConfig.java +++ b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/core/settings/markup/MarkupSettingsConfig.java @@ -2,8 +2,6 @@ import lombok.RequiredArgsConstructor; import org.apache.wicket.protocol.http.WebApplication; -import org.apache.wicket.settings.MarkupSettings; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.context.properties.EnableConfigurationProperties; import com.giffing.wicket.spring.boot.context.extensions.ApplicationInitExtension; diff --git a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/core/settings/pagestore/StoreSettingsConfig.java b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/core/settings/pagestore/StoreSettingsConfig.java index 4bb020c4..02c0516c 100644 --- a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/core/settings/pagestore/StoreSettingsConfig.java +++ b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/core/settings/pagestore/StoreSettingsConfig.java @@ -4,8 +4,6 @@ import lombok.RequiredArgsConstructor; import org.apache.wicket.protocol.http.WebApplication; -import org.apache.wicket.settings.StoreSettings; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.properties.EnableConfigurationProperties; diff --git a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/core/settings/requrestcycle/RequestCycleSettingsConfig.java b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/core/settings/requrestcycle/RequestCycleSettingsConfig.java index ef0a30ec..fc0dbc7a 100644 --- a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/core/settings/requrestcycle/RequestCycleSettingsConfig.java +++ b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/core/settings/requrestcycle/RequestCycleSettingsConfig.java @@ -2,8 +2,6 @@ import lombok.RequiredArgsConstructor; import org.apache.wicket.protocol.http.WebApplication; -import org.apache.wicket.settings.RequestCycleSettings; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.properties.EnableConfigurationProperties; diff --git a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/core/settings/resource/ResourceSettingsConfig.java b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/core/settings/resource/ResourceSettingsConfig.java index dae7c4b9..6b872867 100644 --- a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/core/settings/resource/ResourceSettingsConfig.java +++ b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/core/settings/resource/ResourceSettingsConfig.java @@ -7,7 +7,6 @@ import lombok.RequiredArgsConstructor; import org.apache.wicket.protocol.http.WebApplication; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.properties.EnableConfigurationProperties; diff --git a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/external/development/devutils/diskstorebrowser/DiskStoreBrowserConfig.java b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/external/development/devutils/diskstorebrowser/DiskStoreBrowserConfig.java index cfe6f2d1..28f9a56f 100644 --- a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/external/development/devutils/diskstorebrowser/DiskStoreBrowserConfig.java +++ b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/external/development/devutils/diskstorebrowser/DiskStoreBrowserConfig.java @@ -7,9 +7,6 @@ import org.apache.wicket.pageStore.DiskPageStore; import org.apache.wicket.pageStore.IPageStore; import org.apache.wicket.protocol.http.WebApplication; -import org.apache.wicket.settings.StoreSettings; -import org.apache.wicket.util.lang.Bytes; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.properties.EnableConfigurationProperties; @@ -19,8 +16,6 @@ import com.giffing.wicket.spring.boot.context.extensions.boot.actuator.WicketAutoConfig; import com.giffing.wicket.spring.boot.context.extensions.boot.actuator.WicketEndpointRepository; -import java.io.File; - /** * Mounts the {@link PageStorePage} if the following condition matches * diff --git a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/external/development/devutils/inspector/InspectorConfig.java b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/external/development/devutils/inspector/InspectorConfig.java index 8d37eada..f6998ff5 100644 --- a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/external/development/devutils/inspector/InspectorConfig.java +++ b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/external/development/devutils/inspector/InspectorConfig.java @@ -3,7 +3,6 @@ import lombok.RequiredArgsConstructor; import org.apache.wicket.devutils.inspector.LiveSessionsPage; import org.apache.wicket.protocol.http.WebApplication; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.context.properties.EnableConfigurationProperties; diff --git a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/external/development/devutils/statelesschecker/StatelessCheckerConfig.java b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/external/development/devutils/statelesschecker/StatelessCheckerConfig.java index 017b0b42..0f78d67f 100644 --- a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/external/development/devutils/statelesschecker/StatelessCheckerConfig.java +++ b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/external/development/devutils/statelesschecker/StatelessCheckerConfig.java @@ -3,7 +3,6 @@ import lombok.RequiredArgsConstructor; import org.apache.wicket.devutils.stateless.StatelessChecker; import org.apache.wicket.protocol.http.WebApplication; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.properties.EnableConfigurationProperties; diff --git a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/external/development/springboot/devtools/WicketDevToolsPropertyDefaultsPostProcessor.java b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/external/development/springboot/devtools/WicketDevToolsPropertyDefaultsPostProcessor.java index 7d655447..4f25f722 100644 --- a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/external/development/springboot/devtools/WicketDevToolsPropertyDefaultsPostProcessor.java +++ b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/external/development/springboot/devtools/WicketDevToolsPropertyDefaultsPostProcessor.java @@ -2,7 +2,7 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.devtools.restart.Restarter; -import org.springframework.boot.env.EnvironmentPostProcessor; +import org.springframework.boot.EnvironmentPostProcessor; import org.springframework.core.Ordered; import org.springframework.core.annotation.Order; import org.springframework.core.env.ConfigurableEnvironment; diff --git a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/external/development/wicketsource/WicketSourceConfig.java b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/external/development/wicketsource/WicketSourceConfig.java index dfa47680..b3100870 100644 --- a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/external/development/wicketsource/WicketSourceConfig.java +++ b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/external/development/wicketsource/WicketSourceConfig.java @@ -2,7 +2,6 @@ import lombok.RequiredArgsConstructor; import org.apache.wicket.protocol.http.WebApplication; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.properties.EnableConfigurationProperties; diff --git a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/external/spring/boot/actuator/WicketEndpointConfiguration.java b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/external/spring/boot/actuator/WicketEndpointConfiguration.java index 8425403d..d4aa49cd 100644 --- a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/external/spring/boot/actuator/WicketEndpointConfiguration.java +++ b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/external/spring/boot/actuator/WicketEndpointConfiguration.java @@ -10,13 +10,13 @@ public class WicketEndpointConfiguration { @Bean - public WicketEndpoint wicketEndpoint() { + WicketEndpoint wicketEndpoint() { return new WicketEndpoint(wicketEndpointRepositoryDefault()); } @Bean @ConditionalOnMissingBean - public WicketEndpointRepository wicketEndpointRepositoryDefault() { + WicketEndpointRepository wicketEndpointRepositoryDefault() { return new WicketEndpointRepositoryDefault(); } } diff --git a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/external/spring/security/SpringSecurityConfig.java b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/external/spring/security/SpringSecurityConfig.java index 94f0b623..e5c7fb09 100644 --- a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/external/spring/security/SpringSecurityConfig.java +++ b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/external/spring/security/SpringSecurityConfig.java @@ -23,12 +23,12 @@ public class SpringSecurityConfig { @Bean - public WicketBootSecuredWebApplication wicketBootWebApplication() { + WicketBootSecuredWebApplication wicketBootWebApplication() { return new WicketBootSecuredWebApplication(); } @Bean - public AuthenticatedWebSessionConfig authenticatedWebSessionConfig() { + AuthenticatedWebSessionConfig authenticatedWebSessionConfig() { return () -> SecureWebSession.class; } } diff --git a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/external/webjars/WebjarsConfig.java b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/external/webjars/WebjarsConfig.java index d92b53f2..e7cc7848 100644 --- a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/external/webjars/WebjarsConfig.java +++ b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/external/webjars/WebjarsConfig.java @@ -1,9 +1,7 @@ package com.giffing.wicket.spring.boot.starter.configuration.extensions.external.webjars; -import jdk.jfr.Registered; import lombok.RequiredArgsConstructor; import org.apache.wicket.protocol.http.WebApplication; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.properties.EnableConfigurationProperties; diff --git a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/stuff/annotationscan/AnnotatedMountScannerConfig.java b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/stuff/annotationscan/AnnotatedMountScannerConfig.java index 2e1172d5..674043c5 100644 --- a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/stuff/annotationscan/AnnotatedMountScannerConfig.java +++ b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/stuff/annotationscan/AnnotatedMountScannerConfig.java @@ -5,7 +5,6 @@ import lombok.RequiredArgsConstructor; import org.apache.wicket.protocol.http.WebApplication; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.properties.EnableConfigurationProperties; diff --git a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/stuff/datastore/cassandra/DataStoreCassandraConfig.java b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/stuff/datastore/cassandra/DataStoreCassandraConfig.java index 02b87cf4..b4a70f21 100644 --- a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/stuff/datastore/cassandra/DataStoreCassandraConfig.java +++ b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/stuff/datastore/cassandra/DataStoreCassandraConfig.java @@ -4,15 +4,13 @@ import org.apache.wicket.DefaultPageManagerProvider; import org.apache.wicket.pageStore.IPageStore; import org.apache.wicket.protocol.http.WebApplication; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.AutoConfigureAfter; -import org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.cassandra.autoconfigure.CassandraAutoConfiguration; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.wicketstuff.datastores.cassandra.CassandraDataStore; import org.wicketstuff.datastores.cassandra.CassandraSettings; -import org.wicketstuff.datastores.cassandra.ICassandraSettings; import org.wicketstuff.datastores.common.SessionQuotaManagingDataStore; import com.giffing.wicket.spring.boot.context.extensions.ApplicationInitExtension; diff --git a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/stuff/datastore/hazelcast/DataStoreHazelcastConfig.java b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/stuff/datastore/hazelcast/DataStoreHazelcastConfig.java index 00a657ad..3d2609e0 100644 --- a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/stuff/datastore/hazelcast/DataStoreHazelcastConfig.java +++ b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/stuff/datastore/hazelcast/DataStoreHazelcastConfig.java @@ -4,13 +4,12 @@ import org.apache.wicket.DefaultPageManagerProvider; import org.apache.wicket.pageStore.IPageStore; import org.apache.wicket.protocol.http.WebApplication; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.boot.autoconfigure.hazelcast.HazelcastAutoConfiguration; import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.boot.hazelcast.autoconfigure.HazelcastAutoConfiguration; import org.wicketstuff.datastores.common.SessionQuotaManagingDataStore; import org.wicketstuff.datastores.hazelcast.HazelcastDataStore; diff --git a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/stuff/datastore/memcached/DataStoreMemcachedConfig.java b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/stuff/datastore/memcached/DataStoreMemcachedConfig.java index 562e3d40..9b9fb0b5 100644 --- a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/stuff/datastore/memcached/DataStoreMemcachedConfig.java +++ b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/stuff/datastore/memcached/DataStoreMemcachedConfig.java @@ -4,12 +4,10 @@ import org.apache.wicket.DefaultPageManagerProvider; import org.apache.wicket.pageStore.IPageStore; import org.apache.wicket.protocol.http.WebApplication; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.wicketstuff.datastores.common.SessionQuotaManagingDataStore; -import org.wicketstuff.datastores.memcached.IMemcachedSettings; import org.wicketstuff.datastores.memcached.MemcachedDataStore; import org.wicketstuff.datastores.memcached.MemcachedSettings; diff --git a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/stuff/datastore/redis/DataStoreRedisConfig.java b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/stuff/datastore/redis/DataStoreRedisConfig.java index c5170021..61088d71 100644 --- a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/stuff/datastore/redis/DataStoreRedisConfig.java +++ b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/stuff/datastore/redis/DataStoreRedisConfig.java @@ -4,14 +4,12 @@ import org.apache.wicket.DefaultPageManagerProvider; import org.apache.wicket.pageStore.IPageStore; import org.apache.wicket.protocol.http.WebApplication; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration; +import org.springframework.boot.data.redis.autoconfigure.DataRedisAutoConfiguration; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.wicketstuff.datastores.common.SessionQuotaManagingDataStore; -import org.wicketstuff.datastores.redis.IRedisSettings; import org.wicketstuff.datastores.redis.RedisDataStore; import org.wicketstuff.datastores.redis.RedisSettings; @@ -39,7 +37,7 @@ @ConditionalOnProperty(prefix = DataStoreRedisProperties.PROPERTY_PREFIX, value = "enabled", matchIfMissing = true) @ConditionalOnClass({Jedis.class, RedisDataStore.class}) @EnableConfigurationProperties({DataStoreRedisProperties.class}) -@AutoConfigureAfter(RedisAutoConfiguration.class) +@AutoConfigureAfter(DataRedisAutoConfiguration.class) @RequiredArgsConstructor public class DataStoreRedisConfig implements WicketApplicationInitConfiguration { diff --git a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/stuff/shiro/ShiroSecurityConfig.java b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/stuff/shiro/ShiroSecurityConfig.java index ab855cc4..682a7eb2 100644 --- a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/stuff/shiro/ShiroSecurityConfig.java +++ b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/configuration/extensions/stuff/shiro/ShiroSecurityConfig.java @@ -4,10 +4,7 @@ import org.apache.shiro.spring.boot.autoconfigure.ShiroAutoConfiguration; import org.apache.shiro.spring.web.config.DefaultShiroFilterChainDefinition; import org.apache.shiro.spring.web.config.ShiroFilterChainDefinition; -import org.apache.wicket.Page; -import org.apache.wicket.markup.html.WebPage; import org.apache.wicket.protocol.http.WebApplication; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.properties.EnableConfigurationProperties; diff --git a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/web/WicketWebInitializer.java b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/web/WicketWebInitializer.java index bf408f1d..04cc93b1 100644 --- a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/web/WicketWebInitializer.java +++ b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/web/WicketWebInitializer.java @@ -28,7 +28,7 @@ public class WicketWebInitializer { public static final String WICKET_FILTERNAME = "wicket-filter"; @Bean - public FilterRegistrationBean wicketFilter( + FilterRegistrationBean wicketFilter( WicketWebInitializerConfig wicketWebInitializerConfig, WicketWebInitializerProperties props, WicketEndpointRepository wicketEndpointRepository, diff --git a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/web/config/WicketWebInitializerAutoConfig.java b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/web/config/WicketWebInitializerAutoConfig.java index b28bb9ba..2c65d94d 100644 --- a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/web/config/WicketWebInitializerAutoConfig.java +++ b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/web/config/WicketWebInitializerAutoConfig.java @@ -34,7 +34,7 @@ public class WicketWebInitializerAutoConfig { public static class StandardWicketWebInitializerAutoConfiguration { @Bean - public WicketWebInitializerConfig wicketWebInitializerConfig() { + WicketWebInitializerConfig wicketWebInitializerConfig() { return new StandardWicketWebInitializer(); } } @@ -51,7 +51,7 @@ public static class WebSocketWicketWebInitializerAutoConfiguration { public static final String REGISTER_SERVER_ENDPOINT_ENABLED = REGISTER_SERVER_ENDPOINT + ".enabled"; @Bean - public WicketWebInitializerConfig wicketWebInitializerConfig() { + WicketWebInitializerConfig wicketWebInitializerConfig() { return new WebSocketWicketWebInitializer(); } @@ -60,18 +60,18 @@ public WicketWebInitializerConfig wicketWebInitializerConfig() { */ @Bean @ConditionalOnProperty(prefix = REGISTER_SERVER_ENDPOINT, value = "enabled", matchIfMissing = true) - public WicketServerEndpointConfigRegister wicketServerEndpointConfigRegister() { + WicketServerEndpointConfigRegister wicketServerEndpointConfigRegister() { return new WicketServerEndpointConfigRegister(); } @Bean @ConditionalOnMissingBean(WicketSessionResolver.class) - public WicketSessionResolver dummyWicketSessionResolver() { + WicketSessionResolver dummyWicketSessionResolver() { return new DummyWicketSessionResolver(); } @Bean - public WebSocketMessageSenderDefault webSocketEventHandler(Application application, WicketSessionResolver wicketSessionResolver) { + WebSocketMessageSenderDefault webSocketEventHandler(Application application, WicketSessionResolver wicketSessionResolver) { return new WebSocketMessageSenderDefault(application, wicketSessionResolver); } diff --git a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/web/servlet/websocket/WebSocketMessageSenderDefault.java b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/web/servlet/websocket/WebSocketMessageSenderDefault.java index 090b7c85..50b598b0 100644 --- a/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/web/servlet/websocket/WebSocketMessageSenderDefault.java +++ b/wicket-spring-boot-starter/src/main/java/com/giffing/wicket/spring/boot/starter/web/servlet/websocket/WebSocketMessageSenderDefault.java @@ -1,5 +1,8 @@ package com.giffing.wicket.spring.boot.starter.web.servlet.websocket; +import java.util.Collection; +import java.util.Objects; + import org.apache.wicket.Application; import org.apache.wicket.protocol.ws.WebSocketSettings; import org.apache.wicket.protocol.ws.api.IWebSocketConnection; @@ -25,12 +28,18 @@ public void sendToAll(IWebSocketPushMessage event) { var webSocketSettings = WebSocketSettings.Holder.get(application); var connectionRegistry = webSocketSettings.getConnectionRegistry(); var connections = connectionRegistry.getConnections(application); - log.trace("sending event to {} connections", connections.size()); - for (IWebSocketConnection connection : connections) { - connection.sendMessage(event); - } + sendMessage(event, connections); } + private void sendMessage(IWebSocketPushMessage event, Collection connections) { + log.trace("sending event to {} connections", connections.size()); + connections.stream() + .filter(Objects::nonNull) + .forEach(connection -> + connection.sendMessage(event) + ); + } + @Override public void sendTo(Object identifier, IWebSocketPushMessage event) { if (identifier == null) { @@ -41,10 +50,7 @@ public void sendTo(Object identifier, IWebSocketPushMessage event) { var connectionRegistry = webSocketSettings.getConnectionRegistry(); wicketSessionResolver.resolve(identifier).forEach(sessionId -> { var connections = connectionRegistry.getConnections(application, sessionId); - log.trace("sending event to {} connections", connections.size()); - for (IWebSocketConnection connection : connections) { - connection.sendMessage(event); - } + sendMessage(event, connections); }); } } diff --git a/wicket-spring-boot-starter/src/main/resources/META-INF/spring.factories b/wicket-spring-boot-starter/src/main/resources/META-INF/spring.factories index f343bdfa..fa617eac 100644 --- a/wicket-spring-boot-starter/src/main/resources/META-INF/spring.factories +++ b/wicket-spring-boot-starter/src/main/resources/META-INF/spring.factories @@ -1,3 +1,3 @@ -org.springframework.boot.env.EnvironmentPostProcessor=com.giffing.wicket.spring.boot.starter.configuration.extensions.external.development.springboot.devtools.WicketDevToolsPropertyDefaultsPostProcessor +org.springframework.boot.EnvironmentPostProcessor=com.giffing.wicket.spring.boot.starter.configuration.extensions.external.development.springboot.devtools.WicketDevToolsPropertyDefaultsPostProcessor org.springframework.boot.diagnostics.FailureAnalyzer=com.giffing.wicket.spring.boot.starter.app.verifier.WicketDependencyVersionCheckerFailureAnalyzer