-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: updates after removal of deprecated Flow code (#92)
- Loading branch information
1 parent
a1c3209
commit 9399696
Showing
5 changed files
with
77 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
runtime/src/main/java/com/vaadin/quarkus/QuarkusInstantiatorFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package com.vaadin.quarkus; | ||
|
||
import io.quarkus.arc.Unremovable; | ||
import jakarta.enterprise.context.ApplicationScoped; | ||
import jakarta.enterprise.inject.spi.BeanManager; | ||
import jakarta.inject.Inject; | ||
|
||
import com.vaadin.flow.di.DefaultInstantiator; | ||
import com.vaadin.flow.di.Instantiator; | ||
import com.vaadin.flow.di.InstantiatorFactory; | ||
import com.vaadin.flow.server.VaadinService; | ||
import com.vaadin.quarkus.annotation.VaadinServiceEnabled; | ||
|
||
/** | ||
* Instantiator factory implementation based on Quarkus DI feature. | ||
* | ||
* Quarkus DI solution (also called ArC) is based on the Contexts and Dependency | ||
* Injection for Java 2.0 specification, but it is not a full CDI | ||
* implementation. Only a subset of the CDI features is implemented. | ||
* | ||
* See <a href="https://quarkus.io/guides/cdi-reference">Quarkus CDI | ||
* Reference</a> for further details. | ||
* | ||
* @see InstantiatorFactory | ||
*/ | ||
@VaadinServiceEnabled | ||
@Unremovable | ||
@ApplicationScoped | ||
public class QuarkusInstantiatorFactory implements InstantiatorFactory { | ||
|
||
@Inject | ||
BeanManager beanManager; | ||
|
||
@Override | ||
public Instantiator createInstantitor(VaadinService vaadinService) { | ||
if (!getServiceClass().isAssignableFrom(vaadinService.getClass())) { | ||
return null; | ||
} | ||
return new QuarkusInstantiator(new DefaultInstantiator(vaadinService), | ||
beanManager); | ||
} | ||
|
||
/** | ||
* Gets the service class that this instantiator factory is supposed to work | ||
* with. | ||
* | ||
* @return the service class this instantiator factory is supposed to work | ||
* with. | ||
*/ | ||
public Class<? extends VaadinService> getServiceClass() { | ||
return QuarkusVaadinServletService.class; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters