How can I use authentication in Mongo sink? - spring-xd

http://docs.spring.io/spring-xd/docs/1.1.0.RC1/reference/html/#mongo
The options for mongo sink does not specify any arguments for passing user/password.

Thanks for the feedback!
It isn't supported now: https://jira.spring.io/browse/XD-2674.
To overcome it you should modify /modules/sink/mongodb/config/mongodb.xml with <context-property:placeholder> and add appropriate keys for the <mongo:db-factory >.

Related

Force format for ibm mq messages

We use Spring-integration to send messages from a RabbitMQ to MQSeries. This works fine.
<int-jms:outbound-channel-adapter channel="toJms" .../>
For some consumers we need to force the format of the ibm message or the charset
We allready use a header enricher to force some properties:
<int:header-enricher id="theHeaderEnricher" input-channel="fromRabbit" output-channel="toJms" >
How can we change the mq format and the charset of messages? Format is not a JmsHeaders but a property of the message. Can this be done with xml configuration?
Thanks for your help
Eric
Before sending to the <int-jms:outbound-channel-adapter> you can place a <transformer> in between with POJO method call and there you can do whatever you need with your reformatting.
Unfortunately it is not clear from your question how that formatting looks and what you would like to change from and into.
Therefore my answer is as generic as your question.
Please, see more info about transformer in the Docs: https://docs.spring.io/spring-integration/reference/html/#messaging-transformation-chapter

How to get access and customize Freemarker's Configuration object in spring-boot 2.x?

How to get access and customize Freemarker's Configuration object in spring-boot 2.x?
It allows to set square bracket syntax as default option with something like:
Configuration#setTagSyntax(Configuration.SQUARE_BRACKET_TAG_SYNTAX)
which is not possible with any of spring.freemarker.* configuration property.
Also, it should be possible to introduce default imports having access to direct configuration of this object.
It's possible to set any FreeMarker configuration settings with spring.freemarker.settings.<settingName>, like spring.freemarker.settings.tagSyntax = square_bracket. See the JavaDoc of Configuration.setSetting(String, String) for more (https://freemarker.apache.org/docs/api/freemarker/core/Configurable.html#setSetting-java.lang.String-java.lang.String-). This is the method to which Spring delegates the assignments under spring.freemarker.settings; Spring itself doesn't know what "settings" exist or how to parse them.

Spring data solr and Solr 6.4.0: default search field

Solr 6.4.0 doesn't allow having default field in schema.xml and throws exception so this line must be removed:
<defaultSearchField>product_digest</defaultSearchField>
Removing it requires passing it with parameters explicitly.
It's easy to do with solrj4 and ModifiableSolrParams.
But we use the latest release version spring-data-solr 2.0.6 and I can't figure out how to set it using
org.springframework.data.solr.core.query.SimpleQuery
I would appreciate any help.
Thanks.
DEPRECATED: The defaultSearchField is commented not deprecated.
Note:It is Not recommended by Solr, instead use df of requestHandler in solrconfig.xml.
Un-commenting defaultSearchField will be insufficient if your request handler
in solrconfig.xml defines "df", which takes precedence. That would need to be removed.

Use logback to log SQL parameters in Spring JdbcTemplate

I'm using Logback with Spring JdbcTemplate to log my SQL queries. My configurations contains next line:
<logger name="org.springframework.jdbc.core.JdbcTemplate" level="DEBUG" />
But this logs only query with wildcards ? without list of parameters.
Here on SO I found a few answers how to achieve parameters logging with log4j. But I don't want to switch to log4j.
So how can I receive parameters list for JdbcTemplate with Logback?
Edit
Actually, I'm using NamedParameterJdbcTemplate, if it matters.
Try this
<logger name="org.springframework.jdbc.core.StatementCreatorUtils" level="TRACE" />
this will show log:
Setting SQL statement parameter value: column index 1, parameter value [1234], value class [java.lang.Integer], SQL type unknown
I usually prefer handling SQL statement logging at the DataSource or JDBC driver level.
I use BoneCP DataSource/Connection Pool library, which include support for statement logging via SLF4J and many other usefull features.
If changing your DataSource/Connection Pool library is not an option, maybe you can use log4jdbc which works as a proxy jdbc driver, which logs statements to SLF4J before calling the actual jdbc driver that talks to the database.
We can use as follow :
org.hibernate.type.descriptor.sql.
See Link: https://thorben-janssen.com/hibernate-logging-guide/

How do I access specific schemas in hibernate spring?

I use Hibernate-Spring and I am trying to access a specific schema in a db but don't know how. The name of the table is not doing the trick. I was hoping that annotation would help be but it hasn't so far. Note: I am not trying to create a schema, I just want to access it. I use Spring 2.5.
Set schema in your mappings:
#Table(name="myentity", schema="some")
<class name="MyEntity" table="myentity" schema="some">
or use default:
hibernate.default_schema="some"

Resources