1.报错
Failed to start bean 'eurekaAutoServiceRegistration'; nested exception is java.lang.NullPointException
2.原因
包冲突
建包时,包
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId> </dependency>
放在了最外层的module中,在构建子module时,eureka-client服务引入client包:
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> </dependency>
这导致了父子包冲突。
3.解决
把eureka-server包直接放到注册中心的子module下面引用。