You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by li...@apache.org on 2022/11/29 11:23:17 UTC
[servicecomb-fence] branch master updated: [SCB-2732]upgrade project to the latest java chassis version (#30)
This is an automated email from the ASF dual-hosted git repository.
liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-fence.git
The following commit(s) were added to refs/heads/master by this push:
new b22a9e7 [SCB-2732]upgrade project to the latest java chassis version (#30)
b22a9e7 is described below
commit b22a9e7a4d16766f316bfd1d119240865723cb3d
Author: liubao68 <bi...@qq.com>
AuthorDate: Tue Nov 29 19:23:12 2022 +0800
[SCB-2732]upgrade project to the latest java chassis version (#30)
---
...hubAuthService.java => GithubOAuthService.java} | 2 +-
...stener.java => GithubOAuthServiceRegister.java} | 25 ++++-----------
.../authentication/server/GithubTokenGranter.java | 2 +-
.../endpoint}/src/main/resources/microservice.yaml | 37 +++-------------------
api/common/endpoint/pom.xml | 4 +++
.../token/TokenStoreConfiguration.java | 6 ++--
authentication-server/pom.xml | 2 +-
.../authentication/AuthenticationServerMain.java | 11 +++++--
pom.xml | 10 ++++--
samples/Client/pom.xml | 37 +++-------------------
.../authentication/AuthenticationClientMain.java | 13 +++++---
.../authentication/GateRestTemplate.java | 9 +++---
.../apache/servicecomb/authentication/TestMgr.java | 2 +-
samples/Client/src/main/resources/log4j2.xml | 2 +-
samples/EdgeService/pom.xml | 6 +++-
.../gateway/AuthenticationEdgeMain.java | 17 +++++++---
.../gateway/StaticWebpageDispatcher.java | 3 +-
samples/ResourceServer/pom.xml | 35 ++------------------
.../resource/ResourceServerMain.java | 13 +++++---
.../src/main/resources/microservice.yaml | 2 +-
20 files changed, 87 insertions(+), 151 deletions(-)
diff --git a/api/authentication-server/endpoint/src/main/java/org/apache/servicecomb/authentication/server/GithubAuthService.java b/api/authentication-server/endpoint/src/main/java/org/apache/servicecomb/authentication/server/GithubOAuthService.java
similarity index 97%
rename from api/authentication-server/endpoint/src/main/java/org/apache/servicecomb/authentication/server/GithubAuthService.java
rename to api/authentication-server/endpoint/src/main/java/org/apache/servicecomb/authentication/server/GithubOAuthService.java
index 08ebe4e..09734c9 100644
--- a/api/authentication-server/endpoint/src/main/java/org/apache/servicecomb/authentication/server/GithubAuthService.java
+++ b/api/authentication-server/endpoint/src/main/java/org/apache/servicecomb/authentication/server/GithubOAuthService.java
@@ -28,7 +28,7 @@ import io.swagger.annotations.Api;
//see: https://developer.github.com/apps/building-oauth-apps/authorizing-oauth-apps/
@Path("/login/oauth")
@Api(produces = MediaType.APPLICATION_JSON_VALUE)
-public interface GithubAuthService {
+public interface GithubOAuthService {
@POST
@Path("/access_token")
public GithubAccessTokenResponse accessToken(@FormParam("client_id") String client_id,
diff --git a/api/authentication-server/endpoint/src/main/java/org/apache/servicecomb/authentication/server/ThirdPartyRegisterBootListener.java b/api/authentication-server/endpoint/src/main/java/org/apache/servicecomb/authentication/server/GithubOAuthServiceRegister.java
similarity index 59%
rename from api/authentication-server/endpoint/src/main/java/org/apache/servicecomb/authentication/server/ThirdPartyRegisterBootListener.java
rename to api/authentication-server/endpoint/src/main/java/org/apache/servicecomb/authentication/server/GithubOAuthServiceRegister.java
index e6ec1da..67573bc 100644
--- a/api/authentication-server/endpoint/src/main/java/org/apache/servicecomb/authentication/server/ThirdPartyRegisterBootListener.java
+++ b/api/authentication-server/endpoint/src/main/java/org/apache/servicecomb/authentication/server/GithubOAuthServiceRegister.java
@@ -17,30 +17,17 @@
package org.apache.servicecomb.authentication.server;
-import java.util.Collections;
-
-import org.apache.servicecomb.core.BootListener;
-import org.apache.servicecomb.serviceregistry.RegistryUtils;
+import org.apache.servicecomb.provider.pojo.registry.ThirdServiceWithInvokerRegister;
import org.springframework.stereotype.Component;
//see: https://developer.github.com/apps/building-oauth-apps/authorizing-oauth-apps/
@Component
-public class ThirdPartyRegisterBootListener implements BootListener {
+public class GithubOAuthServiceRegister extends ThirdServiceWithInvokerRegister {
private static final String GITHUB_ENDPOINT = "rest://github.com:443?sslEnabled=true";
- @Override
- public void onBootEvent(BootEvent event) {
- if (BootListener.EventType.AFTER_REGISTRY.equals(event.getEventType())) {
- RegistryUtils.getServiceRegistry().registerMicroserviceMappingByEndpoints(
- // 3rd party rest service name
- "githubAuthService",
- // service version
- "1.0.0",
- // list of endpoints
- Collections.singletonList(GITHUB_ENDPOINT),
- // java interface class to generate swagger schema
- GithubAuthService.class);
- }
- }
+ public GithubOAuthServiceRegister() {
+ super("GithubOAuthService");
+ addSchema("GithubOAuthService", GithubOAuthService.class);
+ }
}
diff --git a/api/authentication-server/endpoint/src/main/java/org/apache/servicecomb/authentication/server/GithubTokenGranter.java b/api/authentication-server/endpoint/src/main/java/org/apache/servicecomb/authentication/server/GithubTokenGranter.java
index 24927db..0358fe5 100644
--- a/api/authentication-server/endpoint/src/main/java/org/apache/servicecomb/authentication/server/GithubTokenGranter.java
+++ b/api/authentication-server/endpoint/src/main/java/org/apache/servicecomb/authentication/server/GithubTokenGranter.java
@@ -54,7 +54,7 @@ public class GithubTokenGranter implements ThirdPartyTokenGranter {
private AbstractOpenIDTokenStore openIDTokenStore;
@RpcReference(microserviceName = "githubAuthService", schemaId = "githubAuthService")
- GithubAuthService githubAuthService;
+ GithubOAuthService githubOAuthService;
RestTemplate githubRestTemplate = RestTemplateBuilder.create();
diff --git a/samples/ResourceServer/src/main/resources/microservice.yaml b/api/authentication-server/endpoint/src/main/resources/microservice.yaml
similarity index 59%
copy from samples/ResourceServer/src/main/resources/microservice.yaml
copy to api/authentication-server/endpoint/src/main/resources/microservice.yaml
index dc4e894..e7d51d2 100644
--- a/samples/ResourceServer/src/main/resources/microservice.yaml
+++ b/api/authentication-server/endpoint/src/main/resources/microservice.yaml
@@ -17,37 +17,8 @@
## ---------------------------------------------------------------------------
# override common configurations in common module
-servicecomb-config-order: 100
+servicecomb-config-order: -1
-APPLICATION_ID: authentication-application
-service_description:
- version: 0.0.1
- name: resource-server
- environment: development
-
-servicecomb:
- service:
- registry:
- address: http://localhost:30100
- instance:
- watch: false
-
- rest:
- address: 0.0.0.0:9092
-
- authencation:
- access:
- needAuth: true
- HandlerAuthEndpoint:
- adminSayHello:
- roles: ADMIN
- guestSayHello:
- roles: GUEST
- guestOrAdminSayHello:
- roles: ADMIN,GUEST
- # everyoneSayHello: all can
-
- handler:
- chain:
- Provider:
- default: qps-flowcontrol-provider,resource-auth-provider
\ No newline at end of file
+GithubOAuthService:
+ urls:
+ - rest://github.com:443?sslEnabled=true
diff --git a/api/common/endpoint/pom.xml b/api/common/endpoint/pom.xml
index de2736a..0dbac98 100644
--- a/api/common/endpoint/pom.xml
+++ b/api/common/endpoint/pom.xml
@@ -34,5 +34,9 @@
<artifactId>authentication-common-api-service</artifactId>
<version>${project.parent.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-autoconfigure</artifactId>
+ </dependency>
</dependencies>
</project>
diff --git a/api/common/endpoint/src/main/java/org/apache/servicecomb/authentication/token/TokenStoreConfiguration.java b/api/common/endpoint/src/main/java/org/apache/servicecomb/authentication/token/TokenStoreConfiguration.java
index 83d4654..d98aa51 100644
--- a/api/common/endpoint/src/main/java/org/apache/servicecomb/authentication/token/TokenStoreConfiguration.java
+++ b/api/common/endpoint/src/main/java/org/apache/servicecomb/authentication/token/TokenStoreConfiguration.java
@@ -20,9 +20,9 @@ package org.apache.servicecomb.authentication.token;
import org.apache.servicecomb.authentication.util.CommonConstants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
-import org.springframework.core.annotation.Order;
import org.springframework.security.jwt.crypto.sign.Signer;
import org.springframework.security.jwt.crypto.sign.SignerVerifier;
@@ -30,13 +30,13 @@ import org.springframework.security.jwt.crypto.sign.SignerVerifier;
public class TokenStoreConfiguration {
@Bean(name = {CommonConstants.BEAN_AUTH_ACCESS_TOKEN_STORE,
CommonConstants.BEAN_AUTH_REFRESH_TOKEN_STORE})
- @Order(CommonConstants.BEAN_DEFAULT_ORDER)
+ @ConditionalOnMissingBean
public SessionTokenStore sessionTokenStore() {
return new SessionTokenStore();
}
@Bean(name = {CommonConstants.BEAN_AUTH_ID_TOKEN_STORE})
- @Order(CommonConstants.BEAN_DEFAULT_ORDER)
+ @ConditionalOnMissingBean
public JWTTokenStore jwtTokenStore(@Autowired @Qualifier(CommonConstants.BEAN_AUTH_SIGNER) Signer signer,
@Autowired @Qualifier(CommonConstants.BEAN_AUTH_SIGNATURE_VERIFIER) SignerVerifier signerVerifier) {
return new JWTTokenStoreImpl(signer, signerVerifier);
diff --git a/authentication-server/pom.xml b/authentication-server/pom.xml
index 0717bc7..c09b64b 100644
--- a/authentication-server/pom.xml
+++ b/authentication-server/pom.xml
@@ -91,7 +91,7 @@
</dependency>
<dependency>
<groupId>org.apache.servicecomb</groupId>
- <artifactId>inspector</artifactId>
+ <artifactId>java-chassis-spring-boot-starter-standalone</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
diff --git a/authentication-server/src/main/java/org/apache/servicecomb/authentication/AuthenticationServerMain.java b/authentication-server/src/main/java/org/apache/servicecomb/authentication/AuthenticationServerMain.java
index 35b239d..21088f0 100644
--- a/authentication-server/src/main/java/org/apache/servicecomb/authentication/AuthenticationServerMain.java
+++ b/authentication-server/src/main/java/org/apache/servicecomb/authentication/AuthenticationServerMain.java
@@ -17,13 +17,18 @@
package org.apache.servicecomb.authentication;
-import org.apache.servicecomb.foundation.common.utils.BeanUtils;
+import org.apache.servicecomb.springboot2.starter.EnableServiceComb;
+import org.springframework.boot.WebApplicationType;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+@SpringBootApplication
+@EnableServiceComb
public class AuthenticationServerMain {
public static void main(String[] args) {
try {
- BeanUtils.init();
- } catch (Exception e) {
+ new SpringApplicationBuilder(AuthenticationServerMain.class).web(WebApplicationType.NONE).run(args);
+ } catch (Throwable e) {
e.printStackTrace();
}
}
diff --git a/pom.xml b/pom.xml
index f9c5beb..5f47c88 100644
--- a/pom.xml
+++ b/pom.xml
@@ -27,7 +27,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <java-chassis-version>2.0.2</java-chassis-version>
+ <java-chassis-version>2.8.3</java-chassis-version>
</properties>
<modules>
@@ -53,6 +53,10 @@
<groupId>org.apache.servicecomb</groupId>
<artifactId>solution-basic</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.servicecomb</groupId>
+ <artifactId>registry-service-center</artifactId>
+ </dependency>
</dependencies>
<build>
@@ -61,7 +65,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
- <version>3.1</version>
+ <version>3.10.1</version>
<configuration>
<compilerArgument>-parameters</compilerArgument>
<source>1.8</source>
@@ -81,7 +85,7 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
- <version>2.1.6.RELEASE</version>
+ <version>2.7.0</version>
<executions>
<execution>
<goals>
diff --git a/samples/Client/pom.xml b/samples/Client/pom.xml
index 8b63d32..1f3b5aa 100644
--- a/samples/Client/pom.xml
+++ b/samples/Client/pom.xml
@@ -65,40 +65,11 @@
</dependency>
<dependency>
<groupId>org.apache.servicecomb</groupId>
- <artifactId>inspector</artifactId>
+ <artifactId>java-chassis-spring-boot-starter-standalone</artifactId>
</dependency>
<dependency>
- <groupId>org.mybatis</groupId>
- <artifactId>mybatis</artifactId>
- </dependency>
- <dependency>
- <groupId>mysql</groupId>
- <artifactId>mysql-connector-java</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-dbcp2</artifactId>
- </dependency>
- <dependency>
- <groupId>org.mybatis</groupId>
- <artifactId>mybatis-spring</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-jdbc</artifactId>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-aop</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context-support</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-tx</artifactId>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-autoconfigure</artifactId>
</dependency>
</dependencies>
@@ -110,4 +81,4 @@
</plugin>
</plugins>
</build>
-</project>
\ No newline at end of file
+</project>
diff --git a/samples/Client/src/main/java/org/apache/servicecomb/authentication/AuthenticationClientMain.java b/samples/Client/src/main/java/org/apache/servicecomb/authentication/AuthenticationClientMain.java
index ce9c356..4505100 100644
--- a/samples/Client/src/main/java/org/apache/servicecomb/authentication/AuthenticationClientMain.java
+++ b/samples/Client/src/main/java/org/apache/servicecomb/authentication/AuthenticationClientMain.java
@@ -17,14 +17,19 @@
package org.apache.servicecomb.authentication;
-import org.apache.servicecomb.foundation.common.utils.BeanUtils;
+import org.apache.servicecomb.springboot2.starter.EnableServiceComb;
+import org.springframework.boot.WebApplicationType;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+@SpringBootApplication
+@EnableServiceComb
public class AuthenticationClientMain {
public static void main(String[] args) {
try {
- BeanUtils.init();
- } catch (Exception e) {
+ new SpringApplicationBuilder(AuthenticationClientMain.class).web(WebApplicationType.NONE).run(args);
+ } catch (Throwable e) {
e.printStackTrace();
}
}
-}
+}
\ No newline at end of file
diff --git a/samples/Client/src/main/java/org/apache/servicecomb/authentication/GateRestTemplate.java b/samples/Client/src/main/java/org/apache/servicecomb/authentication/GateRestTemplate.java
index 69b0af1..4516502 100644
--- a/samples/Client/src/main/java/org/apache/servicecomb/authentication/GateRestTemplate.java
+++ b/samples/Client/src/main/java/org/apache/servicecomb/authentication/GateRestTemplate.java
@@ -23,10 +23,11 @@ import org.apache.servicecomb.core.definition.MicroserviceMeta;
import org.apache.servicecomb.core.definition.SchemaMeta;
import org.apache.servicecomb.core.provider.consumer.MicroserviceReferenceConfig;
import org.apache.servicecomb.foundation.common.net.URIEndpointObject;
+import org.apache.servicecomb.registry.DiscoveryManager;
+import org.apache.servicecomb.registry.api.registry.MicroserviceInstance;
+import org.apache.servicecomb.registry.consumer.MicroserviceVersionRule;
+import org.apache.servicecomb.registry.definition.DefinitionConst;
import org.apache.servicecomb.serviceregistry.RegistryUtils;
-import org.apache.servicecomb.serviceregistry.api.registry.MicroserviceInstance;
-import org.apache.servicecomb.serviceregistry.consumer.MicroserviceVersionRule;
-import org.apache.servicecomb.serviceregistry.definition.DefinitionConst;
import org.springframework.http.converter.FormHttpMessageConverter;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
@@ -70,7 +71,7 @@ public class GateRestTemplate extends RestTemplate {
}
private String getUrlPrefix(String gateName, String producerName, String schemaId) {
- MicroserviceVersionRule microserviceVersionRule = RegistryUtils
+ MicroserviceVersionRule microserviceVersionRule = DiscoveryManager.INSTANCE
.getAppManager()
.getOrCreateMicroserviceVersionRule(RegistryUtils.getAppId(),
gateName,
diff --git a/samples/Client/src/main/java/org/apache/servicecomb/authentication/TestMgr.java b/samples/Client/src/main/java/org/apache/servicecomb/authentication/TestMgr.java
index c9e71fe..bb12177 100644
--- a/samples/Client/src/main/java/org/apache/servicecomb/authentication/TestMgr.java
+++ b/samples/Client/src/main/java/org/apache/servicecomb/authentication/TestMgr.java
@@ -21,9 +21,9 @@ import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicLong;
+import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.util.StringUtils;
public class TestMgr {
private static final Logger LOGGER = LoggerFactory.getLogger(TestMgr.class);
diff --git a/samples/Client/src/main/resources/log4j2.xml b/samples/Client/src/main/resources/log4j2.xml
index 3c70391..21d465b 100644
--- a/samples/Client/src/main/resources/log4j2.xml
+++ b/samples/Client/src/main/resources/log4j2.xml
@@ -40,4 +40,4 @@
<AppenderRef ref="DailyRollingFile"/>
</Root>
</Loggers>
-</configuration>
\ No newline at end of file
+</configuration>
diff --git a/samples/EdgeService/pom.xml b/samples/EdgeService/pom.xml
index 30a52c7..fc09357 100644
--- a/samples/EdgeService/pom.xml
+++ b/samples/EdgeService/pom.xml
@@ -54,7 +54,11 @@
</dependency>
<dependency>
<groupId>org.apache.servicecomb</groupId>
- <artifactId>inspector</artifactId>
+ <artifactId>java-chassis-spring-boot-starter-standalone</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-autoconfigure</artifactId>
</dependency>
<dependency>
<groupId>org.apache.servicecomb</groupId>
diff --git a/samples/EdgeService/src/main/java/org/apache/servicecomb/authentication/gateway/AuthenticationEdgeMain.java b/samples/EdgeService/src/main/java/org/apache/servicecomb/authentication/gateway/AuthenticationEdgeMain.java
index b040342..8191792 100644
--- a/samples/EdgeService/src/main/java/org/apache/servicecomb/authentication/gateway/AuthenticationEdgeMain.java
+++ b/samples/EdgeService/src/main/java/org/apache/servicecomb/authentication/gateway/AuthenticationEdgeMain.java
@@ -17,10 +17,19 @@
package org.apache.servicecomb.authentication.gateway;
-import org.apache.servicecomb.foundation.common.utils.BeanUtils;
+import org.apache.servicecomb.springboot2.starter.EnableServiceComb;
+import org.springframework.boot.WebApplicationType;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+@SpringBootApplication
+@EnableServiceComb
public class AuthenticationEdgeMain {
- public static void main(String[] args) throws Exception {
- BeanUtils.init();
+ public static void main(String[] args) {
+ try {
+ new SpringApplicationBuilder(AuthenticationEdgeMain.class).web(WebApplicationType.NONE).run(args);
+ } catch (Throwable e) {
+ e.printStackTrace();
}
-}
+ }
+}
\ No newline at end of file
diff --git a/samples/EdgeService/src/main/java/org/apache/servicecomb/authentication/gateway/StaticWebpageDispatcher.java b/samples/EdgeService/src/main/java/org/apache/servicecomb/authentication/gateway/StaticWebpageDispatcher.java
index 555ddc4..d6f61b6 100644
--- a/samples/EdgeService/src/main/java/org/apache/servicecomb/authentication/gateway/StaticWebpageDispatcher.java
+++ b/samples/EdgeService/src/main/java/org/apache/servicecomb/authentication/gateway/StaticWebpageDispatcher.java
@@ -41,8 +41,7 @@ public class StaticWebpageDispatcher implements VertxHttpDispatcher {
@Override
public void init(Router router) {
String regex = "/ui/(.*)";
- StaticHandler webpageHandler = StaticHandler.create();
- webpageHandler.setWebRoot(WEB_ROOT);
+ StaticHandler webpageHandler = StaticHandler.create(WEB_ROOT);
LOGGER.info("server static web page for WEB_ROOT={}", WEB_ROOT);
router.routeWithRegex(regex).failureHandler((context) -> {
LOGGER.error("", context.failure());
diff --git a/samples/ResourceServer/pom.xml b/samples/ResourceServer/pom.xml
index ada348c..2a48220 100644
--- a/samples/ResourceServer/pom.xml
+++ b/samples/ResourceServer/pom.xml
@@ -65,40 +65,11 @@
</dependency>
<dependency>
<groupId>org.apache.servicecomb</groupId>
- <artifactId>inspector</artifactId>
+ <artifactId>java-chassis-spring-boot-starter-standalone</artifactId>
</dependency>
<dependency>
- <groupId>org.mybatis</groupId>
- <artifactId>mybatis</artifactId>
- </dependency>
- <dependency>
- <groupId>mysql</groupId>
- <artifactId>mysql-connector-java</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-dbcp2</artifactId>
- </dependency>
- <dependency>
- <groupId>org.mybatis</groupId>
- <artifactId>mybatis-spring</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-jdbc</artifactId>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-aop</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context-support</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-tx</artifactId>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-autoconfigure</artifactId>
</dependency>
</dependencies>
diff --git a/samples/ResourceServer/src/main/java/org/apache/servicecomb/authentication/resource/ResourceServerMain.java b/samples/ResourceServer/src/main/java/org/apache/servicecomb/authentication/resource/ResourceServerMain.java
index 1964390..f43f724 100644
--- a/samples/ResourceServer/src/main/java/org/apache/servicecomb/authentication/resource/ResourceServerMain.java
+++ b/samples/ResourceServer/src/main/java/org/apache/servicecomb/authentication/resource/ResourceServerMain.java
@@ -17,14 +17,19 @@
package org.apache.servicecomb.authentication.resource;
-import org.apache.servicecomb.foundation.common.utils.BeanUtils;
+import org.apache.servicecomb.springboot2.starter.EnableServiceComb;
+import org.springframework.boot.WebApplicationType;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+@SpringBootApplication
+@EnableServiceComb
public class ResourceServerMain {
public static void main(String[] args) {
try {
- BeanUtils.init();
- } catch (Exception e) {
+ new SpringApplicationBuilder(ResourceServerMain.class).web(WebApplicationType.NONE).run(args);
+ } catch (Throwable e) {
e.printStackTrace();
}
}
-}
+}
\ No newline at end of file
diff --git a/samples/ResourceServer/src/main/resources/microservice.yaml b/samples/ResourceServer/src/main/resources/microservice.yaml
index dc4e894..05abf87 100644
--- a/samples/ResourceServer/src/main/resources/microservice.yaml
+++ b/samples/ResourceServer/src/main/resources/microservice.yaml
@@ -50,4 +50,4 @@ servicecomb:
handler:
chain:
Provider:
- default: qps-flowcontrol-provider,resource-auth-provider
\ No newline at end of file
+ default: qps-flowcontrol-provider,resource-auth-provider