我无法从另一个项目自动连接假装客户端.似乎没有生成和注入假装客户端的实现.
这是我得到的错误.
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'passportRestController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException:
Could not autowire field: private com.wstrater.service.contacts.client.ContactService com.wstrater.service.passport.server.controllers.PassportRestController.contactService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException:
No qualifying bean of type [com.wstrater.service.contacts.client.ContactService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations:
{@org.springframework.beans.factory.annotation.Autowired(required=true)}
Run Code Online (Sandbox Code Playgroud)
假装客户非常直截了当.为简洁起见,我删除了导入.
package com.wstrater.service.contacts.client;
@FeignClient("contact-service")
public interface ContactService {
@RequestMapping(method = RequestMethod.GET, value = ContactConstants.CONTACTS_USER_ID_PATH)
public Collection<Contact> contactsByUserId(@PathVariable("userId") String userId);
}
Run Code Online (Sandbox Code Playgroud)
我将组件扫描添加到我的项目中以包含应用程序及其控制器,并将feign客户端包含在另一个项目中.
package com.wstrater.service.passport.server;
@EnableEurekaClient
@EnableFeignClients
@SpringCloudApplication …Run Code Online (Sandbox Code Playgroud) 我正在尝试以Alpine Docker映像中的不同用户身份运行一些脚本。在登录时,devuser我希望setup.sh以root和app.sh身份运行appuser。由于我已经读到不能在脚本文件上使用SUID,所以我有几个C程序,setup和app,它们会调用脚本。我可以setup按,root但不能app按appuser。
这是目录的内容。请注意,应用程序和设置在程序上设置了SUID位。我尝试在脚本上设置SUID,但这没有用。
/opt/app $ ls -l
total 24552
-r-sr-xr-x 1 appuser appgroup 10632 Jun 27 12:59 app
-r-------- 1 appuser appgroup 25101769 Jun 27 12:59 app.jar
-r-xr-xr-- 1 appuser appgroup 327 Jun 27 12:59 app.sh
-r-------- 1 appuser appgroup 316 Jun 27 12:59 application.yml
-r-sr-xr-x 1 root root 10632 Jun 27 12:59 setup
-r-xr-xr-- 1 root root …Run Code Online (Sandbox Code Playgroud) 我必须是反Maven,因为每次我尝试使用它我花了很多时间挣扎然后放弃.我最新的是尽管拥有1.7 JDK,但我无法编译Java 7源代码.
这是输出mvn compile.有趣的是,当我使用Maven 3.0.4时,错误消息表示-source 1.5而不是-source 1.6Maven 3.2.1
[ERROR] .../src/main/java/pox/common/ServiceResponse.java:[300,43] diamond operator is not supported in -source 1.6
[ERROR] (use -source 7 or higher to enable diamond operator)
[ERROR] .../src/main/java/pox/common/ServiceRequest.java:[185,43] diamond operator is not supported in -source 1.6
[ERROR] (use -source 7 or higher to enable diamond operator)
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,我使用的是最新版本的Maven,而Maven正在使用Java 1.7.
$ mvn -v
Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T12:37:52-05:00)
Maven home: /usr/local/maven
Java version: 1.7.0_40, vendor: Oracle Corporation
Java home: /usr/local/jdk1.7.0_40-x64/jre
Default locale: en_US, …Run Code Online (Sandbox Code Playgroud) 我正在尝试了解Spring Boot和Hystrix,并且无法让后备方法工作.我尝试了两种方法,@HystrixCommand并且@FeignClient.我可以得到@HystrixCommand但不是@FeignClient.大多数代码都基于我在搜索时看到的示例,所以我认为我非常接近但必须缺少一些关键的东西.
这是Spring Boot应用程序和REST控制器.我在同一个应用程序中尝试这两种方法.它正在与尤里卡注册.我没有hello-world运行服务所以它应该总是回退.
package com.example.goodBye.service;
@EnableDiscoveryClient
@EnableFeignClients
@EnableCircuitBreaker
@SpringBootApplication
public class GoodByeServiceApplication {
private final static AtomicInteger counter = new AtomicInteger();
private final static Logger logger = LoggerFactory.getLogger(GoodByeServiceApplication.class);
public static void main(String[] args) {
SpringApplication.run(GoodByeServiceApplication.class, args);
}
@Bean
public RestTemplate restTemplate(RestTemplateBuilder builder) {
return builder.build();
}
@RefreshScope
@RestController
class MessageController {
@Autowired
private HelloClient helloClient;
@Autowired
private HelloService helloService;
@Value("${message:Good Bye Default}")
private String message;
@RequestMapping(value = "/message", produces …Run Code Online (Sandbox Code Playgroud) spring ×2
alpine-linux ×1
bash ×1
docker ×1
hystrix ×1
java ×1
maven ×1
spring-boot ×1
spring-cloud ×1