-
Notifications
You must be signed in to change notification settings - Fork 566
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- injection implementation - CDI implementation - refactored MP apps to use it - refactored Níma FT example to use it
- Loading branch information
1 parent
629819a
commit c71fa41
Showing
42 changed files
with
204 additions
and
474 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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,62 @@ | ||
/* | ||
* Copyright (c) 2023 Oracle and/or its affiliates. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.helidon; | ||
|
||
import java.util.ServiceLoader; | ||
|
||
import io.helidon.common.HelidonServiceLoader; | ||
import io.helidon.logging.common.LogConfig; | ||
import io.helidon.spi.HelidonStartupProvider; | ||
|
||
/** | ||
* Main entry point for any Helidon application that is discovering services. | ||
* Main entry point for any Helidon application. | ||
* {@link java.util.ServiceLoader} is used to discover the correct {@link io.helidon.spi.HelidonStartupProvider} | ||
* to start the application (probably either Helidon Injection based application, or a CDI based application). | ||
* <p> | ||
* The default option is to start Helidon injection based application. | ||
*/ | ||
public class Main { | ||
static { | ||
LogConfig.initClass(); | ||
} | ||
|
||
private Main() { | ||
} | ||
|
||
/** | ||
* Start Helidon. | ||
* This method is required to start directly from a command line. | ||
* | ||
* @param args arguments of the application | ||
*/ | ||
public static void main(String[] args) { | ||
// we always initialize logging | ||
LogConfig.configureRuntime(); | ||
|
||
// this should only be called once in a lifetime of the server, so no need to optimize | ||
var services = HelidonServiceLoader.create(ServiceLoader.load(HelidonStartupProvider.class)) | ||
.asList(); | ||
|
||
if (services.isEmpty()) { | ||
throw new IllegalStateException("Helidon Main class can only be called if an startup provider is available. " | ||
+ "Please use either Helidon Injection, or Helidon MicroProfile " | ||
+ "(or a custom extension). If neither is available, you should use " | ||
+ "your own Main class."); | ||
} | ||
services.get(0).start(args); | ||
} | ||
} |
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
17 changes: 16 additions & 1 deletion
17
helidon/src/main/java/io/helidon/spi/HelidonStartupProvider.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
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
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
41 changes: 41 additions & 0 deletions
41
microprofile/cdi/src/main/java/io/helidon/microprofile/cdi/CdiStartupProvider.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,41 @@ | ||
/* | ||
* Copyright (c) 2023 Oracle and/or its affiliates. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.helidon.microprofile.cdi; | ||
|
||
import io.helidon.common.Weight; | ||
import io.helidon.common.Weighted; | ||
import io.helidon.spi.HelidonStartupProvider; | ||
|
||
/** | ||
* {@link java.util.ServiceLoader} implementation of a Helidon startup provider. | ||
*/ | ||
@Weight(Weighted.DEFAULT_WEIGHT + 100) // must have higher than default, to start CDI and not Helidon Injection | ||
public class CdiStartupProvider implements HelidonStartupProvider { | ||
/** | ||
* Default constructor required by {@link java.util.ServiceLoader}. | ||
* | ||
* @deprecated please do not use directly | ||
*/ | ||
@Deprecated | ||
public CdiStartupProvider() { | ||
} | ||
|
||
@Override | ||
public void start(String[] arguments) { | ||
Main.main(arguments); | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.