我有一个工作的Feign接口定义为:
@FeignClient("content-link-service")
public interface ContentLinkServiceClient {
@RequestMapping(method = RequestMethod.GET, value = "/{trackid}/links")
List<Link> getLinksForTrack(@PathVariable("trackid") Long trackId);
}
Run Code Online (Sandbox Code Playgroud)
如果我将其更改为使用@RequestLine
@FeignClient("content-link-service")
public interface ContentLinkServiceClient {
@RequestLine("GET /{trackid}/links")
List<Link> getLinksForTrack(@Param("trackid") Long trackId);
}
Run Code Online (Sandbox Code Playgroud)
我得到了例外
引起:java.lang.IllegalStateException:方法getLinksForTrack没有使用HTTP方法类型注释(例如GET,POST)
有什么想法吗?
我们有许多 Spring Boot 应用程序向 Consul 注册(通过 Spring Cloud Consul)。如果我通过以下方式停止这些应用程序,docker-compose stop myservice那么它们会正确注销自己并从 Consul 中消失。
如果我使用,docker-compose kill myservice则不会发生注销。我知道在 UNIX 系统上不可能捕获 SIGKILL 事件,因此无法强制取消注册。
因此,我们看到的是 Consul 中从未删除的服务(标记为critical但在 UI 中仍然可见)。有没有办法强制 Consul 刷新注册的内容,以便删除死服务?
谢谢
缺口
随着时间的推移,我未使用的 Spring Boot v1.3.2 应用程序会逐渐增加内存消耗,直到它最终崩溃。未使用我的意思是除了/health端点的常规 ping 之外,没有为请求的客户端提供服务。
根据 Eclipse Memory Analyser 的说法,org.springframework.boot.loader.LaunchedURLClassLoader它占用了 920MB 的大量空间。
似乎 Spring Boot 正在不断加载类
任何想法发生了什么?
编辑
看起来是 Spring Cloud Consul 导致了这个问题:
我有一个集成测试,旨在启动我的 Spring Boot 应用程序:
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = AppConfigCorrelationIdTestIt.class)
@WebIntegrationTest("server.port:0")
public class CorrelationIdTestIT {
Run Code Online (Sandbox Code Playgroud)
配置类在哪里:
@EnableConfigurationProperties
@ComponentScan
@EnableAutoConfiguration
@Configuration
public class AppConfigCorrelationIdTestIt {
Run Code Online (Sandbox Code Playgroud)
在应用程序中,我有一个定义的自定义 servlet 过滤器:
public class CorrelationHeaderFilter implements Filter {
Run Code Online (Sandbox Code Playgroud)
但是在测试我的应用程序时,我发现客户过滤器没有被实例化并注入到过滤器链中。我发现解决此问题的唯一方法是手动将其创建为 中的 bean AppConfigCorrelationIdTestIt,然后它就可以完美运行。
@Bean
public CorrelationHeaderFilter correlationHeaderFilter() {
return new CorrelationHeaderFilter();
}
Run Code Online (Sandbox Code Playgroud)
任何想法为什么在应用程序启动时 Spring Boot 没有选择过滤器?
谢谢
我正在尝试通过Maven运行Sonar分析,但它一直在抱怨:
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.7.1:sonar (default-cli) on project mio-commons: Another SonarQube analysis is already in progress for this project -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
Run Code Online (Sandbox Code Playgroud)
此项目尚无任何分析,我什至尝试从Sonar中删除项目本身。任何想法可能是什么问题?