Skip to content

Commit

Permalink
optimise
Browse files Browse the repository at this point in the history
  • Loading branch information
javahongxi committed Dec 5, 2019
1 parent aae00f5 commit 9fc1e6b
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 10 deletions.
25 changes: 25 additions & 0 deletions whatsmars-spring-data/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
Expand All @@ -29,6 +37,23 @@
<groupId>org.hongxi</groupId>
<artifactId>whatsmars-common</artifactId>
</dependency>

<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
</dependencies>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

import org.hongxi.whatsmars.common.profile.ProfileUtils;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;

@ImportResource("classpath:spring-*.xml")
@Configuration
public class Application {

public static void main(String[] args) {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

import org.elasticsearch.client.transport.TransportClient;
import org.hongxi.whatsmars.spring.data.repository.CustomerRepository;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class DataService {
public class DataService implements InitializingBean {

@Resource
private RedisTemplate<Integer, String> redisTemplate;
Expand All @@ -19,4 +20,12 @@ public class DataService {
private MongoTemplate mongoTemplate;
@Resource
private CustomerRepository customerRepository;

@Override
public void afterPropertiesSet() throws Exception {
System.out.println(redisTemplate);
System.out.println(transportClient);
System.out.println(mongoTemplate);
System.out.println(customerRepository);
}
}
25 changes: 25 additions & 0 deletions whatsmars-spring-data/src/main/resources/log4j2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration status="debug">

<properties>
<property name="log.path">/data/logs/whatsmars-spring-data</property>
</properties>

<appenders>
<console name="Console" target="SYSTEM_OUT">
<Filters>
<ThresholdFilter level="DEBUG" onMatch="ACCEPT"
onMismatch="DENY"/>
</Filters>
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</console>

</appenders>

<loggers>
<root level="INFO">
<appender-ref ref="Console"/>
</root>
</loggers>

</configuration>

0 comments on commit 9fc1e6b

Please sign in to comment.