spring-el

filtering on multiple conditions spring xd

最后都变了- 提交于 2019-12-13 05:18:50
问题 I want to filter out payload if it contains following error codes 202048 202049 200003 filter --expression=payload.contains('202048')||payload.contains('202049')||payload.contains('200003') Can i put or condition in my expression || is my or 回答1: See the SpEL language reference. Use OR (or or ). You need spaces around the or so you need to quote the whole expression; since the module is likely within a string, you will need to escape the literal quotes. For example: xd:>stream create foo -

Spring integration expression map access with dot notation

拜拜、爱过 提交于 2019-12-12 22:42:12
问题 Normally in Spring EL you access a map entry by its key using the key in square brackets. If the payload of a spring integration message is a java.util.Map , then payload['mykey'] gives you the value of the entry having the String 'my-key' as key. When using the standard Spring EL setup, e.g. in a unit test, that is the only way to work with the map. However, in expressions used by Spring integration flows I can use the dot notation for map access. This works: payload.mykey I want to be able

Spring Data JPA JSONB Paramaterization

懵懂的女人 提交于 2019-12-12 19:34:15
问题 What is the correct syntax (JPA, Spring Data, or SpEL) to convert this query into a Spring Data Repository nativeQuery ? SELECT * FROM mytable WHERE f_jsonb_arr_lower(myjsonb -> 'myArray', 'subItem', 'email') @> '"foo@foo.com"'; I want to use an input parameter instead of hard-coding "foo@foo.com" . My model: Postgres myTable with a JSONB column myJsonb : { "myArray": [ { "subItem": { "email": "bar@bar.com" } }, { "subItem": { "email": "foo@foo.com" } } ] } Index described here. The hard

Spring Boot Adding Model to the View with Thymeleaf and MVC

一笑奈何 提交于 2019-12-12 04:09:11
问题 Ok, so I'm trying to put an attribute of an object from the model to the view as a list using thymeleaf, spring boot and jpa, I've been reading over the code for hours and I can't seem to spot my problem, also in the same application I have a very similar function working so I sort of know how to do it, but I just cannot seem to figure out this one. I keep getting an error Property or field 'question' cannot be found on null . I have no idea where I'm going wrong. The object I'm have is

Regex with SpEl usage

给你一囗甜甜゛ 提交于 2019-12-12 02:43:58
问题 How to use regex with SpEL? Would like to append system properties along with SpEL and regex . expected output : devInmessagebase/devInmessagetest/devInmessagesample dev :'env' variable Inmessage : from properties file(in.topic.mesge) asterisk(*) : base/test/sample(anything as suffix) Tried as below and many other ways but not working.any suggestion? <int-kafka:consumer-configuration group-id="default3" value-decoder="kafkaSpecificDecoder" key-decoder="kafkaReflectionDecoder" max-messages="10

How to create a @RequestMapping @PathVariable to include a / in the parameter?

人盡茶涼 提交于 2019-12-12 00:27:39
问题 Is there a way in Spring 3.x to have a PathVariable in a request mapping include a forward /? I've tried different regexs that I thought would have parsed properly, but it seems that they never manage to pick up the forward /. I found this related SO question, but that is more dependent on URL encoding of parameters, which is not exactly my problem. I've tried the following @RequestMapping but to no avail: @RequestMapping(value = "/template/{definitionName:[a-zA-Z0-9_./]+}/{attributeName:.+}"

Bean creation using Spel + hibernate

谁都会走 提交于 2019-12-11 23:39:19
问题 We are using Spring MVC + its built in support for uploading files. I want to set the maximum upload size utilizing SpEL. The problem is this value comes from our database. So in our old application code, we do a check once we have the file uploaded with the following: appManager.getAppConfiguration().getMaximumAllowedAttachmentSize(); We then check the file to see if it is larger than this, and proceed based upon the size. I'd like to replace that code with the following call in our servlet

SPEL - Pound Sign in Expression

自古美人都是妖i 提交于 2019-12-11 23:06:14
问题 I have a pound sign in a string (hex color code) that I do not want the parser to attempt to evaluate: #542582 Is there a way to either escape these, or better yet, configure the parser to somehow ignore based on a pattern that matches this? 来源: https://stackoverflow.com/questions/25265098/spel-pound-sign-in-expression

spring SPeL combine filter and projection operations

旧巷老猫 提交于 2019-12-11 18:07:43
问题 Colleagues, how to combine together projection operator ![expr] and filter ?[ boolean ] . For example I have some entity: class User { int age; String name; } I would like select from list of Users only name of user who is elder than 30. Standalone projection looks like: #myArray.![name] Standalone filtering looks like: #myArray.?[age > 30] So how to put it together? Thank you in advance! 回答1: (#myArray.?[age > 30]).![name] i.e. perform the projection on the results of the selection. 来源:

how to use spel to represent $cond of mongo

给你一囗甜甜゛ 提交于 2019-12-11 15:57:39
问题 I have a collection with documents like below { "_id" : ObjectId("5946360fdab24b1d05fac7e6"), "name" : "aaa", "createdAt" : NumberLong("1497773583563"), "segmentedStatus" : 0 } I want to stat how many documents with segmentedStatus = 1, db.foo.aggregate( {$project: {_id:0, segmentedCount:{$cond: [{$eq:["$segmentedStatus",1]}, 1, 0]} } }, {$group: {_id:null, count:{$sum:"$segmentedCount"}}} ) In spring data mongo Aggregation aggregation = newAggregation(project().and("segmentedCount")