I create a eureka project in IDEA and it works well. But when I pack it into war and throw into webapp directory of tomcat 8.5. After restart tomcat,I can not access it by the url localhost:8761
EurekaApplication.java
@SpringBootApplication
@EnableEurekaServer
public class EurekaApplication {
public static void main( String[] args ) {
SpringApplication.run(EurekaApplication.class,args);
}
}
application.yml
server:
port: 8761
eureka:
instance:
hostname: localhost
client:
registerWithEureka: false
fetchRegistry: false
serverUrl:
defaultZone: http://localhost:${server.port}/eureka/
spring.cloud.config.discovery.enabled: true