I am about to start to learn Spring Framework. For that, I had to set up the runtime environment in which I am having a problem. I have installed java and Spring boot CLI. I had set up all the paths as well. However, I get an error of
An error occurred during initialization of VM
Unable to load native library: The specified procedure could not be found
whenever I type spring in cmd.
When I google about this problem, I found a whole lot of complex stuff, and I am just beginner. Any help will be appreciated.
Basically, java and maven/gradle are pretty much the Spring Boot starter pack.
There are lots of examples of how to start development with spring boot, especially on the pivotal site itself.
For example:
1 - Developing Your First Spring Boot Application
2 - Building an Application with Spring Boot
Also, i recommend you start first through the initializr. Later, you can look for more advanced tools and/or options to manage your project.
Related
We have a legacy webapp that we would like to upgrade to Spring Boot 1.5.8.RELEASE. We have run a load test on the legacy webapp and then ran the same load test on the version where we migrated to Spring boot while profiling the app using YourKit. We see saw ~50% slower for response times in the migrated app. It's a REST API webapp. We found that there were 2 areas where we saw slowdowns.
mysql methods (e.g. com.mysql.jdbc.PreparedStatement.executeQuery() PreparedStatement.java)
ApplicationFilterChain
The mysql method is shown as a hotspot in the Spring Boot app, but not the legacy one even though we're using the same mysql connector and same DB configurations.
Things we checked/tried
We checked that the dependency trees are identical
All app configurations are identical
We are running the tomcat in the legacy app and using embedded tomcat in Spring Boot
Questions
Are there are any areas we should be looking into?
Are there good resources on the web for identifying and fixing performance issues during Spring Boot migrations?
What have been your experiences with migrating to Spring Boot?
How else should we be using YourKit to identify performance issues?
Dependency Differences
mvn dependency:list
Diff of the two dependency lists from calling mvn dependency:list
I have a web application created using Spring boot and I am using Spring Tool Suite(STS) for developing it. If my understanding is correct, tomcat is internally embedded in STS and I can run/debug the application from STS with the help of Application.java.
Now my doubts are, when we run the application by running a java class as 'Spring Boot App'
What is the deployment deliverable?(ear/war)
Where exactly the deliverable getting deployed? I have searched
everywhere in STS directories and could find it
If there is nothing like this, then how is it working?
Do this make sense or am I wrong with my understanding?
Your understanding about Spring Boot is wrong.
The embedded Tomcat is included on your application, when you use Spring Boot.
Spring Boot generates a .jar file. When the application is started, Spring knows how to bootstrap a Tomcat instance for you
If you are using the "Run" command on STS, there is no deliverable yet. The main method on Application.java has everything that is need for Spring run your application
Spring Boot is a project dedicated to create stand-alone Spring applications. As I said on first item, Spring Boot knows everything that is need to bootstrap a new Tomcat instance and run your application. You don't need an application server when working with Spring Boot, Spring provides by a embed Tomcat/Jetty or Undertow. The Tomcat is INSIDE your application with your code, not an external application server.
I am trying to build a user authentication system for my Java web application, a basic inventory management system. I want to use AWS Cognito to keep track of all user information, and I am planning to deploy this app to Elastic Beanstalk, where it will also use some AWS database storage (DynamoDB or RDS, to be determined) to store the inventory data. This is my first Java web application so I am having a bit of a hard time understanding how the different technologies can work together.
After doing some research on building a user authentication system for a Java web app, it seems that Spring MVC would be a great framework to use as it would eliminate a lot of the grunt work with building a login system. However, pretty much every guide I have come across for a Spring MVC login system in Java requires Gradle or Maven. (I would be using Maven since I'm more familiar with it.) This is fine for when I'm running my project locally, but I'm concerned about how this will work when I want to upload my project to Elastic Beanstalk. It seems that the only way to deploy a a Java application from Maven to Elastic Beanstalk is with a open source project called Beanstalker, and I'm worried that if I develop my application using Spring MVC and Maven, when it comes time to put my project on Elastic Beanstalk I won't understand how to use this tool/it won't work properly.
So here are my main questions:
Would Spring MVC be a good tool to use in building my user authentication system? Is there a different framework I should look into?
Does using Spring MVC absolutely require the use of Gradle or Maven, or is there a way to build a user auth system with Spring MVC without it?
If I do use Spring MVC to build the auth system with Maven dependencies, will I have a hard time deploying it to Elastic Beanstalk, or am I overthinking it?
Thanks for any information, I greatly appreciate it.
Sure
Spring MVC does not require a specific dependency management tool
No more difficult than deploying any other Java app to EB
Note, you dont have to deploy using Maven just because you use Maven for dependency management. You would typically use the official Elastic Beanstalk command line tool to deploy your application.
There's a specific version of this question and a general version; I'll ask it both ways.
Specific Question
We have a traditional Spring Web application that integrates with Apache Camel that we're pushing to Cloud Foundry. It depends on a custom library that pulls in spring-cloud-security (and therefore, spring-boot-autoconfigure, among others). When deploying to Cloud Foundry, the Java Autoreconfiguration looks for WebApplicationInitializers on the classpath and one that it finds is JerseyAutoConfiguration. When it invokes that particular WebApplicationInitializer, we get annotation parsing errors. Is there a way to exclude that one? #EnableAutoConfiguration(exclude=...) doesn't work because this isn't happening during the AutoConfiguration step.
General Question
Is there a way, via web.xml or some other facility, to tell the Java Autoreconfigure code (included via the Java buildpack) to skip executing certain WebApplicationInitializers?
If you deploy the app as an executable instead of as a WAR then there is no scanning for WebApplicationInitializers (it's a Spring thing not a buildpack thing).
I have a Java desktop application which uses spring framework and I need to replace the Swing UI with a web front end. I understand that I will need to adapt many things to make things work with the MVC architecture.
My concrete question is the following:
Will my application now have to run entirely in the application server?
I would appreciate if anyone could point me to some documentation that goes through a similar process.
Thanks!
Technically yes, but Spring Boot makes it trivial to set up an embedded servlet container and package your entire application as a runnable jar. This is how we're deploying our applications to production; the only thing we need is a JRE on the server VM, and java -jar takes care of all of it.
I recommend using Maven with the Spring Boot plugin (there's also a Gradle plugin) with the repackage goal, and using the lightweight Undertow servlet engine instead of the default Tomcat.