I'm using spring 3.0.5 for a web application running on Tomcat (Yeah, I know it's very old).
And in my REST methods I'm trying to have my #RequestParams validated in terms of Min / Max for numeric values, and MaxLength for String values.
I'm familiar with the Spring 3.1 #Validated annotation, and in my version it doesn't work.
Is there any solution suitable for older spring versions?
Thanks
This is achieved through JSR 303 / hibernate validator.
Create a Validator instance / create custom validator instance.
As in your case its older version hence you can achieve the same using below documentation.
https://docs.spring.io/spring/docs/3.0.0.RC3/spring-framework-reference/html/ch05s07.html
Related
After upgrading to Java 17 and Spring Boot 3.0.1, jakarta is also replacing javax. You can add as many datasources as you like, as long as they share the same username/password and driveClassName. However, what if you have two datasources with different creds? There doesn't seem to be an equivalent to how javax handles this. i.e., see first answer here with the Config class...
Spring Boot configure and use two data sources
What is the jakarta equivalent or how do we configure this?
Can you use hibernate 4 with Spring boot 5? I am trying to integrate hibernate 4 with Spring boot 5 since I want to use Hibernate 4 functions and API instead of 5, but I am using Spring boot 5 and getting errors such as conflicting directories between Spring boot Hibernate and custom Hibernate.
I am using Spring 5.2.3 with Spring Boot 2.2.4.RELEASE
and I want to use Hibernate 4.3.x
In the list of supported Libraries for Spring 5.x, we can see Hibernate as 5+
https://github.com/spring-projects/spring-framework/wiki/Upgrading-to-Spring-Framework-5.x
Spring 5x is compatible with hibernate 4x unless you are using it as an implementation of JPA which might not be compatible.
A suggestion would be using the latest hibernate.
1. Were global-session scoped beans removed from Spring 5?
Official documentation no longer mentions it.
SCOPE_GLOBAL_SESSION is no longer part of RequestAttributes:
Spring 4: https://docs.spring.io/autorepo/docs/spring/4.2.4.RELEASE/javadoc-api/org/springframework/web/context/request/RequestAttributes.html#SCOPE_GLOBAL_SESSION
Spring 5: https://docs.spring.io/autorepo/docs/spring/current/javadoc-api/org/springframework/web/context/request/RequestAttributes.html#SCOPE_GLOBAL_SESSION
2. If 1 is true: why were they removed?
Update:
Found a commit that removes the stuff. Seems it is because of dropping of Portlet:
See commit : https://github.com/spring-projects/spring-framework/commit/2b3445df8134e2b0c4e4a4c4136cbaf9d58b7fc4#diff-42e7410c98a33ab499e5c27858b1c985
Yes. That SCOPE_GLOBAL_SESSION is for sharing session across Portlets and Servlets. And Portlet supported is removed in Spring 5 in SPR-14129 because of :
Spring's Portlet MVC support turned into a second-class feature in
recent years, never having been updated to the modern-day
HandlerMethod infrastructure that Servlet MVC is based on these days
(since 3.1 already, with the old Servlet MVC variant deprecated since
3.2). Furthermore, the Portlet 3.0 specification intends to introduce annotation-driven dispatching itself, so there is no strategic place
for Spring Portlet MVC either, even within its present niche. And last
but not least, common Portlet environments seem to be stuck on Spring
3.x, not even upgrading to Spring 4.x yet.
We will therefore drop Portlet MVC support completely as of Spring 5,
while at the same time introducing our Reactive MVC variant. We intend
to keep supporting (but not recommending) the use of Spring with JSF
in a Portlet environment, in particular through Spring Web Flow. For
all other purposes, Spring Framework 4.3.x will remain supported until
2020, including its Portlet MVC support (and underlying Servlet 2.5
support).
I am going to create simple rest service using spring 3 and hibernate 3. There is no chance for me to use higher version of spring due to legacy business component that is based on hibernate 3.
For such purposes I've tried to use SpringApplication.run, bet recieved following exception:
Exception in thread "main" java.lang.IllegalAccessError: tried to access method org.springframework.core.io.support.SpringFactoriesLoader.loadFactoryNames
Is it possible to use spring-boot-maven-plugin with old spring version? Would be good to know any alternative ways in this direction.
Spring Boot (and all the related tools, e.g the maven plugin) expect Spring v4 and above. Please see the official documentation here.
By default, Spring Boot 1.3.2.BUILD-SNAPSHOT requires Java 7 and Spring Framework 4.1.5 or above.
I am using Hibernate 4 CR1. My application was previously using Spring hibernate support (for version 3).
I have not been able to find any information about this - is there any indication as to when (or which version) Spring will provide support for Hibernate 4?
UPDATE: Spring Framework 3.1 goes GA
You need to upgrade to Spring 3.1.0.RC1 released today:
Spring 3.1.0.RC1 Released:
Support for Hibernate 4.0 (up to date with 4.0 CR4)
As per comment of one of the guys is is involved in the spring project it seems that they started working on hibernate 4 support:
http://forum.springsource.org/showthread.php?115682-Migrating-application-context-configuration-to-Spring-3.1-and-Hibernate-4.0&p=382864#post382864