EmbeddedServletContainerAutoConfiguration and ServerPropertiesAutoConfiguration in Spring Boot 2.0 - java

when updating our project from Spring Boot 1.5 to 2.0 the classes EmbeddedServletContainerAutoConfiguration and
ServerPropertiesAutoConfiguration were gone, although we need them desperately. When I search the internet doe those classes, I can't find any replacements for this classes. So my question is: Have those classes been removed with Spring Boot 2.0? If not, where have they been moved to? Or how I can replace them?
Thanks in advance.

EmbeddedServletContainerAutoConfiguration has been renamed to ServletWebServerFactoryAutoConfiguration by this commit during work on restructuring embedded web server packages.
ServerPropertiesAutoConfiguration has been removed by this commit during work on the following issue. Those properties objects are now created using
#EnableConfigurationProperties only.
Note: It might take some time for GitHub to show you particular line number.

Related

Spring 3 and org.springframework.messaging

I maintain a system that uses Spring 3.1.2-RELEASE, and this cannot change. I added code to test the JMS endpoints, but it will not run because of missing class org.springframework.messaging.handler.annotation.support.MessageHandlerMethodFactory. I read here that the org.springframework.messaging package is distributed in the spring-messaging artifact. However, this does not appear to exist in Spring 3, only Spring 4 and later. I read here that I must keep versions consistent.
So then where can I get this package for Spring 3.1.2-RELEASE?
You are right, things get messy when you mix Spring versions.
So then where can I get this package for Spring 3.1.2-RELEASE?
Probably not the answer you want to hear, but you may need to find an alternative means of testing. According to the javadoc, MessageHandlerMethodFactory wasn't introduced until Spring 4.1. Looking at the maven repo, the Spring messaging module wansn't available until 4.0.

Using FatJarRouter when upgrading camel-spring-boot from 2.18 to 2.19

I was hoping I could get some clarification on a little problem we've been having.
Our project has been using a combination of camel and spring boot. We've been using a bunch of Camel modules, all version '2.18.3'.
Notably, we have been using the Camel module 'camel-spring-boot-starter', which depends on the 'camel-spring-boot' module which gives us the FatJarRouter class that we have been extending on our main class.
Recently, I've been trying to upgrade the main dependencies in our project, including Camel and spring boot. I've upgraded 'spring-boot-starter-parent' to version '1.5.4.RELEASE' and I've upgraded our Camel modules to '2.19.1'.
However, surprisingly, we found that the FatJarRouter class was no longer on our class path! I've tried looking through the change notes for 2.19, as well as Googling for more information but I can't find anything that mentions any change of procedure for using FatJars in Camel Spring Boot applications.
So my questions is this: Does anyone know if FatJarRouter has been removed or merely moved in Camel 2.19? If it has been moved, could you please point me in the direction of which artifact now holds it? If it has been removed, does anyone have any information on how FatJar applications should be tackled in Camel 1.19?
Thankyou for any help you can provide.
Its removed, just use regular RouteBuilder classes, see the existing examples for how to use Camel with Spring Boot: https://github.com/apache/camel/tree/master/examples#examples

Configuring Swagger with Play/Java-framework-2.5

I am trying to configure Swagger with my Play-2.5 project.
I followed this tutorial and it worked, but only for the older version of Play and not working with Play-2.5. As the project has migrated into Play-2.5, we had to remove the swagger configuration.
Firstly, the issue seemed to be with static controller vs non static controller in Play-2.5, but I ended up with proving myself wrong.
I am facing this error
type ApiHelpController is not a member of package controllers
GET /api-docs controllers.ApiHelpController.getResources
If any one knows any link for Swagger configuration with Play-2.5 for Java, please guide.
PS: there are tutorials available for Scala not for java.
Try this repo:
https://github.com/CreditCardsCom/swagger-play
I created this as a temporary workaround until we get support for Play 2.5 in the official swagger-play repo.
I have only used the Play-Swagger project from Zalando. There is a lot of documentation and the repo is kept up-to-date.
If you want a quick start you can take a look at their Activator Template - just run it and you will get the Swagger generated documentation (Swagger UI is already included). From there you can start tweaking it (look for the conf/echo.yaml file).
The problem is, the com.wordnik swagger-play2(What your tutorial is using as a library) breaks with Play 2.4 and up.
You can try this which uses a different one (io.swagger). I have used this and it works well with 2.4. But it also breaks with 2.5.

java.lang.NoClassDefFoundError: org/hibernate/cache/spi/RegionFactory - When upgrading from spring 3 to spring 4

I'm updating my spring project from 3.0.5 to 4.0.3.
Everything's building fine, but at boot time, when spring tries to create beans, I'm hitting this error message:
The class is of course not present in ehcache-core, hibernate-ehcache, or hibernate-core. In fact, the package spi just isn't present anywhere it seems. However, I've checked the maven dependencies, and it seems like spring 4.0.3 and hibernate 3.6.10 should be fully compatible. In my pom I directly depend on hibernate-ehcache, which in turn pulls in the appropriate version of ehcache-core automatically(apparently the done thing), like this:
My dependencies look like:
I've searched extensively for this error, but can only find a couple of references to it. Given it's obscurity, I'm guessing it's a configuration within my project somewhere that's referencing this RegionFactory class, however, despite much searching, I can't find a thing.
Any ideas how I can get this project building with spring 4.0.3??
I can provide any additional data you need.
The key is to get the project building against Spring 4.0.3.Release. Whatever version of hibernate or ehcache enables me to do that doesn't really matter. Obviously My preferencs would be pom changes over reconfiguring over changing code... but I'll take what I can get at this point.
EDIT:
I'm trying to avoid updating my hibernate past 4.x.y as this project is very large and uses HibernateDaoSupport and HibernateTemplate very extensively (thousands of independent usages which would take a long time to refactor)
Update the Hibernate Version.
After Hibernate version 4.0.0.Final they chage the package from RegionFactory.
3.6.10.Final:
org.hibernate.cache.RegionFactory
4.0.0.Final:
org.hibernate.cache.spi.RegionFactory.

Learning resource for configuring Hibernate as JPA 2.0 provider on Tomcat Apache with MySQL

I am trying to created a new java project. I have tried various examples available on the web but my project works sometimes and doesn't rest of the time. It seems that there happens some error which is not thrown when hibernate is doing a secondPassCompile() after creating factory.Can someone tell me a good resource to follow or give me some pointers on where I might be going wrong?
Is there any particular reason for using Tomcat? If you are trying to learn Eclipse with Hibernate as the JPA implementation, I would suggest you use JBoss as the app server. That way you can learn EJBs along the way if you prefer. If you want to learn just Eclipse and JPA there is no need to use any server - JPA can be practised just in JavaSE.
EDIT: Recently I had to create a simple JPA project. This is what I did: Create a new Java Project in eclipse. Download Hibernate 3.6.1 from http://www.hibernate.org/downloads. From the download directory take the Hibernate.jar and from the jpa directory take the one jar there. Take all the jars from lib\required. Add the above to your buildpath. Add logback jars - classic and core jars. For the database I used HSQLDB. Just one jar hsqldb.jar. Thats it! Enjoy JPA from here onwards.
I have found the slides at http://www.coreservlets.com/ very useful when trying to get up to date with EJB3/Hibernate and JSF. Complete and yet simple enough that you do not get ovewelmed by pages and pages of sample code. I wish they had something like that for MFC.
They have materials about Hibernate, I would definitely look at them.
About the JBoss issue, it is interesting if you plan to go into EJB3 later. It is not difficult to have a basic configuration working and, on top of that, it is based in Tomcat.
That said, if you are new to Hibernate, I would definitely test it first in JavaSE and then later go with it in a server (Tomcat or whatever).

Categories