Skip to content

Commit

Permalink
Merge pull request #1 from springside/master
Browse files Browse the repository at this point in the history
pull
  • Loading branch information
gitzhang committed Sep 10, 2015
2 parents ef4e6bc + df81d06 commit db47c98
Show file tree
Hide file tree
Showing 538 changed files with 20,533 additions and 27,680 deletions.
13 changes: 8 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# Eclipse project files
.classpath
.idea
.project
.springBeans
*.iml
.settings/


# Intellij project files
*.iml
.idea/

# Others
target/
logs/
/examples/showcase/bin/yuicompressor-2.4.7.jar
/support/local-script/
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
language: java
script:
- mvn test
- mvn test -Pfunctional-test -Dselenium.driver=firefox
env: MAVEN_OPTS="-XX:MaxPermSize=128m"
addons:
firefox: "26.0"
before_install:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
24 changes: 13 additions & 11 deletions README.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
SpringSide is a Spring Framework based JavaEE application reference architecture.

It shows the mainstream technologies and pragmatic practice in JavaEE world.

It has 2 major examples:

1. Quickstart -- a minimal CRUD Todo-List web application.
2. Showcase -- demonstrate many other interesting technologies.

-------------------------------
Offical Site: http://www.springside.org.cn
SpringSide is a Spring Framework based JavaEE application reference architecture.

It shows the mainstream technologies and pragmatic practice in JavaEE world.

It has 4 major examples:

1. Quickstart -- a minimal CRUD Todo-List web application.
2. Showcase -- demonstrate many other interesting technologies.
3. BootService -- a Spring Boot based WebService application.
4. BootMore -- a Spring Boot based WebService application with more samle.

-------------------------------
Offical Site: http://springside.io
Document: https://github.com/springside/springside4/wiki
5 changes: 5 additions & 0 deletions examples/boot-more/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
What is more?

1. Use Jetty instead of Tomcat
2. Don't use spring boot parent
2. Use JavaSimon, demo AOP and Servlet mapping definition
91 changes: 91 additions & 0 deletions examples/boot-more/note.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
Things not in demo

1. use applicactionContextxml

@ImportResource("applicationContext.xml")
public class BootServiceApplication {
}


2. use Jetty instead of Tomcat

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>

3. disable web in junit test use spring context

setWebEnvironment(false)

4. set system exit code

org.springframework.boot.ExitCodeGenerator

5. read configuration
@Value(${name})
String name

or

@Autowired
Environment env;
env.get

6. set the configuration file path

java -jar myproject.jar --spring.config.location=classpath:/default.properties,classpath:/override.properties

or just change the file name

java -jar myproject.jar --spring.config.name=myproject

7. active profile
java -jar myproject.jar --spring.profiles.active=dev,hsqldb

SpringApplication.setAdditionalProfiles(…​)

8. define logging level in appliation.properties

logging.level.org.springframework.web: DEBUG
logging.level.org.hibernate: ERROR

9. add spring-mvc defenation
write WebMvcConfigurerAdapter without @EnableWebMvc

10. add servlet/filter

in application.properties

ServletRegistrationBean or FilterRegistrationBean

11. configure web

1. add context path
server.contextPath

2. set tomcat threads

12. JMX

1. add new jmx
@ManagedResource, @ManagedAttribute, @ManagedOperation

2. change jmx default domian name
endpoints.jmx.domain=myapp
endpoints.jmx.uniqueNames=true


13. APP id

14. Custom Health information
162 changes: 162 additions & 0 deletions examples/boot-more/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>io.springside.examples</groupId>
<artifactId>boot-more</artifactId>
<version>4.3.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>Springside :: Example :: SpringBoot More Demo</name>

<properties>
<springside.version>4.3.0-SNAPSHOT</springside.version>
<spring-boot.version>1.1.10.RELEASE</spring-boot.version>
<commons-lang3.version>3.2.1</commons-lang3.version>
<javasimon.version>3.5.2</javasimon.version>
<assertj.version>1.7.0</assertj.version>

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.6</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
</properties>

<dependencies>
<!-- spring boot -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
<exclusions>
<exclusion>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

<!-- springside -->
<dependency>
<groupId>io.springside</groupId>
<artifactId>springside-utils</artifactId>
<version>${springside.version}</version>
</dependency>

<!-- database -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>

<!-- utils -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>

<!-- jmx -->
<dependency>
<groupId>org.jolokia</groupId>
<artifactId>jolokia-core</artifactId>
</dependency>

<!-- javasimon -->
<dependency>
<groupId>org.javasimon</groupId>
<artifactId>javasimon-spring</artifactId>
<version>${javasimon.version}</version>
</dependency>
<dependency>
<groupId>org.javasimon</groupId>
<artifactId>javasimon-console-embed</artifactId>
<version>${javasimon.version}</version>
</dependency>

<!-- test -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>io.springside</groupId>
<artifactId>springside-utils</artifactId>
<version>${springside.version}</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>

<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package org.springside.examples.bootservice;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

// Spring Java Config的标识
@Configuration
// Spring 默认扫描ClassPath中的Component,以本类所在地package为起点。
@ComponentScan
// Spring Boot的AutoConfig
@EnableAutoConfiguration
public class BootMoreApplication {

public static void main(String[] args) throws Exception {
SpringApplication.run(BootMoreApplication.class, args);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package org.springside.examples.bootservice.common;

import org.javasimon.console.SimonConsoleServlet;
import org.javasimon.spring.MonitoredMeasuringPointcut;
import org.javasimon.spring.MonitoringInterceptor;
import org.springframework.aop.support.DefaultPointcutAdvisor;
import org.springframework.boot.context.embedded.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class JavaSimonConfig {

// 定义AOP
@Bean(name = "monitoringAdvisor")
public DefaultPointcutAdvisor monitoringAdvisor() {
DefaultPointcutAdvisor monitoringAdvisor = new DefaultPointcutAdvisor();
monitoringAdvisor.setAdvice(new MonitoringInterceptor());
monitoringAdvisor.setPointcut(new MonitoredMeasuringPointcut());
return monitoringAdvisor;
}

// 定义URL Mapping
@Bean
public ServletRegistrationBean dispatcherRegistration() {
ServletRegistrationBean registration = new ServletRegistrationBean(new SimonConsoleServlet());
registration.addInitParameter("url-prefix", "/javasimon");
registration.addUrlMappings("/javasimon/*");
return registration;
}

}
Loading

0 comments on commit db47c98

Please sign in to comment.