How to add Spring functionality to Eclipse. [closed] - java

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I installed eclipse 3.8 on my Ubuntu and I want to add Spring to it. I guess I will have to installed the associated libraries to my build path, but where do I get them from?
Do I need to download something? Googling did not really help much.
Also, I have a related question. The framework is basically something that gives you libraries to work with, right? We can make use of those libraries and integrate them in our project.?
Thank.

You have two possible options to add Spring functionality to Eclipse:
Install Spring Tools Suite
The Spring Tool Suite is an Eclipse-based development environment that is customized for developing Spring applications. It provides a ready-to-use environment to implement, debug, run, and deploy your Spring applications, including integrations for Pivotal tc Server, Pivotal Cloud Foundry, Git, Maven, AspectJ, and comes on top of the latest Eclipse releases.
Install STS plugin for Eclipse
Well, if you are comfortable with Eclipse as a DE , you can install STS plugin for Eclipse that will essentially let you create and deploy Spring applications
Coming to your second question, Yes. These are basically libraries that are added to your project and you can use them. You can add these functionalities to your project in two ways:
Use Spring-provided JARS
This is a common method to basically, add and third party API to a Java Project. Download the jars related to spring. Include them in your classpath and use them like you would with ant Third party API. You can use the link Spring Projects to download the required spring library. Unzip it and copy to your classpath.
Use Apache Maven
This will let you manage your spring dependencies and is a hassle free solution to include the necessary jars to needed to build your project.
If you are totally new to spring check out:
Setup Spring from scratch

You can install STS, which by default comes with spring capabilities. Below is dowlnload url
http://spring.io/tools/sts

Install maven(m2e Eclipse plugin or through apt-get). Enable maven in your project, add spring dependencies in your pom.xml.

When you need a given set of jar files in your Eclipse project, the simplest way to do this is to copy-paste them into your Eclipse project, and then for each jar file right-click and choose Build Path -> Add.
This allows you to develop your program.
Then when you need to share the result with others, use Export -> Runnable Jar.
when you get more experienced you may want to use a tool that helps with downloading the jars you need and add them to your build path, and much more. Maven is nice for that, is used by many, but requires quite a bit of discipline.

Related

How to add a plugin-architecture in my Java application? [duplicate]

How would you implement a Plugin-system for your Java application?
Is it possible to have an easy to use (for the developer) system which achieves the following:
Users put their plugins into a subdirectory of the app
The Plugin can provide a configuration screen
If you use a framework, is the license compatible with commercial developement?
First you need an interface that all plugins need to implement, e.g.
public interface Plugin {
public void load(PluginConfiguration pluginConfiguration);
public void run();
public void unload();
public JComponent getConfigurationPage();
}
Plugin authors should then bundle their plugins into JAR files. Your applications opens the JAR file and could then use an attribute from JAR manifest or the list of all files in the JAR file to find the class that implements your Plugin interface. Instantiate that class, the plugin is ready to go.
Of course you may also want to implement some kind of sandboxing so that the plugin is restricted in what it can and can not do. I have created a small test application (and blogged about it) that consists of two plugins, one of which is denied access to local resources.
Use OSGi.
It is the foundation of the Eclipse plug-in system. Equinox is Eclipse's implementation (licensed EPL) and Felix is the Apache Project's implementation (licensed Apache Public License).
Eclipse provides a concrete example that OSGi can cover the points you mentioned (or you could just build your application on top of Eclipse RCP if you want a full Eclipse/SWT/JFace stack).
Since 1.6, there's been java.util.ServiceLoader which can be used if you want to code your own simple system.
But if you want anything more than basic features, use one of the existing frameworks.
Use PF4J.
It has support for Web, Spring and Wicket.
Easy to use and build the applications
There is also JPF (Java Plugin Framework).
I worked on OSGi for a week--an intense, nothing but OSGi week. At the end it was like a bad dream but I learned a lot.
I was able to get OSGi working (not easy, all examples are out of date, everything on the net is at least three years old if not five), but I had serious trouble getting it integrated into an existing project because of issues with the jar manifests.
In short, there are only a few obscure tools used for building manifests and they are not well documented (BND Tools is hardly obscure, but it is designed for a certain process in Eclipse). Also, most of the OSGi information available is not targeted towards application developers who have an existing desktop application.
This makes a lot of the context for the information foggy or inappropriate. Neil Bartlett's blog posts were the biggest help, but even those failed to get a working system (I grabbed some code from the Felix tutorial and pieced it together to get the embedded framework rolling). I found his book draft that he posted for free years ago, which is excellent, but the examples in Eclipse do not work because of changes in Eclipse OSGi support.
I think that recommending OSGi for solving the above stated problem is extremely poor advice. OSGi is "the right choice" but for a scenario as the one above, I think either JPF or some homegrown minimalistic framework is sufficient.
Years ago I started a project like that and I hope soon will be ready.I got inspired by projects like NetBeans and Eclipse but meanwhile it changed to something a little bit different. OSGi looks like a good choice now, but I didn't had a chance to compare it with my project.It is similar with JPF mentioned above, but in the same time different in many ways.
The basic idea which motivated me is to be as easy as possible to build Java application, with no separation between web applications, desktop applications or applet/JWS applications(of course this doesn't cover the UI - yet) as a core functionality.
I built the project with a few goals in my mind :
it doesn't matter if you build a web application or a desktop application you should start the application in the same way, a plain main method, No fancy web.xml declaration(not that I'm against having a standard web descriptor, but it doesn't go well with a plug-in system, where you add "servlets" - I call them RequestHandler(s) - dynamic at your will).
easy to plug in "extensions" around an "extension point" - something from Eclipse but a different approach.
self-deployable, since all the plugins are registered(XML files) the application must be self-deployable independent of the build system - of course there is an Ant task and a Maven MOJO which are the links with the ourside world, but in the end it calls the application and instruct it to self-deploy itself at a specific location.
borrowed from Maven, it can download code from repositories(including Maven 1 & 2 repositories) so your application can be deployed as a single small jar as long as you have access to the repositories(useful sometime, and basically this provides support for auto-updates - don't you love the idea to be notified by your web application that there is a newer version, it was downloaded and it just needs your permission to install it? I know I love that).
basic application monitoring about system health, email notifications in case of failures

Before moving to learn spring should need to know about Gradle and Maven? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm currently new in Java EE but good handling at core Java, and knows much about Servlet, JSP(little bit), Now planning to learn about Spring Framework, and i don't know anything about Gradle and Maven honestly, so do I need to know about dependencies? i mean what's the use of them before moving to Spring? thanks in advanced,
Help Would be appreciated!
They're all build tools, when you have small programs, adding dependencies and running regression tests are fairly straight forward. However as you start to have large prjects with complex hierarchies, using tools such as Makefiles or simple build scripts become very hard to maintain.
Don't worry, learning mavin takes < 1 day; gradle can get a bit complicated, but if you're just starting out, there's ample resources online.
I found this resource pretty indispensable when learning about gradle.
Personal experience, no.
You learn gradle/maven depending on which you use to build with.
If you get into Spring Framework you will pick it up along the way.
Gradle or Maven are build frameworks. They simplify and automate the job of collecting all your third party dependencies and packaging the complete application. You can get exactly the same results by creating a shell script or some other build tool.
Spring on the other hand is a framework which is used for specific functionality, but not for builds. The two things are completely separate.
Spring can even be used directly by downloading the .jar and manually adding it to your classpath. IDEs like Eclipse will help with this. Many projects still do this - they have a custom build framework instead of Maven, etc.
In short, learning Gradle/Maven is not required for using Spring. You should still learn them anyway, because they are widely used standards. However, there is no dependency and both can be learned separately.
Start with Maven and then jump to Spring. Maven has a concept called archetypes which will help create bare minimal Spring projects. The list of archetypes is published in the Maven site. Also when you want to learn spring you will need to work with dependencies between different components. So start with Maven basics and then jump into Spring otherwise you will have a constant struggle with the spring library and its dependencies.
Gradle is an elegant build system for working with large projects and is a better maven.

Good Development setup for Spring-MVC/Hibernate/MySql [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I'm staring a new project using Spring3-MVC w/ Hibernate and MySql and am envisioning the following development setup:
Maven
Eclipse IDE (Having used netbeans in the past, I want to give Eclipse a run)
Tomcat
Questions:
What will be the life-cycle of development?
I've developed struts2 applications with the GF application server and Netbeans IDE in the past. The setup and lifecycle of making a change has been quite slow. Making change to java code, netbeans building code, deploying to GF. I understand these are common points of working with java and webapplication unless I go the Grails way. However, now since there are a few container-less solutions for java web apps - does it make the process a bit fast/east?
Should I use the embedded Tomcat plugin?
In netbeans there is a way to add servers and start a maven project by associating the project with the server. Is there something similar in Eclipse?
Which version of Eclipse should I be downloading?
There seem to be so many I downloaded the javaEE version but it didn't have a way to start a maven project.
You can use embedded tomcat plugin, if you are going with Maven, go with maven tomcat plugin. And deploy your application with:
mvn tomcat:run
In netbeans there is a way to add servers and start a maven project by
associating the project with the server. Is there something similar in
Eclipse?
Yes you can add tomcat server in eclipse, and start/stop tomcat within eclipse, it also allows you to debug easily, by just adding the source projects.
Which version of Eclipse should I be downloading?
Latest :) Eclipse Juno 4.1 I believe.
For starting on maven project, check the maven getting-started guide
Also, you can use maven plugin for eclipse m2eclipse
If starting from scratch I'd recommend using spring boot.
Regarding eclipse, you should get the version 'for java developers' but not the EE version unless you plan on using glassfish or JBoss or some other EE container. Even if you did need the EE version I'd download and use it separately.
It has been a decade since Microsoft ASP.NET has conquered the entire web application development community.A latest alternative have been developed which is known as ASP .Net MVC development. Model View Controller (MVC) is the new thing in the present era that has caught the fancy of many web development companies.

how to integrate a Plug-in Project template into an existing eclipse project?

I have already developped a Java project using Eclipse.
Now I would like to integrate an help system to allow the user to open a guide.
Browsing other questions i found this tutorial to set up Eclipse environment in order to use the Eclipse Help System. Anyway, this tutorial and all documentation I found since now, only explain how to use this system creating a new plugin project.
But what about if I want simply add the help system to an existing Java Project created in Eclipse IDE?
Which step should I follow to update my project configuration?
Is it possible to integrate Eclipse Help system, without using eclipse?
No, the help system you point to is an eclipse plugin based system, useful with RCP programs. See http://wiki.eclipse.org/RCP It will only run in the context of an RCP application.
You might be able to write an RCP app that contains only help, launch it, and communicate with it through http from your java app, but it's not a simple integration ... and you still have to build your help documents so that org.eclipse.ui.help can see them.

What is the typical Java (Java EE) development environment in Software Companies? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I have been a project manager so far in a small company that focuses on PHP and .NET Development. No Java Development.
I learnt Java and J2EE 4 years back. I know things changed radically now. I would like to dive back to Java Enterprise Development. Can you guys tell me what the typical Development Environment is like in the big / small companies for Java / Java EE? Lot of friends who are in Java Development says, they use Spring and Hibernate.
What I would like to know is things like this...
Eclipse or NetBeans IDE or some proprietary IDE? Do we get to choose the one we are comfortable with?
Local or Remote Web and App Servers?
I see that when I create a simple Java Project using eclipse, it adds some eclipse related tags / classes in the config files. Is this acceptable?
And so on...
Hope my question makes sense...
Please shed some light. Thanks in advance!
Eclipse or NetBeans IDE or some proprietary IDE?
IntelliJ from JetBrains is the best Java IDE out there. That's what my team uses.
Do we get to choose the one we are comfortable with?
Depends on where you work. I think it makes sense to allow the workman to choose his/her tools.
Local or Remote Web and App Servers?
We use Spring, so developers use Tomcat to deploy locally. The web servers exposed to the outside world are maintained by others; usually IIS or Apache. The app servers are JBOSS 5.
I see that when I create a simple Java Project using eclipse, it adds some eclipse related tags / classes in the config files. Is this acceptable? And so on...
Your IDE should not add anything that you don't want. I personally don't care for Eclipse.
Eclipse or NetBeans IDE or some proprietary IDE? Do we get to choose
the one we are comfortable with?
It depends. In a company I last worked for, they loved NetBeans while I preferred Eclipse (more configurable than NetBeans IMHO). NetBeans, however, is now owned by Oracle (formerly Sun) and thus comes with integrated Java EE packages to start with Development right away (includes GlassFish and Tomcat bundled). Eclipse Java EE doesn't include a webapp server.
Local or Remote Web and App Servers?
That totally depends on the company.
I see that when I create a simple Java
Project using eclipse, it adds some
eclipse related tags / classes in the
config files. Is this acceptable? And
so on...
These config files doesn't affect your project when exporting it to JARS/WAR/EAR, etc. Those config (.project, .classpath) are basically your project information Eclipse uses. NetBeans does the same. If these do affect your project when exporting, rather use Ant/Maven to build your project.
You'll get as many answers as there are software companies.
I'll speak for mine:
Eclipse
Tomcat for local and remote
I'm not sure what you mean here. Eclipse will definitely need .project and .classpath files if you want to share project, but I am not sure that it adds tags to config files.
Definitely look into maven for builds, using it makes your projects ide-agnostic, and you can have people using eclipse or netbeans or whatever is their favorite and still be able to contribute.
The ones that are used in the Java shops around here are mostly Eclipse, with the latest version of Netbeans gaining popularity. Personally I find Eclipse to be decent and meets my needs, but YMMV

Categories