我正在尝试使用REST Web服务的Spring Boot应用程序。我计划使用同一应用程序的多个实例,因此将它们注册为Eureka客户端。我已经和Zuul一起使用了负载平衡。这很好。现在,当我尝试将Hezelcast实例添加到应用程序实例时,该应用程序启动,但hazelcast实例却没有。我坚持为什么不这样做。任何帮助表示赞赏。
这是我的配置类。
subgroup
这些是我的pom依赖项。
grp
根据要求添加日志。
@Configuration
public class CacheConfig {
@Bean
public Config config() {
return new Config();
}
}
主类:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
<version>1.1.5.RELEASE</version>
</dependency>
<dependency>
<groupId>com.hazelcast</groupId>
<artifactId>hazelcast</artifactId>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.3.0</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.6.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
这是我的应用。为了方便起见,将所有三个类放在同一块中。
[WARNING]
[WARNING] Some problems were encountered while building the effective settings
[WARNING] 'proxies.proxy.id' must be unique but found duplicate proxy with id optional @ C:\apache-maven-3.3.9\conf\settings.xml
[WARNING]
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building POC-REST 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.0.0:clean (default-clean) @ POC-REST ---
[INFO] Deleting c:\Workspace_Github\POC-REST\target
[INFO]
[INFO] >>> spring-boot-maven-plugin:2.0.2.RELEASE:run (default-cli) > test-compile @ POC-REST >>>
[INFO]
[INFO] --- maven-resources-plugin:3.0.1:resources (default-resources) @ POC-REST ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ POC-REST ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 52 source files to c:\Workspace_Github\POC-REST\target\classes
[INFO]
[INFO] --- maven-resources-plugin:3.0.1:testResources (default-testResources) @ POC-REST ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory c:\Workspace_Github\POC-REST\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:testCompile (default-testCompile) @ POC-REST ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to c:\Workspace_Github\POC-REST\target\test-classes
[INFO]
[INFO] <<< spring-boot-maven-plugin:2.0.2.RELEASE:run (default-cli) < test-compile @ POC-REST <<<
[INFO]
[INFO] --- spring-boot-maven-plugin:2.0.2.RELEASE:run (default-cli) @ POC-REST ---
2018-07-02 14:22:12.463 INFO 2892 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@1574712c: startup date [Mon Jul 02 14:22:12 EDT 2018]; root of context hierarchy
2018-07-02 14:22:12.931 INFO 2892 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2018-07-02 14:22:13.126 INFO 2892 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'configurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$a39c3820] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.0.2.RELEASE)
2018-07-02 14:22:18.116 INFO 2892 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 3462 ms
2018-07-02 14:22:26.988 INFO 2892 --- [ main] o.s.s.web.DefaultSecurityFilterChain : Creating filter chain: org.springframework.security.web.util.matcher.AnyRequestMatcher@1, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@377a610f, org.springframework.security.web.context.SecurityContextPersistenceFilter@31b29aea, org.springframework.security.web.header.HeaderWriterFilter@228598d, org.springframework.security.web.authentication.logout.LogoutFilter@4e4795c, com.mhf.ids_rest.jwt.CustomCorsFilter@5b5256fd, com.mhf.ids_rest.jwt.security.auth.ajax.AjaxLoginProcessingFilter@4bda7dc, com.mhf.ids_rest.jwt.security.auth.jwt.JwtTokenAuthenticationProcessingFilter@3c9d3b31, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@3a981279, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@3327dc67, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@580b47b4, org.springframework.security.web.session.SessionManagementFilter@3f1d99a8, org.springframework.security.web.access.ExceptionTranslationFilter@236d4b91, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@2259c500]
2018-07-02 14:22:27.063 WARN 2892 --- [ main] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources.
2018-07-02 14:22:27.074 WARN 2892 --- [ main] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources.
2018-07-02 14:22:27.179 INFO 2892 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-07-02 14:22:27.301 INFO 2892 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@696771bc: startup date [Mon Jul 02 14:22:14 EDT 2018]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@1574712c
2018-07-02 14:22:27.366 WARN 2892 --- [ main] aWebConfiguration$JpaWebMvcConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2018-07-02 14:22:27.414 INFO 2892 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/]}" onto public org.springframework.http.ResponseEntity<?> com.mhf.ids_rest.controller.PingController.home()
2018-07-02 14:22:27.418 INFO 2892 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/sample-data/function2/data1/{data1}/data2/{data2}/data3/{data3}],methods=[GET],produces=[application/json]}" onto public org.springframework.http.ResponseEntity<?> com.mhf.ids_rest.controller.RestApiController.getFunction1(int,int,java.lang.String)
2018-07-02 14:22:27.419 INFO 2892 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/sample-data/function1/data1/{data1}],methods=[GET],produces=[application/json]}" onto public org.springframework.http.ResponseEntity<?> com.mhf.ids_rest.controller.RestApiController.getFunction2(java.lang.String)
2018-07-02 14:22:27.420 INFO 2892 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/api/me],methods=[GET]}" onto public com.mhf.ids_rest.jwt.security.model.UserContext com.mhf.ids_rest.jwt.profile.endpoint.ProfileEndpoint.get(com.mhf.ids_rest.jwt.security.auth.JwtAuthenticationToken)
2018-07-02 14:22:27.421 INFO 2892 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/api/auth/token],methods=[GET],produces=[application/json]}" onto public com.mhf.ids_rest.jwt.security.model.token.JwtToken com.mhf.ids_rest.jwt.security.endpoint.RefreshTokenEndpoint.refreshToken(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) throws java.io.IOException,javax.servlet.ServletException
2018-07-02 14:22:27.426 INFO 2892 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2018-07-02 14:22:27.427 INFO 2892 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-07-02 14:22:27.465 INFO 2892 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-07-02 14:22:27.465 INFO 2892 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]