2017-03-16 16:09:08.821 INFO 9104 --- [ main] com.hello.EurekaClientApplication : No active profile set, falling back to default profiles: default 2017-03-16 16:09:08.848 INFO 9104 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@5dcd8c7a: startup date [Thu Mar 16 16:09:08 CDT 2017]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@441772e 2017-03-16 16:09:09.873 INFO 9104 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'hystrixFeature' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.cloud.netflix.hystrix.HystrixCircuitBreakerConfiguration$HystrixWebConfiguration; factoryMethodName=hystrixFeature; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/cloud/netflix/hystrix/HystrixCircuitBreakerConfiguration$HystrixWebConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.cloud.netflix.hystrix.HystrixCircuitBreakerConfiguration; factoryMethodName=hystrixFeature; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/cloud/netflix/hystrix/HystrixCircuitBreakerConfiguration.class]] 2017-03-16 16:09:10.364 WARN 9104 --- [ main] o.s.c.a.ConfigurationClassPostProcessor : Cannot enhance @Configuration bean definition 'refreshScope' since its singleton instance has been created too early. The typical cause is a non-static @Bean method with a BeanDefinitionRegistryPostProcessor return type: Consider declaring such methods as 'static'. 2017-03-16 16:09:10.701 INFO 9104 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=d0eb8cfd-bd5b-3565-9f63-f671e896f6be 2017-03-16 16:09:10.736 INFO 9104 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring 2017-03-16 16:09:11.312 INFO 9104 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$94394ff6] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2017-03-16 16:09:12.091 INFO 9104 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http) 2017-03-16 16:09:12.128 INFO 9104 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat 2017-03-16 16:09:12.130 INFO 9104 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.11 2017-03-16 16:09:12.546 INFO 9104 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2017-03-16 16:09:12.547 INFO 9104 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 3699 ms 2017-03-16 16:09:13.191 INFO 9104 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'proxyStreamServlet' to [/proxy.stream] 2017-03-16 16:09:13.193 INFO 9104 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/] 2017-03-16 16:09:13.198 INFO 9104 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'metricsFilter' to: [/*] 2017-03-16 16:09:13.199 INFO 9104 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*] 2017-03-16 16:09:13.199 INFO 9104 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*] 2017-03-16 16:09:13.200 INFO 9104 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*] 2017-03-16 16:09:13.200 INFO 9104 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*] 2017-03-16 16:09:13.200 INFO 9104 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'webRequestLoggingFilter' to: [/*] 2017-03-16 16:09:13.200 INFO 9104 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'applicationContextIdFilter' to: [/*] 2017-03-16 16:09:13.269 WARN 9104 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'eurekaClientApplication': Unsatisfied dependency expressed through field 'clientservice'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'clientService' defined in file [C:\Users\Mike\workspace\Eureka_client\target\classes\com\hello\ClientService.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.netflix.discovery.DiscoveryClient' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {} 2017-03-16 16:09:13.306 INFO 9104 --- [ main] o.apache.catalina.core.StandardService : Stopping service Tomcat 2017-03-16 16:09:13.404 INFO 9104 --- [ main] utoConfigurationReportLoggingInitializer : Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled. 2017-03-16 16:09:13.745 ERROR 9104 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPLICATION FAILED TO START *************************** Description: Parameter 0 of constructor in com.hello.ClientService required a bean of type 'com.netflix.discovery.DiscoveryClient' that could not be found. Action: Consider defining a bean of type 'com.netflix.discovery.DiscoveryClient' in your configuration.
package com.hello;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.stereotype.Service;
import com.netflix.discovery.DiscoveryClient;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
@EnableDiscoveryClient
@Service
public class ClientService {
private final DiscoveryClient disc;
public ClientService(DiscoveryClient disc){
this.disc=disc;
}
@HystrixCommand(fallbackMethod="disp")
public String serviceInstancesByApplicationName(){
return this.disc.getInstancesById("a-bootiful-client").toString();
}
public String disp(){
return "This is fall back method";
}
}
package com.hello;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
@EnableHystrix
@EnableHystrixDashboard
@EnableDiscoveryClient
@SpringBootConfiguration
@EnableAutoConfiguration
@ComponentScan
@RestController
public class EurekaClientApplication {
@Autowired
private ClientService clientservice;
public static void main(String[] args) {
SpringApplication.run(EurekaClientApplication.class, args);
}
@RequestMapping("/serv")
public String serviceInstancesByApplicationName(){
return clientservice.serviceInstancesByApplicationName();
}
}
我正在尝试创建一个简单的eureka服务和客户端程序,并在其上启用hystrix。但我在代码上发现了这个错误
您在代码中导入了错误的DiscoveryClient
类。netflix的DiscoveryClient不作为Spring Bean提供。所以您应该使用Spring-Cloud中的一个。
尝试在ClientService
类中导入org.springframework.cloud.client.discovery.discoveryclient
而不是com.netflix.discovery.client
。
此外,您还需要将this.disc.getInstancesByID(“a-bootiful-client”)
更改为this.disc.getInstances(...)
。
在尝试创建一对多(以及多对一)关系时,我遇到以下错误: 以下是完整的故事。目前在这些课程中,我有以下几点: LoginUser.java 用户角色。JAVA 用户角色存储。JAVA 开始atabase.java 我得到的全部错误是: 我不完全确定在哪里或为什么它试图找到一个属性的id时,我显然已经设置了所有类型的UserRole。
我正试图按照本教程将thymeleaf添加到springboot应用程序中,但我似乎无法让它工作。辅导的:http://spr.com/part-2-adding-views-using-thymeleaf-and-jsp-if-you-want/ 当我在LoginController中使用@RestController启动应用程序时,我能够让springstart正常工作,但是当我将@RestC
我在Spring网站上跟踪这个SpringBoot演示,学习如何创建一个接受上传的文件。我收到一条错误消息: 我试图通过向FileUploadController添加注释来修复它。 我已尝试将以下依赖项添加到build.gradle 注意:我不想将数据库连接到此演示项目。这个演示确认它不是在这个演示中尝试连接数据库,而是在生产环境中尝试连接数据库。 我尝试在Storage Service接口上方添
当我启动应用程序时,我得到一个错误,即找不到。 然后我把它添加到我的SpringBootApp中 并且找到,但没有找到。 存储库