2013年5月思想汇报,阿拉德战记小说,赛义夫近况
文章开头唠叨两句。
2019年了,而自己参加工作也两年有余了,用一个词来概括这两年多的生活,就是:“碌碌无为”。
也不能说一点收获都没有,但是很少。2019来了,我立志要打破现状,改变自己,突破自我。现在明白了只有不断的学习才能不被淘汰,只有不断的学习才能拿到更高的工资。
言归正传,在今早发现张队在元旦前的博客“年末展望:oracle 对 jdk收费和.net core 给我们的机遇”,说明了以后.net core会越来越好,而我本人在2017年的时候开始接触过.net core的时候,就没有放弃过对.net core的学习,现在觉得微服务是个不错的方向,而自己也在学习这块的东西,所以写个博客记录一下自己的学习的笔记。
我采用的是java的spring cloud + .net core。
<dependencymanagement> <dependencies> <dependency> <groupid>org.springframework.cloud</groupid> <artifactid>spring-cloud-dependencies</artifactid> <version>dalston.sr3</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencymanagement> <dependencies> <dependency> <groupid>org.springframework.cloud</groupid> <artifactid>spring-cloud-starter-config</artifactid> </dependency> <dependency> <groupid>org.springframework.cloud</groupid> <artifactid>spring-cloud-starter-eureka-server</artifactid> </dependency> </dependencies>
下载eureka需要的jar包。
server.port=8888 #客户端默认情况下会将自己注册到一个8761的端口,我们修改端口为8888 eureka.client.register-with-eureka=false #默认会把自己当作一个客户端注册到eureka服务,把他设置为false。 eureka.client.fetch-registry=false #默认去抓取注册信息,自己本身是一个eureka服务器,没必要去抓取,应该是客户端去抓取,所以把这个配置设置为false。
import org.springframework.boot.autoconfigure.springbootapplication; import org.springframework.boot.builder.springapplicationbuilder; import org.springframework.cloud.netflix.eureka.server.enableeurekaserver; @springbootapplication @enableeurekaserver public class serverapp { public static void main(string[] args){ new springapplicationbuilder(serverapp.class).web(true).run(args); } }
启动这个启动类,然后浏览器里输入:http://www.lhsxpumps.com/_localhost:8888(8888是我spring boot的端口),然后看到如下页面,这个时候说明spring boot eureka服务启动成功。
public void configureservices(iservicecollection services) { // services.adddiscoveryclient(configuration); services.adddiscoveryclient(configuration); services.addmvc().setcompatibilityversion(compatibilityversion.version_2_1); }
public void configure(iapplicationbuilder app, ihostingenvironment env,iloggerfactory loggerfactory) { loggerfactory.addconsole(configuration.getsection("logging")); loggerfactory.adddebug(); if (env.isdevelopment()) { app.usedeveloperexceptionpage(); } else { app.usehsts(); } app.usediscoveryclient(); app.usehttpsredirection(); app.usemvc(); }
需要using pivotal.discovery.client;
"demo": { "commandname": "project", "launchbrowser": true, "launchurl": "api/values", "applicationurl": "http://localhost:5000", "environmentvariables": { "aspnetcore_environment": "development" }
{ "logging": { "loglevel": { "default": "warning" } }, "spring":{ "application":{ "name":"serviceone" } }, "eureka":{ "client":{ "serviceurl":"http://localhost:8888/eureka", "shouldfetchregistry":false, "shouldregisterwitheureka":true }, "instance":{ "port":5000 } } }
参考资料:
备注:最近先更新spring cloud知识,之后会使用完整的spring cloud + .net core完成一个完整的项目。
下周更新:搭建eureka群集。
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Blazor server side 自家的一些开源的, 实用型项目的进度之 CEF客户端
.NET IoC模式依赖反转(DIP)、控制反转(Ioc)、依赖注入(DI)
vue+.netcore可支持业务代码扩展的开发框架 VOL.Vue 2.0版本发布
网友评论