Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Apache CXF (JAX-RS) #394

Closed
cmoulliard opened this issue Mar 20, 2017 · 19 comments
Closed

Add support for Apache CXF (JAX-RS) #394

cmoulliard opened this issue Mar 20, 2017 · 19 comments
Assignees

Comments

@cmoulliard
Copy link

cmoulliard commented Mar 20, 2017

Apache CXF (>= 3.1.9) ships Spring-boot which supports to develop Web Services - JAX-WS or RESTfull - JAX-RS projects

The apache cxf documentation page is available here : https://cxf.apache.org/docs/springboot.html

while the starter is referred here : https://github.com/spring-projects/spring-boot/tree/master/spring-boot-starters

A project can be developed using the Spring or JAX-RS annotations

@RestController
public class GreetingController {

	@Autowired
	private GreetingProperties properties;

	private final AtomicLong counter = new AtomicLong();

	@RequestMapping("/greeting")
	public Greeting greeting(@RequestParam(value = "name", defaultValue = "World") String name) {
		return new Greeting(this.counter.incrementAndGet(), String.format(this.properties.getMessage(), name));
	}
}

@SpringBootApplication
public class RestApplication {

	public static void main(String[] args) {
		SpringApplication.run(RestApplication.class, args);
	}

}

&

  <dependencies>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-tomcat</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-spring-boot-starter-jaxrs</artifactId>
    </dependency>
    <dependency>
...
</dependencies>
@sberyozkin
Copy link

Please note that the CXF JAX-RS starter only indirectly supports Spring annotations due its dependency on spring-boot-starter.
It would probably make sense to introduce 'cxfws' and "cxfrs" qualifiers for selecting either CXF JAXWS or CXF JAXRS starter.

@snicoll
Copy link
Contributor

snicoll commented Apr 11, 2017

We won't add two starters for CXF.

We are now considering adding the jax-rs starter and before we do I'd like to know if there are multiple versions of the starter supported and which spring boot generations are supported. As @vpavic actively implemented this, he may be aware.

@snicoll snicoll self-assigned this Apr 11, 2017
@deki
Copy link

deki commented Apr 11, 2017

And what about jax-ws?

CXF 3.1.11 which was released yesterday supports Spring 1.5.x.

@vpavic
Copy link
Contributor

vpavic commented Apr 11, 2017

The original Spring Boot integration in CXF was introduced in 3.1.7 and was based on Boot 1.3.x.
CXF 3.1.11 and 3.2.0 support Boot 1.5.x - see CXF-7198.

@snicoll
Copy link
Contributor

snicoll commented Apr 11, 2017

We won't add jax-ws.

@snicoll
Copy link
Contributor

snicoll commented Apr 11, 2017

@vpavic I am confused. A bug fix release of the starter changed the supported Spring Boot version? What should I take then? 3.2.0 for 1.5?

@cmoulliard
Copy link
Author

@snicoll When you say that you wan't add jax-ws, I suppose that you would like to say that the CXF Starter will be either jax-rs or jax-ws and not both ?

@snicoll
Copy link
Contributor

snicoll commented Apr 11, 2017

@cmoulliard Yes. And besides we'll go only for jax-rs at this point anyway. I can't see how the starter could handle both and still manage to provide a decent set of dependencies.

@cmoulliard cmoulliard changed the title Add Apache CXF (SOAP - RESTfull) to the list Add Apache CXF - RESTfull to the list Apr 11, 2017
@vpavic
Copy link
Contributor

vpavic commented Apr 11, 2017

I am confused. A bug fix release of the starter changed the supported Spring Boot version? What should I take then? 3.2.0 for 1.5?

Well, 3.2.0 isn't out yet.

The cause for that change was removal of org.springframework.boot.context.embedded.ServletRegistrationBean in Spring Boot 1.5.0 which prevented CXF's Boot integration users from upgrading Boot.

BTW I have to correct myself, 3.1.11 upgraded to Boot 1.4.x, but it works with 1.5.x as well. IMO you should go with 3.1.11 for both 1.4.x and 1.5.x ATM.

@cmoulliard
Copy link
Author

@snicoll Is the CXF Starter project ready to become part of the initialzr ? Do we miss something ?

@snicoll
Copy link
Contributor

snicoll commented Apr 11, 2017

Thanks @vpavic ! I guess we have most of the interested parties in this issue so if a new release of CXF is out, I'd appreciate a request for upgrade (or a PR but we can do that ourselves, it's usually a one line change).

I'll get going with 3.1.11 then.

@snicoll
Copy link
Contributor

snicoll commented Apr 11, 2017

@snicoll snicoll added this to the 0.4.0 milestone Apr 11, 2017
@snicoll snicoll changed the title Add Apache CXF - RESTfull to the list Add support for Apache CXF (JAX-RS) Apr 11, 2017
@sberyozkin
Copy link

sberyozkin commented Apr 11, 2017 via email

@sberyozkin
Copy link

sberyozkin commented May 10, 2017

Hi, I'd like to propose improving a generated Demo a bit by adding a simple JAX-RS service bean which will be auto-discovered and a test code which invokes on that service bean. Can you please advise how it can be accomplished ? I can attach the proposed content to this issue. thanks

@snicoll
Copy link
Contributor

snicoll commented May 10, 2017

@sberyozkin I am not following. This isuse is closed and I am not keen to do code generation atm (if that's what you're asking)

@cmoulliard
Copy link
Author

cmoulliard commented May 10, 2017

generated Demo

@sberyozkin We have started to develop a JBoss Forge Spring Boot addon to include such code generation. Here is the project. See add a Rest Controller

@sberyozkin
Copy link

@snicoll What I was thinking about was this - a CXF user goes to https://start.spring.io/, types 'CXF', clicks Generate Project, downloads the generated Demo which already does something OOB, at the moment it is empty and the only CXF specific thing in it is a CXF JAXRS starter dependency. Do you think it would be reasonable - if yes then I can open a new issue and provide the necessary code, let me know please

@cmoulliard thanks for the link, the project looks very interesting

@sberyozkin
Copy link

@cmoulliard sorry, so basically, once this JBoss SpringBoot AddOn is finalized then this is exactly what the CXF users will be able to do when they go to https://start.spring.io/ and type 'CXF', be able to add some custom resources/controllers, etc ? if so then it is exactly what I'm after :-), sorry for the noise then

@snicoll
Copy link
Contributor

snicoll commented May 11, 2017

No, that's not going to do anything here. Thanks for the details that confirms I understood your question. As I said above I am not keen to do that. If you have more questions join us on Gitter.

@spring-io spring-io locked and limited conversation to collaborators May 11, 2017
@snicoll snicoll modified the milestone: 0.4.0 Aug 15, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants