最近想写项目,使用到了eureka服务,遇到了一些问题,想记录下来,也能给需要帮助的同学提供帮助。
server:
port: 8761
eureka:
client:
register-with-eureka: false
fetch-registry: false
service-url:
defaultZone: http://localhost:8761/eureka
spring:
application:
name:eureka
注意端口号是8761。
并且文件中不要有过多的注释,因为我找了很多原因都无法显示界面,最后发现删除注释就好了。
defaultZone那一行记得开头有一个空格,不然会报错。
启动项:
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication
@