Skip to content

Commit

Permalink
修复循环依赖警告
Browse files Browse the repository at this point in the history
  • Loading branch information
naivetoby committed Dec 30, 2023
1 parent 56fb12b commit f992ea1
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<groupId>com.demo</groupId>
<artifactId>demo</artifactId>
<version>2.0.7</version>
<version>2.0.8</version>

<dependencies>
<dependency>
Expand All @@ -27,7 +27,7 @@
<dependency>
<groupId>vip.toby.rpc</groupId>
<artifactId>simple-rpc</artifactId>
<version>2.0.7</version>
<version>2.0.8</version>
</dependency>
</dependencies>
</project>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<groupId>vip.toby.rpc</groupId>
<artifactId>simple-rpc</artifactId>
<version>2.0.7</version>
<version>2.0.8</version>
<packaging>jar</packaging>

<name>simple-rpc</name>
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/vip/toby/rpc/annotation/RpcServer.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package vip.toby.rpc.annotation;

import org.springframework.core.annotation.AliasFor;
import org.springframework.stereotype.Component;
import vip.toby.rpc.entity.RpcType;

Expand All @@ -17,6 +18,7 @@
@Inherited
public @interface RpcServer {

@AliasFor(annotation = Component.class)
String value();

int xMessageTTL() default 500;
Expand Down
5 changes: 0 additions & 5 deletions src/main/java/vip/toby/rpc/client/RpcClientProxyFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,6 @@ public Class<T> getObjectType() {
return this.rpcClientInterface;
}

@Override
public boolean isSingleton() {
return true;
}

/**
* 实例化 replyQueue
*/
Expand Down
15 changes: 10 additions & 5 deletions src/main/java/vip/toby/rpc/server/RpcServerPostProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import jakarta.validation.Validation;
import jakarta.validation.Validator;
import jakarta.validation.ValidatorFactory;
import lombok.RequiredArgsConstructor;
import org.hibernate.validator.HibernateValidator;
import org.springframework.amqp.core.*;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
Expand All @@ -15,6 +14,7 @@
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import vip.toby.rpc.annotation.RpcServer;
import vip.toby.rpc.entity.RpcType;
Expand All @@ -32,15 +32,20 @@
* @author toby
*/
@Component
@RequiredArgsConstructor
public class RpcServerPostProcessor implements BeanPostProcessor {

private final ConfigurableApplicationContext applicationContext;
private final ConnectionFactory connectionFactory;
private RpcServerHandlerInterceptor rpcServerHandlerInterceptor;
private final RpcServerHandlerInterceptor rpcServerHandlerInterceptor;

@Autowired(required = false)
public void setRpcServerHandlerInterceptor(RpcServerHandlerInterceptor rpcServerHandlerInterceptor) {
@Autowired
public RpcServerPostProcessor(
ConfigurableApplicationContext applicationContext,
@Lazy ConnectionFactory connectionFactory,
@Lazy RpcServerHandlerInterceptor rpcServerHandlerInterceptor
) {
this.applicationContext = applicationContext;
this.connectionFactory = connectionFactory;
this.rpcServerHandlerInterceptor = rpcServerHandlerInterceptor;
}

Expand Down

0 comments on commit f992ea1

Please sign in to comment.