Skip to content

youngmonkeys/ezyfox-boot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ezyfox-boot

boot project for ezyfox

How to use?

  1. Add dependency to your pom.xml:
<dependency>
    <groupId>com.tvd12</groupId>
    <artifactId>ezyfox-boot-autoconfigure</artifactId>
    <version>1.0.6</version>
</dependency>
  1. Create and edit configuration file:

You can create src/main/resources/[FILE_NAME].properties file:

# for mongodb
database.mongo.uri=mongodb://root:[email protected]:27017/[DATABASE_NAME]
database.mongo.database=[DATABASE_NAME]
database.mongo.collection.naming.case=UNDERSCORE
database.mongo.collection.naming.ignored_suffix=Entity
# for jpa
datasource.jdbcUrl=[your jdbc url, i.e jdbc:h2:mem:testdb]
datasource.driverClassName=[your driver class name, i.e org.h2.Driver]
datasource.username=[your db username]
datasource.password=[your db password]
# for redis
redis.uri=[your uri]

Or src/main/resources/[FILE_NAME].yaml file like this:

# for mongodb
database:
  mongo:
  uri: mongodb://root:[email protected]:27017/[DATABASE_NAME]
  database: [ DATABASE_NAME ]
  collection:
    naming.case: UNDERSCORE
    naming.ignored_suffix: Entity

# for jpa
datasource:
  jdbcUrl: [ your jdbc url, i.e jdbc:h2:mem:testdb ]
  driverClassName: [ your driver class name, i.e org.h2.Driver ]
  username: [ your db username ]
  password: [ your db password ]

# for redis
redis:
  uri: [ your uri ]

NOTE: You can add above fields directly to application.properties or application.yaml file and skip Step 3. By default, ezyfox-boot automatically loads application.properties and application.yaml, so we don't need to specify the @EzyPropertiesSources

  1. Add @EzyPropertiesSources({"[FILE_NAME].properties"}) before the main class:
@EzyPropertiesSources({"[FILE_NAME].properties"})
public class ServerStartup {  
	...

    public static void main(String[] args) throws Exception {
    }
}