parent
05a2b53527
commit
2431767c81
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.logging;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link LoggingApplicationListener}.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class LoggingApplicationListenerIntegrationTests {
|
||||
|
||||
|
||||
@Test
|
||||
public void loggingSystemRegisteredInTheContext() {
|
||||
ConfigurableApplicationContext context = new SpringApplicationBuilder(
|
||||
SampleService.class).web(false).run();
|
||||
try {
|
||||
SampleService service = context.getBean(SampleService.class);
|
||||
assertNotNull(service.loggingSystem);
|
||||
}
|
||||
finally {
|
||||
context.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Component
|
||||
static class SampleService {
|
||||
|
||||
private final LoggingSystem loggingSystem;
|
||||
|
||||
@Autowired
|
||||
SampleService(LoggingSystem loggingSystem) {
|
||||
this.loggingSystem = loggingSystem;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue