-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SFTP Outbound Gateway: UnsatisfiedDependencyException when no expression is specified #3395
Comments
Just an additional note: if you really really want the user to be forced to specify the |
This is valid; the issue is because the gateway can be used for many functions and and not all require an expression. This is hard to do in a parser because the command (e.g. We either need to create a factory bean so we can perform the check after the place holders have been resolved, or we might be able to set a default in the .xsd, but we'd have to check if there are any unexpected side effects of doing that (with the other commands). |
Please open a separate new feature issue to request |
This is the assertion in the gateway... if (expression == null) {
Assert.state(Command.LS.equals(this.command)
|| Command.NLST.equals(this.command)
|| Command.PUT.equals(this.command)
|| Command.MPUT.equals(this.command),
"Only LS, NLST, PUT and MPUT commands can rely on the working directory.\n" +
"All other commands must be supplied with the filename expression");
this.fileNameProcessor = null;
} PUT and MPUT ignore the expression altogether (they always use the payload). Adding a hard-coded |
Correction - since this error is at the parser level, an |
Resolves spring-projects#3395 Outbound remote file gateway parser requires `expression` even though some commands don't need or use it. To avoid adding a factory bean, set a default value in the schema and interpret that default as needed, depending on the command.
Resolves #3395 Outbound remote file gateway parser requires `expression` even though some commands don't need or use it. * Propagate the empty string for `expression` attribute * Fix default (`payload`) expression logic in the `AbstractRemoteFileOutboundGateway` **Cherry-pick to `5.3.x`**
Resolves #3395 Outbound remote file gateway parser requires `expression` even though some commands don't need or use it. * Propagate the empty string for `expression` attribute * Fix default (`payload`) expression logic in the `AbstractRemoteFileOutboundGateway` **Cherry-pick to `5.3.x`**
In what version(s) of Spring Integration are you seeing this issue?
5.3.2.RELEASE
Describe the bug
When you define a SFTP outbound gateway using the XML namespace, if you don't specify the
expression
attribute, instantiation of the gateway fails with an obscure message.To Reproduce
Consider this:
Expected behavior
This is expected to work. As documentation for
put
command says, "the payload of the message can be ajava.io.File
, abyte[]
, or aString
". So, it's natural for me that the "default expression" is the message payload, unless I want to submit something else. This is quite standard in Spring Integration.(quick hint: what about
java.nio.file.Path
support?)Actual behavior
This fails on application context refresh with:
Workaround
Add
expression="payload"
to the outbound gateway definition.This was also submitted to Stack Overflow at: https://stackoverflow.com/questions/64160194/unsatisfieddependencyexception-when-setting-up-a-spring-integration-sftp-outboun
The text was updated successfully, but these errors were encountered: