You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by mreardon <re...@gmail.com> on 2010/12/10 01:06:16 UTC

Spring 3.0 Java-based configuration

I'm experimenting with Java-based configuration in Spring 3.0. So far I'm
finding it a mixed bag. One problem has been that there is no equivalent for
the domain-specific configuration though XML namespaces. Has anyone else
tried using @Bean to define JAX-WS endpoints and clients (as apposed to
using <jaxws:client/> or <jaxws:endpoint/>)? For example, I tried the
following endpoint without success...


import org.apache.cxf.Bus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.expd.service.person.impl.dao.IPersonDao;

@Configuration
public class PersonServiceConfiguration {
	
	@Autowired
	private Bus bus;

	@Autowired
	private PersonDao personDao;
	
	@Bean
	public Endpoint personServiceEndpoint() {		
		return new EndpointImpl(bus, personService(), "/PersonService");
	}

	@Bean
	public PersonService personService() {
		PersonServiceImpl service = new PersonServiceImpl();
		service.setDao(personDao);
		return service;
	}
}
-- 
View this message in context: http://cxf.547215.n5.nabble.com/Spring-3-0-Java-based-configuration-tp3299668p3299668.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Spring 3.0 Java-based configuration

Posted by Willem Jiang <wi...@gmail.com>.
I think if you take out the bus part, which is more complicated to be 
used as the Spring java configure, the PersonServiceConfiguration should 
work as you want.

Current you can't load a bus from spring without the import the 
classpath:META-INF/cxf/cxf.xml and other extensions.

Willem
On 12/10/10 8:06 AM, mreardon wrote:
>
> I'm experimenting with Java-based configuration in Spring 3.0. So far I'm
> finding it a mixed bag. One problem has been that there is no equivalent for
> the domain-specific configuration though XML namespaces. Has anyone else
> tried using @Bean to define JAX-WS endpoints and clients (as apposed to
> using<jaxws:client/>  or<jaxws:endpoint/>)? For example, I tried the
> following endpoint without success...
>
>
> import org.apache.cxf.Bus;
> import org.springframework.beans.factory.annotation.Autowired;
> import org.springframework.context.annotation.Bean;
> import org.springframework.context.annotation.Configuration;
> import com.expd.service.person.impl.dao.IPersonDao;
>
> @Configuration
> public class PersonServiceConfiguration {
> 	
> 	@Autowired
> 	private Bus bus;
>
> 	@Autowired
> 	private PersonDao personDao;
> 	
> 	@Bean
> 	public Endpoint personServiceEndpoint() {		
> 		return new EndpointImpl(bus, personService(), "/PersonService");
> 	}
>
> 	@Bean
> 	public PersonService personService() {
> 		PersonServiceImpl service = new PersonServiceImpl();
> 		service.setDao(personDao);
> 		return service;
> 	}
> }


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang