text:
@ConfigurationProperties and @RefreshScope don't work together as documented

Based on reading the docs and this https://gist.github.com/dsyer/a43fe5f74427b371519af68c5c4904c7 it was my understanding that it should be possible to place @RefreshScope on a bean defined with @ ConfigurationProperties and have the properties bean  put in the refresh scope. It would appear that this doesn't work - a bean created by scanning for ConfigurationProperties classes or via @ EnableConfigurationProperties is never put into the RefreshScope correctly. On the other hand, if the same bean is created by means of an @ Bean annotated method on a configuration class, it is correctly added to the RefreshScope.
This is frustrating because explicit bean creation for these configuration beans makes it very hard to use immutable classes for them without duplicating a bunch of spring internal binding code; and having them work in RefreshScope would be a convenient  way around not being able to rely on the EnvironmentChangedEvent rebinding for @ ConstructorBinding  ConfigurationProperties classes. From what I can see, RefreshScope.refresh results in the entire bean being thrown away and reloaded (thus compatible with ConstructorBinding) the next time a method is called on the proxy.
Testcase showing various different configurations of RefreshScope here: https://github.com/symposion/spring-test/tree/refresh-scope-properties-bean . For all but three of the beans, calling the foo() method after a refresh results in a new bean being constructed (as expected for RefreshScope). But the bean created by EnableConfigurationProperties  isn't correctly placed into the RefreshScope, so this doesn't work for it.

We have no plans to support refresh of read only properties (ie constructor binding)

A couple of  points to note:

Although my original use case concerns being able to use @ ConstructorBinding, none of the beans in my test case use ConstructorBinding. There is a bug/undocumented limitation here that relates purely to the fact that you can't combine RefreshScope and ConfigurationProperties on a bean discovered by spring's EnabledConfigurationProperties/ConfigurationPropertiesScan mechanisms. Obviously if you don't need ConstructorBinding this is easier to work around because you can define an explicit bean factory method somewhere and annotate that with RefreshScope instead, but this isn't documented and obviously entails adding some not-very-Spring-Boot boilerplate

I know from the other ticket that you didn't want to support rebinding for immutable classes via EnvironmentChangeEvent - which I understand because it's clearly going to be tricky to achieve without some sort of proxy present. But it appears that you're also saying you won't support refreshing them via RefreshScope; this is more disappointing since it closes off the last credible avenue to achieving a requirement that I believe quite a few people have, and there's already a proxying mechanism in place here to enable a bean to be swapped out.

There was a long-running spring boot ticket about allowing @ ConfigurationProperties to be used on Interfaces so that people didn't have to expose mutable properties beans to the rest of their context because of the internal needs of Spring's binding system. This ticket was eventually closed on the grounds that @ ConstructorBinding provides a credible alternative to binding fields behind an interface. If Spring Cloud won't support refreshing ConstructorBound obejcts, this undermines this decision somewhat. In a distributed microservices world, I don't think it's unreasonable to want to be able to provide an immutable interface to clients of a configuration class, but still support the idea of refreshing the values they represent when e.g. they are changed in a central config store. Not supporting this entails users either having to duplicate a  lot of property methods to a redundant interface - especially frustrating in a world of kotlin data classes and value objects - or accept that clients of configuration properties classes must be allowed (unsafely) to modify configuration that is supposed to be centrally managed

FWIW, it seems to be possible to make this work - no doubt you will tell me that what I've done is a terrible idea and will break all manner of things, but hey, what the hell:
class ConfigurationPropertiesRefreshScopeFixer : BeanDefinitionRegistryPostProcessor {
    override fun postProcessBeanFactory(beanFactory: ConfigurableListableBeanFactory) {
        //NO-OP
    }
    override fun postProcessBeanDefinitionRegistry(registry: BeanDefinitionRegistry) {
        for (name in registry.beanDefinitionNames) {
            val beanDefinition = registry.getBeanDefinition(name!!)
            if (beanDefinition.javaClass.name == "org.springframework.boot.context.properties.ConfigurationPropertiesValueObjectBeanDefinition") {
                val gbd = beanDefinition as GenericBeanDefinition
                val annAttrs = AnnotationAttributes.fromMap(AnnotationMetadata.introspect(gbd.beanClass).getAnnotationAttributes(Scope::class.java.name, false))
                val scopedProxyMode = annAttrs?.getEnum<ScopedProxyMode>("proxyMode") ?: ScopedProxyMode.NO
                gbd.scope = annAttrs?.getString("value") ?: "singleton"
                if (scopedProxyMode == ScopedProxyMode.NO) {
                    continue
                }
                val proxyTargetClass = scopedProxyMode == ScopedProxyMode.TARGET_CLASS
                registry.removeBeanDefinition(name)
                val scopedProxy = ScopedProxyUtils.createScopedProxy(BeanDefinitionHolder(gbd, name), registry, proxyTargetClass)
                registry.registerBeanDefinition(scopedProxy.beanName, scopedProxy.beanDefinition)
            }
        }
    }
}

Obviously it's a lot uglier than it needs to be because there's a bunch of package-visibility stuff in Spring that I couldn't take advantage of. But it seems to work and lets ConfigurationProperties beans be in RefreshScope - which in turn means that they get rebound even if they are using ConstructorBinding

There is a bug/undocumented limitation here that relates purely to the fact that you can't combine RefreshScope and ConfigurationProperties on a bean discovered by spring's EnabledConfigurationProperties/ConfigurationPropertiesScan mechanisms.

I think this is working as designed. If you want a refresh scope configuration properties, use an @Bean method in configuration.

@spencergibb, I'm also of the opinion that this should be looked at.
Quoting from the issue #1547 of the spring-cloud-config project. The issue was closed so replying here.

🤷♂ I'm going to keep this closed and use immutable configuration as a marker that it shouldn't be refreshed. If you want it to be, use mutable configuration objects.

@spencergibb, may I ask you to share what makes you think that immutable configuration shouldn't be REFRESHED? Because as a result, what your comment is essentially leading to, as an analogy, is that if a mutable collection contains immutable objects (e.g. configs), then it is a marker that the elements can't be replaced in the collection, because that is what I believe is asked here.
While you are right in the sense that an immutable object should not be modified, it is not the goal we are trying to achieve. We would like to have a NEW instance with NEW values injected dynamically behind the proxy object once the external configs change, without exposing setter methods to guarantee immutability of the current object. Just because we would like to use a new instance with new fields doesn't mean we have to compromise immutability of existing objects. We just want to replace it, not modify it. What do you think about it?

You should add @Component at the class that is annotated by ConfigurationProperties, after that by calling /actuator/refresh url, surprisingly you will see your configuration will ne refreshed

You should add @component at the class that is annotated by ConfigurationProperties, after that by calling /actuator/refresh url, surprisingly you will see your configuration will ne refreshed

Sadly, this doesn't work with @ConstructorBinding which is a big part of my original motivation for raising this ticket

authors: sepidehabbasitehrani spencergibb symposion tbadalov

repo: spring-cloud/spring-cloud-commons


text:
Config Client not fetching config when Spring Security is active on Spring Cloud Config Server

When I run spring cloud config server without spring security the service fetches the config without issue but when I activate Spring security it won't fetch the config files. It seems to throw a 401 http error. I have checked that the username and password is correct, I have also tried the user:password@url way of authenticating with the same issue.
If i access the url http://localhost:8888/service/default directly in browser and enter the username and password the configs are displayed.
I tried adding it to existing services I had and it did not work so I created a new config server and a new client via the spring initializer on https://start.spring.io/ with the below config and still does not work. it seems to always fail with the same issue.
Spring Boot version: '2.2.4.RELEASE'
spring-cloud-config-server version: '2.2.1.RELEASE'
Build system: Gradle
Java 8
Configs and logs detailed in this stack overflow post:
https://stackoverflow.com/questions/60298657/spring-cloud-config-client-not-fetching-config-when-spring-security-is-active-on

Please don't cross post, closing in favor of stack overflow

source: gharchive/issue

authors: NecoHorne spencergibb

repo: spring-cloud/spring-cloud-config

license_type: permissive

license_source: bigquery


text:
SVN Implementation: Locking Problem

If you have multiple concurrent client requests you run into a locking problem. Most of the clients receive a HTTP 500 Status code.
This is not solved by issue #128
On the server you have the following stack trace:
2016-02-15 12:35:25,619 ERROR http-nio-8888-exec-9 [org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[dispatcherServlet]] Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.IllegalStateException: Cannot checkout repository] with root cause
org.tmatesoft.svn.core.SVNException: svn: E155004: Working copy '/var/folders/xd/xn9612n9075136nfvpw47z780000gn/T/config-repo-3539913185186500338' locked
svn: E155004: '/var/folders/xd/xn9612n9075136nfvpw47z780000gn/T/config-repo-3539913185186500338' is already locked.
	at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:64) ~[svnkit-1.8.7.jar:na]
	at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:51) ~[svnkit-1.8.7.jar:na]
	at org.tmatesoft.svn.core.internal.wc17.db.SVNWCDb$WCLockObtain.transaction(SVNWCDb.java:5722) ~[svnkit-1.8.7.jar:na]
	at org.tmatesoft.svn.core.internal.db.SVNSqlJetDb.runTransaction(SVNSqlJetDb.java:256) ~[svnkit-1.8.7.jar:na]
	at org.tmatesoft.svn.core.internal.db.SVNSqlJetDb.runTransaction(SVNSqlJetDb.java:250) ~[svnkit-1.8.7.jar:na]
	at org.tmatesoft.svn.core.internal.wc17.db.SVNWCDb.obtainWCLock(SVNWCDb.java:5655) ~[svnkit-1.8.7.jar:na]
	at org.tmatesoft.svn.core.internal.wc17.SVNWCContext.acquireWriteLock(SVNWCContext.java:1632) ~[svnkit-1.8.7.jar:na]
	at org.tmatesoft.svn.core.internal.wc2.ng.SvnNgAbstractUpdate.update(SvnNgAbstractUpdate.java:106) ~[svnkit-1.8.7.jar:na]
	at org.tmatesoft.svn.core.internal.wc2.ng.SvnNgUpdate.run(SvnNgUpdate.java:38) ~[svnkit-1.8.7.jar:na]
	at org.tmatesoft.svn.core.internal.wc2.ng.SvnNgUpdate.run(SvnNgUpdate.java:18) ~[svnkit-1.8.7.jar:na]
	at org.tmatesoft.svn.core.internal.wc2.ng.SvnNgOperationRunner.run(SvnNgOperationRunner.java:20) ~[svnkit-1.8.7.jar:na]
	at org.tmatesoft.svn.core.internal.wc2.SvnOperationRunner.run(SvnOperationRunner.java:21) ~[svnkit-1.8.7.jar:na]
	at org.tmatesoft.svn.core.wc2.SvnOperationFactory.run(SvnOperationFactory.java:1235) ~[svnkit-1.8.7.jar:na]
	at org.tmatesoft.svn.core.wc2.SvnOperation.run(SvnOperation.java:294) ~[svnkit-1.8.7.jar:na]
	at org.springframework.cloud.config.server.SvnKitEnvironmentRepository.update(SvnKitEnvironmentRepository.java:114) ~[spring-cloud-config-server-1.0.3.RELEASE.jar:1.0.3.RELEASE]
	at org.springframework.cloud.config.server.SvnKitEnvironmentRepository.findOne(SvnKitEnvironmentRepository.java:65) ~[spring-cloud-config-server-1.0.3.RELEASE.jar:1.0.3.RELEASE]
	at be.milieuinfo.cumulus.configserver.svn.SecuredSvnKitEnvironmentRepository.findOne(SecuredSvnKitEnvironmentRepository.java:31) ~[classes/:na]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_51]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_51]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_51]
	at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_51]
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302) ~[spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) ~[spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:68) ~[spring-security-core-4.0.3.RELEASE.jar:4.0.3.RELEASE]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208) ~[spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at com.sun.proxy.$Proxy82.findOne(Unknown Source) ~[na:na]
	at org.springframework.cloud.config.server.EnvironmentController.labelled(EnvironmentController.java:109) ~[spring-cloud-config-server-1.0.3.RELEASE.jar:1.0.3.RELEASE]
	at org.springframework.cloud.config.server.EnvironmentController.labelledProperties(EnvironmentController.java:129) ~[spring-cloud-config-server-1.0.3.RELEASE.jar:1.0.3.RELEASE]
	at org.springframework.cloud.config.server.EnvironmentController.properties(EnvironmentController.java:122) ~[spring-cloud-config-server-1.0.3.RELEASE.jar:1.0.3.RELEASE]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_51]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_51]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_51]
	at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_51]
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:222) ~[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137) ~[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110) ~[spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:814) ~[spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:737) ~[spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) ~[spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959) ~[spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893) ~[spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:969) ~[spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:860) ~[spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:622) ~[tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:845) ~[spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) ~[tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291) ~[tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) ~[tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) ~[tomcat-embed-websocket-8.0.30.jar:8.0.30]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) ~[tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) ~[tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration$ApplicationContextHeaderFilter.doFilterInternal(EndpointWebMvcAutoConfiguration.java:243) ~[spring-boot-actuator-1.3.1.RELEASE.jar:1.3.1.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) ~[tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) ~[tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:111) ~[spring-boot-actuator-1.3.1.RELEASE.jar:1.3.1.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) ~[tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) ~[tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:316) ~[spring-security-web-4.0.3.RELEASE.jar:4.0.3.RELEASE]
	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126) ~[spring-security-web-4.0.3.RELEASE.jar:4.0.3.RELEASE]
	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90) ~[spring-security-web-4.0.3.RELEASE.jar:4.0.3.RELEASE]
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) ~[spring-security-web-4.0.3.RELEASE.jar:4.0.3.RELEASE]
	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114) ~[spring-security-web-4.0.3.RELEASE.jar:4.0.3.RELEASE]
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) ~[spring-security-web-4.0.3.RELEASE.jar:4.0.3.RELEASE]
	at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:213) ~[spring-security-web-4.0.3.RELEASE.jar:4.0.3.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) ~[spring-security-web-4.0.3.RELEASE.jar:4.0.3.RELEASE]
	at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:213) ~[spring-security-web-4.0.3.RELEASE.jar:4.0.3.RELEASE]
	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:176) ~[spring-security-web-4.0.3.RELEASE.jar:4.0.3.RELEASE]
	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) ~[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262) ~[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) ~[tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) ~[tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) ~[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) ~[tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) ~[tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:87) ~[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) ~[tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) ~[tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77) ~[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) ~[tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) ~[tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121) ~[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) ~[tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) ~[tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:103) ~[spring-boot-actuator-1.3.1.RELEASE.jar:1.3.1.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) ~[tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) ~[tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212) ~[tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:521) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1096) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:674) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_51]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_51]
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.0.30.jar:8.0.30]
	at java.lang.Thread.run(Thread.java:745) [na:1.8.0_51]

The following example code shows how to reproduce this:
ExecutorService executor = Executors.newCachedThreadPool();
for (int i = 0; i < maxRequests; i++) executor.execute(new Runnable() {
	@Override
	public void run() {
		HttpClient client = new HttpClient();
		GetMethod get = new GetMethod("http://localhost:8888/myapp-myprofile.properties");
		try {
			int status = client.executeMethod(get);
			System.out.println(Thread.currentThread().getName() + " "+ status);
		} catch (Exception ex) {
			ex.printStackTrace();
		} finally {
			get.releaseConnection();
		}
	}
});

It works for me using this app:
	@EnableAutoConfiguration
	@Configuration
	@EnableConfigServer
	protected static class TestApplication {

		public static void main(String[] args) throws Exception {
			File basedir = new File("target/config");
			String uri = ConfigServerTestUtils.prepareLocalSvnRepo(
					"src/test/resources/svn-config-repo", "target/repos/svn-config-repo");
			if (basedir.exists()) {
				FileUtils.delete(basedir, FileUtils.RECURSIVE | FileUtils.RETRY);
			}
			new SpringApplicationBuilder(TestApplication.class).profiles("subversion")
					.properties("server.port=8888",
							"spring.cloud.config.server.svn.uri:" + uri)
					.run(args);
		}

	}

and a command line to drive it:
$ ab -c 10 -n 100 http://localhost:8888/app/default

It's really slow, but there are no errors.
What version are you testing? How did you launch it?

I'm using version 1.0.3.RELEASE, I've upgraded to current version 1.0.4.RELEASE and the problem is still there.
Browsing trough the code I saw that it was solved in version 1.1.0.M4 (synchronized added on getLocations on SvnKitEnvironmentRepository class).
I've started the application more or less like in your example. The only differences are externalized configuration + remote svn http server.
I've temporary solved it by subclassing the existing SvnKitEnvironmentRepository and putting synchronized on the getLocations method.

authors: dsyer ldeschuyter


text:
Service registry

I know this is a huge PR. It's my attempt to move auto registration out of discovery and into the service-registry package while keeping backwards compatibility.

Can't pretend I read it all. LGTM.

Closed via ba85624a98e1bc972ed41c5b799aae78c04bdaa6

source: gharchive/pull-request

authors: dsyer spencergibb

repo: spring-cloud/spring-cloud-consul


text:
Gateway crashed accidentally

Describe the bug
Spring Cloud: Greenwich.SR6
Gateway application crashed sometimes, it caused all request failed.
It seemed that RequestRateLimiter filter applied to all pathes, RequestRateLimiter filter only apply to some pathes actually.
[450ee940] 500 Server Error for HTTP GET "/other/xxx"

java.lang.RuntimeException: org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors

Field error in object 'redis-rate-limiter' on field 'replenishRate': rejected value [0]; codes [Min.redis-rate-limiter.replenishRate,Min.replenishRate,Min.int,Min]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [redis-rate-limiter.replenishRate,replenishRate]; arguments []; default message [replenishRate],1]; default message [must be greater than or equal to 1]

	at org.springframework.cloud.gateway.support.ConfigurationUtils.bind(ConfigurationUtils.java:54)

	at org.springframework.cloud.gateway.support.ConfigurationUtils.bind(ConfigurationUtils.java:37)

	at org.springframework.cloud.gateway.filter.ratelimit.AbstractRateLimiter.onApplicationEvent(AbstractRateLimiter.java:64)

	at org.springframework.cloud.gateway.filter.ratelimit.AbstractRateLimiter.onApplicationEvent(AbstractRateLimiter.java:28)

	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)

	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)

	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)

	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:403)

	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:360)

	at org.springframework.cloud.gateway.route.RouteDefinitionRouteLocator.loadGatewayFilters(RouteDefinitionRouteLocator.java:186)

	at org.springframework.cloud.gateway.route.RouteDefinitionRouteLocator.getFilters(RouteDefinitionRouteLocator.java:209)

	at org.springframework.cloud.gateway.route.RouteDefinitionRouteLocator.convertToRoute(RouteDefinitionRouteLocator.java:144)

	at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:100)

	at org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onNext(ScopePassingSpanSubscriber.java:96)

	at reactor.core.publisher.FluxFlatMap$FlatMapMain.drainLoop(FluxFlatMap.java:706)

	at reactor.core.publisher.FluxFlatMap$FlatMapMain.tryEmit(FluxFlatMap.java:563)

	at reactor.core.publisher.FluxFlatMap$FlatMapInner.onNext(FluxFlatMap.java:999)

	at org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onNext(ScopePassingSpanSubscriber.java:96)

	at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:114)

	at org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onNext(ScopePassingSpanSubscriber.java:96)

	at reactor.core.publisher.MonoPublishOn$PublishOnSubscriber.run(MonoPublishOn.java:178)

	at reactor.core.scheduler.ElasticScheduler$DirectScheduleTask.run(ElasticScheduler.java:292)

	at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:50)

	at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:27)

	at org.springframework.cloud.sleuth.instrument.async.TraceCallable.call(TraceCallable.java:70)

	at java.util.concurrent.FutureTask.run(Unknown Source)

	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)

	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)

	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

	at java.lang.Thread.run(Unknown Source)

Caused by: org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors

Field error in object 'redis-rate-limiter' on field 'replenishRate': rejected value [0]; codes [Min.redis-rate-limiter.replenishRate,Min.replenishRate,Min.int,Min]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [redis-rate-limiter.replenishRate,replenishRate]; arguments []; default message [replenishRate],1]; default message [must be greater than or equal to 1]

	... 31 common frames om

Sample
Here is the route config example:
spring:
  cloud:
    gateway:
      default-filters:
      routes:
        - id: rate-limiter
          uri: lb://test
          predicates:
            - Path=/test/path
          filters:
            - name: RequestRateLimiter
              args:
                redis-rate-limiter.replenishRate: 200
                redis-rate-limiter.burstCapacity: 500
            - name: Hystrix
              args:
                name: testCommand
                fallbackUri: 'forward:/fallback/testCommand'
        - id: other
          uri: lb://other
          predicates:
            - Path=/other/**

RequestRateLimiterConfig.java
@Configuration
public class RequestRateLimiterConfig {

    @Bean("uriKeyResolver")
    public KeyResolver uriKeyResolver() {
        return exchange -> {
            String path = exchange.getRequest().getURI().getPath();
            return Mono.just(path);
        };
    }
}

Please try again with Hoxton.SR7

Thanks for your reply.
We worked around by adding a healthcheck.
Will try to upgrade and feedback if the issue still occur.

authors: chuntungho spencergibb

repo: spring-cloud/spring-cloud-gateway

license_source: github-api


text:
Provide additional debug information when there is a memory leak (Reactor Netty client)

Hi,
Netty provides the following API
io.netty.buffer.ByteBuf.touch()

    /**
     * Records the current access location of this object for debugging purposes.
     * If this object is determined to be leaked, the information recorded by this operation will be provided to you
     * via {@link ResourceLeakDetector}.  This method is a shortcut to {@link #touch(Object) touch(null)}.
     */
    ReferenceCounted touch();

Currently Reactor Netty is the last component that records access to the byte buffers.
It will be very helpful if the Spring Gateway implementation uses this functionality when it does additional transformations of the content or buffers the object.
If there is a memory leak, when Netty dumps the stack traces of the components that accessed this object, it will be easier to find where the buffer was leaked.
Thanks,
Violeta

@violetagg is this available in 0.7.x and 0.8.x? Do you have an idea where I might put this?

@spencergibb This is Netty API
For example when Reactor Netty buffers the incoming content it does the following:
https://github.com/reactor/reactor-netty/blob/0.7.x/src/main/java/reactor/ipc/netty/channel/FluxReceive.java#L319-L327
If the buffered content is not released then the following stack trace will be provided by Netty:
2018-09-02 12:52:01.544 ERROR 7772 --- [reactor-http-nio-1] io.netty.util.ResourceLeakDetector       : LEAK: ByteBuf.release() was not called before it's garbage-collected. See http://netty.io/wiki/reference-counted-objects.html for more information.
Recent access records:
#1:
	Hint: Buffered ByteBufHolder in Inbound Flux Queue
	io.netty.handler.codec.http.DefaultHttpContent.touch(DefaultHttpContent.java:88)
	io.netty.handler.codec.http.DefaultLastHttpContent.touch(DefaultLastHttpContent.java:88)
	io.netty.handler.codec.http.DefaultLastHttpContent.touch(DefaultLastHttpContent.java:28)
	reactor.ipc.netty.channel.FluxReceive.onInboundNext(FluxReceive.java:324)

@spencergibb @violetagg
Is this what you are looking for?
https://github.com/dave-fl/spring-cloud-gateway/tree/netty_touch_on_debug

@spencergibb @violetagg
What are the suggested versions to test with currently?

authors: dave-fl spencergibb violetagg


text:
upgrade feign to v8.17.0

https://github.com/Netflix/feign/releases/tag/v8.17.0

wait for Camden as this changes okhttp dep to 3.0

What version for spring-cloud is this targeted to?

Sometime after spring boot 1.4 is released. August possibly.

authors: SaikiranDaripelli spencergibb

repo: spring-cloud/spring-cloud-netflix


text:
@EnableZuulProxy fails on context load tests

With simple edge service based on Spring-cloud and Zuul basic test generated by https://start.spring.io/ fails!
java.lang.IllegalStateException: Failed to load ApplicationContext

    at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:124)
    at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:83)
    at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:117)
    at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83)
    at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:228)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:230)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:249)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:89)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:193)
    at org.junit.runners.Suite.runChild(Suite.java:128)
    at org.junit.runners.Suite.runChild(Suite.java:27)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:119)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'zuulEndpoint' defined in class org.springframework.cloud.netflix.zuul.ZuulProxyConfiguration$RoutesEndpointConfiguration: Unsatisfied dependency expressed through constructor argument with index 0 of type [org.springframework.cloud.netflix.zuul.filters.discovery.DiscoveryClientRouteLocator]: Error creating bean with name 'org.springframework.cloud.netflix.zuul.ZuulProxyConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: protected org.springframework.boot.autoconfigure.web.ServerProperties org.springframework.cloud.netflix.zuul.ZuulConfiguration.server; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.boot.autoconfigure.web.ServerProperties] 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)}; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.cloud.netflix.zuul.ZuulProxyConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: protected org.springframework.boot.autoconfigure.web.ServerProperties org.springframework.cloud.netflix.zuul.ZuulConfiguration.server; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.boot.autoconfigure.web.ServerProperties] 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)}
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:464)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766)
    at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
    at org.springframework.boot.test.SpringApplicationContextLoader.loadContext(SpringApplicationContextLoader.java:98)
    at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:98)
    at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:116)
    ... 37 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.cloud.netflix.zuul.ZuulProxyConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: protected org.springframework.boot.autoconfigure.web.ServerProperties org.springframework.cloud.netflix.zuul.ZuulConfiguration.server; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.boot.autoconfigure.web.ServerProperties] 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)}
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:368)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1192)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1116)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1014)
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:813)
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741)
    ... 55 more
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: protected org.springframework.boot.autoconfigure.web.ServerProperties org.springframework.cloud.netflix.zuul.ZuulConfiguration.server; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.boot.autoconfigure.web.ServerProperties] 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)}
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:573)
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
    ... 76 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.boot.autoconfigure.web.ServerProperties] 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)}
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:1373)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1119)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1014)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:545)
    ... 78 more

You can reproduce by downloading sample on https://start.spring.io/ with Zuul dependency, simply add @EnableZuulProxy on ExampleApplication then mvn clean test.
Or simply fetch https://github.com/kakawait/scn-gh-1094

Not sure this is a bug. Putting @WebIntegrationTest on the test is what is needed.

@spencergibb Yes but I found that strange to force @WebIntegrationTest for just testing context loading.

zuul expects a ServerProperties bean, @WebIntegrationTest is the signal to provide it. Not sure what to do about it.

Closing this due to inactivity. Please re-open if there's more to discuss.

I am facing the same exception after upgrading spring versions. Spring boot also replaced the annotation with @SpringBootTest. It seems there is no such thing as @WebIntegrationTest anymore.
Any other workarounds how to fix this problem since spring-boot 1.4+?

@hohwille please open a new issue if you can provide a sample that reproduces the problem.

Get the same issue, 6 years later!
19:10:32.414 [main] WARN org.springframework.context.annotation.AnnotationConfigApplicationContext -- Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'httpClientSslConfigurer' defined in class path resource [org/springframework/cloud/gateway/config/GatewayAutoConfiguration$NettyConfiguration.class]: Unsatisfied dependency expressed through method 'httpClientSslConfigurer' parameter 0: No qualifying bean of type 'org.springframework.boot.autoconfigure.web.ServerProperties' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}

authors: dreamstar-enterprises hohwille kakawait spencergibb


text:
Eureka Instance appname "UNKNOWN"

2016-03-17 16:26:55.846  INFO 15020 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_UNKNOWN/WCABJ185046-368.corp.ncr.com:myapp:8085: registering service...
2016-03-17 16:26:55.942  INFO 15020 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_UNKNOWN/WCABJ185046-368.corp.ncr.com:myapp:8085 - registration status: 204

TestAppSpringBoot.java
@EnableDiscoveryClient
@SpringBootApplication
@ImportResource("classpath:main-config.xml")
public class TestAppSpringBoot extends SpringBootServletInitializer {

//	I have to write commented code below to force eureka instance to set appname
//	@Value("${spring.application.name:myapp}")
//	private String appname;

//	@Autowired
//	private EurekaInstanceConfigBean eureka;
//
//	@PostConstruct
//	public void myPostConstruct(){
//		eureka.setAppname(appname);
//		System.setProperty("spring.application.name", appname);
//	}

	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
		return application.sources(TestAppSpringBoot.class);
	}

	public static void main(String[] args) throws Exception {
		SpringApplication app = new SpringApplication(TestAppSpringBoot.class);
		app.run(args);
	}

	@Bean
	public MessageDispatcherServlet messageDispatcherServlet() {
		MessageDispatcherServlet mds = new MessageDispatcherServlet();
		return mds;
	}

	@Bean
	public ServletRegistrationBean messageDispatcherServletRegistration() {
		ServletRegistrationBean registration = new ServletRegistrationBean(messageDispatcherServlet());
		registration.setLoadOnStartup(1);
		registration.addUrlMappings("/hello/*");
		return registration;
	}
}

This register in eureka service by name of UNKNOWN
bootstrap.yml
spring:
  application:
    name: myapp
server:
  port: 8085
  context-path: /AppStart
eureka:
  client:
    serviceUrl:
      defaultZone: http://localhost:8761/eureka/

Now if I comment @ImportResource("classpath:main-config.xml"), then EurekaInstanceConfigBean.java picks up the appname from bootstrap.yml
@Value("${spring.application.name:unknown}")
private String appname = "unknown";

UPDATE
I updated the pom file to have latest version (1.1.0.M5) for spring-cloud-netflix. Now I am getting following message also :
com.netflix.discovery.DiscoveryClient    : Application name is not defined (defaults to UNKNOWN); registration not allowed