I do not wish to use Spring annotations or xml or any declarative, non-compile-time-safe code or anything that relies on reflection. However, I'm guessing Spring does have traditional libraries (like Apache Commons libraries) that you can call from your code rather than your annotated code getting called by the framework.
What Spring projects are libraries? I'm assuming some of them are.
The core of Spring is the Spring Framework. Which is uses reflection, annotations etc without remorse. Using spring as a library completely misses the point. You could use, say JdbcTemplates with the correct dependency but why?
If you do use Spring as a Library bare in mind you are only getting tiny bits of functionality, most of which is just bootstrap code you avoid writing. Spring is designed to be used within it's framework and built upon. Some do use libraries such as Apache Commons. Using Spring Framework as a library however does just complicate your own project and people would probably ask - "why".
Related
How to integrate the spring boot project generated by swagger with OSGi and deploy it in Apache karaf?
How should I write my pom.xml and how to modify the startup class. If there is something not detailed, I will add it. Thank you!
You don't. It's not strictly impossible but it would be a lot of work and struggle and you will not get any benefits out of it.
If you want SpringBoot - stick to that. You will sacrifice modularity, strong encapsulation, enforced clean architecture and bunch of other architectural thing that will matter a lot in the long run. But you will gain something that is easy to work with in the beginning and tons of code to copy/paste.
If you are playing the long game - I'd recommend to forget about SpringBoot and learn how to build modular OSGi applications. Recent version allow you to use popular technologies like JAX-RS and CDI. You can probably use one of the Swagger's JAX-RS generators and then convert the outcome to proper modular code. It may even be that there is a generator that generates OSGi JAX-RS code already.
Is it possible to use Ceylon classes in a Spring Boot application? What would that look like - the Ceylon classes as a separate dependency, or could they be in the same project?
I've got a particularly knotty Java problem that would really benefit from reified generics and an absence of type erasure. However, the main reason I'm writing it in Java in the first place is because I want to exploit a Java library for interacting with a thing. I don't want to learn any more Ceylon than is necessary for solving the problem, if at all possible.
Ceylon integration with java is really smooth, you can use all the springboot stack and use java classes and even libs (maven) without problems, I have a small project ceylon with springboot using Discovery, Gateway and microservices that you can use as example. Its not documented yet but if you know about springboot then I think its enough as start point for you. I hope it's enough , otherwise I am available to help.
Its working/using ceylon from current development, I didnt try with 1.2.2 release.
I am implementing a REST service from scratch. I am using Spring + ibatis for the same.
Now, spring offers REST support using annotations. However, online, I find many tutorials to integrate Jersey with Spring.
My question: Why would one want to introduce extra dependencies by including another framework, that is Jersey JAX-RS, when Spring itself is good?
You assume that there's a problem with introducing "another" dependency, which, unless you're developing for some tiny embedded system, there isn't. The added memory footprint, complexity etc would generally be irrelevant.
The decision to use Spring or Jersey for RESTv implementation should be one of personal preference and suitability. Pick the one that satisfies your requirements and you're most comfortable with.
Also, using Spring for REST will require additional dependencies itself. If you're only using Spring for dependency injection, you won't require spring-web or spring-webmvc, whereas these will be required for REST.
Hope this helps
Is the any way to perform integration CQ5 platform with Spring framework?
I would like to use Spring IoC capabilities to make my code more clear and efficient.
UPDATE
Hello againg, seems that I found solution.
Guys here developed Slice framework that really redices amound of code and made CQ5 development easier.
You probably want to check out Eclipse Gemini Blueprint, or it's original incarnation Spring Dynamic Modules. The Blueprint project basically gives you an easy way to create Spring enabled bundles in an OSGi environment.
As shsteimer mentions, Spring distributions before 3.2.0 were OSGi bundles, so could be dropped into an OSGi environment and you could probably use them directly. Spring 3.2.0 bundles and above are now available through the SpringSource ERB. However, Blueprint gets around or helps with some of the boilerplate OSGi stuff that you would otherwise have to do.
On a past project, I was able to get Spring JDBC working inside of CQ (to support some legacy code so we didn't have to re-write it). My memory is that the spring jar files already come "OSGI-ified" and so it was just a matter of figuring out all the layers of dependency needed for JDBC to work inside of CQ, and adding all the jars to the repository in an /apps/myApp/install folder.
Long story short, I'm not sure about IoC, but you might check to see if it's already packaged as an OSGI version which you can simply use without too much hassle.
EJB 3.0 comes with the concept of Interceptors, but then again they are applicable to EJBs only. My project requires developing Interceptors for POJO classes. One option for this is to use Spring AOP. I want to know if it's worth the overhead of including the libraries such as commons-logging, spring-aop, cglib that are required for Spring AOP.
Spring is much more than Spring AOP, and you can not use Spring AOP without Spring, and I am talking not only to the Spring libs, but to the Spring programming model too!
So if you think Spring is useful for your application (believe me, it is very useful to many application), then you can use it. - But it is a complete programming model, like EJB, not only a lib or a simple framework.
But I think every modern not trivial application should have a ICO container, so Spring is one of the choices you have.
Sure, it's worth, but be aware it won't be enough if you need to have interceptors for you POJOs : You will also need a "spring agent" to be passed as an argument to your jvm ("Load-Time Weaving"), or you won't be able to intercept your pojos methods, or you will have to use "Compile-Time Weaving".
In short : POJOs have to be created via Spring for them to be "interceptable".
CTW (or LTW) makes compilation (or startup) quite slower.