Cloning source
Search For Nancos on Github and clone the code without going into details.
Setting up maven Environment
Baidu search, also no longer repeat.
Download the source code
mvn -Prelease-nacos -Dmaven.test.skip=true clean install -U
Copy the code
Program entrance
In the console module
└ ─ SRC ├ ─ the main │ ├ ─ Java │ │ └ ─ com │ │ └ ─ alibaba │ │ └ ─ nacos │ │ └ ─ the console | | ├ ─ * * nacos in Java * * │ │ ├ ─ config │ │ ├ ─ controller │ │ ├ ─ exception │ │ ├ ─ filter │ │ ├ ─ model │ │ ├ ─ security │ │ │ └ ─ nacos │ │ │ ├ ─ roles │ │ │ └ ─ the users │ │ └ ─ utilsCopy the code
@SpringBootApplication(scanBasePackages = "com.alibaba.nacos")
@ServletComponentScan
@EnableScheduling
public class Nacos {
public static void main(String[] args) { SpringApplication.run(Nacos.class, args); }}Copy the code
Importing a Database
Nacos-mysql. SQL in distribution\conf, import
├─ Circulation │ ├─bin │ ├─ confCopy the code
Modifying a Configuration File
### If use MySQL as datasource:
spring.datasource.platform=mysql
### Count of DB:
db.num=1
### Connect URL of DB:Db. Url. 0 = JDBC: mysql: / / 127.0.0.1:3306 / nacos? characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
db.user.0=root
db.password.0=czy123456
Copy the code
Modifying command Parameters
Example Change the VM option parameter to single-machine mode
-Dnacos.standalone=true -Dnacos.home=D:/DevelopData/JavaProject/nacos/distribution
Copy the code
Start the
2021-06-13 19:03:39.586 INFO 10440 -- [main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler@38a1a26' of type [org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible forAuto-proxying) 2021-06-13 19:03:39.595 INFO 10440 -- [main] trationDelegate$BeanPostProcessorChecker : Bean 'methodSecurityMetadataSource' of type [org.springframework.security.access.method.DelegatingMethodSecurityMetadataSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible forAuto - proxying) 19:03:40 2021-06-13. 10440-239 the INFO [main] O.S.B.W.E mbedded. Tomcat. TomcatWebServer: Tomcat initialized with port(s): 8848 (http)Copy the code
If you have these logs, you’re successful.