Browse Source

Align RSocket sample with new Spring Boot configuration

Filip Hanik 5 năm trước cách đây
mục cha
commit
5345aecd7f

+ 4 - 3
samples/boot/hellorsocket/src/integration-test/java/sample/HelloRSocketApplicationITests.java

@@ -15,8 +15,6 @@
  */
 package sample;
 
-import org.junit.Test;
-import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.rsocket.context.RSocketServerInitializedEvent;
 import org.springframework.boot.test.context.SpringBootTest;
@@ -27,6 +25,9 @@ import org.springframework.security.rsocket.metadata.BasicAuthenticationEncoder;
 import org.springframework.security.rsocket.metadata.UsernamePasswordMetadata;
 import org.springframework.test.context.TestPropertySource;
 import org.springframework.test.context.junit4.SpringRunner;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
 import reactor.core.publisher.Mono;
 
 import static org.assertj.core.api.Assertions.assertThat;
@@ -91,7 +92,7 @@ public class HelloRSocketApplicationITests {
 
 		@Override
 		public void onApplicationEvent(RSocketServerInitializedEvent event) {
-			this.port = event.getrSocketServer().address().getPort();
+			this.port = event.getServer().address().getPort();
 		}
 	}
 }

+ 0 - 7
samples/boot/hellorsocket/src/main/java/sample/HelloRSocketSecurityConfig.java

@@ -16,14 +16,12 @@
 
 package sample;
 
-import org.springframework.boot.rsocket.server.ServerRSocketFactoryCustomizer;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.security.config.annotation.rsocket.EnableRSocketSecurity;
 import org.springframework.security.core.userdetails.MapReactiveUserDetailsService;
 import org.springframework.security.core.userdetails.User;
 import org.springframework.security.core.userdetails.UserDetails;
-import org.springframework.security.rsocket.core.SecuritySocketAcceptorInterceptor;
 
 /**
  * @author Rob Winch
@@ -43,9 +41,4 @@ public class HelloRSocketSecurityConfig {
 		return new MapReactiveUserDetailsService(user);
 	}
 
-	@Bean
-	ServerRSocketFactoryCustomizer springSecurityRSocketSecurity(
-			SecuritySocketAcceptorInterceptor interceptor) {
-		return builder -> builder.addSocketAcceptorPlugin(interceptor);
-	}
 }