How can I use Maven to configure BlazeDS AMF services with Spring? Obviously, I can’t just drop jars in my /WEB-INF/lib directory; I have to include the necessary dependencies, but many of the tutorials that exist refer to older versions or non-Maven projects. Thanks!
The pom.xml in the spring-flex-testdrive/testdrive project has all of the dependencies needed for the Spring BlazeDS Integration. You can get the spring-flex-testdrive from the Spring BlazeDS download page (just the regular Spring BlazeDS distribution).
Related
As of version 4 of Spring, these are the jars needed to use Spring AOP:
aopalliance.jar
aspectjrt.jar
aspectjweaver.jar
cglib-nodep-2.1_3.jar
spring-aop-4.0.0.M2.jar
But for version 5, what are the jars needed other than
spring-aop-5.0.2.RELEASE.jar
spring-aspects-5.0.2.RELEASE.jar
And where do I find them?
Following are the minimum set of dependencies that I required to run an annotations based Spring applciation
spring-context-5.2.2.RELEASE.jar
spring-beans-5.2.2.RELEASE.jar
spring-expression-5.2.2.RELEASE.jar
spring-core-5.2.2.RELEASE.jar
spring-aop-5.2.2.RELEASE.jar
spring-jcl-5.2.2.RELEASE.jar
and additional dependency for Spring AOP
aspectjweaver-1.9.5.jar
You may download the entire spring distribution based on the release from here or from any maven repository by searching with individual jar name.
I am working on building an oAuth2 application using spring boot. However, there are various sample projects in Github using spring-security-oauth2 and spring-cloud-starter-oauth2.
Do we have specific scenarios where we can use a specific jar among both for an application?
Though Spring cloud is mainly used for distributed systems. There are a lot of implementations on Github using spring-cloud-starter-oauth2 for even non-distributed applications. Thanks.
To resolve complex dependency management, Spring Boot starters were introduced. Starter POMs are a set of dependency descriptors (combines multiple commonly used dependencies into one POM) which otherwise you could also manually include in your application individually. Starters are available for web, test, data jpa, security, mailing and more. If it is not starter, it is a module: a simple artifact.
If you want to work with web, you could include tomcat, mvc and jackson all by yourself (manually) - a lot of dependencies for a single simple application. Instead, you just introduce one starter dependency:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
Coming to your question:
spring-security-oauth2 is an artifact of group org.springframework.security.oauth which supports oAuth2 (only) for Spring Security (not cloud), whereas spring-cloud-starter-oauth2 is a set of multiple dependencies like a starter web dependency above. This is OAuth2 starter for Spring Cloud that is only if you are working with Spring cloud. This starter comes with bundle of out-of-the-box dependencies underneath the OAuth2 framework for Spring Cloud like SSO, OAuth2 client.
Spring initially moved oauth2 to spring cloud started but as of version 2.4.0.M1 it was moved to spring security. You will be able to verify on start.spring.io that oauth2 cloud dependency is only in version >=2.0.0.RELEASE and <2.4.0.M1
Is Spring tightly coupled with Maven ? Most of the examples in the internet shows Spring and Maven to configure spring dependent jars, this post explains so many cons of Maven. All commercial projects are should to be using only this combination ?
Please explain
Thanks
Both of them serve different purposes, Spring examples use Maven because maven is highly adopted as a build, dependency management framework. That has nothing to do with Spring coupling with Maven. Spring is a framework to build enterprise applications and Maven is a build and deploy tool.
You can use Gradle, ivy or even manually download the libraries instead of relying on Maven as the dependency management framework.
No. You can use whatever you want to build your Spring-based app. BTW, all the Spring tutorials show examples using Gradle (that Spring also uses internally).
What is true, though, is that Spring jars are available from the Maven central repository and the Spring repository, and that their dependencies is thus described in a Maven pom.xml file. But nothing prevents you from downloading the required jars manually and add them in the classpath.
I see there are three JARs in Maven repo:
spring-data-rest-core
spring-data-rest-repository
spring-data-rest-webmvc
I have used webmvc JAR in the past, but not sure what/when to use the others.
Any insight?
I'm trying to use Maven 3 to create a project which uses Spring 3, Spring MVC, Hibernate 4, and JPA. However, when I execute:
mvn archetype:generate
Non of the archetypes listed include all of these; and even those which are close seem to be special projects such as projects with Flex. I want to avoid having extra modules such as Flex that would crowd the project and configuration files. So, is there an archetype for Maven 3 that I can use to create such a project?
A great Spring MVC quickstart archetype is available on GitHub, courtesy of kolorobot. Good instructions are provided on how to install it to your local Maven repo and use it to create a new Spring MVC project. He’s even helpfully included the Tomcat 7 Maven plugin in the archetypical project so that the newly created Spring MVC can be run from the command line without having to manually deploy it to an application server.
Kolorobot’s example application includes the following:
No-xml Spring MVC 3.2 web application for Servlet 3.0 environment
Apache Tiles with configuration in place,
Bootstrap
JPA 2.0 (Hibernate/HSQLDB)
JUnit/Mockito
Spring Security 3.1
Possible duplicate: Is there a maven 2 archetype for spring 3 MVC applications?
That said, I would encourage you to think about making your own archetype. The reason is, no matter what you end up getting from someone else's, you can do better in not that much time, and a decent sized Java project is going to end up making a lot of jar projects.
Take a look at http://start.spring.io/ it basically gives you a kick starter with either maven or gradle build.
Note: This is a Spring Boot based archetype.
With appFuse framework, you can create an Spring MVC archetype with jpa support, etc ...
Take a look at it's quickStart guide to see how to create an archetype based on this Framework.
Foundational frameworks in AppFuse:
Bootstrap and jQuery
Maven, Hibernate, Spring and Spring Security
Java 7, Annotations, JSP 2.1, Servlet 3.0
Web Frameworks: JSF, Struts 2, Spring MVC, Tapestry 5, Wicket
JPA Support
For example to create an appFuse light archetype :
mvn archetype:generate -B -DarchetypeGroupId=org.appfuse.archetypes
-DarchetypeArtifactId=appfuse-light-struts-archetype -DarchetypeVersion=2.2.1
-DgroupId=com.mycompany -DartifactId=myproject