Skip to content

Commit

Permalink
perf($VarAndVal): synchronize codes
Browse files Browse the repository at this point in the history
RedisClientConfiguration.java
ServerConfiguration.java
  • Loading branch information
johnnymillergh committed May 8, 2020
1 parent 6a235aa commit 941a87a
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.jcraft.jsch.ChannelSftp;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
Expand All @@ -27,7 +26,6 @@
* @date 2019-07-04 18:18
**/
@Data
@Slf4j
@Component
@ConfigurationProperties(prefix = "sftp.client.configuration")
public class SftpClientConfiguration {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.jmsoftware.authcenter.universal.configuration;

import lombok.val;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
import org.springframework.cache.annotation.CachingConfigurerSupport;
Expand All @@ -16,10 +17,10 @@
/**
* <h1>RedisClientConfiguration</h1>
* <p>
* Redis configuration.
* Ignored request configuration.
*
* @author Johnny Miller (鍾俊), email: johnnysviva@outlook.com
* @date 2019-03-23 14:27
* @date 5/2/20 11:41 PM
**/
@Configuration
@EnableCaching
Expand All @@ -30,7 +31,7 @@ public class RedisClientConfiguration extends CachingConfigurerSupport {
*/
@Bean
public RedisTemplate<String, Serializable> redisFactory(LettuceConnectionFactory lettuceConnectionFactory) {
RedisTemplate<String, Serializable> template = new RedisTemplate<>();
val template = new RedisTemplate<String, Serializable>();
template.setKeySerializer(new StringRedisSerializer());
template.setValueSerializer(new GenericJackson2JsonRedisSerializer());
template.setConnectionFactory(lettuceConnectionFactory);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import org.springframework.boot.web.context.WebServerInitializedEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;
Expand Down Expand Up @@ -64,8 +65,8 @@ public String getPublicIp() {
}
try {
// An API provided by https://whatismyipaddress.com/api
URL url = new URL("https://ipv4bot.whatismyipaddress.com/");
BufferedReader sc = new BufferedReader(new InputStreamReader(url.openStream()));
val url = new URL("https://ipv4bot.whatismyipaddress.com/");
val sc = new BufferedReader(new InputStreamReader(url.openStream()));
// Read system IP Address
return sc.readLine().trim();
} catch (Exception e) {
Expand All @@ -80,9 +81,9 @@ public String getPublicIp() {
* @return internet IP
*/
private String getInternetIp() {
String intranetIp = this.getIntranetIp();
val intranetIp = this.getIntranetIp();
try {
Enumeration<NetworkInterface> networks = NetworkInterface.getNetworkInterfaces();
val networks = NetworkInterface.getNetworkInterfaces();
InetAddress ip;
Enumeration<InetAddress> addresses;
while (networks.hasMoreElements()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import org.springframework.boot.web.context.WebServerInitializedEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;
Expand Down Expand Up @@ -64,8 +65,8 @@ public String getPublicIp() {
}
try {
// An API provided by https://whatismyipaddress.com/api
URL url = new URL("https://ipv4bot.whatismyipaddress.com/");
BufferedReader sc = new BufferedReader(new InputStreamReader(url.openStream()));
val url = new URL("https://ipv4bot.whatismyipaddress.com/");
val sc = new BufferedReader(new InputStreamReader(url.openStream()));
// Read system IP Address
return sc.readLine().trim();
} catch (Exception e) {
Expand All @@ -80,9 +81,9 @@ public String getPublicIp() {
* @return internet IP
*/
private String getInternetIp() {
String intranetIp = this.getIntranetIp();
val intranetIp = this.getIntranetIp();
try {
Enumeration<NetworkInterface> networks = NetworkInterface.getNetworkInterfaces();
val networks = NetworkInterface.getNetworkInterfaces();
InetAddress ip;
Enumeration<InetAddress> addresses;
while (networks.hasMoreElements()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import org.springframework.boot.web.context.WebServerInitializedEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;
Expand Down Expand Up @@ -64,8 +65,8 @@ public String getPublicIp() {
}
try {
// An API provided by https://whatismyipaddress.com/api
URL url = new URL("https://ipv4bot.whatismyipaddress.com/");
BufferedReader sc = new BufferedReader(new InputStreamReader(url.openStream()));
val url = new URL("https://ipv4bot.whatismyipaddress.com/");
val sc = new BufferedReader(new InputStreamReader(url.openStream()));
// Read system IP Address
return sc.readLine().trim();
} catch (Exception e) {
Expand All @@ -80,9 +81,9 @@ public String getPublicIp() {
* @return internet IP
*/
private String getInternetIp() {
String intranetIp = this.getIntranetIp();
val intranetIp = this.getIntranetIp();
try {
Enumeration<NetworkInterface> networks = NetworkInterface.getNetworkInterfaces();
val networks = NetworkInterface.getNetworkInterfaces();
InetAddress ip;
Enumeration<InetAddress> addresses;
while (networks.hasMoreElements()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import org.springframework.boot.web.context.WebServerInitializedEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;
Expand Down Expand Up @@ -64,8 +65,8 @@ public String getPublicIp() {
}
try {
// An API provided by https://whatismyipaddress.com/api
URL url = new URL("https://ipv4bot.whatismyipaddress.com/");
BufferedReader sc = new BufferedReader(new InputStreamReader(url.openStream()));
val url = new URL("https://ipv4bot.whatismyipaddress.com/");
val sc = new BufferedReader(new InputStreamReader(url.openStream()));
// Read system IP Address
return sc.readLine().trim();
} catch (Exception e) {
Expand All @@ -80,9 +81,9 @@ public String getPublicIp() {
* @return internet IP
*/
private String getInternetIp() {
String intranetIp = this.getIntranetIp();
val intranetIp = this.getIntranetIp();
try {
Enumeration<NetworkInterface> networks = NetworkInterface.getNetworkInterfaces();
val networks = NetworkInterface.getNetworkInterfaces();
InetAddress ip;
Enumeration<InetAddress> addresses;
while (networks.hasMoreElements()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import org.springframework.boot.web.context.WebServerInitializedEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;
Expand Down Expand Up @@ -64,8 +65,8 @@ public String getPublicIp() {
}
try {
// An API provided by https://whatismyipaddress.com/api
URL url = new URL("https://ipv4bot.whatismyipaddress.com/");
BufferedReader sc = new BufferedReader(new InputStreamReader(url.openStream()));
val url = new URL("https://ipv4bot.whatismyipaddress.com/");
val sc = new BufferedReader(new InputStreamReader(url.openStream()));
// Read system IP Address
return sc.readLine().trim();
} catch (Exception e) {
Expand All @@ -80,9 +81,9 @@ public String getPublicIp() {
* @return internet IP
*/
private String getInternetIp() {
String intranetIp = this.getIntranetIp();
val intranetIp = this.getIntranetIp();
try {
Enumeration<NetworkInterface> networks = NetworkInterface.getNetworkInterfaces();
val networks = NetworkInterface.getNetworkInterfaces();
InetAddress ip;
Enumeration<InetAddress> addresses;
while (networks.hasMoreElements()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import org.springframework.boot.web.context.WebServerInitializedEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;
Expand Down Expand Up @@ -64,8 +65,8 @@ public String getPublicIp() {
}
try {
// An API provided by https://whatismyipaddress.com/api
URL url = new URL("https://ipv4bot.whatismyipaddress.com/");
BufferedReader sc = new BufferedReader(new InputStreamReader(url.openStream()));
val url = new URL("https://ipv4bot.whatismyipaddress.com/");
val sc = new BufferedReader(new InputStreamReader(url.openStream()));
// Read system IP Address
return sc.readLine().trim();
} catch (Exception e) {
Expand All @@ -80,9 +81,9 @@ public String getPublicIp() {
* @return internet IP
*/
private String getInternetIp() {
String intranetIp = this.getIntranetIp();
val intranetIp = this.getIntranetIp();
try {
Enumeration<NetworkInterface> networks = NetworkInterface.getNetworkInterfaces();
val networks = NetworkInterface.getNetworkInterfaces();
InetAddress ip;
Enumeration<InetAddress> addresses;
while (networks.hasMoreElements()) {
Expand Down

0 comments on commit 941a87a

Please sign in to comment.