Deploying Multiple Grails Apps With Spring Security Against Same Oracle Database - oracle

I have an existing Grails app which includes the Spring Security Core, Spring Security UI and Searchable plugins running on Tomcat against Oracle.
I have a new Grails app which will utilize the same plugins. Both apps customize the Person (User) domain class with different fields.
When I tried to deploy the second app against the same Oracle Database as the existing app NONE of the Spring Security classes were created. As a secondary issue there appears to be an issue with the Searchable plugin trying to create indexes. Clearly an oversight on my part that trying to deploy this.
Does anyone have any experience with an issue like this? Any workarounds you can think of? The obvious choice to deploy the second app against a new instance of Oracle, but as you can imagine this is less than desirable. My fall back plan is to merge the two applications, although this would be a great deal of work. Any advice or thoughts would be appreciated.
Much Thanks
UPDATE:
Still unsure of why the second deployment did not work, I would up rolling both apps together in order to deploy.

Related

How to deploy Spring Boot MVC project for others to see?

I've made a spring boot project called student-management using spring MVC, Thymeleaf, spring data JPA and MySql. When I run it locally on localhost:8081 it works perfectly. I made CRUD operations so I see all the changes in database when changed on the website and vice versa.
Now, I need to get my website "out there" for others to see, specifically a company. I'm new to Spring boot and everything that goes with it but I don't understand how to deploy my rather simple website so the company can access it by not using localhost.
This is my project_hierarchy. As you can see it's quite simple.
This is my StudentController.java. I've used #Controller and maybe I should've used #RestController. If so, how do I change it to #RestController so that my website still works.
My thymeleaf html files students.html edit_students.html create_student.html
Deploying remotely means choosing a host (e.g. AWS), setting up infrastructure, deploying your executable JAR with dependencies, and running it on a server.
You'll need to set up a separate MySQL instance and connect your app to it. That means you'll set up the database server, create the database and schema, and start it up before your app starts.
You should be thinking about security and who should be able to access your app and data. Most developers who have only deployed locally tend to put off those considerations. I'd urge you to think about them sooner.
If your purpose is to provide access inside your company, only to employees, perhaps you'd be better off making your local machine available to others on the network OR choose a server that's already on your company network. You'll have to work with others to make that happen.

Making a simple invoice web app with Spring but which technologies is advisable?

I am going to teach myself some Java EE and making a simple web portal where people can generate their own invoices(pdf lib is needed). Not asking about any code but can you give advice (examples) which technologies I can make use of through the process? I have decided to use "Spring MVC" as the framework + java/Kotlin as a compiler. Some database + server + email+ some micro services?, are needed but which can it be? Thank you!
If you are trying to implement microservices, i prefer spring boot which has embedded tomcat with additional services, and for database you can use open source mysql
if you are also planning for UI stuff and new to it prefer basic Html,css and Bootstrap
If I am there here are my choices. All these choices are based on my past 4 complete end to end web application project experience.
Spring Boot
Using spring boot create micro services. As it has in built tomcat it will be easy to deploy any environment, either local laptop or on premise server or cloud server.
JPA with Hibernate
If you are looking for free you can choose MYSQL. As it has strong community support
almost all the issues you are going to face would have been asked and answered already under stack overflow or somewhere else in the internet. Another think is as you chose JPA you can switch to any database easily.
React
As of now the simplest and one of the fastest ui framework. Also it has strong user support. You can find answer to almost all questions you will have on internet.
Apart from all, you can extend any of these technologies. Happy Coding!!!
You may want to consider using Jaspersoft for generating your pdf files:
https://www.jaspersoft.com/reporting-software
https://community.jaspersoft.com/wiki/introduction-jaspersoft-studio
There may undoubtedly be other solutions out there, but this is the one I'm most used to.

How to make Spring Hibernate Application enterprise ready?

So, I have my application based on spring and hibernate. The user produces some data (in my case the data is kind of development itself) which is persisted by hibernate.
But for now this won't be accepted by large enterprises. They want to have a development enviroment, a test environment and a production. What I need to implement is a way to deploy data from one environment to another.
To be clear: I am not asking about deploying the application, but its data.
Are there best practices to implement this feature?
To maintain DDL and use same across various environments use liquibase or flyaway which also integrates with seamlessly with spring.
If you want DML to be migrated then vendor specific data migration can be used.
I think you are mostly looking at DDL only so either of above is better solution

The best web login approach

I am developing a jsp dynamic web project on eclipse.
I want to create an website with login functionality. I intend to store users' accounts and passwords in MySQL database. Of course, different users have different roles and rights to access different web pages. What is the best approach to implement it?
So far, I know these approaches:
1) Users enter accounts/passwords in login.jsp. LoginServlet then connects to MySQL database to check if it is correct. AuthenticationFilters will make sure only users with rights can access certain pages.
2) Use Role Based Authentication by declaring user roles in web.xml. I find this approach is not flexible, because I need to declare roles in advance.
3) Use HttpServletRequest's login/logout methods. I have not studied it.
Is my understanding correct? Could someone gives me some suggestions? Some clues would be very helpful!
Besides, I know that using POST alone to send passwords is not safe enough. Many websites suggest to use HTTPS connections. So if using HTTPS connections, does it affect the approach I choose to implement the login function?
Thanks!
--
Now, I know I need to use Spring. But Spring seems difficult for me... In Spring website I cant find out the link to download jar files. The user guide says I need to use Gradle or Maven, which I haven't used before, and have no idea why I need them. Besides, there are many Spring projects. Which one should I choose? Spring framework?
--
Have you looked into using Spring Security? It's built for just that. You don't need to be familiar with Spring but it may help.
Here are a couple of tutorials that use database authentication:
1: Spring Security Authentication and Authorization Example with Database Credentials
2: Spring Security Login Example with Database
Edit:
You don't have to Maven or Gradle. You can simply add the jars to your build path and they will work. The only projects you need to implement for the login to work is the Spring Framework and Spring Security.
To use Spring Security without Maven or Gradle:
Download the Spring Framework jars, unzip them, and add them to your project and build path. It's probably a good idea to find a hello world tutorial using Spring to get you started. A quick Google search should turn up many results.
After you have Spring implemented in your project, download the Spring Security jars, unzip those, and add them to your build path. The links to the tutorials that I previously posted will get you started. They may take a little while to go through and you may not understand exactly what is happening behind the scenes, but once you get it set up is works outstanding. I'm also not sure if you are using xml configuration or Java config but I believe those tutorials are for xml.
Spring Security was built so that it could be added to any project and have you up and running with basic configuration in about 15 minutes. After you get the basic login going (it will use the generic login form), you can search for how to implement your own custom login form, add permissions or restrictions to users and url patters, adding custom filters, etc. I encourage you to spend some time learning it as it is highly flexible and customizable.

Spring 4 vs Grails - Open Source Plugins

I have used spring 3 but not sure what is the equivalent of a grails plugin. And now need to suggest a stack for a new app. Looking at grails it seems to be great for making data base models and has a lot of plugins. but it seems its more expensive at runtime.
So my question is that is there a equal or better repo of spring for every little thing you can need like facebook login or other social actions, ajax upload, joda etc or is this what we call a dependency and some code from a blog/ stack?
Is there any repo of small reusable code like we have on grails plug ins for regular spring mvc projects?
I know that your question is about pure spring alternatives, but I would honestly recommend just using Grails. I've done projects in both stacks. If you want to get rid of the configuration headaches and get started quickly on a new project while staying within the Spring stack, it is the way to go. It is a great framework and some of my employers have many production Grails applications supporting thousands of customers.
You can also upgrade to Grails 3 when it comes out next year and take advantage of the leaner code they provide in it due to Spring Boot!
You may need to check into Spring Boot. It does not provide a full stack framework, but it is hiding much of the extra coding you may need to do for a spring application. There are some new projects that enable you to get the benefits of spring boot. Check the below projects:
1- http://jhipster.github.io/ , use it if you need to make SPA with AngularJS also have commands to generate Entities for you using Yeoman
2- http://lightadmin.org/ , use it if you want to create CRUD pages based on Spring Data Entities
For both, you may have to use Spring Data and maybe even Spring Data REST. These may be helpful too.

Resources