Commit ce191df9 authored by fangzhipeng's avatar fangzhipeng

完成初始化dubbo配置

parent 5da9ebb7
<html>
<body>
<h2>Hello World!</h2>
</body>
</html>
package com.paul;
import com.paul.api.TestService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
String paths[] = {"applicationContext.xml"};
//这个xml文件是Spring配置beans的文件,顺带一提,路径 在整个应用的根目录
ApplicationContext ctx = new ClassPathXmlApplicationContext(paths);
TestService testService = ctx.getBean(TestService.class);
System.out.println(testService.sayHello("fzp"));
new Thread(){
@Override
public void run() {
while (true) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}.start();
System.out.println("启动spring 服务启动完毕");
}
}
package com.paul;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment