spring-boot/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-xml/src/main/java/smoketest/xml/SampleSpringXmlApplication....

48 lines
1.5 KiB
Java
Raw Normal View History

2013-06-01 03:26:30 +08:00
/*
* Copyright 2012-2019 the original author or authors.
2013-06-01 03:26:30 +08:00
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
2013-06-01 03:26:30 +08:00
*
* 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 smoketest.xml;
2013-04-24 17:02:07 +08:00
import java.util.Collections;
import smoketest.xml.service.HelloWorldService;
2013-04-24 17:02:07 +08:00
import org.springframework.beans.factory.annotation.Autowired;
2013-07-27 05:10:38 +08:00
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
2014-01-22 06:37:18 +08:00
@SpringBootApplication
2013-07-06 07:44:24 +08:00
public class SampleSpringXmlApplication implements CommandLineRunner {
2013-04-24 17:02:07 +08:00
private static final String CONTEXT_XML = "classpath:/META-INF/application-context.xml";
2013-04-24 17:02:07 +08:00
@Autowired
private HelloWorldService helloWorldService;
@Override
public void run(String... args) {
System.out.println(this.helloWorldService.getHelloMessage());
}
2018-01-25 19:38:55 +08:00
public static void main(String[] args) {
SpringApplication application = new SpringApplication();
application.setSources(Collections.singleton(CONTEXT_XML));
application.run(args);
2013-04-24 17:02:07 +08:00
}
2015-06-23 15:47:12 +08:00
2013-04-24 17:02:07 +08:00
}