SpringMVC,SpringBoot、mybits整合基础配置
application.yml的基础配置:
#配置数据源 spring: datasource: driver-class-name: oracle.jdbc.driver.OracleDriver url: jdbc:oracle:thin:@192.168.95.254:1521:orcl username: lwt password: 123456 ############################################### # thymeleaf 相关设置 thymeleaf: prefix: classpath:/templates/ cache: false suffix: .html encoding: UTF-8 content-type: text/html #spring.thymeleaf.mode的默认值是HTML5,其实是一个很严格的检查, #改为LEGACYHTML5可以得到一个可能更友好亲切的格式要求。 #LEGACYHTML5需要搭配一个额外的库NekoHTML才可用 # <dependency> # <groupId>net.sourceforge.nekohtml</groupId> # <artifactId>nekohtml</artifactId> # <version>1.9.15</version> # </dependency> mode: LEGACYHTML5 server: port: 8080 ############################################### #开MYBATIS日志打印 修改level及包名级别为debug 设置日志保存目录 logging: level: net.vv2.baby.mapper: DEBUG file: var/log/myapp.log ##mybatis############################################# mybatis: type-aliases-package: com/dkt/entity mapper-locations: classpath:mappers/*.xml
pom.xml的基本配置:
<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>ERP</groupId> <artifactId>PPS</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>war</packaging> <name>ERP</name> <description/> <!-- Spring Boot 启动父依赖 --> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.3.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.8</java.version> <oracle.version>11.2.0.3</oracle.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-aop</artifactId> </dependency> <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>1.3.0</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </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> <scope>test</scope> </dependency> <dependency> <groupId>net.sourceforge.nekohtml</groupId> <artifactId>nekohtml</artifactId> <version>1.9.15</version> </dependency> <dependency> <groupId>com.xiaoleilu</groupId> <artifactId>hutool-all</artifactId> <version>3.0.6</version> </dependency> <dependency> <groupId>com.oracle</groupId> <artifactId>ojdbc6</artifactId> <version>${oracle.version}</version> <scope>runtime</scope> </dependency> <!-- 另一种驱动 <dependency> <groupId>com.oracle</groupId> <artifactId>classes12</artifactId> <version>10.2.0.2.0</version> </dependency> --> <dependency> <groupId>c3p0</groupId> <artifactId>c3p0</artifactId> <version>0.9.1.2</version> </dependency> <!--PageHelp分页--> <dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper-spring-boot-starter</artifactId> <version>1.2.3</version> </dependency> <!--json解析包 --> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.3</version> </dependency> <dependency> <groupId>net.sf.json-lib</groupId> <artifactId>json-lib</artifactId> <version>2.4</version> <classifier>jdk15</classifier> </dependency> <!-- JSON begin --> </dependencies> <build> <!-- 指定mybatis 接口实现 的配置文件 位置 在非springboot情况下使用 <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.xml</include> </includes> </resource> </resources> --> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <configuration> <source>1.7</source> <target>1.7</target> </configuration> </plugin> <plugin> <artifactId>maven-war-plugin</artifactId> <version>2.6</version> <configuration> <failOnMissingWebXml>false</failOnMissingWebXml> </configuration> </plugin> </plugins> </build> </project>

浙公网安备 33010602011771号