Last active
December 17, 2015 22:49
-
-
Save chocotan/5684509 to your computer and use it in GitHub Desktop.
the config xmls of a JSF/Spring project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<beans xmlns="http://www.springframework.org/schema/beans" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xmlns:context="http://www.springframework.org/schema/context" | |
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd | |
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd"> | |
<context:component-scan base-package="io.loli.jsj.test" | |
<!-- scope-resolver="org.springframework.context.annotation.Jsr330ScopeMetadataResolver" -->/> | |
</beans> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<faces-config xmlns="http://java.sun.com/xml/ns/javaee" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_1.xsd" | |
version="2.1"> | |
<application> | |
<el-resolver> | |
org.springframework.web.jsf.el.SpringBeanFacesELResolver | |
</el-resolver> | |
</application> | |
</faces-config> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package io.loli.jsj.test; | |
import javax.inject.Named; | |
@Named | |
public class HelloBao { | |
public String getHelloMessage(){ | |
return "Hello JSF/Spring"; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package io.loli.jsj.test; | |
import javax.inject.Inject; | |
import javax.inject.Named; | |
//@ManagedBean | |
//@RequestScoped | |
@Named("helloBean") | |
public class HelloBean { | |
//@ManagedProperty(value = "#{helloService}") | |
@Inject | |
@Named("helloServiceImpl") | |
private HelloService helloService; | |
public String sayHello(){ | |
return helloService.getHelloMessage(); | |
} | |
public void setHelloService(HelloService helloService) { | |
this.helloService = helloService; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package io.loli.jsj.test; | |
import javax.inject.Inject; | |
import javax.inject.Named; | |
import javax.inject.Singleton; | |
@Named("helloServiceImpl") | |
@Singleton | |
public class HelloServiceImpl implements HelloService { | |
private int count; | |
@Inject | |
private HelloBao helloBao; | |
@Override | |
public String getHelloMessage(){ | |
return helloBao.getHelloMessage()+count++; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" | |
xmlns:h="http://java.sun.com/jsf/html" | |
xmlns:f="http://java.sun.com/jsf/core" | |
xmlns:ui="http://java.sun.com/jsf/facelets"> | |
<h:head></h:head> | |
<body> | |
<h2>#{helloBean.sayHello()}</h2> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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/maven-v4_0_0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>io.loli</groupId> | |
<artifactId>kaoqin.spring</artifactId> | |
<packaging>war</packaging> | |
<version>0.0.1-SNAPSHOT</version> | |
<name>kaoqin.spring</name> | |
<properties> | |
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
<spring.version>3.2.2.RELEASE</spring.version> | |
<slf4j.version>1.7.5</slf4j.version> | |
<java.version>1.7</java.version> | |
<jetty.version>6.1.4</jetty.version> | |
<junit.version>4.11</junit.version> | |
<openjpa.version>2.2.2</openjpa.version> | |
<dbcp.version>20030825.184428</dbcp.version> | |
<pool.version>20030825.183949</pool.version> | |
<mysql-driver.version>5.1.25</mysql-driver.version> | |
<taglib.version>1.1.2</taglib.version> | |
<log4j.version>1.2.15</log4j.version> | |
<jstl.version>1.2</jstl.version> | |
<validation.version>1.1.0.Final</validation.version> | |
<hibernate-validator.version>5.0.1.Final</hibernate-validator.version> | |
<derby.version>10.10.1.1</derby.version> | |
</properties> | |
<dependencies> | |
<!-- Bean Validation Dependencies --> | |
<dependency> | |
<groupId>javax.validation</groupId> | |
<artifactId>validation-api</artifactId> | |
<version>${validation.version}</version> | |
<scope>compile</scope> | |
</dependency> | |
<!-- JPA Persistence Dependencies --> | |
<dependency> | |
<groupId>org.apache.openjpa</groupId> | |
<artifactId>openjpa</artifactId> | |
<version>${openjpa.version}</version> | |
</dependency> | |
<!-- JSF Dependencies --> | |
<dependency> | |
<groupId>com.sun.faces</groupId> | |
<artifactId>jsf-api</artifactId> | |
<version>2.2.0</version> | |
</dependency> | |
<dependency> | |
<groupId>com.sun.faces</groupId> | |
<artifactId>jsf-impl</artifactId> | |
<version>2.2.0</version> | |
</dependency> | |
<!-- Spring Dependencies --> | |
<dependency> | |
<groupId>org.springframework</groupId> | |
<artifactId>spring-context</artifactId> | |
<version>${spring.version}</version> | |
<exclusions> | |
<!-- Exclude Commons Logging in favor of SLF4j --> | |
<exclusion> | |
<groupId>commons-logging</groupId> | |
<artifactId>commons-logging</artifactId> | |
</exclusion> | |
</exclusions> | |
</dependency> | |
<dependency> | |
<groupId>org.springframework</groupId> | |
<artifactId>spring-webmvc</artifactId> | |
<version>${spring.version}</version> | |
</dependency> | |
<dependency> | |
<groupId>org.springframework</groupId> | |
<artifactId>spring-orm</artifactId> | |
<version>${spring.version}</version> | |
<type>jar</type> | |
<scope>compile</scope> | |
</dependency> | |
<dependency> | |
<groupId>org.springframework</groupId> | |
<artifactId>spring-test</artifactId> | |
<version>${spring.version}</version> | |
<type>jar</type> | |
<scope>test</scope> | |
</dependency> | |
<!-- DB Dependencies --> | |
<dependency> | |
<groupId>commons-dbcp</groupId> | |
<artifactId>commons-dbcp</artifactId> | |
<version>${dbcp.version}</version> | |
<type>jar</type> | |
<scope>compile</scope> | |
</dependency> | |
<dependency> | |
<groupId>commons-pool</groupId> | |
<artifactId>commons-pool</artifactId> | |
<version>${pool.version}</version> | |
<type>jar</type> | |
<scope>compile</scope> | |
</dependency> | |
<!-- View Dependencies --> | |
<dependency> | |
<groupId>taglibs</groupId> | |
<artifactId>standard</artifactId> | |
<version>${taglib.version}</version> | |
<type>jar</type> | |
<scope>compile</scope> | |
</dependency> | |
<!-- Test Dependencies --> | |
<dependency> | |
<groupId>junit</groupId> | |
<artifactId>junit</artifactId> | |
<version>${junit.version}</version> | |
<scope>test</scope> | |
</dependency> | |
<!-- logging --> | |
<dependency> | |
<groupId>org.slf4j</groupId> | |
<artifactId>slf4j-api</artifactId> | |
<version>${slf4j.version}</version> | |
</dependency> | |
<dependency> | |
<groupId>org.slf4j</groupId> | |
<artifactId>jcl-over-slf4j</artifactId> | |
<version>${slf4j.version}</version> | |
<scope>runtime</scope> | |
</dependency> | |
<dependency> | |
<groupId>org.slf4j</groupId> | |
<artifactId>slf4j-log4j12</artifactId> | |
<version>${slf4j.version}</version> | |
<scope>runtime</scope> | |
</dependency> | |
<dependency> | |
<groupId>log4j</groupId> | |
<artifactId>log4j</artifactId> | |
<version>${log4j.version}</version> | |
<exclusions> | |
<exclusion> | |
<groupId>com.sun.jdmk</groupId> | |
<artifactId>jmxtools</artifactId> | |
</exclusion> | |
<exclusion> | |
<groupId>com.sun.jmx</groupId> | |
<artifactId>jmxri</artifactId> | |
</exclusion> | |
</exclusions> | |
<scope>runtime</scope> | |
</dependency> | |
<dependency> | |
<groupId>jstl</groupId> | |
<artifactId>jstl</artifactId> | |
<version>${jstl.version}</version> | |
</dependency> | |
<dependency> | |
<groupId>mysql</groupId> | |
<artifactId>mysql-connector-java</artifactId> | |
<version>${mysql-driver.version}</version> | |
</dependency> | |
<!-- validator --> | |
<dependency> | |
<groupId>org.hibernate</groupId> | |
<artifactId>hibernate-validator</artifactId> | |
<version>${hibernate-validator.version}</version> | |
</dependency> | |
<!-- JSR-330 --> | |
<dependency> | |
<groupId>javax.inject</groupId> | |
<artifactId>javax.inject</artifactId> | |
<version>1</version> | |
</dependency> | |
<dependency> | |
<groupId>javax.servlet</groupId> | |
<artifactId>javax.servlet-api</artifactId> | |
<version>3.0.1</version> | |
</dependency> | |
<dependency> | |
<groupId>javax.servlet.jsp</groupId> | |
<artifactId>jsp-api</artifactId> | |
<version>2.1</version> | |
</dependency> | |
<!-- Tomcat 6 need this --> | |
<dependency> | |
<groupId>com.sun.el</groupId> | |
<artifactId>el-ri</artifactId> | |
<version>1.0</version> | |
</dependency> | |
</dependencies> | |
<build> | |
<finalName>kaoqin.spring</finalName> | |
<!-- Ensures we are compiling at 1.6 level --> | |
<plugins> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-compiler-plugin</artifactId> | |
<version>2.3.2</version> | |
<configuration> | |
<source>${java.version}</source> | |
<target>${java.version}</target> | |
</configuration> | |
</plugin> | |
</plugins> | |
</build> | |
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package io.loli.jsj.test; | |
@java.lang.annotation.Documented | |
@java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) | |
@javax.inject.Scope | |
public @interface RequestScoped {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:jsp="http://java.sun.com/xml/ns/javaee/jsp" | |
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" | |
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" | |
id="WebApp_ID" version="3.0"> | |
<display-name>kaoqin</display-name> | |
<session-config> | |
<session-timeout>10</session-timeout> | |
</session-config> | |
<welcome-file-list> | |
<welcome-file>index.jsf</welcome-file> | |
</welcome-file-list> | |
<context-param> | |
<param-name>contextConfigLocation</param-name> | |
<param-value>/WEB-INF/applicationContext.xml</param-value> | |
</context-param> | |
<filter> | |
<filter-name>characterEncodingFilter</filter-name> | |
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> | |
<init-param> | |
<param-name>encoding</param-name> | |
<param-value>UTF-8</param-value> | |
</init-param> | |
<init-param> | |
<param-name>forceEncoding</param-name> | |
<param-value>true</param-value> | |
</init-param> | |
</filter> | |
<filter-mapping> | |
<filter-name>characterEncodingFilter</filter-name> | |
<url-pattern>/*</url-pattern> | |
</filter-mapping> | |
<!-- | |
<servlet-mapping> | |
<servlet-name>default</servlet-name> | |
<url-pattern>*.jpg</url-pattern> | |
</servlet-mapping> | |
<servlet-mapping> | |
<servlet-name>default</servlet-name> | |
<url-pattern>*.js</url-pattern> | |
</servlet-mapping> | |
<servlet-mapping> | |
<servlet-name>default</servlet-name> | |
<url-pattern>*.css</url-pattern> | |
</servlet-mapping> | |
<servlet-mapping> | |
<servlet-name>default</servlet-name> | |
<url-pattern>*.png</url-pattern> | |
</servlet-mapping> | |
--> | |
<!-- | |
<jsp-config> | |
<taglib> | |
<taglib-uri>http://java.sun.com/jsp/jstl/fmt</taglib-uri> | |
<taglib-location>/META-INF/fmt.tld</taglib-location> | |
</taglib> | |
<taglib> | |
<taglib-uri>http://java.sun.com/jsp/jstl/c</taglib-uri> | |
<taglib-location>/META-INF/c.tld</taglib-location> | |
</taglib> | |
<taglib> | |
<taglib-uri>http://java.sun.com/jsp/jstl/functions</taglib-uri> | |
<taglib-location>/META-INF/fn.tld</taglib-location> | |
</taglib> | |
<jsp-property-group> | |
<url-pattern>*.jsp</url-pattern> | |
<trim-directive-whitespaces>true</trim-directive-whitespaces> | |
</jsp-property-group> | |
</jsp-config> | |
--> | |
<listener> | |
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> | |
</listener> | |
<listener> | |
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class> | |
</listener> | |
<listener> | |
<listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class> | |
</listener> | |
<servlet> | |
<servlet-name>Faces Servlet</servlet-name> | |
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class> | |
<load-on-startup>1</load-on-startup> | |
</servlet> | |
<servlet-mapping> | |
<servlet-name>Faces Servlet</servlet-name> | |
<url-pattern>*.jsf</url-pattern> | |
</servlet-mapping> | |
<!-- Change to "Production" when you are ready to deploy --> | |
<context-param> | |
<param-name>javax.faces.PROJECT_STAGE</param-name> | |
<param-value>Development</param-value> | |
</context-param> | |
</web-app> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment