Changes done from Spring 2 to Spring 3 - java

Recently while I was upgrading a project in spring 2.5.6 to spring 3.0.5, happened to know that some libraries aren't there anymore and some were renamed like spring-agent to spring-instrument...
Is there any site or a resource to refer to know these sort of changes done in migrating from spring 2 -3 ?

Yes, for most purposes, the Spring Upgrade Guide should provide you with what you need. In particular, check section 2.5 and 2.6 on the new packaging model.
If you are looking for a class that appears to be no longer available, try searching for it with FindJar. Some utility classes have been moved to another packages.

Related

Legacy Spring 2.5.6 Migration to Spring 3.x or 4.x in WLS & Java 8

Upon being handed a legacy Spring 2.5.6 application (deployed in WLS 12.1, java 7), I've been asked to migrate it to WLS 12.2 and java 8. I am attempting to re-build the application with a source and target of "1.8". It builds OK, but on deployment/test, I immediately, I have an issue where Spring 2.5.6 cannot seem to find application context files on the classpath in this new environment:
org.springframework.io.support.PathMatchingResourcePatternResolver.findPathMatchingResources(PathPatchingResourcePatternResolver.java:346)
| Resolved location pattern [classpath*:context*.xml] to resources[]
No resources are found. In fact, no classpath directory trees are even searched. I've checked to make sure the files are present and the classpath looks right in the WLS log files. All of this works great in java 7/WLS 12.1 but fails in java 8/WLS 12.2.
My guess is that Spring 2.5.6 is so ancient that it may not be working correctly in a java 8 environment. Any recommendations on how to easily migrate to Spring 3.x or 4.x w/out making any (if possible) source code changes?
Pieces of Spring 2.5.6 being used:
SpringBeanAutoWiringInterceptor (overrides getBeanFactory() to use
ClassPathXmlApplicationContext)
Spring JDBC's SimpleJdbcDaoSupport
Spring Transaction annotation (#Transactional)
That's about it. Not a whole lot of Spring but enough to warrant the question: which Spring version would be the easiest to migrate to without making any (or many) source code changes? Or is there a better way to handle this?
I got this to work by upgrading to Spring 4.1.9, which contains the same classes as Spring 2.5.6 (although many of them are deprecated).
One note, however. When making this change I had an issue with Spring 4 no longer finding/loading the context files from the CLASSPATH when using an exploded directory on the filesystem.
The issue was resolved here:
ClassLoader.getResources returning an empty Enumeration on a Weblogic/Spring application

spring-boot-starter-web-reactive + spring-boot-starter-actuator doesn't work together?

I tried out spring-boot-starter-actuator, by default instructions, add to spring boot project in pom, and it works without any issues.
As soon as I add spring-boot-starter-web-reactive everything breaks down, newly created reactive endpoint works, but actuator stopped working, have anybody had such issue and maybe already have any ideas how to solve it?
Also noticed, that h2 /console which I had working before, also broken.
I receive no errors, no exceptions, these things just stop working.
As Github page of Spring Boot Web Reactive Starter mentiones:
This experimental project ...
and
Go to start.spring.io, set the Spring Boot version to 2.0.0(SNAPSHOT) and add the "Reactive Web" starter.
When it's experimental, it is clearly not meant to be used in production and is not fully stable. Feel free to contribute or create issue.
Please, refer to this post Netty HttpServer api changed/differs from available examples
As the reactive-web is experimental you should add BOM file with compatible versions of libraries.

Resources linking in Dropwizard / JAX-RS 1.x (JSR 311)

I've got a problem with resources linking in Dropwizard. With JAX-RS 2.0 we've got magical javax.ws.rs.core.Link class which with it's builder can do almost all the work for you. Unfortunately Dropwizard 0.7.1 doesn't depend on the new 2.0 API, but on the old javax.ws.rs:jsr311-api API, which can't handle linking. Or can it? This is the problem I want to solve with Dropwizard. I probably have two ways to do it and I don't know if any of them is valid:
Option 1: I add JAX-RS 2.0 dependency to my project. Voila! I've got Link. But the problem is, that it doesn't work well with old implementations from Jersey - I got AbstractMethodException from UriBuilder, which apparently changed from version 1 to 2. So the answer is to supply new implementations. Can I do it? If yes, than how can I do it? Will new implementations work with dropwizard well?
Option 2: I can just add some other resource linking to dropwizard. Is there some other linking standard/library? I can't use jersey-declarative-linking because it mixes representations with the resources (the linking takes place in representations), and I want my representations not to know a thing about resources layer. So is there another linking standard for Dropwizard, Jersey and JAX-RS 1?
I've finally found an answer to my question.
Option 2 was a dead end. There was no other jax-rs-2-like linking library to either dropwizard or jersey itself.
Option one also was hard to do, but fortunatelly yesterday dropwizard released version 0.8.0-rc1 of their framework, which depends on jersey 2, which is the implementation of JAX-RS 2.0. So for all of you that want to have HATEOAS in dropwizard, version 0.8.0 is for you.

Springframework 2.5.6 and OSGi

I am trying to figure how to enable OSGi in a 2.5.6 install (The Dynamic Modules seems long gone now. Correct? ).
Is there some documentation describing the necessary steps and measures in getting OSGi workig the installed framework? I cannot find any. Maybe I'm just looking in the wrong places? I do get results that seem relevant with Google, but they point to dead ends (dead links - points to http://www.springsource.org/, but the documents seem to be removed).
I have a suite of OSGi bundles and need some of the services they provide as bean-references:
"<osgi:reference ... />" as defined by http://www.springframework.org/schem...pring-osgi.xsd
Is this possible? Other ways to do it? Schema seems to still be in place. But valid?
I got some info from another source also indicating the fact that Spring DM merged into Eclipse Gemini Blueprint. As of version 3.0.0 of Spring framework this is valid.

I am confused with Hibernate Spring

I am rookie into Java and I am directly thrown into Hibernate and Spring. I have attended some training classes and I am following documents online from random forums and trying to run a test project. I have some set of questions to be answered.
What is the latest version of Hibernate that has come and where do I download all the dependent jars in one place?
What is the latest version of Spring that is out there?
Any links/blogs that shows me to configure a hello world or a similar implementation would be of great help with the latest versions of Spring and Hiberante!!
Thanks.
The project web page says it is Spring 3.0.5 Release
The project web page says it is Hibernate 3.6.1 Release
Hibernate and Spring tutorial
Rest you will find using some web search like google.com or bing.com or altavista.com
I highly recommend you check out Spring Roo. There is a super duper quickstart.
Although its touted for doing Code and JSP scaffolding I find its biggest benefit is setting up your project in a very canonical and java/spring best practice setup.
It will setup maven and all the dependencies you will need. The default Maven Pom file alone is a big time saver.
If you don't want to use Roo you can easily just strip it out of your Maven pom file after your done doing the initial scaffolding.
The other option is using a Maven Archetype like AppFuse but I haven't used this in quite some time and I find Roo easier.
What I don't recommend is wasting your time writing an Ant script and then trying to cobble together all the dependencies.

Categories

Resources