首页

基于nacos简单demo maven项目示例下载

标签:nacos示例,nacos入门DEMO     发布时间:2022-05-03   
  • 云盘下载:
  • [提取码:m3nf]
  • 本地下载:
       ( 需积分:8  )

一、项目说明

nacos简单项目结构如下图,包括maven的参考配置文件、nacos注册中心地址配置、测试入口类等部分。

基于nacos简单demo maven项目示例下载

二、运行说明

1. 启动nacos注册中心服务(安装配置参考其他文章页面)

2. 下载导入该示例maven项目(将项目maven-settings.xml修改本地仓库地址后,映射maven配置)

基于nacos简单demo maven项目示例下载

3. 修改bootstrap.yml中对应nacos的server-addr注册中心地址

#spring.cloud.nacos.config.server-addr=${NACOS_META}@b@spring:@b@  application:@b@    name: nacos-demo@b@  cloud:@b@    nacos:@b@      config:@b@        server-addr: localhost:8848

3. 运行项目Application,效果如下

D:\apps\jdk\jdk1.8.0_221\bin\java.exe -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:60900,suspend=y,server=n -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -javaagent:C:\Users\Think\AppData\Local\JetBrains\IntelliJIdea2020.1\captureAgent\debugger-agent.jar -Dfile.encoding=UTF-8 -classpath "D:\apps\jdk\jdk1.8.0_221\jre\lib\charsets.jar;D:\apps\jdk\jdk1.8.0_221\jre\lib\deploy.jar;D:\apps\jdk\jdk1.8.0_221\jre\lib\ext\access-bridge-64.jar;D:\apps\jdk\jdk1.8.0_221\jre\lib\ext\cldrdata.jar;D:\apps\jdk\jdk1.8.0_221\jre\lib\ext\dnsns.jar;D:\apps\jdk\jdk1.8.0_221\jre\lib\ext\jaccess.jar;D:\apps\jdk\jdk1.8.0_221\jre\lib\ext\jfxrt.jar;D:\apps\jdk\jdk1.8.0_221\jre\lib\ext\localedata.jar;D:\apps\jdk\jdk1.8.0_221\jre\lib\ext\nashorn.jar;D:\apps\jdk\jdk1.8.0_221\jre\lib\ext\sunec.jar;D:\apps\jdk\jdk1.8.0_221\jre\lib\ext\sunjce_provider.jar;D:\apps\jdk\jdk1.8.0_221\jre\lib\ext\sunmscapi.jar;D:\apps\jdk\jdk1.8.0_221\jre\lib\ext\sunpkcs11.jar;D:\apps\jdk\jdk1.8.0_221\jre\lib\ext\zipfs.jar;D:\apps\jdk\jdk1.8.0_221\jre\lib\javaws.jar;D:\apps\jdk\jdk1.8.0_221\jre\lib\jce.jar;D:\apps\jdk\jdk1.8.0_221\jre\lib\jfr.jar;D:\apps\jdk\jdk1.8.0_221\jre\lib\jfxswt.jar;D:\apps\jdk\jdk1.8.0_221\jre\lib\jsse.jar;D:\apps\jdk\jdk1.8.0_221\jre\lib\management-agent.jar;D:\apps\jdk\jdk1.8.0_221\jre\lib\plugin.jar;D:\apps\jdk\jdk1.8.0_221\jre\lib\resources.jar;D:\apps\jdk\jdk1.8.0_221\jre\lib\rt.jar;E:\maven-ws\nacos_demo-master\server_demo\target\classes;E:\Repository\Jar\org\springframework\boot\spring-boot-starter\2.3.2.RELEASE\spring-boot-starter-2.3.2.RELEASE.jar;E:\Repository\Jar\org\springframework\boot\spring-boot\2.3.2.RELEASE\spring-boot-2.3.2.RELEASE.jar;E:\Repository\Jar\org\springframework\spring-context\5.2.8.RELEASE\spring-context-5.2.8.RELEASE.jar;E:\Repository\Jar\org\springframework\boot\spring-boot-autoconfigure\2.3.2.RELEASE\spring-boot-autoconfigure-2.3.2.RELEASE.jar;E:\Repository\Jar\org\springframework\boot\spring-boot-starter-logging\2.3.2.RELEASE\spring-boot-starter-logging-2.3.2.RELEASE.jar;E:\Repository\Jar\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;E:\Repository\Jar\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;E:\Repository\Jar\org\slf4j\slf4j-api\1.7.30\slf4j-api-1.7.30.jar;E:\Repository\Jar\org\apache\logging\log4j\log4j-to-slf4j\2.13.3\log4j-to-slf4j-2.13.3.jar;E:\Repository\Jar\org\apache\logging\log4j\log4j-api\2.13.3\log4j-api-2.13.3.jar;E:\Repository\Jar\org\slf4j\jul-to-slf4j\1.7.30\jul-to-slf4j-1.7.30.jar;E:\Repository\Jar\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;E:\Repository\Jar\org\springframework\spring-core\5.2.8.RELEASE\spring-core-5.2.8.RELEASE.jar;E:\Repository\Jar\org\springframework\spring-jcl\5.2.8.RELEASE\spring-jcl-5.2.8.RELEASE.jar;E:\Repository\Jar\org\yaml\snakeyaml\1.26\snakeyaml-1.26.jar;E:\Repository\Jar\org\springframework\boot\spring-boot-starter-web\2.3.2.RELEASE\spring-boot-starter-web-2.3.2.RELEASE.jar;E:\Repository\Jar\org\springframework\boot\spring-boot-starter-json\2.3.2.RELEASE\spring-boot-starter-json-2.3.2.RELEASE.jar;E:\Repository\Jar\com\fasterxml\jackson\core\jackson-databind\2.11.1\jackson-databind-2.11.1.jar;E:\Repository\Jar\com\fasterxml\jackson\core\jackson-annotations\2.11.1\jackson-annotations-2.11.1.jar;E:\Repository\Jar\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.11.1\jackson-datatype-jdk8-2.11.1.jar;E:\Repository\Jar\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.11.1\jackson-datatype-jsr310-2.11.1.jar;E:\Repository\Jar\com\fasterxml\jackson\module\jackson-module-parameter-names\2.11.1\jackson-module-parameter-names-2.11.1.jar;E:\Repository\Jar\org\springframework\boot\spring-boot-starter-tomcat\2.3.2.RELEASE\spring-boot-starter-tomcat-2.3.2.RELEASE.jar;E:\Repository\Jar\org\apache\tomcat\embed\tomcat-embed-core\9.0.37\tomcat-embed-core-9.0.37.jar;E:\Repository\Jar\org\glassfish\jakarta.el\3.0.3\jakarta.el-3.0.3.jar;E:\Repository\Jar\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.37\tomcat-embed-websocket-9.0.37.jar;E:\Repository\Jar\org\springframework\spring-web\5.2.8.RELEASE\spring-web-5.2.8.RELEASE.jar;E:\Repository\Jar\org\springframework\spring-beans\5.2.8.RELEASE\spring-beans-5.2.8.RELEASE.jar;E:\Repository\Jar\org\springframework\spring-webmvc\5.2.8.RELEASE\spring-webmvc-5.2.8.RELEASE.jar;E:\Repository\Jar\org\springframework\spring-aop\5.2.8.RELEASE\spring-aop-5.2.8.RELEASE.jar;E:\Repository\Jar\org\springframework\spring-expression\5.2.8.RELEASE\spring-expression-5.2.8.RELEASE.jar;E:\Repository\Jar\com\alibaba\cloud\spring-cloud-starter-alibaba-nacos-discovery\2.1.3.RELEASE\spring-cloud-starter-alibaba-nacos-discovery-2.1.3.RELEASE.jar;E:\Repository\Jar\com\alibaba\nacos\nacos-client\1.3.3\nacos-client-1.3.3.jar;E:\Repository\Jar\com\alibaba\nacos\nacos-common\1.3.3\nacos-common-1.3.3.jar;E:\Repository\Jar\commons-io\commons-io\2.2\commons-io-2.2.jar;E:\Repository\Jar\org\apache\httpcomponents\httpasyncclient\4.1.4\httpasyncclient-4.1.4.jar;E:\Repository\Jar\org\apache\httpcomponents\httpcore\4.4.13\httpcore-4.4.13.jar;E:\Repository\Jar\org\apache\httpcomponents\httpcore-nio\4.4.13\httpcore-nio-4.4.13.jar;E:\Repository\Jar\com\alibaba\nacos\nacos-api\1.3.3\nacos-api-1.3.3.jar;E:\Repository\Jar\org\apache\commons\commons-lang3\3.10\commons-lang3-3.10.jar;E:\Repository\Jar\com\google\guava\guava\29.0-jre\guava-29.0-jre.jar;E:\Repository\Jar\com\google\guava\failureaccess\1.0.1\failureaccess-1.0.1.jar;E:\Repository\Jar\com\google\guava\listenablefuture\9999.0-empty-to-avoid-conflict-with-guava\listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar;E:\Repository\Jar\com\google\code\findbugs\jsr305\3.0.2\jsr305-3.0.2.jar;E:\Repository\Jar\org\checkerframework\checker-qual\2.11.1\checker-qual-2.11.1.jar;E:\Repository\Jar\com\google\errorprone\error_prone_annotations\2.3.4\error_prone_annotations-2.3.4.jar;E:\Repository\Jar\com\google\j2objc\j2objc-annotations\1.3\j2objc-annotations-1.3.jar;E:\Repository\Jar\commons-codec\commons-codec\1.14\commons-codec-1.14.jar;E:\Repository\Jar\com\fasterxml\jackson\core\jackson-core\2.11.1\jackson-core-2.11.1.jar;E:\Repository\Jar\io\prometheus\simpleclient\0.5.0\simpleclient-0.5.0.jar;E:\Repository\Jar\com\alibaba\spring\spring-context-support\1.0.10\spring-context-support-1.0.10.jar;E:\Repository\Jar\org\springframework\cloud\spring-cloud-commons\2.2.6.RELEASE\spring-cloud-commons-2.2.6.RELEASE.jar;E:\Repository\Jar\org\springframework\security\spring-security-crypto\5.3.3.RELEASE\spring-security-crypto-5.3.3.RELEASE.jar;E:\Repository\Jar\org\springframework\cloud\spring-cloud-context\2.2.6.RELEASE\spring-cloud-context-2.2.6.RELEASE.jar;E:\Repository\Jar\org\springframework\cloud\spring-cloud-starter-netflix-ribbon\2.2.6.RELEASE\spring-cloud-starter-netflix-ribbon-2.2.6.RELEASE.jar;E:\Repository\Jar\org\springframework\cloud\spring-cloud-starter\2.2.6.RELEASE\spring-cloud-starter-2.2.6.RELEASE.jar;E:\Repository\Jar\org\springframework\security\spring-security-rsa\1.0.9.RELEASE\spring-security-rsa-1.0.9.RELEASE.jar;E:\Repository\Jar\org\bouncycastle\bcpkix-jdk15on\1.64\bcpkix-jdk15on-1.64.jar;E:\Repository\Jar\org\bouncycastle\bcprov-jdk15on\1.64\bcprov-jdk15on-1.64.jar;E:\Repository\Jar\org\springframework\cloud\spring-cloud-netflix-ribbon\2.2.6.RELEASE\spring-cloud-netflix-ribbon-2.2.6.RELEASE.jar;E:\Repository\Jar\org\springframework\cloud\spring-cloud-netflix-archaius\2.2.6.RELEASE\spring-cloud-netflix-archaius-2.2.6.RELEASE.jar;E:\Repository\Jar\org\springframework\cloud\spring-cloud-starter-netflix-archaius\2.2.6.RELEASE\spring-cloud-starter-netflix-archaius-2.2.6.RELEASE.jar;E:\Repository\Jar\com\netflix\archaius\archaius-core\0.7.6\archaius-core-0.7.6.jar;E:\Repository\Jar\commons-configuration\commons-configuration\1.8\commons-configuration-1.8.jar;E:\Repository\Jar\com\netflix\ribbon\ribbon\2.3.0\ribbon-2.3.0.jar;E:\Repository\Jar\com\netflix\ribbon\ribbon-transport\2.3.0\ribbon-transport-2.3.0.jar;E:\Repository\Jar\io\reactivex\rxnetty-contexts\0.4.9\rxnetty-contexts-0.4.9.jar;E:\Repository\Jar\io\reactivex\rxnetty-servo\0.4.9\rxnetty-servo-0.4.9.jar;E:\Repository\Jar\com\netflix\hystrix\hystrix-core\1.5.18\hystrix-core-1.5.18.jar;E:\Repository\Jar\org\hdrhistogram\HdrHistogram\2.1.9\HdrHistogram-2.1.9.jar;E:\Repository\Jar\javax\inject\javax.inject\1\javax.inject-1.jar;E:\Repository\Jar\io\reactivex\rxnetty\0.4.9\rxnetty-0.4.9.jar;E:\Repository\Jar\com\netflix\ribbon\ribbon-core\2.3.0\ribbon-core-2.3.0.jar;E:\Repository\Jar\commons-lang\commons-lang\2.6\commons-lang-2.6.jar;E:\Repository\Jar\com\netflix\ribbon\ribbon-httpclient\2.3.0\ribbon-httpclient-2.3.0.jar;E:\Repository\Jar\commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar;E:\Repository\Jar\org\apache\httpcomponents\httpclient\4.5.12\httpclient-4.5.12.jar;E:\Repository\Jar\com\sun\jersey\jersey-client\1.19.1\jersey-client-1.19.1.jar;E:\Repository\Jar\com\sun\jersey\jersey-core\1.19.1\jersey-core-1.19.1.jar;E:\Repository\Jar\javax\ws\rs\jsr311-api\1.1.1\jsr311-api-1.1.1.jar;E:\Repository\Jar\com\sun\jersey\contribs\jersey-apache-client4\1.19.1\jersey-apache-client4-1.19.1.jar;E:\Repository\Jar\com\netflix\servo\servo-core\0.12.21\servo-core-0.12.21.jar;E:\Repository\Jar\com\netflix\netflix-commons\netflix-commons-util\0.3.0\netflix-commons-util-0.3.0.jar;E:\Repository\Jar\com\netflix\ribbon\ribbon-loadbalancer\2.3.0\ribbon-loadbalancer-2.3.0.jar;E:\Repository\Jar\com\netflix\netflix-commons\netflix-statistics\0.1.1\netflix-statistics-0.1.1.jar;E:\Repository\Jar\io\reactivex\rxjava\1.3.8\rxjava-1.3.8.jar;E:\Repository\Jar\org\junit\jupiter\junit-jupiter\5.6.2\junit-jupiter-5.6.2.jar;E:\Repository\Jar\org\junit\jupiter\junit-jupiter-api\5.6.2\junit-jupiter-api-5.6.2.jar;E:\Repository\Jar\org\apiguardian\apiguardian-api\1.1.0\apiguardian-api-1.1.0.jar;E:\Repository\Jar\org\opentest4j\opentest4j\1.2.0\opentest4j-1.2.0.jar;E:\Repository\Jar\org\junit\platform\junit-platform-commons\1.6.2\junit-platform-commons-1.6.2.jar;E:\Repository\Jar\org\junit\jupiter\junit-jupiter-params\5.6.2\junit-jupiter-params-5.6.2.jar;E:\Repository\Jar\org\junit\jupiter\junit-jupiter-engine\5.6.2\junit-jupiter-engine-5.6.2.jar;E:\Repository\Jar\org\junit\platform\junit-platform-engine\1.6.2\junit-platform-engine-1.6.2.jar;E:\Repository\Jar\org\mockito\mockito-junit-jupiter\3.3.3\mockito-junit-jupiter-3.3.3.jar;E:\Repository\Jar\org\mockito\mockito-core\3.3.3\mockito-core-3.3.3.jar;E:\Repository\Jar\net\bytebuddy\byte-buddy\1.10.13\byte-buddy-1.10.13.jar;E:\Repository\Jar\net\bytebuddy\byte-buddy-agent\1.10.13\byte-buddy-agent-1.10.13.jar;E:\Repository\Jar\org\objenesis\objenesis\2.6\objenesis-2.6.jar;E:\Repository\Jar\com\alibaba\cloud\spring-cloud-starter-alibaba-nacos-config\2.1.3.RELEASE\spring-cloud-starter-alibaba-nacos-config-2.1.3.RELEASE.jar;D:\tool\JetBrains\IntelliJ IDEA 2020.1\lib\idea_rt.jar" com.demo.Application@b@Connected to the target VM, address: '127.0.0.1:60900', transport: 'socket'@b@@b@  .   ____          _            __ _ _@b@ /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \@b@( ( )\___ | '_ | '_| | '_ \/ _' | \ \ \ \@b@ \\/  ___)| |_)| | | | | || (_| |  ) ) ) )@b@  '  |____| .__|_| |_|_| |_\__, | / / / /@b@ =========|_|==============|___/=/_/_/_/@b@ :: Spring Boot ::        (v2.3.2.RELEASE)@b@@b@2022-05-03 23:52:58.453  INFO 26984 --- [           main] c.a.n.c.c.impl.LocalConfigInfoProcessor  : LOCAL_SNAPSHOT_PATH:C:\Users\Think\nacos\config@b@2022-05-03 23:52:58.542  INFO 26984 --- [           main] c.a.nacos.client.config.impl.Limiter     : limitTime:5.0@b@2022-05-03 23:52:58.623  WARN 26984 --- [           main] c.a.c.n.c.NacosPropertySourceBuilder     : Ignore the empty nacos configuration and get it based on dataId[nacos-demo] & group[DEFAULT_GROUP]@b@2022-05-03 23:52:58.655  WARN 26984 --- [           main] c.a.c.n.c.NacosPropertySourceBuilder     : Ignore the empty nacos configuration and get it based on dataId[nacos-demo.properties] & group[DEFAULT_GROUP]@b@2022-05-03 23:52:58.656  INFO 26984 --- [           main] b.c.PropertySourceBootstrapConfiguration : Located property source: [BootstrapPropertySource {name='bootstrapProperties-nacos-demo.properties,DEFAULT_GROUP'}, BootstrapPropertySource {name='bootstrapProperties-nacos-demo,DEFAULT_GROUP'}]@b@2022-05-03 23:52:58.665  INFO 26984 --- [           main] com.demo.Application                     : No active profile set, falling back to default profiles: default@b@2022-05-03 23:52:59.718  INFO 26984 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=9bf959a3-3440-3227-a604-736842e6718f@b@2022-05-03 23:53:00.445  INFO 26984 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)@b@2022-05-03 23:53:00.495  INFO 26984 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]@b@2022-05-03 23:53:00.496  INFO 26984 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.37]@b@2022-05-03 23:53:01.057  INFO 26984 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext@b@2022-05-03 23:53:01.058  INFO 26984 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2361 ms@b@2022-05-03 23:53:01.324  WARN 26984 --- [           main] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.@b@2022-05-03 23:53:01.324  INFO 26984 --- [           main] c.n.c.sources.URLConfigurationSource     : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.@b@2022-05-03 23:53:01.332  WARN 26984 --- [           main] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.@b@2022-05-03 23:53:01.334  INFO 26984 --- [           main] c.n.c.sources.URLConfigurationSource     : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.@b@2022-05-03 23:53:01.690  INFO 26984 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'@b@2022-05-03 23:53:03.757  INFO 26984 --- [           main] o.s.s.c.ThreadPoolTaskScheduler          : Initializing ExecutorService 'Nacos-Watch-Task-Scheduler'@b@2022-05-03 23:53:05.793  INFO 26984 --- [           main] com.alibaba.nacos.client.naming          : initializer namespace from System Property :null@b@2022-05-03 23:53:05.794  INFO 26984 --- [           main] com.alibaba.nacos.client.naming          : initializer namespace from System Environment :null@b@2022-05-03 23:53:05.795  INFO 26984 --- [           main] com.alibaba.nacos.client.naming          : initializer namespace from System Property :null@b@2022-05-03 23:53:06.139  INFO 26984 --- [           main] com.alibaba.nacos.client.naming          : [LISTENER] adding DEFAULT_GROUP@@nacos-demo with DEFAULT to listener map@b@2022-05-03 23:53:06.303  INFO 26984 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''@b@2022-05-03 23:53:06.313  INFO 26984 --- [           main] com.alibaba.nacos.client.naming          : [BEAT] adding beat: BeatInfo{port=8080, ip='192.168.1.178', weight=1.0, serviceName='DEFAULT_GROUP@@nacos-demo', cluster='DEFAULT', metadata={preserved.register.source=SPRING_CLOUD}, scheduled=false, period=5000, stopped=false} to beat map.@b@2022-05-03 23:53:06.314  INFO 26984 --- [           main] com.alibaba.nacos.client.naming          : [REGISTER-SERVICE] public registering service DEFAULT_GROUP@@nacos-demo with instance: Instance{instanceId='null', ip='192.168.1.178', port=8080, weight=1.0, healthy=true, enabled=true, ephemeral=true, clusterName='DEFAULT', serviceName='null', metadata={preserved.register.source=SPRING_CLOUD}}@b@2022-05-03 23:53:06.343  INFO 26984 --- [           main] c.a.c.n.registry.NacosServiceRegistry    : nacos registry, DEFAULT_GROUP nacos-demo 192.168.1.178:8080 register finished@b@2022-05-03 23:53:06.651  INFO 26984 --- [g.push.receiver] com.alibaba.nacos.client.naming          : received push data: {"type":"dom","data":"{\"name\":\"DEFAULT_GROUP@@nacos-demo\",\"clusters\":\"DEFAULT\",\"cacheMillis\":10000,\"hosts\":[{\"instanceId\":\"192.168.1.178#8080#DEFAULT#DEFAULT_GROUP@@nacos-demo\",\"ip\":\"192.168.1.178\",\"port\":8080,\"weight\":1.0,\"healthy\":true,\"enabled\":true,\"ephemeral\":true,\"clusterName\":\"DEFAULT\",\"serviceName\":\"DEFAULT_GROUP@@nacos-demo\",\"metadata\":{\"preserved.register.source\":\"SPRING_CLOUD\"},\"ipDeleteTimeout\":30000,\"instanceHeartBeatTimeOut\":15000,\"instanceHeartBeatInterval\":5000}],\"lastRefTime\":1651593186590,\"checksum\":\"\",\"allIPs\":false,\"reachProtectionThreshold\":false,\"valid\":true}","lastRefTime":438679292413400} from /192.168.1.178@b@2022-05-03 23:53:06.683  INFO 26984 --- [g.push.receiver] com.alibaba.nacos.client.naming          : new ips(1) service: DEFAULT_GROUP@@nacos-demo@@DEFAULT -> [{"instanceId":"192.168.1.178#8080#DEFAULT#DEFAULT_GROUP@@nacos-demo","ip":"192.168.1.178","port":8080,"weight":1.0,"healthy":true,"enabled":true,"ephemeral":true,"clusterName":"DEFAULT","serviceName":"DEFAULT_GROUP@@nacos-demo","metadata":{"preserved.register.source":"SPRING_CLOUD"},"ipDeleteTimeout":30000,"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000}]@b@2022-05-03 23:53:06.709  INFO 26984 --- [g.push.receiver] com.alibaba.nacos.client.naming          : current ips:(1) service: DEFAULT_GROUP@@nacos-demo@@DEFAULT -> [{"instanceId":"192.168.1.178#8080#DEFAULT#DEFAULT_GROUP@@nacos-demo","ip":"192.168.1.178","port":8080,"weight":1.0,"healthy":true,"enabled":true,"ephemeral":true,"clusterName":"DEFAULT","serviceName":"DEFAULT_GROUP@@nacos-demo","metadata":{"preserved.register.source":"SPRING_CLOUD"},"ipDeleteTimeout":30000,"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000}]@b@2022-05-03 23:53:08.165  INFO 26984 --- [           main] com.demo.Application                     : Started Application in 15.975 seconds (JVM running for 24.104)@b@2022-05-03 23:53:08.171  INFO 26984 --- [           main] c.a.n.client.config.impl.ClientWorker    : [fixed-localhost_8848] [subscribe] nacos-demo.properties+DEFAULT_GROUP@b@2022-05-03 23:53:08.173  INFO 26984 --- [           main] c.a.nacos.client.config.impl.CacheData   : [fixed-localhost_8848] [add-listener] ok, tenant=, dataId=nacos-demo.properties, group=DEFAULT_GROUP, cnt=1@b@2022-05-03 23:53:08.173  INFO 26984 --- [           main] c.a.n.client.config.impl.ClientWorker    : [fixed-localhost_8848] [subscribe] nacos-demo+DEFAULT_GROUP@b@2022-05-03 23:53:08.173  INFO 26984 --- [           main] c.a.nacos.client.config.impl.CacheData   : [fixed-localhost_8848] [add-listener] ok, tenant=, dataId=nacos-demo, group=DEFAULT_GROUP, cnt=1@b@2022-05-03 23:55:26.936  INFO 26984 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'@b@2022-05-03 23:55:26.936  INFO 26984 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'@b@2022-05-03 23:55:26.952  INFO 26984 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 16 ms@b@2022-05-03 23:55:29.017  INFO 26984 --- [nio-8080-exec-1] c.netflix.config.ChainedDynamicProperty  : Flipping property: nacos-demo.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647@b@2022-05-03 23:55:29.062  INFO 26984 --- [nio-8080-exec-1] c.netflix.loadbalancer.BaseLoadBalancer  : Client: nacos-demo instantiated a LoadBalancer: DynamicServerListLoadBalancer:{NFLoadBalancer:name=nacos-demo,current list of Servers=[],Load balancer stats=Zone stats: {},Server stats: []}ServerList:null@b@2022-05-03 23:55:29.075  INFO 26984 --- [nio-8080-exec-1] c.n.l.DynamicServerListLoadBalancer      : Using serverListUpdater PollingServerListUpdater@b@2022-05-03 23:55:29.087  INFO 26984 --- [nio-8080-exec-1] com.alibaba.nacos.client.naming          : new ips(1) service: DEFAULT_GROUP@@nacos-demo -> [{"instanceId":"192.168.1.178#8080#DEFAULT#DEFAULT_GROUP@@nacos-demo","ip":"192.168.1.178","port":8080,"weight":1.0,"healthy":true,"enabled":true,"ephemeral":true,"clusterName":"DEFAULT","serviceName":"DEFAULT_GROUP@@nacos-demo","metadata":{"preserved.register.source":"SPRING_CLOUD"},"ipDeleteTimeout":30000,"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000}]@b@2022-05-03 23:55:29.090  INFO 26984 --- [nio-8080-exec-1] com.alibaba.nacos.client.naming          : current ips:(1) service: DEFAULT_GROUP@@nacos-demo -> [{"instanceId":"192.168.1.178#8080#DEFAULT#DEFAULT_GROUP@@nacos-demo","ip":"192.168.1.178","port":8080,"weight":1.0,"healthy":true,"enabled":true,"ephemeral":true,"clusterName":"DEFAULT","serviceName":"DEFAULT_GROUP@@nacos-demo","metadata":{"preserved.register.source":"SPRING_CLOUD"},"ipDeleteTimeout":30000,"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000}]@b@2022-05-03 23:55:29.110  INFO 26984 --- [nio-8080-exec-1] c.netflix.config.ChainedDynamicProperty  : Flipping property: nacos-demo.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647@b@2022-05-03 23:55:29.112  INFO 26984 --- [nio-8080-exec-1] c.n.l.DynamicServerListLoadBalancer      : DynamicServerListLoadBalancer for client nacos-demo initialized: DynamicServerListLoadBalancer:{NFLoadBalancer:name=nacos-demo,current list of Servers=[192.168.1.178:8080],Load balancer stats=Zone stats: {unknown=[Zone:unknown;	Instance count:1;	Active connections count: 0;	Circuit breaker tripped count: 0;	Active connections per server: 0.0;]

4. 浏览器输入测试接口地址:http://localhost:8080/test,效果如下图所示

基于nacos简单demo maven项目示例下载

  • <<相关内容>>
<<热门下载>>