[java]
public interface BasicService {
public void setServiceName(String serverName)
public String getServiceName()
public User createUser()
}
public class BasicServiceImpl implements BasicService {
private String serviceName;
@Override
public void setServiceName(String serverName) {
this
}
@Override
public String getServiceName() {
return this
}
@Override
public User createUser() {
return new User(
}
}
[java]
public class User implements Serializable {
private static final long serialVersionUID =
private String username;
private String password;
public User(String username
this
this
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this
}
}
[html]
<?xml version=
<web
<display
<servlet>
<servlet
<servlet
<init
<param
<param
</init
<load
</servlet>
<servlet
<servlet
<url
</servlet
</web
[html]
<?xml version=
<beans xmlns=
xmlns:xsi=
xsi:schemaLocation=
/schema/beans/spring
<bean id=
<bean id=
<property name=
<property name=
</bean>
</beans>
[html]
<?xml version=
<beans xmlns=
xmlns:xsi=
xsi:schemaLocation=
/schema/beans/spring
<bean id=
<bean id=
<property name=
<property name=
</bean>
</beans>
[java]
public class RemoteTest {
public static void main(String[] args) {
ApplicationContext context = new ClassPathXmlApplicationContext(
BasicService basicService = (BasicService) context
basicService
System
System
System
}
}
hello service
zhangsan
From:http://tw.wingwit.com/Article/program/Java/ky/201311/28147.html