I'm struggling with XML-less setup of a Spring project. Could you suggest some approaches to making this an iterative process? i.e. descirbe the steps of where to obtain configuration, how to find docs, which configs to define first, etc..
My goal is to implement a web app that supports websocket and I already found a very recent stock portfolio example https://github.com/rstoyanchev/spring-websocket-portfolio which works great, but when I try to create a simplest webapp that will have a very basic chat, I don't know where to start. I suppose this is all very new and not many are playing with this yet, but if you are, please share, I would be very grateful.
Update: My exact issue is how to dissect WebConfig java of the spring-websocket-portfolio project and rebuild it step by step to achieve a simple chat functionality. I have a spring project going, and it compiles and runs on tomcat 8 successfully(env is fine). the config file in question is this version: WebConfig.java.
What I am after is what is the best way to create something simple, a starting point, and build on top of it. By the way, the latest WebConfig.java has been much simplified by Rossen, but interestingly it has some compile issues and doesn't work.
Related
I need help here with the below issue. I am learning JMS and I am quite new to it. I came across a tutorial which I was following, however when I try to run this by selecting the project in eclipse I do not get an option to run on server. Is there a way we can run a simple java application on application servers?
Below is the link to the tutorial I am following
https://www.javatpoint.com/jms-tutorial
I have mostly worked with dynamic web projects for which the option is present to run on server.
I have not posted the code as it's the exact same as given in the tutorial.
For that you need to figure out which server(s) you want to deploy JMS. You can go with Weblogic or with ActiveMQ.
Below are the 2 reference links that would actually help you to resolve your query :
http://www.catgovind.com/java/test-weblogic-jms-java/
https://javainsider.wordpress.com/tag/jms-with-activemq-sample-example/
Yes, I would suggest you to go through spring-boot.
Here, you have an option to try a simple Hello World application
http://www.mastertheboss.com/jboss-frameworks/spring/your-first-jms-application-with-spring-boot
In the above example, you just have 2 java classes and one maven pom xml file to edit :)
Just try it out.
You can configure it to run from your eclipse too.
In/with spring-boot -
you don't have to do any web-server configuration on your own. Spring boot itself contains a web container.
It just creates a JAR file with which you can just run your application as "as your run a jar" which has your code + server.
And my last point is - you will get lots of support from different forums as spring boot is used widely.
I am trying to follow one of the basic Spring Security tutorials in order to have a foundation to test something more advanced afterwards. But the tutorial is not working. Here is the link:
http://docs.spring.io/spring-security/site/docs/3.2.x/guides/hellomvc.html
Here is what I have done so far:
1.) I followed the instructions explicitly up to the start of the section titled “Verify SecurityConfig is loaded”.
2.) I was then not sure what to do with the “Verify SecurityConfig is loaded” section because it does not give instructions, only explanations. So at first I just skipped it and moved to the section titled “Exploring the secured application, but Run As..Run on Server launched the unsecured app with no login required.”
3.) Next, I tried importing the MessageWebApplicationInitializer.java and RootConfiguration.java classes from the messages-jc sample mentioned in the “Verify SecurityConfig is loaded” section, but this caused a failure of the app to get launched when tomcat was restarted, with errors about beans of specific names not being resolved.
4.) So I started importing the classes for each of the named beans from the messages-jc project and resolving one error after another, but the number of these tells me that the author could not possibly have meant for readers to manually import so many classes that are not described in the tutorial.
How can I get this tutorial to work?
I really just want to add a custom login form, but I have to start with something simpler and build up with a tutorial.
A major problem with the Spring example projects is that they are rarely self-contained, so that a project never contains all the required code. One thus has to do a lot of detective work to figure out where else the example project is pulling code from. It would be nice to just have a simple example project that contains within the project all the code required to execute the project. Such nesting may explain the problems described above.
Note
I am using Eclipse Mars and Tomcat 8, not the STS and tc server. But this should not matter.
Edit
Diff command results in the following. How should I interpret it?
I did not scroll down to the target section since that is all generated, but I could if someone needs me to.
I'm trying to create a 'skeleton' framework of sorts for a basic java app.
One thing I'm looking to add is a version page/display that list the current framework/libs attached.
For example:
Skeleton version: 1.0.0
Spring: 2.5.6
Hibernate: Malbolge
The purpose of the Skeleton project was to make it very easy for a new developer to quickly start a robust app.
I figured the worst case scenario is that I could search through every framework jars manifest and use that... but that's no fun...
Anyone have a different suggestion? This would be a no brainer if the project was going to use Maven... I could just parse the pom.xml or something to that extent...
I guess a more defined question is:
Given a folder of libs; is there a way to dynamically gather the jars/frameworks version # without touching the manifest?
You can get the Spring version using the SpringVersion class.
I had a code snippet in a previous question:
Need Spring version# - only have spring.jar file
Using System.getProperties() gives you a listing of JVM properties including the different version ids of the JRE, JVM and specification. Not sure if this will give Spring etc versions.
before asking, please understand that my english is not good.
I'm using Class.forName(...) class in a servlet programming. when I access the servlet, I get a row of detailed controller information from Database indicating which controller to use.
This is Class.forName(...) I coded:
Class c = Class.forName(row.getControllerInfo);
c.newInstance();
This works fine, but there's a problem, i'm using Eclipse. The problem is that when I modified the Controller file, the changed contents were not applied to the server.,,.
Probably the easiest way is not to support dynamic loading. Much better to achieve something like dynamic update by supporting multiple servers. For development, you could get around redeploy delays by using JRebel (there might be others).
If you really do want dynamic loading of classes then the answer is "class loaders". I suggest having a look at those, and come back with any specific questions.
If I understood your problem true,
When you change any file of your project, you must deploy your project to server. If you use server from eclipse, republish may solve your problem.
have you tried clean - re-built and then deploying your application?
We are developing an backoffice application using Spring and Maven as configuration manager. The project is moreless divided in two parts, and one of this parts is just for manage the data in the DB tables.
Now someone has discovered Grails, and with Grails this job is very easy, but we can't drop all the job and start a new project (the other part is fine as is).
With this, we are trying to merge both. We've configured maven grails plugin, and now we can get dependencies and run grails tasks, not perfect yet, but almost. The big problem we have is that the first part of the project (the Spring part) has a directory structure a bit different of the one wich uses Grails. We want to change de structure of the Grails part, but we really don't know how to do it. We suspect we must use some of (G)ant to change the directory structure with a script, but we've no idea of first, how to make the script, second, how to use it from Maven, and finally merging the two parts. The libraries of both parts are compatible, so it is posible that putting everything together the thing works.
I'm not waiting the answer but something related with the gant script and maven would be great.
As second question, has anyone tried to do something like this? (merge or expand a normal spring project with one grails project?)
Thanks all.
I found Mastering Grails a very good presentation of applications a little bit more complex than Hello World!.
"Slapping" a Grails application on top of existing Java classes is described in Grails and legacy databases.
HTH
You want the grails-app/conf/Config.groovy file.
In it, add or set grails.config.locations { } to the locations you want to merge the spring app with the main gails app.