Feb 16 2009
Spring annotations based config
Example
DAO class in persistence package
JAVA:
-
package com.mycompany.persistence;
-
import org.springframework.stereotype.Repository;
-
[...]
-
-
public class DaoImpl
-
implements Dao {
-
[...]
-
}
Service class in service package
JAVA:
-
package com.mycompany.service;
-
import org.springframework.stereotype.Service;
-
[...]
-
-
@Service
-
public class ServiceImpl
-
implements Service {
-
@Autowired
-
private Dao dao;
-
[...]
-
}
Usage of service in a jax-ws webservice implementation
JAVA:
-
package com.mycompany.ws.impl;
-
import org.springframework.beans.factory.annotation.Autowired;
-
import org.springframework.web.context.support.SpringBeanAutowiringSupport;
-
-
[...]
-
-
@javax.jws.WebService (endpointInterface="com.mycompany.ws.MyWs", targetNamespace="http://schema.mycompany.com/service", serviceName="myservice", portName="portname", wsdlLocation="WEB-INF/wsdl/mywsdl.wsdl")
-
public class WsImpl
-
extends SpringBeanAutowiringSupport{
-
-
@Autowired
-
private Service service;
-
[...]

