spring-boot-starter-aop only available for open source projects - spring-boot

I've just encountered an issue regarding licensing with spring-boot-starter-aop.
spring-boot-starter-aop comes with a non-optional compile transitive dependency to aspectjweaver.
aspectjweaver though is licensed under EPL 1.0 which as far as I understand requires any project using it to have its source code made public. Since we're developing a commercial product we cannot make the code public.
Does that mean that Spring AOP can only be used for open source projects? Or is this a problem only if I add the dependency through Spring Boot Starter. Is there any other way to use Spring AOP without aspectjweaver?
Moreover, other Spring Boot Starters have a dependency on spring-boot-starter-aop like spring-boot-starter-data-jpa (for some reason). But in this case I was able to exclude just the aspectjweaver dependency so there would be no licensing infringements and apparently the project still works as intended.

EPL does not prevent you from building closed proprietary software using EPL licensed libraries.
You don't need to worry - there are thousands of closed source projects built on the top of Spring AOP.

Related

Why does this pom.xml have references to javascript libraries?

I came across this pom.xml file of a sample spring boot project. I was surprised to see dependency section for client side javascript libraries like bootstrap and jquery inside it.
I would like to know what are these dependencies, what do they offer and is there any advantage of using them in a Spring Boot application?
This is a special project called WebJars.
It aims to package most popular JavaScript libraries into JAR files that could be used in the Java projects as a Maven/Gradle/etc dependencies.
Some of its benefits are:
you don't need to import all the JS libraries into your version control system (Git, for example)
you can easily manage JS libraries and its versions by updating and rolling them back, like you do with other Maven dependencies
other benefits (like resolving transitive dependencies) are listed on the official site
See also: Utilizing WebJars in Spring Boot
This allows a dependency management for js libraries/frameworks over maven. That's all.
Alternately, you could do this as well with bower or node.js

How to enable spring support in IntelliJ Community Edition 2016.1.3

I have very good pure Java basic knowledge. As long as there are no XML config and no project management tools involved, I am very good.
The things that really confused me are the project management tools, e.g.: Maven, Gradle.
I am learning Spring, and it is so confusing to me since it involves many XML files and there is no clear explanation for it.
I am learning Spring from this set of video tutorials, Lecture 6
Spring "Hello World".
I couldn't get a Spring hello world done because it requires a xxxxx.xml file to config the beans (Java object). To generate the XML files, I need to generate an XML file using a plugin on IntelliJ 2016.
The question is I can't find the plugin to generate a XML file for the bean by following this official tutorial. There is no such plugin called " Spring Support".
What should I do to generate the beans.xml? (The file to manage beans for Spring)
You can't enable Spring support with IntelliJ community Edition, it only available with paying version (Ultimate).
However, you can create the .xml file manually and CE version also supports it (a little bit).
To working with Spring or J2EE, you should get familiar with build tools like Maven, Gradle (or Ant in some special case). The concept is simple and you can get it easily from the official website (https://maven.apache.org/ - http://gradle.org/).
For Spring, if you are not familiar with creating a .xml file, you can use Java configuration instead or move to use Spring-boot to forget this configuration file (almost).
However, at first, I think you should get the basic concept of Spring and try to work well with .xml files configure. It'll be helpful in the future when you work with it deeply.
Let's take things one by one:
Your problem understanding builds management tools like maven and gradle. Try these links for tutorials: Maven in 5 Minutes, gradle is very advance build automation tool with continuous Integration features, you can find a good comparison between gradle and maven here.
If you are confused about spring to try this book: Spring in Action 3rd Edition (4th Edition is also available, I recommend 3rd edition as you will be able to link XML to annotations.)
You do not need any tool to generate XML files. Copy a sample spring configuration file from the internet, remove unwanted elements and write your own beans.
The Spring support plugin is a feature of IntelliJ IDEA Ultimate, which is a commercial IDE. It's not available in the free Community Edition.
You don't need any plugin to generate the beans.xml file; you can write it manually in the source code editor.
For Spring support, did you try "Spring Assistant" plugin ?
https://plugins.jetbrains.com/plugin/10229-spring-assistant
Good part it is it has active development.
Edit on Aug 21, 2020:
Seems like this plugin has no more active development. Its last release was in 2018 April.
No need to worry. We sill have some good news :-)
Its Github repository is here. We can clone the repo and make necessary changes what ever we specifically need.
I know you are asking about IntelliJ Idea but as it is a commercial tool, you should pay to let you use its plugins. Another way is using "Spring Tools for Eclipse" which is a great environment to develop Spring applications. But you need to be familiar with eclipse.
It can be downloaded from:
Spring Tools 4 for Eclipse

How do I implement dynamic reloading in Spring (Netbeans)?

I'm used to writing Grails applications where my view or controller changes are automatically redeployed on save. I'm now stringing together a Spring Web-
MVC application and I'd like the same feature.
I'm using Netbeans as an IDE, Gradle as a build tool and the spring-boot plugin at the moment. I remember some talk of people using Jetty as it's so quick to restart that dynamic class reloading / deployment is no longer necessary. I've heard others mention JRebel which I used to use a few years back. I'm sure there is a more modern, spring-supported / spring-standard way of doing it.
I'd also like to know if you recommend deploying as a WAR or as a standalone executable JAR with a lightweight built-in web server.
Recommendations appreciated.
A yet unsolved challenge
It turns out that the Netbeans Gradle plugin does not support "compile on save" out-of-the box - and this means that a Java Agent won't be able to pick up the changes. The author kelemen suggested one or two approaches around this. It's a non-negotiable for me, so I decided to switch IDE's to Eclipse (terrible Gradle support), then IntelliJ Idea - which is looking very promising.
Netbeans Gradle Author Comment: https://github.com/kelemen/netbeans-gradle-project/issues/183
Alternatively, there is Jrebel, which is claimed to be able to support this Netbeans / Gradle combination. I wasn't able to get it working easily using a trial of JRebel. The JRebel support guys are there to help, so if you're willing to pay the price, it's likely that their support team will solve your problems.
JRebel: http://zeroturnaround.com/software/jrebel/
If anything changes, please comment below...
Spring class reloading is supported by HotswapAgent as well. It is free alternative to JRebel.
Spring has their own agent as well: https://github.com/spring-projects/spring-loaded. While developing why not just use embedded Tomcat/Jetty provided by Spring Boot.

Spring2.x and Spring3.x maven dependency

i have a question about maven transitive dependency.
i have a project A and dependency the project b and spring 2.x but the project b dependency spring 3.x
you known the spring framework splited several modules.
so the problem as below.
if i exclusive the spring3.x dependency in project A i'm afraid the project can running because the project b need spring3.x api and project A dependency B
if i remove the spring2.x in project A ,i'm afraid the project A can't running too,maybe some old api be removed at spring3.x
anybody have some solutions for this scenario
This is not a maven or spring issue - its more related to the design of your software. You need to make a decision which spring version you are going with. Usually upgrading spring is not the biggest mess, sometimes you need to change the set of dependencies as they move stuff around - but Google is quite helpful with this - or findjar.com.
I assume both A and B run in the same process (or classloader)? You are not deploying them separately? So you need to decide which spring version to use. If you can't change dependencies in project B use their spring version. If you can: take the newer one and upgrade spring in project B.
Maven sadly does not include a magic jar mechanism. If you need different versions of the same jar around something like OSGi might help - but thats a looooong shot. And a complicated one as well. And usually not necessary. Maven (as you have noticed) helps you to manage the dependencies. Which one to use is your choice to make.

How to make antlr 4 runtime as an osgibundle?

I have created a eclipse plugin and converted it to maven,which needs the dependency of antlr but when the plugin execute it says it cant find the required package. Then i came to know anltr is not osgi bundle. any one please tell me how to convert the antlr jar file into an osgi bundle.? The antlr dependency must support my mvenized eclipse plugin
The main ANTLR 4 project doesn't support this (see issue #689). However, I've recently created an independent fork of the project which aims to target a number of issues related to the use of ANTLR 4 in large(r)-scale and/or performance-critical applications. One of the items I'd like to implement is using OSGi for improved runtime versioning instead of the manual mechanism currently in place. I recommend filing an issue with this fork of the project so I can include these changes as part of my initial release.
https://github.com/tunnelvisionlabs/antlr4/issues

Resources