You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2022/03/18 10:45:22 UTC

[GitHub] [servicecomb-java-chassis] YOC19970520 opened a new pull request #2736: 【SCB-2422】https://issues.apache.org/jira/browse/SCB-2422?filter=12347645

YOC19970520 opened a new pull request #2736:
URL: https://github.com/apache/servicecomb-java-chassis/pull/2736


   Follow this checklist to help us incorporate your contribution quickly and easily:
   
    - [ ] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/SCB) filed for the change (usually before you start working on it).  Trivial changes like typos do not require a JIRA issue.  Your pull request should address just this issue, without pulling in other changes.
    - [ ] Each commit in the pull request should have a meaningful subject line and body.
    - [ ] Format the pull request title like `[SCB-XXX] Fixes bug in ApproximateQuantiles`, where you replace `SCB-XXX` with the appropriate JIRA issue.
    - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
    - [ ] Run `mvn clean install -Pit` to make sure basic checks pass. A more thorough check will be performed on your pull request automatically.
    - [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   ---
   Optimized the bean injection with constructor-based injection and setter injection. This PR might has some problems. Please comment on it and I will modify it again if some code change in a wrong injection way.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] YOC19970520 commented on pull request #2736: 【SCB-2422】change bean injection to constructor injection

Posted by GitBox <gi...@apache.org>.
YOC19970520 commented on pull request #2736:
URL: https://github.com/apache/servicecomb-java-chassis/pull/2736#issuecomment-1076258860


   Yes sir. I'll modified it tomorrow. Thanks for reminding.
   
   
   
   ---Original---
   From: "ZhangJian ***@***.***&gt;
   Date: Wed, Mar 23, 2022 19:12 PM
   To: ***@***.***&gt;;
   Cc: ***@***.******@***.***&gt;;
   Subject: Re: [apache/servicecomb-java-chassis] 【SCB-2422】change bean injection to constructor injection (PR #2736)
   
   
   
   
    
   we should use [ instead of chinese 【
    
   —
   Reply to this email directly, view it on GitHub, or unsubscribe.
   You are receiving this because you authored the thread.Message ID: ***@***.***&gt;


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] YOC19970520 commented on a change in pull request #2736: 【SCB-2422】change bean injection to constructor injection

Posted by GitBox <gi...@apache.org>.
YOC19970520 commented on a change in pull request #2736:
URL: https://github.com/apache/servicecomb-java-chassis/pull/2736#discussion_r830807369



##########
File path: governance/src/main/java/org/apache/servicecomb/governance/properties/GovernanceProperties.java
##########
@@ -53,12 +53,17 @@
 
   private final String configKey;
 
-  @Autowired
   protected Environment environment;
 
-  @Autowired
   private MicroserviceMeta microserviceMeta;
 
+  @Autowired
+  public GovernanceProperties(String configKey, Environment environment, MicroserviceMeta microserviceMeta) {
+    this.configKey = configKey;
+    this.environment = environment;
+    this.microserviceMeta = microserviceMeta;
+  }

Review comment:
        ```  
       protected GovernanceProperties(String key) {
       configKey = key;
       representer.getPropertyUtils().setSkipMissingProperties(true);
       GovernanceEventManager.register(this);
       entityClass = getEntityClass();
     }
   ```
   不删除,该构造方法里初始化了configKey; 将@Autowired改成setter方法注入,只注入environment和microserviceMeta




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] liubao68 commented on a change in pull request #2736: [SCB-2422]change bean injection to constructor injection

Posted by GitBox <gi...@apache.org>.
liubao68 commented on a change in pull request #2736:
URL: https://github.com/apache/servicecomb-java-chassis/pull/2736#discussion_r834083947



##########
File path: governance/src/main/java/org/apache/servicecomb/router/distribute/AbstractRouterDistributor.java
##########
@@ -46,9 +46,16 @@
 
   private Function<E, Map<String, String>> getProperties;
 
-  @Autowired
   private RouterRuleCache routerRuleCache;
 
+  @Autowired
+  public AbstractRouterDistributor(RouterRuleCache routerRuleCache) {
+    this.routerRuleCache = routerRuleCache;
+  }
+
+  protected AbstractRouterDistributor() {
+  }

Review comment:
       change to setter injection




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] Shoothzj commented on pull request #2736: 【SCB-2422】change bean injection to constructor injection

Posted by GitBox <gi...@apache.org>.
Shoothzj commented on pull request #2736:
URL: https://github.com/apache/servicecomb-java-chassis/pull/2736#issuecomment-1076245567


   we should use `[` instead of chinese `【`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] liubao68 merged pull request #2736: [SCB-2422]change bean injection to constructor injection

Posted by GitBox <gi...@apache.org>.
liubao68 merged pull request #2736:
URL: https://github.com/apache/servicecomb-java-chassis/pull/2736


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] liubao68 commented on a change in pull request #2736: 【SCB-2422】change bean injection to constructor injection

Posted by GitBox <gi...@apache.org>.
liubao68 commented on a change in pull request #2736:
URL: https://github.com/apache/servicecomb-java-chassis/pull/2736#discussion_r830747015



##########
File path: governance/src/main/java/org/apache/servicecomb/governance/properties/GovernanceProperties.java
##########
@@ -53,12 +53,17 @@
 
   private final String configKey;
 
-  @Autowired
   protected Environment environment;
 
-  @Autowired
   private MicroserviceMeta microserviceMeta;
 
+  @Autowired
+  public GovernanceProperties(String configKey, Environment environment, MicroserviceMeta microserviceMeta) {
+    this.configKey = configKey;
+    this.environment = environment;
+    this.microserviceMeta = microserviceMeta;
+  }

Review comment:
       ```
     protected GovernanceProperties(String key) {
       configKey = key;
       representer.getPropertyUtils().setSkipMissingProperties(true);
       GovernanceEventManager.register(this);
       entityClass = getEntityClass();
     }
   ```
   
   是否删除? 另外 @Autowired 是否加到 property 上面? 因为 configKey 是无法autowired。 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] liubao68 commented on a change in pull request #2736: [SCB-2422]change bean injection to constructor injection

Posted by GitBox <gi...@apache.org>.
liubao68 commented on a change in pull request #2736:
URL: https://github.com/apache/servicecomb-java-chassis/pull/2736#discussion_r834084870



##########
File path: pom.xml
##########
@@ -519,6 +519,17 @@
               <goals>deploy</goals>
             </configuration>
           </plugin>
+          <plugin>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-maven-plugin</artifactId>
+          </plugin>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-surefire-plugin</artifactId>
+            <configuration>
+              <skip>true</skip>
+            </configuration>
+          </plugin>

Review comment:
       Why add there two plugins?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org