全局文件配置pom.xml
<!-- 添加父工程 --> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.7.RELEASE</version> <relativePath /> </parent> <dependencies> <dependency> <!-- 数据库 --> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> </dependency> <!-- 德鲁伊数据库连接池 --> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid</artifactId> <version>1.0.27</version> </dependency> <!-- mybatis的starter --> <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>1.1.1</version> </dependency> <!--web --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <!-- 添加servlet的依赖 --> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <scope>provided</scope> </dependency> <!-- 添加对jsp的支持 --> <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-jasper</artifactId> <scope>provided</scope> </dependency> <!-- jstl的依赖 foreach的循环标签--> <dependency> <groupId>javax.servlet</groupId> <artifactId>jstl</artifactId> </dependency> <!--支持热启动的依赖 工具 当你的代理发生改变的时候会自动重启项目 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> <scope>runtime</scope> </dependency> </dependencies> <build> <!-- 插件 --> <plugins> <!-- 设定JDK编译版本为1.8 --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.8</source> <target>1.8</target> <encoding>UTF-8</encoding> </configuration> </plugin> </plugins> </build>
配置application.properties
# 数据库 spring.datasource.url = jdbc:mysql://localhost:3306/myssm?useSSL=false&characterEncoding=UTF-8 spring.datasource.username = root spring.datasource.password = 1234 spring.datasource.driverClassName = com.mysql.jdbc.Driver spring.datasource.max-active=20 spring.datasource.max-idle=8 spring.datasource.min-idle=8 spring.datasource.initial-size=10 # 别名 mybatis.type-aliases-package=com.pojo #日志级别 logging.level.com.mapper=debug # 视图映射 prefix前缀 spring.mvc.view.prefix=/pages/ #spring.mvc.view.suffix=.html #端口号 server.port=8081 #静态资源映射 spring.mvc.static-path-pattern=/**
springboot的启动项和德鲁伊的配置
@SpringBootApplication public class BikeStart { public static void main(String[] args) { SpringApplication.run(BikeStart.class, args); } @Bean("datasource") @ConfigurationProperties(prefix="spring.datasource") @Primary//当使用到DataSource的时候 优先使用此DataSource public DataSource getDataSource(){ DruidDataSource dataSource = new DruidDataSource(); return dataSource ; }
运行时的图片修改
直接创建一个banner.txt的文件,里面放置改动的图片