Commit ec59bca0 by 石头

提交admin

1 parent 1b683692
<?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/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>cihai</artifactId>
<groupId>com.dookay</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>cihai-app</artifactId>
<packaging>war</packaging>
<properties>
<maven.test.skip>true</maven.test.skip>
<jetty.scope>compile</jetty.scope>
</properties>
<dependencies>
<dependency>
<groupId>com.dookay</groupId>
<artifactId>coral-common-web</artifactId>
</dependency>
<dependency>
<groupId>com.dookay</groupId>
<artifactId>cihai-core</artifactId>
</dependency>
<!--开发工具-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<!--表现层-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<scope>${jetty.scope}</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
<scope>${jetty.scope}</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>apache-jsp</artifactId>
<scope>${jetty.scope}</scope>
</dependency>
<!--表现层-->
<!--工具-->
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<!--接口文档-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
</dependency>
<!--接口文档-->
</dependencies>
</project>
package com.dookay.cihai.app;
import com.dookay.coral.common.core.CoralCommonCoreMarker;
import com.dookay.coral.common.web.CoralCommonWebMarker;
import com.dookay.cihai.core.CihaiCoreMarker;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.cache.annotation.EnableCaching;
/**
* 项目运行入口
*
* @author houkun
*/
@SpringBootApplication(
// 加载不同模块的配置与待注入的Bean
scanBasePackageClasses = {
CoralCommonCoreMarker.class,
CoralCommonWebMarker.class,
CihaiCoreMarker.class,
CihaiAppApplication.class,
})
@ServletComponentScan(basePackageClasses = {
CoralCommonWebMarker.class,
CihaiAppApplication.class
})
@MapperScan(basePackageClasses = CihaiCoreMarker.class)
@EnableCaching
public class CihaiAppApplication extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(CihaiAppApplication.class);
}
public static void main(String[] args) {
SpringApplication.run(CihaiAppApplication.class, args);
}
}
package com.dookay.cihai.app.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
* 接口文档配置
*
* @author houkun
*/
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Bean
public Docket demoApi() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build();
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("Coral Demo 示例接口文档")
.description("示例描述")
.version("0.1")
.build();
}
}
package com.dookay.cihai.app.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
/**
* Web config
*
* @author houkun
*/
@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("swagger-ui.html")
.addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/");
}
}
......@@ -34,6 +34,10 @@
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.dookay</groupId>
<artifactId>coral-builder</artifactId>
</dependency>
<!--开发工具-->
</dependencies>
......
package com.dookay.cihai.core;
import com.dookay.coral.common.core.CoralCommonCoreMarker;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
/**
* @author houkun
*/
public interface CihaiCoreMarker {
}
package com.dookay.cihai.core;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.Rollback;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.transaction.annotation.Transactional;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE)
@Rollback
@Transactional
@MapperScan(basePackageClasses = CihaiCoreMarker.class)
public class CihaiCoreApplicationTests {
@Test
public void contextLoads() {
}
}
......@@ -43,6 +43,11 @@
<artifactId>coral-common-web</artifactId>
<version>${dookay.common.version}</version>
</dependency>
<dependency>
<groupId>com.dookay</groupId>
<artifactId>coral-builder</artifactId>
<version>2.0</version>
</dependency>
<!--稻壳基础库-->
<!--项目内依赖-->
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!