Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 19:36
    rwinch edited #33766
  • 17:46
    philwebb commented #34052
  • 17:34
    bclozel milestoned #34053
  • 17:34
    bclozel labeled #34053
  • 17:34
    bclozel labeled #34053
  • 17:34
    bclozel opened #34053
  • 15:47
    wilkinsona labeled #34052
  • 15:47
    wilkinsona unlabeled #34052
  • 15:47
    wilkinsona closed #34052
  • 15:47
    wilkinsona commented #34052
  • 15:34
    MevlutOzdemir commented #33526
  • 15:32
    spring-projects-issues labeled #34052
  • 15:31
    yanaair opened #34052
  • 15:30
    wilkinsona commented #33526
  • 15:30
    wilkinsona commented #33526
  • 15:17
    spring-projects-issues labeled #34051
  • 15:12
    MevlutOzdemir commented #33526
  • 15:12
    MevlutOzdemir commented #33526
  • 15:12
    MevlutOzdemir commented #33526
  • 15:11
    MevlutOzdemir commented #33526
Stefano De Angelis
@deanstef
@konstantinblaesi thank you! I already know quite well, at least theoretical, how OAUTH2 works. My problem is the integration with spring. Particularly how to manage external OAuth2 providers as Google or Facebook. I am looking for standard solutions/best practices
boda2004
@boda2004
Stefano De Angelis
@deanstef
@boda2004 as far as I can see this is just for Stateful services, am I right?
boda2004
@boda2004
@deanstef i tend to think that session or state is not required, but would have to take a look at sources. OTOH https://docs.spring.io/spring-security-oauth2-boot/docs/current/reference/html/boot-features-security-oauth2-resource-server.html does not imply any state, bearer token would be fine, so unless you want to use refresh tokens you should be fine
Alphalatot
@Alphalatot
hello guys, i am learning spring webflux and i have problem on custom Constraint Validator
image.png
i am wondering if that is a good practice ?
image.png
my goal is to throw group of errors
image.png
Stefano De Angelis
@deanstef
@boda2004 I hope the configuration of a ResourceServer is enough but I am afraid for single Authorisation Providers like Google or Facebook it requires more configuration. However I will try to follow the spring documentation
hyginous29
@hyginous29

Hi Team

I am getting error for , this example is from the Spring boot docs. any help appreciated

Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'local.server.port' in value "${local.server.port}"
    at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:178) ~[spring-core-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:124) ~[spring-core-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:236) ~[spring-core-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:210) ~[spring-core-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.lambda$processProperties$0(PropertySourcesPlaceholderConfigurer.java:175) ~[spring-context-5.2.3.RELEASE.jar:5.2.3.RELEASE]"

Test

@SpringBootTest(classes = { TestApplication.class}, webEnvironment = RANDOM_PORT)
public class ELFSpringWebAutoConfigurationTest {

    @LocalServerPort
    int port;

    @Autowired
    TestRestTemplate restTemplate;

    @Test
    void testRestCall() {
        assertThat(this.restTemplate.getForObject("http://localhost:" + port + "/",
                String.class)).contains("Hello, World");
    }

}
boda2004
@boda2004
@hyginous29 see https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/web/server/LocalServerPort.html
effectively you have @Value(value="${local.server.port}") int port;
so you have to define it somehow
ah, my bad, missed webEnvironment = RANDOM_PORT. disregard my comment
hyginous29
@hyginous29
yeah, its RANDOM_PORT
hyginous29
@hyginous29
Ignore, it works .. i had TestApplication class which SpringBootApplication, which was in src/test. once i moved to src/main , it works.
marios sofocleous
@sofocleous2_twitter
Hi team ! any idea how to implementa "store and forward" pattern in spring boot to store request and retry?
@bclozel Hi Brian, do u have any idea how to implement "store and forward" pattern in Spring boot to store request and retry?
Brian Clozel
@bclozel
@sofocleous2_twitter like a proxy?
marios sofocleous
@sofocleous2_twitter
This is a reusable component(lib) which will be included in various microservices to take care of rest requests (webclient) that fail either in upstream or downstream service by storing the request and forwarding once services are available.Initially I was thinking about using resilient operator in webclient(retry) but we are missing the case that upstream fails , so we need to store the request and use callbacks but not sure how to implement this efficiently
@bclozel This is a reusable component(lib) which will be included in various microservices to take care of rest requests (webclient) that fail either in upstream or downstream service by storing the request and forwarding once services are available.Initially I was thinking about using resilient operator in webclient(retry) but we are missing the case that upstream fails , so we need to store the request and use callbacks but not sure how to implement this efficiently
Brian Clozel
@bclozel
if upstream fails, retry should still work; it's up to the client to define what failure means
if it's a shared concern amongst services, maybe spring cloud gateway is a better fit here
marios sofocleous
@sofocleous2_twitter
But how come the retry works if the upstream fails ? could u please elaborate on that?
we already an API gateway so I dont think spring cloud gateway would be an option.
*got
If retry still works on failure (upstream) that would be nice but I dont understand how it works..
Brian Clozel
@bclozel
what's a failure in your case? the server is missing? or responds with a HTTP 500 status?
if this is a common use case, maybe your API gateway can handle retries?
marios sofocleous
@sofocleous2_twitter
a failure would be either a response with HTTP 500 status of a failure of upstream(caller) server itself. The requirement to create a shared lib that will be included in different microservices to take care the above. So I dont understand how retry would be possible if caller fails without persisting the request somehow..
*or
a response with HTTP 500 status OR a failure of upstream(caller) server itself.
Brian Clozel
@bclozel
retry resubscribes to the publisher, which means the request is re-created and sent again, it's not stored
marios sofocleous
@sofocleous2_twitter
But what happens if the caller (upstream) is down due to failure ? the is lost right?
Brian Clozel
@bclozel
what do you mean by caller? the client sending a request to your app (and your app is itself sending a request to another service?)
marios sofocleous
@sofocleous2_twitter
By caller i mean another microservice. This is a communication between microservices
Brian Clozel
@bclozel
so a service calling your app?
Let's say a client "A" sends a request to your application "B", and your app sends a request to "C". If "A" is gone, you might get an exception in your app but for sure you won't be able to write to the response. This should not prevent you from sending that request to "C".
marios sofocleous
@sofocleous2_twitter
Basically the core banking syste
Is implementing the store and forward integration pattern and they need to replicate this in microservices
Brian Clozel
@bclozel
If the goal is to implement that pattern, then I'm not aware of a way to implement it with webclient. I'm not familiar with that pattern, so I might be wrong.
marios sofocleous
@sofocleous2_twitter
So based in your example above we could have a comm between A and B and when either one fails we should be able to send the request again
So based on the mentioned pattern the request is saved along with its callback but its quite complicate to replicate this in micro
Basically they are not aware of any othe solution thats why they believe is the only solution thats why am asking if that behavior is feasible using webclient
marios sofocleous
@sofocleous2_twitter
If we achieve this with webclient then should be fine
marios sofocleous
@sofocleous2_twitter
So by using webclient if service A fails and is down then request is lost right?
Timo GrĂ¼n
@Lacritz
Hi everyone,
I currently search for the possibility to feature toggle RestController. Is there already a standard way to disable/enable RestController accordingly to "@ConditionalOnBean(MyBean.class)" which can be used when auto configuring?
Thanks a lot !
salaboy
@salaboy
hi everyone.. quick question.. can someone point me to how to extend a controller annotation such as @PostMapping ? is that possible in webflux as well?
@Lacritz you probably need to define a Configuration for that