Skip to content

Commit 7493c9e

Browse files
author
trung.nguyenn
committed
Upgrate Spring Boot to 1.1.5; Add db_migration step; re-structure steps
folder
1 parent 6ef25be commit 7493c9e

File tree

106 files changed

+5605
-5509
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+5605
-5509
lines changed

README.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
springboot-angularjs-demo
2-
=========================
3-
4-
This code is an example of how to step by step develop an application with Spring Boot and AngularJS. It includes:
5-
0. Start a project (Maven & Spring Boot)
6-
1. Develop the business (Spring Core, JUnit)
7-
2. Persist data (Spring Data JPA, Hibernate)
8-
3. Make a REST service (Spring Web MVC, REST services)
9-
4. Validate the inputs (Bean Validation, Hibernate Validator)
10-
5. View by AngularJS (AngularJS)
11-
6. Upload a photo (common-fileupload)
12-
7. More secure (Spring Security)
13-
8. Production-ready (Spring Boot Metrics, Health, Tracing, Remote Shell)
14-
9. Deploy the application ('fat' JAR file, WAR file)
15-
16-
You can find the presentation slide for this code at http://www.slideshare.net/Soddino/developing-an-application-with-spring-boot-34661781
17-
1+
springboot-angularjs-demo
2+
=========================
3+
4+
This code is an example of how to step by step develop an application with Spring Boot and AngularJS. It includes:
5+
0. Start a project (Maven & Spring Boot)
6+
1. Develop the business (Spring Core, JUnit)
7+
2. Persist data (Spring Data JPA, Hibernate)
8+
3. Make a REST service (Spring Web MVC, REST services)
9+
4. Validate the inputs (Bean Validation, Hibernate Validator)
10+
5. View by AngularJS (AngularJS)
11+
6. Upload a photo (common-fileupload)
12+
7. More secure (Spring Security)
13+
8. Production-ready (Spring Boot Metrics, Health, Tracing, Remote Shell)
14+
9. Deploy the application ('fat' JAR file, WAR file)
15+
16+
You can find the presentation slide for this code at http://www.slideshare.net/Soddino/developing-an-application-with-spring-boot-34661781
17+

etc/contacts.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
001|David|David Byrne|Project Manager|[email protected]|123 456 7890|dbyrne90
2-
002|John|John Smith|Business Analyst|[email protected]|123 456 7891|jsmith91
3-
003|Diana|Diana Lopez|Software Architect|[email protected]|123 456 7892|dlopez92
4-
004|Sarah|Sarah Leggett|Software Engineer|[email protected]|123 456 7893|sleggett93
5-
005|Carol|Carol Ling|Senior Software Engineer|[email protected]|123 456 7894|cling94
1+
001|David|David Byrne|Project Manager|[email protected]|123 456 7890|dbyrne90
2+
002|John|John Smith|Business Analyst|[email protected]|123 456 7891|jsmith91
3+
003|Diana|Diana Lopez|Software Architect|[email protected]|123 456 7892|dlopez92
4+
004|Sarah|Sarah Leggett|Software Engineer|[email protected]|123 456 7893|sleggett93
5+
005|Carol|Carol Ling|Senior Software Engineer|[email protected]|123 456 7894|cling94
66
006|Pete|Petter Brown|Quality Analyst|[email protected]|123 456 7895|pbrown95

pom.xml

Lines changed: 88 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,89 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4-
<modelVersion>4.0.0</modelVersion>
5-
<groupId>com.kms.contact</groupId>
6-
<artifactId>contact-sbs</artifactId>
7-
<version>0.0.1-SNAPSHOT</version>
8-
<!-- uncomment for WAR deployment
9-
<packaging>war</packaging>
10-
-->
11-
12-
<parent>
13-
<groupId>org.springframework.boot</groupId>
14-
<artifactId>spring-boot-starter-parent</artifactId>
15-
<version>1.0.2.RELEASE</version>
16-
</parent>
17-
18-
<dependencies>
19-
<dependency>
20-
<groupId>org.springframework.boot</groupId>
21-
<artifactId>spring-boot-starter</artifactId>
22-
</dependency>
23-
<dependency>
24-
<groupId>org.springframework.boot</groupId>
25-
<artifactId>spring-boot-starter-data-jpa</artifactId>
26-
</dependency>
27-
<dependency>
28-
<groupId>com.h2database</groupId>
29-
<artifactId>h2</artifactId>
30-
</dependency>
31-
<dependency>
32-
<groupId>org.springframework.boot</groupId>
33-
<artifactId>spring-boot-starter-web</artifactId>
34-
</dependency>
35-
<!-- uncomment for WAR deployment
36-
<dependency>
37-
<groupId>org.springframework.boot</groupId>
38-
<artifactId>spring-boot-starter-tomcat</artifactId>
39-
<scope>provided</scope>
40-
</dependency>
41-
-->
42-
<dependency>
43-
<groupId>org.hibernate</groupId>
44-
<artifactId>hibernate-validator</artifactId>
45-
</dependency>
46-
<dependency>
47-
<groupId>commons-fileupload</groupId>
48-
<artifactId>commons-fileupload</artifactId>
49-
<version>1.3.1</version>
50-
</dependency>
51-
<dependency>
52-
<groupId>org.springframework.boot</groupId>
53-
<artifactId>spring-boot-starter-security</artifactId>
54-
</dependency>
55-
<dependency>
56-
<groupId>org.springframework.boot</groupId>
57-
<artifactId>spring-boot-starter-actuator</artifactId>
58-
</dependency>
59-
<dependency>
60-
<groupId>org.springframework.boot</groupId>
61-
<artifactId>spring-boot-starter-remote-shell</artifactId>
62-
</dependency>
63-
64-
<dependency>
65-
<groupId>org.springframework.boot</groupId>
66-
<artifactId>spring-boot-starter-test</artifactId>
67-
<scope>test</scope>
68-
</dependency>
69-
</dependencies>
70-
71-
<build>
72-
<finalName>contact</finalName>
73-
<plugins>
74-
<plugin>
75-
<groupId>org.springframework.boot</groupId>
76-
<artifactId>spring-boot-maven-plugin</artifactId>
77-
</plugin>
78-
</plugins>
79-
</build>
80-
81-
<properties>
82-
<start-class>com.kms.contact.Application</start-class>
83-
<java.version>1.8</java.version>
84-
</properties>
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<groupId>com.kms.contact</groupId>
6+
<artifactId>contact-sbs</artifactId>
7+
<version>0.0.1-SNAPSHOT</version>
8+
<!-- uncomment for WAR deployment
9+
<packaging>war</packaging>
10+
-->
11+
12+
<parent>
13+
<groupId>org.springframework.boot</groupId>
14+
<artifactId>spring-boot-starter-parent</artifactId>
15+
<version>1.1.5.RELEASE</version>
16+
</parent>
17+
18+
<dependencies>
19+
<dependency>
20+
<groupId>org.springframework.boot</groupId>
21+
<artifactId>spring-boot-starter</artifactId>
22+
</dependency>
23+
<dependency>
24+
<groupId>org.springframework.boot</groupId>
25+
<artifactId>spring-boot-starter-data-jpa</artifactId>
26+
</dependency>
27+
<dependency>
28+
<groupId>org.flywaydb</groupId>
29+
<artifactId>flyway-core</artifactId>
30+
</dependency>
31+
<dependency>
32+
<groupId>com.h2database</groupId>
33+
<artifactId>h2</artifactId>
34+
</dependency>
35+
<dependency>
36+
<groupId>org.springframework.boot</groupId>
37+
<artifactId>spring-boot-starter-web</artifactId>
38+
</dependency>
39+
<!-- uncomment for WAR deployment
40+
<dependency>
41+
<groupId>org.springframework.boot</groupId>
42+
<artifactId>spring-boot-starter-tomcat</artifactId>
43+
<scope>provided</scope>
44+
</dependency>
45+
-->
46+
<dependency>
47+
<groupId>org.hibernate</groupId>
48+
<artifactId>hibernate-validator</artifactId>
49+
</dependency>
50+
<dependency>
51+
<groupId>commons-fileupload</groupId>
52+
<artifactId>commons-fileupload</artifactId>
53+
<version>1.3.1</version>
54+
</dependency>
55+
<dependency>
56+
<groupId>org.springframework.boot</groupId>
57+
<artifactId>spring-boot-starter-security</artifactId>
58+
</dependency>
59+
<dependency>
60+
<groupId>org.springframework.boot</groupId>
61+
<artifactId>spring-boot-starter-actuator</artifactId>
62+
</dependency>
63+
<dependency>
64+
<groupId>org.springframework.boot</groupId>
65+
<artifactId>spring-boot-starter-remote-shell</artifactId>
66+
</dependency>
67+
68+
<dependency>
69+
<groupId>org.springframework.boot</groupId>
70+
<artifactId>spring-boot-starter-test</artifactId>
71+
<scope>test</scope>
72+
</dependency>
73+
</dependencies>
74+
75+
<build>
76+
<finalName>contact</finalName>
77+
<plugins>
78+
<plugin>
79+
<groupId>org.springframework.boot</groupId>
80+
<artifactId>spring-boot-maven-plugin</artifactId>
81+
</plugin>
82+
</plugins>
83+
</build>
84+
85+
<properties>
86+
<start-class>com.kms.contact.Application</start-class>
87+
<java.version>1.8</java.version>
88+
</properties>
8589
</project>
Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
1-
// Copyright (c) 2014 KMS Technology, Inc.
2-
package com.kms.contact;
3-
4-
import java.io.IOException;
5-
6-
import org.springframework.boot.SpringApplication;
7-
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
8-
import org.springframework.boot.builder.SpringApplicationBuilder;
9-
import org.springframework.boot.context.web.SpringBootServletInitializer;
10-
import org.springframework.context.ApplicationContext;
11-
import org.springframework.context.annotation.ComponentScan;
12-
import org.springframework.transaction.annotation.EnableTransactionManagement;
13-
14-
import com.kms.contact.service.ContactService;
15-
16-
/**
17-
* @author trungnguyen
18-
*/
19-
@ComponentScan
20-
@EnableAutoConfiguration
21-
@EnableTransactionManagement
22-
public class Application extends SpringBootServletInitializer {
23-
@Override
24-
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
25-
return application.sources(Application.class);
26-
}
27-
28-
public static void main(String... args) throws IOException {
29-
ApplicationContext appContext = SpringApplication.run(Application.class, args);
30-
31-
ContactService contactService = appContext.getBean(ContactService.class);
32-
String filePath = (args.length > 0)? args[0] : "etc/contacts.txt";
33-
contactService.loadContacts(filePath);
34-
}
1+
// Copyright (c) 2014 KMS Technology, Inc.
2+
package com.kms.contact;
3+
4+
import java.io.IOException;
5+
6+
import org.springframework.boot.SpringApplication;
7+
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
8+
import org.springframework.boot.builder.SpringApplicationBuilder;
9+
import org.springframework.boot.context.web.SpringBootServletInitializer;
10+
import org.springframework.context.ApplicationContext;
11+
import org.springframework.context.annotation.ComponentScan;
12+
import org.springframework.transaction.annotation.EnableTransactionManagement;
13+
14+
import com.kms.contact.service.ContactService;
15+
16+
/**
17+
* @author trungnguyen
18+
*/
19+
@ComponentScan
20+
@EnableAutoConfiguration
21+
@EnableTransactionManagement
22+
public class Application extends SpringBootServletInitializer {
23+
@Override
24+
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
25+
return application.sources(Application.class);
26+
}
27+
28+
public static void main(String... args) throws IOException {
29+
ApplicationContext appContext = SpringApplication.run(Application.class, args);
30+
31+
ContactService contactService = appContext.getBean(ContactService.class);
32+
String filePath = (args.length > 0)? args[0] : "etc/contacts.txt";
33+
contactService.loadContacts(filePath);
34+
}
3535
}
Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
1-
// Copyright (c) 2014 KMS Technology, Inc.
2-
package com.kms.contact;
3-
4-
import org.springframework.context.MessageSource;
5-
import org.springframework.context.annotation.Bean;
6-
import org.springframework.context.support.ResourceBundleMessageSource;
7-
import org.springframework.validation.Validator;
8-
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
9-
import org.springframework.web.multipart.MultipartResolver;
10-
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
11-
12-
/**
13-
* @author trungnguyen
14-
*/
15-
@org.springframework.context.annotation.Configuration
16-
public class Configuration {
17-
@Bean
18-
public MessageSource messageSource() {
19-
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
20-
messageSource.setBasename("messages");
21-
messageSource.setDefaultEncoding("UTF-8");
22-
return messageSource;
23-
}
24-
25-
@Bean
26-
public Validator validator() {
27-
LocalValidatorFactoryBean factoryBean = new LocalValidatorFactoryBean();
28-
factoryBean.setValidationMessageSource(messageSource());
29-
return factoryBean;
30-
}
31-
32-
@Bean
33-
public MultipartResolver getMultipartResolver() {
34-
CommonsMultipartResolver resolver = new CommonsMultipartResolver();
35-
resolver.setMaxUploadSize(5 * 1024 * 1024); // 5MB
36-
37-
return resolver;
38-
}
39-
}
1+
// Copyright (c) 2014 KMS Technology, Inc.
2+
package com.kms.contact;
3+
4+
import org.springframework.context.MessageSource;
5+
import org.springframework.context.annotation.Bean;
6+
import org.springframework.context.support.ResourceBundleMessageSource;
7+
import org.springframework.validation.Validator;
8+
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
9+
import org.springframework.web.multipart.MultipartResolver;
10+
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
11+
12+
/**
13+
* @author trungnguyen
14+
*/
15+
@org.springframework.context.annotation.Configuration
16+
public class Configuration {
17+
@Bean
18+
public MessageSource messageSource() {
19+
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
20+
messageSource.setBasename("messages");
21+
messageSource.setDefaultEncoding("UTF-8");
22+
return messageSource;
23+
}
24+
25+
@Bean
26+
public Validator validator() {
27+
LocalValidatorFactoryBean factoryBean = new LocalValidatorFactoryBean();
28+
factoryBean.setValidationMessageSource(messageSource());
29+
return factoryBean;
30+
}
31+
32+
@Bean
33+
public MultipartResolver getMultipartResolver() {
34+
CommonsMultipartResolver resolver = new CommonsMultipartResolver();
35+
resolver.setMaxUploadSize(5 * 1024 * 1024); // 5MB
36+
37+
return resolver;
38+
}
39+
}

0 commit comments

Comments
 (0)