Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jan 07 17:44
    @jameskleeh banned @GrantEllison15_twitter
  • Jan 06 01:27
    @jameskleeh banned @brittapop_twitter
  • Jan 06 01:19
    @jameskleeh banned @BeApi_io_twitter
  • Jan 04 18:47
    @jameskleeh banned @orubel
  • Jan 04 18:46
    @jameskleeh banned @orubel
  • Jan 04 18:41
    @jameskleeh banned @orubel
  • Jan 04 18:39
    @jameskleeh banned @orubel
  • Jan 04 18:32
    @jameskleeh banned @orubel
  • Jan 04 18:31
    @jameskleeh banned @BeApi_io_twitter
  • Jan 04 18:30
    @jameskleeh banned @BeApi_io_twitter
  • Jan 04 18:28
    @jameskleeh banned @orubel
  • Jan 04 18:23
    @jameskleeh banned @BeApi_io_twitter
  • Jan 04 18:20
    @jameskleeh banned @orubel
  • Jan 04 18:10
    @jameskleeh banned @BeApi_io_twitter
  • Apr 03 2020 13:09
    @jameskleeh banned @orubel
  • Mar 30 2020 18:40
    @graemerocher banned @BeApi_io_twitter
  • Mar 30 2020 08:44
    @graemerocher banned @orubel
James Kleeh
@jameskleeh
its not a problem that can be solved
they are on different threads
16 replies
Vishnu Govindan
@VishGov_twitter
Hi,
akshaydewan
@akshaydewan
Hey folks, I'm working on a project which uses Postgres and has a homemade framework for generating SQL boilerplate. It does not use micronaut-data, just uses a JDBC datasouce directly. I'm trying to implement transaction management, and wondering if I could use micronaut-data-tx only without adding the whole of micronaut-data. Any pointers?
Templeton Peck
@LtTempletonPeck
How do I disable endpoint security but enable HTTP client filter for client credentials ClientCredentialsHttpClientFilter? I have this in the application.yml but the client call doesn't have the access token added and there is no ClientCredentialsHttpClientFiltercall
micronaut:
  security:
    enabled: false
    oauth2:
      enabled: true
      clients:
        abc:
          enabled: true
          client-id: myClientId
          client-secret: myClientSecret
          scopes:
            - myScope
          client-credentials:
            enabled: true
            service-id-regex: 'myClient'
          token:
            url: 'https://login.microsoftonline.com/myAccountID/oauth2/v2.0/token'
            auth-method: client_secret_basic
          grant-type: client_credentials
Templeton Peck
@LtTempletonPeck

Ahh for starters there's a typo in the docs

      client-credentials:
        serviceid-regex: 'inventory'

But that has not fixed it, I'll improve the docs micronaut-projects/micronaut-security#539

Vishnu Govindan
@VishGov_twitter

I am using micronaut with postgresql and using @JdbcRepository(dialect = Dialect.POSTGRES)

I have a MappedEntity which has the below field (in postgresql this field is a JSONB)

@TypeDef(type = DataType.JSON)
private List<ObjectA> objectA;

public class ObjectA {
private String field1;
private String field2;
private String field3;
private String field4;
}

When I am using findBy** method of my repository, I am getting the field "objectA" as (string representation)

[[{"field1": "1", "field2": "2", "field3": "3", "field4": "4"}, {"field1": "1.1", "field2": "1.2", "field3": "1.3", "field4": "1.4"}]]

How can I convert into a list of 2 ObjectA objects without a TypeConverter if that is possible?

meredrica
@meredrica
@jameskleeh you asked me to check for the memory leak with the current version. it's still there
Index
@Ksnz

Hi.
I've found that @Requres annotation works well with @EventListener
Like

@EventListener
@Requires(env = Environment.DEVELOPMENT)
public void onStartUp(StartupEvent event) {
//some code
}

While @Requres doc only said

Expresses a requirement for a bean or {@link Configuration}.

Is it an expected behavior or it may be broken in future?

Templeton Peck
@LtTempletonPeck
Hmmmn I've got it working by keeping security enabled, endpoints.login.enabled: false and adding @Secured(SecurityRule.IS_ANONYMOUS) to the controllers. Can't find a way to disable endpoint security but enable client credentials.
Ivan
@ivyazmitinov
Hello, everyone.
@jameskleeh, we are preparing to upgrade to micronaut 2.0, and I have a question regarding thread selection change: for my team AUTO mode is a perfect fit, since we resort to the reactive only when necessary (some multithreading involved), and disciplined enough to use subscribeOn() in controllers.
From the blog post I got the impression that AUTO mode will not be supported in future releases and present only for backwards compatibility option. Is my impression correct, and it is better for is to switch to theIOmode, or it is safe to continue to use AUTO?
James Kleeh
@jameskleeh
There aren’t any plans to remove Auto in Micronaut 3
1 reply
@Ksnz event listener creates a bean, so that makes sense. I would be surprised if we had test coverage for that though
jdb-gb
@jdb-gb
@jameskleeh As you suggested yesterday I moved getting user data from an external API to an custom authentication fetcher. Everything works great locally but when running in docker I am getting an read timeout due event loop being blocked. I have modified the code to offload the external call. I am now stuck as I don't know how to 'wait' for the response from external API before creating the Authentication. Here is my code snippet:
var flowable = Flowable.fromCallable {
identityClient.fetchIdentity(sessionId)
}.subscribeOn(Schedulers.io())
I am just learning reactive. Any pointers you can give is greatly appreciated.
James Kleeh
@jameskleeh
The identity client should be reactive
Can then use .map to convert the data to authentication
jdb-gb
@jdb-gb
Thanks for the tip. Will try it.
charkins
@charkins
Is it necessary for the annotation for a custom scope to use @ScopedProxy?
charkins
@charkins
Nevermind, looks like I can use @Scope and @Around directly (I don't want lazy @Around)
Hmm, actually that doesn't work, seems to treat it as @Prototype now.
Let me rephrase: Can I create a custom scope that doesn't lazily initialize? My scope is active during construction of an object graph. Because of the lazy init of some of the custom scoped objects, they don't get created until later and I can no longer differentiate instances of the custom scope.
Silvio D‘Alessandro
@sda2392_twitter
Hey! Beans created as part of @EachBean do not respect @PostConstruct or @PreDestroy hooks. Is this on purpose?
James Kleeh
@jameskleeh
@sda2392_twitter no. Can you file an issue with an example app?
Silvio D‘Alessandro
@sda2392_twitter
Will do, thanks.
Semyon Gaschenko
@gasches
Hi. My question is about Micronaut Data. For me it's often more convenient to keep an SQL script in a file instead of a @Query string. Would like to get an opinion on this feature
Anand
@anandjaisy

Can we merge securitySchemes with Micronaut open API

In the additional files, I have the below security schemes

securitySchemes:
  Open Id Connect:
    type: oauth2
    flows:
      authorizationCode:
        authorizationUrl: https://falconidentityserver.azurewebsites.net/connect/authorize
        tokenUrl: https://falconidentityserver.azurewebsites.net/connect/token
        refreshUrl: ""
        scopes:
          openid: Open Id scope
          profile: Name scope
          email: Email scope
        usePkceWithAuthorizationCodeGrant: true
pratik-brex
@pratik-brex

I was wondering if this would be the right intent in using BootstrapContextCompatible in micronaut. To summarize what i'm trying to do:

I have multiple microservices and they share the same config. Typically you'd write it in application.yml but I don't want to copy-paste it across multiple services; so for now, I'm programmatically generating it using PropertySources.of and passing it to Micronaut.run. Would you do this in a different way perhaps?

sakis kaliakoudas
@skaliakoudas_twitter
Does Micronaut Data support GraalVM for MySQL?
Anand
@anandjaisy

Is there a way to replace micronaut server error with own implementation ?
I tried the below code, but didn't work

@Produces
@Singleton
@Replaces(SerializationException.class)
@Requires(classes = {GlobalException.class, SerializationException.class})
public class GlobalExceptionHandler implements ExceptionHandler<GlobalException, HttpResponse> {

    @Override
    public HttpResponse handle(HttpRequest request, GlobalException exception) {
        return HttpResponse.ok(0);
    }
}

For example how to handle with own implementation

14:51:04.845 [pool-1-thread-5] ERROR i.m.h.s.netty.RoutingInBoundHandler - Unexpected error occurred: Incorrect message body size to deserialize to a Long
io.micronaut.core.serialize.exceptions.SerializationException: Incorrect message body size to deserialize to a Long
    at io.micronaut.rabbitmq.serdes.JavaLangRabbitMessageSerDes$LongSerDes.deserialize(JavaLangRabbitMessageSerDes.java:314)
Laurent Pellegrino
@lpellegr
Hi there
Is there a "Micronaut solution" to add response headers to all methods in a Controller without altering each method manually?
5 replies
James Kleeh
@jameskleeh
A server filter
Can be applied via annotation instead of url if desired
Laurent Pellegrino
@lpellegr
@jameskleeh Fantastic. Thanks a lot!
public class HttpResponseFilter extends OncePerRequestHttpServerFilter {

    @Override
    protected Publisher<MutableHttpResponse<?>> doFilterOnce(HttpRequest<?> request, ServerFilterChain chain) {
        return Publishers.map(chain.proceed(request), response -> response.header("Test", "My Value"));
    }

}
Anand
@anandjaisy
James Kleeh
@jameskleeh
Add @Nullable
amaresh309
@amaresh309

I am passing two headers in controller as below
@Header("x-correlationId") String correlationId,
@Header(name = "x-consumedBy") String consumedBy
where x-correlationId is mandatory and x-consumedBy is optional. I am not able to specify this

In Spring we can specify required=false.

Tell us what happens instead
It is taking both as mandatory.

if I specify @Nullable then it is always taking the value as null even if I pass the value
correlationId::12345:consumedBy:null
James Kleeh
@jameskleeh
Then the header isn’t being sent correctly
amaresh309
@amaresh309
image.png
image.png
image.png
Here are the screenshot..
Not sure where it is going wrong
James Kleeh
@jameskleeh
Remove name =