ananta-code / Spring-Example

Extensive Spring Example

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Spring Example 1.0

Build Status

####TODO:

    1. Test docker in windows
    1. How to do Http to Https forward in Embedded Jetty?

This is a skeleton project using spring.

The main idea behind this is to have a working java spring web and/or rest application up and running as quick as possible, seeing as creating a new java project is usually a very time consuming process.

Everything should be completely automatic with the exception of the database creation. Default database name is "example". It can be changed in application.properties.

spring.datasource.url = jdbc:mysql://localhost:3306/example
spring.datasource.username = root
spring.datasource.password =

So far, the project includes:

####RUN AS DEPLOYABLE WAR: http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#build-tool-plugins-maven-packaging

    1. Change package to war in pom.xml:
<packaging>war</packaging>

    1. Add this dependency in pom.xml, below the Spring Boot Starter Core dependencies :
   <dependency>
     <groupId>org.springframework.boot</groupId>
     <artifactId>spring-boot-starter-tomcat</artifactId>
     <scope>provided</scope>
   </dependency>
    1. Add this plugin in pom.xml, below the spring-boot-maven-plugin :
     <!-- Webapps Resources -->
     <!-- Since we already have the minified css and js and don't need the original files in the packaging -->
     <plugin>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-war-plugin</artifactId>
       <configuration>
         <packagingExcludes>resources/</packagingExcludes>
       </configuration>
     </plugin>
    1. Delete this line in pom.xml:
     <!-- Webapps Resources -->
     <!-- Since we already have the minified css and js and don't need the original files in the packaging -->
     <resource>
       <directory>${basedir}/src/main/webapp</directory>
       <filtering>false</filtering>
       <excludes>
         <exclude>resources/**</exclude>
       </excludes>
     </resource>

####REMOVE WEB CONTENT: If you don't need a WEB Application:

  1. Delete the folder webapp/webpages AND webapp/templates. You will then use thymeleaf only for email templates.

  2. If you want absolutely NOTHING to do with HTML and WEB pages:

  • Delete the webapp folder entirely
  • Remove ThymeleafConfig.java
  • Remove "Security configuration for web content" in SecurityConfig.java and change the security configurations to your liking
  • Delete Controllers' WEB folder
  • Remove LocalizationConfig.java and the resources/i18n folder
  • Remove MailerService.java
  • Remove thymeleaf configurations from application.properties
  • Remove all Thymeleaf AND WebJar dependencies from pom.xml
  • Remove this resource from pom.xml:
   <!-- Webapps Resources-->
   <!-- Since we already have the minified css and js and don't need the original files in the packaging -->
   <resource>
     <directory>${basedir}/src/main/webapp</directory>
     <filtering>false</filtering>
     <excludes>
       <exclude>resources/**</exclude>
     </excludes>
   </resource>

####WARNING: KEYSTORE IS INVALID. PLEASE CREATE ONE TO SUBSTITUTE.

About

Extensive Spring Example


Languages

Language:Java 85.5%Language:HTML 14.2%Language:CSS 0.2%Language:JavaScript 0.1%