`
javaso
  • 浏览: 53193 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

spring-boot

阅读更多

 

import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;

import org.springframework.boot.autoconfigure.web.HttpMessageConverters;
import org.springframework.boot.context.embedded.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;

import com.balewo.commons.web.filter.LoginFilter;


@Configuration
public class Config {

	    @Bean
	    public HttpMessageConverters customConverters() {
	    	MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
	    	List<MediaType>  list = new ArrayList<>();
	    	MediaType type=MediaType.valueOf("text/html; charset=UTF-8");
	    	list.add(type);
	    	list.add(MediaType.APPLICATION_JSON_UTF8);
	    	converter.setDefaultCharset(Charset.forName("UTF-8"));
	    	converter.setSupportedMediaTypes(list);
	    	return new HttpMessageConverters(converter);
	    }
	    
	    @Bean
	    public FilterRegistrationBean registerFilter(){
	    	FilterRegistrationBean registration = new FilterRegistrationBean();
	    	LoginFilter filter = new LoginFilter();
	    	filter.setNotLoginPath("/login");
	    	registration.setFilter(filter);
	    	registration.addUrlPatterns("/home/*");
	    	registration.addInitParameter("notLoginPath", "/login");
	    	registration.addInitParameter("session_name", "channel_user");
	    	registration.setOrder(1);
	    	return registration;
	    }
	    
	  
}

 

 

 

<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>com.balewo</groupId>
	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>1.4.3.RELEASE</version>
	</parent>
	<artifactId>pay-api</artifactId>
    <packaging>war</packaging>
    
	<properties>
		<java.version>1.7</java.version>
		<guava.version>18.0</guava.version>
		<commons-lang3.version>3.3.2</commons-lang3.version>
		<commons-io.version>2.4</commons-io.version>
		<spymemcached.version>2.11.2</spymemcached.version>

	</properties>


	<dependencies>

		<dependency>
			<groupId>com.balewo</groupId>
			<artifactId>jpa-base</artifactId>
			<version>1.0.0.RELEASE</version>
		</dependency>

		<dependency>
			<groupId>com.balewo</groupId>
			<artifactId>dev-commons</artifactId>
			<version>1.0.0.RELEASE</version>
		</dependency>

		<dependency>
			<groupId>org.mybatis</groupId>
			<artifactId>mybatis</artifactId>
			<version>3.4.2</version>
		</dependency>

		<dependency>
			<groupId>org.springframework.data</groupId>
			<artifactId>spring-data-redis</artifactId>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.mybatis/mybatis-spring -->
		<dependency>
			<groupId>org.mybatis</groupId>
			<artifactId>mybatis-spring</artifactId>
			<version>1.3.1</version>
		</dependency>

		<dependency>
			<groupId>org.mybatis.spring.boot</groupId>
			<artifactId>mybatis-spring-boot-starter</artifactId>
			<version>1.2.0</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/com.googlecode.log4jdbc/log4jdbc -->
		<dependency>
			<groupId>com.googlecode.log4jdbc</groupId>
			<artifactId>log4jdbc</artifactId>
			<version>1.2</version>
		</dependency>

		<dependency>
			<groupId>org.apache.httpcomponents</groupId>
			<artifactId>fluent-hc</artifactId>
			<version>4.3.6</version>
		</dependency>

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

		<dependency>
			<groupId>com.google.guava</groupId>
			<artifactId>guava</artifactId>
			<version>${guava.version}</version>
		</dependency>

		<dependency>
			<groupId>commons-beanutils</groupId>
			<artifactId>commons-beanutils</artifactId>
			<exclusions>
				<exclusion>
					<groupId>commons-logging</groupId>
					<artifactId>commons-logging</artifactId>
				</exclusion>
			</exclusions>
		</dependency>

		<dependency>
			<groupId>commons-codec</groupId>
			<artifactId>commons-codec</artifactId>
			<version>1.9</version>
		</dependency>

		<dependency>
			<groupId>commons-io</groupId>
			<artifactId>commons-io</artifactId>
			<version>${commons-io.version}</version>
		</dependency>

		<dependency>
			<groupId>net.spy</groupId>
			<artifactId>spymemcached</artifactId>
			<version>${spymemcached.version}</version>
		</dependency>


		<dependency>
			<groupId>com.googlecode.log4jdbc</groupId>
			<artifactId>log4jdbc</artifactId>
			<version>1.2</version>
			<scope>runtime</scope>
		</dependency>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>

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

		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>jstl</artifactId>
		</dependency>

		<!--配置servlet -->
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>javax.servlet-api</artifactId>
		</dependency>

		<!--配置jsp jstl的支持 -->
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>jstl</artifactId>
		</dependency>

		<dependency>
			<groupId>com.fasterxml.jackson.module</groupId>
			<artifactId>jackson-module-jaxb-annotations</artifactId>
		</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>

		<!--添加对tomcat的支持 -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-tomcat</artifactId>
			<scope>provided</scope>
		</dependency>


		<!--对jsp的支持 -->
		<dependency>
			<groupId>org.apache.tomcat.embed</groupId>
			<artifactId>tomcat-embed-jasper</artifactId>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>mysql</groupId>
			<artifactId>mysql-connector-java</artifactId>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.elasticsearch/elasticsearch -->
		<!-- https://mvnrepository.com/artifact/org.elasticsearch.client/transport -->

		<!-- https://mvnrepository.com/artifact/org.slf4j/log4j-over-slf4j -->
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>log4j-over-slf4j</artifactId>
			<scope>runtime</scope>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core -->
		<dependency>
			<groupId>org.apache.logging.log4j</groupId>
			<artifactId>log4j-core</artifactId>
		</dependency>


		<dependency>
			<groupId>com.google.zxing</groupId>
			<artifactId>core</artifactId>
			<version>3.0.0</version>
		</dependency>
		<dependency>
			<groupId>com.google.zxing</groupId>
			<artifactId>javase</artifactId>
			<version>3.0.0</version>
		</dependency>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			
		</dependency>

	</dependencies>


	<build>
		<plugins>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-war-plugin</artifactId>
				<configuration>
					<failOnMissingWebXml>false</failOnMissingWebXml>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<executions>
					<execution>
						<goals>
							<goal>repackage</goal>
						</goals>
					</execution>
				</executions>
			</plugin>


		</plugins>
	</build>




</project>
server.port=80
spring.http.encoding.force=true
spring.mvc.view.prefix=/WEB-INF/views/
spring.mvc.view.suffix=.jsp


spring.datasource.url=jdbc:log4jdbc:mysql://localhost:3306/pay2?useUnicode=true&characterEncoding=utf-8
spring.datasource.username=root
spring.datasource.password=123456
spring.datasource.driver-class-name=net.sf.log4jdbc.DriverSpy

spring.datasource.name=datasourse
# Number of ms to wait before throwing an exception if no connection is available.
spring.datasource.tomcat.max-wait=10000
spring.datasource.tomcat.defaultAutoCommit=false

# Maximum number of active connections that can be allocated from this pool at the same time.
spring.datasource.tomcat.max-active=50
spring.datasource.tomcat.validationQuery=select 1

# Validate the connection before borrowing it from the pool.
spring.datasource.tomcat.testWhileIdle=true
spring.datasource.tomcat.timeBetweenEvictionRunsMillis=600000
spring.datasource.tomcat.minEvictableIdleTimeMillis=1800000
spring.datasource.tomcat.test-on-borrow=false

spring.jpa.show-sql=true
spring.jpa.database = MYSQL

spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl

#mybatis.type-aliases-package=com.balewo.domain
#mybatis.mapper-locations=classpath:/mybatis/*Mapper.xml
#mybatis.configuration.default-fetch-size=100
#mybatis.configuration.default-statement-timeout=30
#mybatis.type-handlers-package=com.example.typehandler


# Redis server host.
spring.redis.host=localhost
#spring.redis.password= # Login password of the redis server.
spring.redis.pool.max-active=30
# Max number of connections that can be allocated by the pool at a given time. Use a negative value for no limit.
spring.redis.pool.max-idle=20
# Max number of "idle" connections in the pool. Use a negative value to indicate an unlimited number of idle connections.
spring.redis.pool.max-wait=-1
# Maximum amount of time (in milliseconds) a connection allocation should block before throwing an exception when the pool is exhausted. Use a negative value to block indefinitely.
spring.redis.pool.min-idle=20
# Target for the minimum number of idle connections to maintain in the pool. This setting only has an effect if it is positive.
spring.redis.port=6379 
# Redis 


#spring.data.elasticsearch.cluster-nodes=localhost:9300


  

 

 

 

 

<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>com.balewo</groupId>
	<artifactId>parent</artifactId>
	<version>1.0.0.RELEASE</version>
	<packaging>pom</packaging>
	<properties>
		<maven_compiler_plugin_version>2.3.2</maven_compiler_plugin_version>
		<java_source_version>1.7</java_source_version>
		<java_target_version>1.7</java_target_version>
		<file_encoding>UTF-8</file_encoding>
		
		<maven_compiler_plugin_version>2.3.2</maven_compiler_plugin_version>
		<maven_source_plugin_version>2.1.1</maven_source_plugin_version>
		<maven_jar_plugin_version>2.3.2</maven_jar_plugin_version>
		
	</properties>

	<build>
		<plugins>
			<!--  -->	
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>${maven_compiler_plugin_version}</version>
				<configuration>
					<fork>true</fork>
					<source>${java_source_version}</source>
					<target>${java_target_version}</target>
					<encoding>${file_encoding}</encoding>
					<compilerArgs>
						<arg>-XX:MaxPermSize=512M</arg>
					</compilerArgs>
				</configuration>
			</plugin>
			
			
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jar-plugin</artifactId>
				<version>${maven_jar_plugin_version}</version>
				<configuration>
					<archive>
						<addMavenDescriptor>true</addMavenDescriptor>
						<index>true</index>
						<manifest>
							<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
							<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
						</manifest>
					</archive>
				</configuration>
			</plugin>
			
			<plugin>
				<artifactId>maven-source-plugin</artifactId>
				<executions>
					<execution>
						<id>attach-sources</id>
						<phase>package</phase>
						<goals>
							<goal>jar-no-fork</goal>
						</goals>
					</execution>
				</executions>
			   <version>${maven_source_plugin_version}</version>
			</plugin>
		
		</plugins>
		
	</build>
	
	<modules>
		<module>boot-action</module>
		<module>dev-commons</module>
		<module>jpa-base</module>
		<module>third-pay</module>
		<module>pay-api</module>
	</modules>
</project>

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics