How can I update Spring and Hibernate libraries in NetBeans IDE? - spring

Probably, it's a common and obvious issue, but I couldn't find the answer, so, a short tutorial or a link would be appreciated. My NetBeans has been recently updated, but if I create a new project, that uses Spring and Hibernate, the IDE provides options for Spring 3.0.2 (and even 2.5.6) and Hibernate 3.2.5. Of course, I could add manualy all the new libraries for each project, but it doesn't seem like a good idea. Just in case it's important, I use Ubuntu.

I think I've found a way to do that. In NetBeans's menu Tools/Libraries there are options for creating new libraries and adding its jar files or folders. I tried to add new Spring libraries (I didn't have a chance to put spaces in its name) and they appeared as an option of Spring MVC version when creating a new project.

Related

Really removing a package from a Spring Boot / Maven / IntelliJ project

I'm building a web server using Spring Boot, Kotlin and IntelliJ and am learning a lot. I added Thymeleaf but decided later than it didn't meet my needs, removed it from the POM and rebuilt the project.
On startup, Thymeleaf was still looking for the /templates/ folder (which I'd also removed), even though Thymeleaf was no longer a part of the project, supposedly. A project-wide search (shift-ctrl-F) for thyme, case-folding, found nothing, so I closed the project and used the GNU find command-line utility to search for thyme in the project hierarchy. That found references in project.iml and some .xml files under .idea/libraries. I removed those, re-opened and rebuilt the project, and it no longer mentioned /templates/ or Thymeleaf on startup.
So my question is: what would have been the 'official' non-hacky way of removing the Thymeleaf package from my project? I am now wondering what other unwanted libraries are in the project, and how I should remove them.

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.

How to use Maven, Spring, Hibernate (JPA) on Netbeans or Eclipse

Being extremely very new to Java EE, I am trying to build a rest api with a database layer.
I am using Netbeans 7.2 and Glassfish because they were easy to install on my Mac OSX Lion. From netbeans I open a project with Maven, choosing archetype weby. What I am going for is Maven, Spring, and Hibernate with JPA. Also I am using restlet for my Rest API layer. Anyway, the tutorials I find online, along with the book Spring persistence with Hibernate [electronic resource] / Paul Tepper Fisher and Brian D. Murphy keep refering to /src/main/resources/META-INF/spring/spring-master.xml. But the project has no such folder. Instead the project has the /main/resources/hibernate.cfg.xml and a folder about jdbc connection.
Basically I am stuck. Some questions:
Am I using the correct Maven Archetype? Is there another way to get what I am looking for (using Netbeans or Eclipse on my Mac)?
I don't want to spin around too much, which is why I have not manually added the /src/main/resources/META-INF/spring/spring-master.xml, especially since I am not sure what to put in it.
Others opinions is greatly appreciated.

No AspectJ getter/setter -- upgrade Roo from 1.1.5 to 1.2.1

I am upgrading current project from Roo 1.1.5 to 1.2.1.
I have noticed there are some new features in Roo 1.2.1 to facilitate JPA functionality, i.e. #RooEntity to #RooJpaActiveRecord, but I thought when I open Roo shell in STS it could handler that conversion automatically...I can still achieve that manually, however, after I change the annotation name, no matter I use poll now or re-build the project, all the getter/setter/finder/entityManager are error out due to no AspectJ injection, actually I can see the aspectJ files are generated, STS just cannot identify them with the entity java file. So suddenly the whole project falls apart.
Please, geniuses on the stack, let me know how to fix that. Many thanks in advance.
I have figured out the solution:
Simply speaking: make sure running the project as a Maven project.
How: Right click project->Configure->Convert to Maven Project. Then run Right click project -> Maven -> Update Project Configuration.
Maven will build the project once again with aspect injection. I think the problem is previously my project is compiled under Spring Tools -> Update Maven Dependencies where if the STS/AspectJ Tool stop working, then the project will suffer from missing aspect injection(still thinking it is could be a remaining bug of STS, this issue may be very specific but still STS fail the job).
Sorry I have to answer my own question
Make sure you clean your project eclipse style. That is run Project->Clean.

Resources