在 jhipster 中配置电子邮件
configuring email in jhipster
我正在尝试在 jhipster 应用程序上配置电子邮件,但出现此错误:
Exception in thread "restartedMain" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: mapping values are not allowed here
in 'reader', line 73, column 17:
port: 587
^
这是我的配置:
jhipster:
datasource: # JHipster-specific configuration, in addition to the standard spring.datasource properties
cachePrepStmts: true
prepStmtCacheSize: 250
prepStmtCacheSqlLimit: 2048
useServerPrepStmts: true
cache: # Hibernate 2nd level cache, used by CacheConfiguration
timeToLiveSeconds: 3600
ehcache:
maxBytesLocalHeap: 16M
mail: # specific JHipster mail property, for standard properties see MailProperties
host: smtp.gmail.com
port: 587
user: spoonatte@gmail.com
password: password
protocol: smtp
tls: true
auth: true
from: spoonatte@gmail.com
我该如何解决这个问题?
你的邮件配置是错误的,它不应该在 jhipster
下,而且一些邮件属性应该少缩进,它们必须在 spring
下,就像 JHipster 生成的 application-prod.yml
中一样在你的项目中。
spring:
mail:
host: smtp.gmail.com
port: 587
user: spoonatte@gmail.com
password: password
protocol: smtp
tls: true
auth: true
from: spoonatte@gmail.com
properties.mail.smtp:
auth: true
starttls.enable: true
ssl.trust: smtp.gmail.com
我正在尝试在 jhipster 应用程序上配置电子邮件,但出现此错误:
Exception in thread "restartedMain" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: mapping values are not allowed here
in 'reader', line 73, column 17:
port: 587
^
这是我的配置:
jhipster:
datasource: # JHipster-specific configuration, in addition to the standard spring.datasource properties
cachePrepStmts: true
prepStmtCacheSize: 250
prepStmtCacheSqlLimit: 2048
useServerPrepStmts: true
cache: # Hibernate 2nd level cache, used by CacheConfiguration
timeToLiveSeconds: 3600
ehcache:
maxBytesLocalHeap: 16M
mail: # specific JHipster mail property, for standard properties see MailProperties
host: smtp.gmail.com
port: 587
user: spoonatte@gmail.com
password: password
protocol: smtp
tls: true
auth: true
from: spoonatte@gmail.com
我该如何解决这个问题?
你的邮件配置是错误的,它不应该在 jhipster
下,而且一些邮件属性应该少缩进,它们必须在 spring
下,就像 JHipster 生成的 application-prod.yml
中一样在你的项目中。
spring:
mail:
host: smtp.gmail.com
port: 587
user: spoonatte@gmail.com
password: password
protocol: smtp
tls: true
auth: true
from: spoonatte@gmail.com
properties.mail.smtp:
auth: true
starttls.enable: true
ssl.trust: smtp.gmail.com