These are chat archives for spring-cloud/spring-cloud

28th
Feb 2016
David Welch
@dwelch2344
Feb 28 2016 03:03
Does anyone know what the policy should look like for spring-cloud-aws to get the environment detection stuff working? We keep getting the following:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'embeddedServletContainerCustomizerBeanPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.cache.annotation.ProxyCachingConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: void org.springframework.cache.annotation.AbstractCachingConfiguration.setConfigurers(java.util.Collection); nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.cloud.aws.cache.config.annotation.ElastiCacheCachingConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.cloud.aws.core.env.stack.ListableStackResourceFactory org.springframework.cloud.aws.cache.config.annotation.ElastiCacheCachingConfiguration.stackResourceFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'stackResourceRegistryFactoryBean' defined in class path resource [org/springframework/cloud/aws/autoconfigure/context/ContextStackAutoConfiguration$StackAutoDetectConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.aws.core.env.stack.config.StackResourceRegistryFactoryBean]: Factory method 'stackResourceRegistryFactoryBean' threw exception; nested exception is com.amazonaws.AmazonServiceException: User: arn:aws:sts::836747871371:assumed-role/aws-elasticbeanstalk-ec2-role/i-f581e032 is not authorized to perform: cloudformation:DescribeStackResources
Juicy bits:
Factory method 'stackResourceRegistryFactoryBean' threw exception; nested exception is com.amazonaws.AmazonServiceException: User: arn:aws:sts::836747871371:assumed-role/aws-elasticbeanstalk-ec2-role/i-f581e032 is not authorized to perform: cloudformation:DescribeStackResources
We're spinning up a demo app in Elastic Bean Stalk, so I figured we could assign a profile to the IAM-Role that EBS assigns our machines, but I can't find any good docs on what that would look like. Any help would be greatly appreciated ;)
Dave Syer
@dsyer
Feb 28 2016 07:34
Ping @alainsahli
Jose Armesto
@fiunchinho
Feb 28 2016 13:44

hello everyone! I'm trying to get the Feign example running using Spring Cloud. My feign client looks like

@RequestMapping(value = "/users", method = RequestMethod.POST, consumes = "application/json")
    @Headers("Content-Type: application/json")
    @Body("%7B\"id\":\"{id}\",\"name\":\"{name}\",\"lastname\":\"{lastname}\"%7D")
    Observable<User> saveUserWithBodyTemplate(
            @Param("id") String userId,
            @Param("name") String userName,
            @Param("lastname") String lastname
    );

But I get Method has too many Body parameters: public abstract rx.Observable com.scmspain.howtospring.hystrixfeign.UserServiceRestClient.saveUserWithBodyTemplate(java.lang.String,java.lang.String,java.lang.String)

anyone knows what am I doing wrong?
Dave Syer
@dsyer
Feb 28 2016 15:00
I think you're trying to mix spring annotations with feign ones
Stick to the spring ones if you are using spent cloud
Jose Armesto
@fiunchinho
Feb 28 2016 15:44
I dont find any documentation about which annotation to use to assign variables to the @Body template
I’ve tried @RequestParam instead of @Param but then no body is sent in the request
Dave Syer
@dsyer
Feb 28 2016 15:49
The @Headers and @Body you are using are not Spring annotations
Spring uses @RequestBody for POST body, but it's optional, I think, because it's the default.
Jose Armesto
@fiunchinho
Feb 28 2016 15:50
but @RequestBody doesn’t seem to work the same as @Body
@RequestBody doesn’t allow variable interpolation in a template
Dave Syer
@dsyer
Feb 28 2016 15:52
True
It is what it is.
Jose Armesto
@fiunchinho
Feb 28 2016 15:53
so it’s not possible to use all feign features within spring?
Dave Syer
@dsyer
Feb 28 2016 15:54
It might be possible if you want to write some code
I don't see much value in the interpolation really
Jose Armesto
@fiunchinho
Feb 28 2016 15:54
you normally pass the json string directly to your method then?
Dave Syer
@dsyer
Feb 28 2016 15:55
No POJOs
You can just create a POJO with those properties and it will be much easier to understand IMO
Jose Armesto
@fiunchinho
Feb 28 2016 15:55
    @RequestMapping(value = "/users", method = RequestMethod.POST, consumes = "application/json")
    Observable<User> saveUser(User user);
something like that?
Dave Syer
@dsyer
Feb 28 2016 15:55
Yes
Jose Armesto
@fiunchinho
Feb 28 2016 15:56
ok, thank you
Fabian Wallwitz
@cforce
Feb 28 2016 16:30
How can i add/change metadatamap on client side (shall be synced via eureka towards other clients) dynamically on server start. The data i want to add to the map is based on source code introspection that os done on application start.
The map data can't ge static configured as it comes from anotations in code base.
Dave Syer
@dsyer
Feb 28 2016 16:33
EurekaInstanceConfig
Fabian Wallwitz
@cforce
Feb 28 2016 16:44
not sure how that is going to be used .. do i have to extend an own interface with my own params ....and inject a @Bean of this type? But how is the implementation for retrieveing the values implemented? I don't want to chnage the impl. for the existing values..
looking at spring-cloud/spring-cloud-netflix#302 ..but did not yet get the point how it shalle ne done..
Dave Syer
@dsyer
Feb 28 2016 16:56
I was thinking you wanted to just provide your own @Bean
Alternatively, I guess you can just provide environment properties that will be used to initilialize the one that spring provides already
Fabian Wallwitz
@cforce
Feb 28 2016 16:57
not .. i want to extend the existing metadata map with additional params..
shall i extends EurekaInstanceConfigBean as impl for my MyEurekaInstanceConfig interface ?
will spring cloud netflix take @Baan MyEurekaInstanceConfig instead of bean of EurekaInstanceConfig then?
do i assume corretcly thar EurekaInstanceConfig is called periodically?
Fabian Wallwitz
@cforce
Feb 28 2016 17:05
EurekaInstanceConfigBean has a @ConfigurationProperties("eureka.instance") anotation.. so i assume the "static" config comes in here ...
Dave Syer
@dsyer
Feb 28 2016 17:09
Yes. But it isn't necessarily refreshed after start up.
I don't know why you'd need your own implementation, but I suppose that's a valid choice
Petar Tahchiev
@ptahchiev
Feb 28 2016 17:50
This annotation seems to do the trick @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) however I don't want to use DateTimeFormat.ISO.DATE - I want to use my date pattern which is defined in application.properties
Fabian Wallwitz
@cforce
Feb 28 2016 17:57
@dsyer i only need to add some entries to the metadata map .. but at runtime and not via the weel known approach application.yml
that i need to extends the interface and the impl.. your are right that is more wiring i hoped to do ;)
Dave Syer
@dsyer
Feb 28 2016 18:15
But application.yml is only one source of config properties
You can define your own in any way you choose
Whether it's better to do that or use a custom bean is really up to you (and you haven't really explained the use case)
Fabian Wallwitz
@cforce
Feb 28 2016 18:57
the use case is: special microservices shall register with routing criteria that comes from anotations at service level at an edge (mirco)service which then can route based on this criteria the requets
Dave Syer
@dsyer
Feb 28 2016 19:12
Annotations sounds like you know what to do when the app starts
Fabian Wallwitz
@cforce
Feb 28 2016 19:13
i see an advantage in the library strategy and "near" binding with source code
that also allows compsition of scuh services in one deployable microservice
using a application.yml has disadvantages therfore.
Dave Syer
@dsyer
Feb 28 2016 19:14
I'm not sure that explains why
But application.yml (as bundled in a jar file) is only one of many sources of config data
and I don't know what you mean by "near" binding
So it would probably help if you just implemented something and then linked to a sample with some comments saying what you didn't like about it