[
https://issues.apache.org/jira/browse/MNG-7954?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17810966#comment-17810966
]
ASF GitHub Bot commented on MNG-7954:
-------------------------------------
gnodet commented on code in PR #1393:
URL: https://github.com/apache/maven/pull/1393#discussion_r1466628081
##########
api/maven-api-di/src/main/java/org/apache/maven/api/di/Transient.java:
##########
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.maven.api.di;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+@Target(METHOD)
+@Retention(RUNTIME)
+@Documented
+public @interface Transient {}
Review Comment:
So currently, the engine defaults to singleton, so that's different from
traditional JSR-330 annotation. So that's one point to decide. Currently,
most of our beans are defined as singletons, but I think that's overused as a
lot of those are stateless and have no need for being singletons. That they may
cause problems when trying to bridge across scopes later.
So having singletons by default is closer to what we have now, but I don't
think that's a good idea.
Anyway, it's true that I don't really see why this has not been implemented
as a scope. I'll see if that can be changed, and maybe change the default to
prototype.
> Provide a cleaner DI api
> ------------------------
>
> Key: MNG-7954
> URL: https://issues.apache.org/jira/browse/MNG-7954
> Project: Maven
> Issue Type: New Feature
> Components: API
> Reporter: Guillaume Nodet
> Priority: Major
> Fix For: 4.0.0
>
>
> With https://issues.apache.org/jira/browse/MNG-7947 the {{jakarta.inject}}
> package has been brought into the API.
> We need a cleaner way and not depend on any third party library if possible.
> The
> [{{SessionScope}}|https://github.com/apache/maven/blob/23bca281fcd084ac21d80f5a2950dcee30a19080/maven-core/src/main/java/org/apache/maven/session/scope/internal/SessionScope.java#L123-L125]
> would also require some cleaning to avoid having to rely on
> {{{}(org.eclipse.sisu|javax.enterprise.inject|jakarta.enterprise.inject).Typed{}}}.
> For complete DI, we may also miss the sisu annotations
> ({{{}PostConstruct{}}}, {{PreDestroy}} and {{Priority}} and
> {{{}EagerSingleton{}}}.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)