| Launchpad | Spring Boot | Java |
|---|---|---|
| 4.x | 4.x | 25+ |
| 3.x | 4.x | 17+ |
| 1.x | 3.x | 17+ |
| 0.x | 2.x | 11+ |
- Include Launchpad to your project:
Choose the version matching your Spring Boot and Java version, see Requirements. Launchpad is a Spring Boot auto-configuration, no
<dependency> <groupId>de.focus-shift</groupId> <artifactId>launchpad</artifactId> <version>...</version> </dependency>
@Importor component scan is needed. - Configure launchpad apps in your
application.ymllaunchpad: name-default-locale: de apps[0]: icon: data:image/png;base64,xxxxxxx name: de: name-1-de en: name-1-en url: https://link-1 apps[1]: icon: /static/images/app-icon.png name: de: name-2-de en: name-2-en url: https://link-2
- Assign
HasLaunchpadto all Controllers you want the launchpad to be available - Render the model attribute
launchpadin your view. It has a listapps, each withurl,name(in the request's language) andicon. The attribute is missing when the user may see no app.<nav th:if="${launchpad}"> <a th:each="app : ${launchpad.apps}" th:href="${app.url}"> <img th:src="${app.icon}" alt=""> <span th:text="${app.name}"></span> </a> </nav>
App names are looked up by the request's locale, then by its language (en-US finds en), then
name-default-locale is used.
An app with an authority is only shown to users having this authority. Users who are not logged in
only see apps without an authority.
launchpad:
apps[0]:
authority: ROLE_ADMINWith tenancy enabled, {tenantId} in an app URL is replaced by the id of the current tenant.
launchpad:
tenant:
enabled: true
default-supplier:
id: my-tenant # defaults to "default"
apps[0]:
url: https://{tenantId}.example.orgTo determine the tenant yourself, set launchpad.tenant.default-supplier.enabled: false and provide a
TenantSupplier bean. To build app URLs completely on your own, provide a LaunchpadAppUrlCustomizer
bean instead. Apps whose URL cannot be built are left out and logged as a warning.
Create a custom ErrorControllerAdvice and use the LaunchpadModelAttributeAppender
to prepare the required launchpad model attributes.
Example:
@ControllerAdvice(assignableTypes = ErrorController.class)
@Conditional(LaunchpadAutoConfiguration.LaunchpadAppsCondition.class)
class ErrorControllerAdvice {
private final LaunchpadModelAttributeAppender launchpadModelAttributeAppender;
ErrorControllerAdvice(LaunchpadModelAttributeAppender launchpadModelAttributeAppender) {
this.launchpadModelAttributeAppender = launchpadModelAttributeAppender;
}
@ModelAttribute
public void addAttributes(Model model, Locale locale, Authentication authentication) {
launchpadModelAttributeAppender.addModelAttribute(model, locale, authentication);
}
}You can inject HttpServletRequest to check the requested URL with
request.getAttribute("jakarta.servlet.error.request_uri") and only call the
LaunchpadModelAttributeAppender if the requested URL matches your condition.
- Java 25 is required.
- Launchpad registers itself as Spring Boot auto-configuration. Remove any
@Importor@ComponentScanofLaunchpadAutoConfigurationorLaunchpadTenantConfiguration. AppDtois a record: Java code callinggetUrl(),getName()orgetIcon()has to useurl(),name()andicon(). Templates usingapp.urletc. keep working.
Launchpad is Open Source software released under the Apache License 2.0.