Create a SOAP-producer without spring Boot but Spring integration - java

I have a WSDL-file, which describes properties of a SOAP-requests (XSD-parts and also service-parts). Using Maven, I was able to generate model classes.
Now I want to use given classes to provide some SOAP-services.
Most of tutorials using Spring Boot, but I don't want. They also use a given wsdl-file and xsd-file, which I don't have.
All I want, is to have a easy to code SOAP endpoint, which uses Spring integration, where I can use stuff link #Inject. Do you have an idea?

Related

How to write a framework on top of spring boot (i.e. write a spring boot application without implementing some interfaces)

I'd like to write a framework on top of spring boot that does a bunch of things, like exposing specific endpoints and doing specific logic.
But I'd like to build it as a framework in the sense that someone else can take it, implement a number of specific interfaces and it will then run as a spring boot web application.
I haven't found how to do this specifically.
I've looked into this article about writing a custom starter, but it looks like the dependency is the wrong way round. I want the custom code "plugged into" the framework rather than calling the classes of the starter directly, if that makes sense.
It seems you're looking for the EnableAutoConfiguration plugin. This is the core of any spring boot libraries that wants to deal with spring boot custom beans without user help. EnableAutoConfiguration classes need to be placed in spring.factories file.
spring.factories file can have multiple classes each class needs to be provided using org.springframework.boot.autoconfigure.EnableAutoConfiguration=A,B,C
Using these boot classes you can create many beans that could be the backbone of your framework. Also if you want to provide custom properties as boot does, you need to add those properties file spring-configuration-metadata.json file.
For your reference, you can see this repo Rqueue

Apache Camel XML configuration rules and restrictions

I am learning Camel and trying to integrate it with Spring Boot applications. From what I've read there appear to be two main ways to configure the Camel routes (and other related entities): 1) via Java DSL, or 2) via XML DSL. We don't think the Java DSL approach will work for us, as it doesn't seem that it would allow dynamic route definitions. Maybe I'm wrong? If dynamic routing can somehow be done using Java DSL and whatever, I'd like to know about it.
So, I'm focusing on configuring the routes in XML, where we should have a little more flexibility. The idea is that a given application (or service) could be handed a constructed XML route configuration at deploy-time that would specify the details of that service's routing.
The first question I have is how can we indicate to Camel (or Spring Boot and Camel) what/where the configuration file(s) are? Does it expect specific file naming and/or project location, or is it more flexible? Can it be broken into separate files?
By the way, we configure our Spring Boot applications via a combination of Java-based bean configuration and an application.yml file. We don't use XML for Spring Boot configuration.
I've poked around in a number of places on the Camel site (https://camel.apache.org/) but haven't found much information on this subject. The emphasis definitely favors the Java DSL approach.
There is a spring boot example with XML DSL at
https://github.com/apache/camel-spring-boot/tree/master/examples/camel-example-spring-boot-xml
You can use property placeholders in your Camel routes that can be configured via spring boot configuration (eg application.properties etc).
From Camel pov, then XML or Java can be equally dynamic. You can remove/add routes at runtime. But mind that its not always a good thing to do dynamic changes in production, without knowing if the changes works.

How to use swagger without annotations

I am working on a java project which does not use spring boot. I am asked to integrate swagger into my project. I have been searching the internet on how to do it without spring boot, but I have found no clue.
Manual is the way to go. Luckily, they have a tool! https://swagger.io/tools/swagger-editor/ The other great thing is that Swagger is not Java specific so it can be re-used for other REST implementations in other languages.
Spring Boot is just an integration for Swagger. You can also make use of Swagger withtout using Spring Boot.
You can use Swagger core library for getting Swagger to work.
https://github.com/swagger-api/swagger-core

Adding spring to servlet just for validation

I am currently not using any frameworks (other than bootstrap) for my java-ee application. But i came across a problem in using server side validation for servlets. I am finding it difficult to implement validation like this
http://spring.io/guides/gs/validating-form-input/
I could use request dispatcher, but I am not sure if it's the right way.
So i wanted to ask is it advisable to use the spring framework just for the validation?
is there any way to convert my entire java application to use spring or should i build the application from the ground up again?
If you just need the validation, then I recommend to use JSR-303/349 Bean Validation 1.0/1.1. The default implementation is done by Hiberante-Validator (this is NOT the Hibernate-ORM project!). It is relative easy to use out of the box.
http://hibernate.org/validator/documentation/getting-started/

Integrating JackSon for JSON View with Spring 2.5

We are using Spring 2.5 and spring-json for JSON support. We have the below configuration in views.xml
<bean name="jsonView" class="org.springframework.web.servlet.view.json.JsonView"/>
Now, we have learnt that Spring 3.x uses JackSon API internally for JSON support. My question is how can we override the default implementation of Spring 2.5 to use JackSon - The way Spring 3.x begins.
Note: We don't want to migrate my Spring version, but, want Spring 2.5 to use this JackSon API instead of Spring-Json
Is it possible to replace Spring's JSON support without breaking it ?
Unfortunately, Spring's own documentation states that Spring-json is "deeply" a component of the existing Spring 2.5 framework.
See : http://spring-json.sourceforge.net/
That said - removing the dependencies on spring-json, adding your own JSON parser, and rebuilding spring can be done. I assume this will require a lot of work given that spring-json is a major component of the whole Spring MVC suite.
An alternative : Building a Facade
In addition, I don't know of any Java EE specification for Json libraries which implies that there is a good chance that all internal Spring json dependencies are specific to the APIs defined by Spring-json [compare this, for example, with JPA, which is generically defined by Java EE, so that it is easy to replace many a DAO framework].
Generally, you can package any sort of JSon library as a Spring component that will be available in the application context. Now - if you reimplement the necessary interfaces using the facade pattern, using Jackson under the hood, your version of Spring 2.5 should work the same. Alternatively, you could intercept Json related calls of interest using Spring's aspect oriented injection libraries, and reroute them as necessary.
Again, however, these are all advanced tasks - they would be excellent learning projects but I'm not sure that the time investment would really pay off if this is a production application.
http://www.javaworld.com/javaworld/jw-02-2008/jw-02-springcomponents.html

Categories

Resources