[bs-19] Medley of changes supporting integration apps

* Use file adapters in sample instead of internal flow
* Add Exception to signature of CommandLineRunner for
implementation convenience
* Updates for Security snapshots
This commit is contained in:
Dave Syer
2013-04-29 08:35:01 +01:00
parent 10c333ea10
commit 628a8c79aa
21 changed files with 206 additions and 121 deletions

View File

@@ -1,4 +1,4 @@
package org.springframework.bootstrap.sample.service;
package org.springframework.bootstrap.sample.consumer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

View File

@@ -1,4 +1,4 @@
package org.springframework.bootstrap.sample.service;
package org.springframework.bootstrap.sample.consumer;
import org.springframework.bootstrap.SpringApplication;
import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration;

View File

@@ -0,0 +1,25 @@
package org.springframework.bootstrap.sample.consumer;
import java.io.File;
import java.io.FileInputStream;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.integration.annotation.MessageEndpoint;
import org.springframework.integration.annotation.ServiceActivator;
import org.springframework.util.StreamUtils;
@MessageEndpoint
public class SampleEndpoint {
@Autowired
private HelloWorldService helloWorldService;
@ServiceActivator
public String hello(File input) throws Exception {
FileInputStream in = new FileInputStream(input);
String name = new String(StreamUtils.copyToByteArray(in));
in.close();
return this.helloWorldService.getHelloMessage(name);
}
}

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.bootstrap.sample.service;
package org.springframework.bootstrap.sample.consumer;
import org.springframework.bootstrap.context.annotation.ConfigurationProperties;

View File

@@ -1,22 +0,0 @@
package org.springframework.bootstrap.sample.service;
import java.util.Collections;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.integration.annotation.MessageEndpoint;
import org.springframework.integration.annotation.ServiceActivator;
@MessageEndpoint
public class SampleEndpoint {
@Autowired
private HelloWorldService helloWorldService;
@ServiceActivator
public Map<String, String> hello(String input) {
return Collections.singletonMap("message",
this.helloWorldService.getHelloMessage(input));
}
}

View File

@@ -2,10 +2,19 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:int-file="http://www.springframework.org/schema/integration/file"
xsi:schemaLocation="http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/integration/file http://www.springframework.org/schema/integration/file/spring-integration-file.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<int:channel id="input"/>
<int:service-activator input-channel="input" ref="sampleEndpoint"/>
<int-file:inbound-channel-adapter channel="input" directory="target/input" filename-pattern="*">
<int:poller fixed-rate="500"/>
</int-file:inbound-channel-adapter>
<int:service-activator input-channel="input" ref="sampleEndpoint" output-channel="output"/>
<int:channel id="output"/>
<int-file:outbound-channel-adapter channel="output" directory="target/output"/>
</beans>

View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<property name="LOG_PATTERN" value="[%d{yyyy-MM-dd HH:mm:ss.SSS}] - ${PID:-????} %5p [%t] --- %c{1}: %m%n"/>
<property name="LOG_FILE" value="${LOG_FILE:-${LOG_PATH:-/tmp/}spring.log}"/>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<appender name="FILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<encoder>
<pattern>${LOG_PATTERN}</pattern>
</encoder>
<file>${LOG_FILE}</file>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<fileNamePattern>${LOG_FILE}.%i</fileNamePattern>
</rollingPolicy>
<triggeringPolicy
class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<MaxFileSize>10MB</MaxFileSize>
</triggeringPolicy>
</appender>
<logger name="org.springframework.integration.file" level="DEBUG" />
<root level="INFO">
<appender-ref ref="CONSOLE" />
<appender-ref ref="FILE" />
</root>
</configuration>