no message

main
이범준 1 year ago
parent 4d1f4e4619
commit 82320c60b2

@ -36,22 +36,26 @@
<version>23.04.01-SNAPSHOT</version> <version>23.04.01-SNAPSHOT</version>
<exclusions> <exclusions>
<exclusion> <exclusion>
<groupId>cokr.xit.base</groupId> <groupId>cokr.xit.base</groupId>
<artifactId>xit-security</artifactId> <artifactId>xit-security</artifactId>
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>cokr.xit.boot</groupId> <groupId>cokr.xit.base</groupId>
<artifactId>xit-foundation-starter</artifactId> <artifactId>xit-foundation</artifactId>
<version>23.04.01-SNAPSHOT</version> <version>23.04.01-SNAPSHOT</version>
<exclusions> <exclusions>
<exclusion> <exclusion>
<groupId>cokr.xit.base</groupId> <groupId>javax.servlet</groupId>
<artifactId>xit-security</artifactId> <artifactId>javax.servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>cokr.xit.base</groupId>
<artifactId>xit-security</artifactId>
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency> <dependency>
@ -66,19 +70,42 @@
<version>3.3.6</version> <version>3.3.6</version>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.hibernate</groupId> <groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId> <artifactId>hibernate-validator</artifactId>
<version>6.1.5.Final</version> <version>5.3.6.Final</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>javax</groupId> <groupId>org.projectlombok</groupId>
<artifactId>javaee-api</artifactId> <artifactId>lombok</artifactId>
<version>8.0</version>
<scope>provided</scope>
</dependency> </dependency>
</dependencies> </dependencies>

@ -1,4 +1,4 @@
package cokr.xit.base.boot; package cokr.xit.custom.boot;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.List; import java.util.List;
@ -19,8 +19,6 @@ import org.springframework.web.servlet.i18n.SessionLocaleResolver;
import com.fasterxml.jackson.core.JsonParser.Feature; import com.fasterxml.jackson.core.JsonParser.Feature;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import cokr.xit.foundation.boot.Yml;
/** xit foundation Bean . /** xit foundation Bean .
* @author mjkhan * @author mjkhan
*/ */
@ -49,7 +47,7 @@ public class CommonConfig2 {
/**SessionLocaleResolver . /**SessionLocaleResolver .
* @return SessionLocaleResolver * @return SessionLocaleResolver
*/ */
@Bean(name="localeResolver2") @Bean(name="localeResolver")
public SessionLocaleResolver localeResolver() { public SessionLocaleResolver localeResolver() {
SessionLocaleResolver bean = new SessionLocaleResolver(); SessionLocaleResolver bean = new SessionLocaleResolver();
bean.setDefaultLocale(Locale.getDefault()); bean.setDefaultLocale(Locale.getDefault());
@ -64,7 +62,7 @@ public class CommonConfig2 {
return new LeaveaTrace(); return new LeaveaTrace();
} }
private Yml yml = new Yml("application.yml", "application.yml"); private Yml2 yml = new Yml2("application.yml", "application.yml");
/**application.yml MessageSource Bean . /**application.yml MessageSource Bean .
* <pre><code> messageSource: * <pre><code> messageSource:

@ -1,4 +1,4 @@
package cokr.xit.base.boot; package cokr.xit.custom.boot;
import javax.sql.DataSource; import javax.sql.DataSource;

@ -1,4 +1,4 @@
package cokr.xit.base.boot; package cokr.xit.custom.boot;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -15,19 +15,18 @@ import org.springframework.web.servlet.view.json.MappingJackson2JsonView;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import cokr.xit.foundation.boot.StaticResourceConfig;
import cokr.xit.foundation.web.AccessInitializer; import cokr.xit.foundation.web.AccessInitializer;
@Configuration @Configuration
public class MvcConfig4 implements WebMvcConfigurer { public class MvcConfig4 implements WebMvcConfigurer {
protected static String[] URL_PATTERNS = {"/lvis/**/*"}; protected static String[] URL_PATTERNS = {"/lvis/**/*"};
@Resource(name = "staticResource") @Resource(name = "staticResource")
private StaticResourceConfig staticResource; private StaticResourceConfig2 staticResource;
/**AccessInitializer . /**AccessInitializer .
* @return AccessInitializer * @return AccessInitializer
*/ */
@Bean @Bean(name="accessInitializer2")
public AccessInitializer accessInitializer() { public AccessInitializer accessInitializer() {
return new AccessInitializer(); return new AccessInitializer();
} }

@ -1,4 +1,4 @@
package cokr.xit.base.boot; package cokr.xit.custom.boot;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -13,13 +13,11 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.filter.CharacterEncodingFilter; import org.springframework.web.filter.CharacterEncodingFilter;
import cokr.xit.foundation.boot.StaticResourceConfig;
@Configuration @Configuration
public class ServletConfig2 { public class ServletConfig2 {
protected static String[] URL_PATTERNS = {"/","*.do"}; protected static String[] URL_PATTERNS = {"/","*.do"};
@Resource(name = "staticResource") @Resource(name = "staticResource")
private StaticResourceConfig staticResource; private StaticResourceConfig2 staticResource;
/**CharacterEncodingFilter . /**CharacterEncodingFilter .
* @return FilterRegistrationBean * @return FilterRegistrationBean

@ -0,0 +1,37 @@
package cokr.xit.custom.boot;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration;
import org.springframework.test.context.ContextConfiguration;
/**Spring Boot xit-foundation.jar stand-alone
* <p>
* <ul><li> spring </li>
* <li> 'context-' xml </li>
* <li> classpath*:spring/context-*.xml .</li>
* </ul>
* @author mjkhan
*/
@SpringBootApplication(exclude = {
WebMvcAutoConfiguration.class
})
@ImportAutoConfiguration({
CommonConfig2.class,
DatasourceConfig2.class,
TransactionConfig2.class,
})
@ContextConfiguration("classpath:spring/context-*.xml")
public class StandAloneApplication2 implements CommandLineRunner {
@Override
public void run(String... args) throws Exception {}
protected static void start(Class<?> klass, String... args) {
SpringApplication app = new SpringApplication(klass);
app.setWebApplicationType(WebApplicationType.NONE);
app.run(args);
}
}

@ -0,0 +1,55 @@
package cokr.xit.custom.boot;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.function.Predicate;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import cokr.xit.foundation.Assert;
import cokr.xit.foundation.data.StringMap;
@Configuration("staticResource")
public class StaticResourceConfig2 {
@Value("${spring.mvc.static-path-pattern}")
private String staticURLs;
@Value("${spring.web.resources.static-locations}")
private String staticLocations;
public Map<String, String> getMappings() {
if (Assert.isEmpty(staticURLs) && Assert.isEmpty(staticLocations))
return Collections.emptyMap();
List<String>
urls = Arrays.asList(staticURLs.split(",")),
locations = Arrays.asList(staticLocations.split(","));
if (urls.size() != locations.size())
throw new RuntimeException("URLs and locations do not match in size for static resources");
StringMap<String> resMap = new StringMap<>();
for (int i = 0; i < urls.size(); ++i) {
String url = urls.get(i),
location = locations.get(i);
resMap.put(url.trim(), location.trim());
}
return resMap;
}
public String[] getURLs(Predicate<Map.Entry<String, String>> filter) {
Predicate<Map.Entry<String, String>> test = filter != null ? filter : entry -> true;
List<String> urls = getMappings().entrySet().stream()
.filter(test)
.map(entry -> entry.getKey())
.toList();
return urls.toArray(new String[urls.size()]);
}
public String[] getLocations() {
List<String> locations = getMappings().values().stream().toList();
return locations.toArray(new String[locations.size()]);
}
}

@ -1,4 +1,4 @@
package cokr.xit.base.boot; package cokr.xit.custom.boot;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package cokr.xit.base.boot; package cokr.xit.custom.boot;
import javax.xml.ws.Endpoint; import javax.xml.ws.Endpoint;

@ -1,4 +1,4 @@
package cokr.xit.base.boot; package cokr.xit.custom.boot;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration; import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;

@ -0,0 +1,130 @@
package cokr.xit.custom.boot;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.springframework.boot.env.YamlPropertySourceLoader;
import org.springframework.core.env.PropertySource;
import org.springframework.core.io.ClassPathResource;
import cokr.xit.foundation.Assert;
/**yml .
* <p>
* @author mjkhan
*/
public class Yml2 {
private Map<String, ?> source;
/** Yml .
* @param rootName
* @param path yml
*/
public Yml2(String rootName, String path) {
load(rootName, path);
}
/** yml .
* @param rootName
* @param path yml
* @return Yml
*/
public Yml2 load(String rootName, String path) {
source = null;
try {
List<PropertySource<?>> sources = new YamlPropertySourceLoader()
.load(rootName, new ClassPathResource(path));
if (!sources.isEmpty())
source = (Map<String, ?>)sources.get(0).getSource();
return this;
} catch (Exception e) {
throw Assert.runtimeException(e);
}
}
/** ( ) .
* @param key .
* <pre><code> spring:
* application:
* name: my-application
* </code></pre>
* @return
*/
public String getValue(String key) {
if (source == null) return "";
Object obj = source.get(key);
return obj != null ? obj.toString() : "";
}
/** ( ) .
* <pre><code> list:
* - item-0
* - item-2
* - item-3</code></pre>
* @param prefix
* @return
*/
public List<String> getValues(String prefix) {
if (source == null) return Collections.emptyList();
return getPrefixed(prefix).stream()
.map(entry -> entry.getValue().toString())
.collect(Collectors.toList());
}
private List<Map.Entry<String, ?>> getPrefixed(String prefix) {
return source.entrySet().stream()
.filter(entry -> entry.getKey().startsWith(prefix))
.collect(Collectors.toList());
}
/** ( ) Map .
* <pre><code> parent:
* - property-0: value-0
* - property-1: value-1
* - property-2: value-2</code></pre>
* @param prefix
* @return Map
*/
public Map<String, String> getMap(String prefix) {
if (source == null) return Collections.emptyMap();
LinkedHashMap<String, String> map = new LinkedHashMap<>();
getPrefixed(prefix).stream().forEach(entry -> putTo(map, entry));
return map;
}
private void putTo(LinkedHashMap<String, String> map, Map.Entry<String, ?> entry) {
String key = entry.getKey();
key = key.substring(key.lastIndexOf(".") + 1);
String val = entry.getValue().toString();
map.put(key, val);
}
/** ( ) Map .
* <pre><code> parent:
* - property-0: value-0.0
* property-1: value-0.1
* - property-0: value-1.0
* property-1: value-1.1</code></pre>
* @param prefix
* @return Map
*/
public List<Map<String, String>> getMaps(String prefix) {
if (source == null) return Collections.emptyList();
return getPrefixed(prefix).stream()
.map(entry -> {
String str = entry.getKey();
return str.substring(0, str.lastIndexOf("."));
})
.collect(Collectors.toSet()).stream()
.map(this::getMap)
.collect(Collectors.toList());
}
}

@ -3,7 +3,7 @@ package testserver;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.context.annotation.ImportResource; import org.springframework.context.annotation.ImportResource;
import cokr.xit.base.boot.XitBaseApplication2; import cokr.xit.custom.boot.XitBaseApplication2;
@ImportResource("classpath:spring/context-*.xml") @ImportResource("classpath:spring/context-*.xml")
public class TsApplication extends XitBaseApplication2 { public class TsApplication extends XitBaseApplication2 {

@ -6,13 +6,11 @@ server:
spring: spring:
application: application:
name: dummy-external-system name: dummy-external-system
main: main:
allow-bean-definition-overriding: true allow-bean-definition-overriding: true
sql: sql:
init: init:
platform: mariadb platform: mariadb
datasource: datasource:
hikari: hikari:
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
@ -27,7 +25,6 @@ spring:
username: fimsweb username: fimsweb
password: fimsweb!@ password: fimsweb!@
auto-commit: false auto-commit: false
mvc: mvc:
static-path-pattern: /resources/**,/files/** static-path-pattern: /resources/**,/files/**
web: web:

Loading…
Cancel
Save