码迷,mamicode.com
首页 > 移动开发 > 详细

spring boot app

时间:2017-07-26 13:47:29      阅读:164      评论:0      收藏:0      [点我收藏+]

标签:pen   root   timeout   upd   encoding   web   ddl   pid   localhost   

一个demo  可以参考一下

AppConfig

@Configuration
@ComponentScan(basePackages = { "org.whm.test" })
@EnableAutoConfiguration
public class AppConfig {

    public static void main(String[] argss) {
        String[] args = { "--spring.config.location=classpath:config/app.yml" };
        SpringApplication.run(AppConfig.class, args);
    }

}

pom.xml

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.4.RELEASE</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-aop</artifactId>
        </dependency>
        
    </dependencies>

app.yml

server: 
  port: 8099 
  session-timeout: 30
  tomcat.max-threads: 0
  tomcat.uri-encoding: UTF-8
  
spring: 
  aop: 
    auto: true 
  datasource:  
    url : jdbc:mysql://localhost:3306/newbirds
    username : root
    password : mymysql
    driverClassName : com.mysql.jdbc.Driver
  jpa:  
    database : MYSQL
    show-sql : true
    hibernate: 
      ddl-auto : update
      naming-strategy : org.hibernate.cfg.ImprovedNamingStrategy
    properties: 
      hibernate: 
        dialect : org.hibernate.dialect.MySQL5Dialect

 

spring boot app

标签:pen   root   timeout   upd   encoding   web   ddl   pid   localhost   

原文地址:http://www.cnblogs.com/whm-blog/p/7239109.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!