我正在尝试使用亚马逊的SES/SMTP发送电子邮件,我收到以下错误:
javax.mail.MessagingException:无法连接到SMTP主机:email-smtp.us-east-1.amazonaws.com,port:465,响应:-1
以下是我尝试发送邮件的方式:
Spring邮件发件人配置:
<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
<property name="host" value="${mail.server}"/>
<property name="port" value="${mail.port}"/>
<property name="username" value="${aws.mail.smtp.user}"/>
<property name="password" value="${aws.mail.smtp.password}"/>
<property name="javaMailProperties">
<props>
<!-- Use SMTP-AUTH to authenticate to SMTP server -->
<prop key="mail.smtp.auth">true</prop>
<!-- Use TLS to encrypt communication with SMTP server -->
<prop key="mail.smtp.starttls.enable">true</prop>
</props>
</property>
</bean>
Run Code Online (Sandbox Code Playgroud)
有:
mail.server =email-smtp.us-east-1.amazonaws.com
mail.port = 465
Run Code Online (Sandbox Code Playgroud) 我的问题涉及Spring批处理和事务.
假设我为我的一个步骤选择了50的提交间隔.
还假设我总共有1000条记录,其中一条记录会导致itemWriter失败,从而导致整个块的回滚(在我的例子中为50条记录).
什么是stategies以确保在作业完成后将49个有效记录写入数据库(并忽略有问题的块)?
我使用jQuery select2插件来使用提供的ajax回调函数检索邮政编码,如下所示:
$(document).ready(function() {
$("#postcodes").select2({
placeholder : "Search for a postcode",
multiple : true,
minimumInputLength : 3,
ajax : {
url : "/bignibou/utils/findGeolocationPostcodeByPostcodeStartingWith.json",
dataType : 'json',
data : function(term) {
return {
postcode : term
};
},
results : function(data) {
console.log(data);
return {
results : $.map(data, function(item) {
return {
id : item.id,
text : item.postcode
};
})
};
}
}
});
});
Run Code Online (Sandbox Code Playgroud)
一旦选择了两个邮政编码,我得到了结果hidden input
:
<input type="hidden" class="bigdrop select2-offscreen" id="postcodes" style="width:600px" name="familyAdvertisement.postcodes" value="4797,4798" tabindex="-1">
Run Code Online (Sandbox Code Playgroud)
我遇到的问题是,一旦重新显示表单(例如,在某些其他控件出错的情况下),选择(即两个邮政编码,尤其是两个邮政编码text
)不会在表单中显示,尽管 …
我正在尝试组装一个Angular 2 + Rx.JS 5/Next 的演示应用程序.
我注意到每次切换路由时都会重新实例化我的组件.
以下是根应用程序的代码:
import {bootstrap} from 'angular2/platform/browser';
import {HTTP_PROVIDERS} from 'angular2/http';
import {ROUTER_PROVIDERS} from 'angular2/router';
import {AppComponent} from './app.component.ts';
bootstrap(AppComponent, [HTTP_PROVIDERS, ROUTER_PROVIDERS]);
Run Code Online (Sandbox Code Playgroud)
以下是根组件的代码:
import {Component} from 'angular2/core';
import {RouteConfig, ROUTER_DIRECTIVES} from 'angular2/router';
import {FirstComponent} from './app.first-component.ts';
import {SecondComponent} from './app.second-component.ts';
import {AppService} from "./app.services.ts";
@Component({
selector: 'my-app',
providers: [AppService, FirstComponent, SecondComponent],
directives: [FirstComponent, SecondComponent, ROUTER_DIRECTIVES],
template: `<h1>An Angular 2 App</h1>
<a [routerLink]="['First']">first-default</a>
<a [routerLink]="['Second']">second</a>
<router-outlet></router-outlet>`
})
@RouteConfig([
{path: '/', name: 'First', component: FirstComponent, useAsDefault: …
Run Code Online (Sandbox Code Playgroud) 我正面临着让Karma使用SystemJS,Angular2和Typescript的问题.
这是我的karma.conf.js:
'use strict';
module.exports = function (config) {
config.set({
// base path, that will be used to resolve files and exclude
basePath: '.',
// frameworks to use
frameworks: ['systemjs', 'jasmine'],
plugins: ['karma-systemjs', 'karma-jasmine', 'karma-phantomjs-launcher'],
files: [
'node_modules/reflect-metadata/Reflect.js',
'app/**/*.spec.ts',
//'jspm_packages/system-polyfills.js',
'karma-test-shim.js'
],
systemjs: {
configFile: "systemjs.config.js",
config: {
//baseURL: ".",
transpiler: "typescript",
paths: {
"systemjs": "jspm_packages/system.js",
"system-polyfills": "jspm_packages/system-polyfills.js",
"typescript": "node_modules/typescript/lib/typescript.js"
},
packages: {
'app': {
defaultExtension: 'ts'
}
}
},
includeFiles: [
'node_modules/reflect-metadata/Reflect.js'
],
serveFiles: [
'app/**/*.ts',
'main-bundle.js'
]
}, …
Run Code Online (Sandbox Code Playgroud) 关于Spring MVC 格式化程序和转换器之间的区别,我需要澄清一下.
我对它们之间的主要区别的理解是格式化程序处理将要显示给最终用户的数据,例如日期,SSN或信用卡号,而转换器处理隐藏在表单控件后面的数据,例如value属性选择的选项.
我是对还是错?有人可以提供建议和/或样本,以便更好地解释两者之间的差异.
我试图检查表单是否有效,以防止进一步执行,如果不是.
这是我的表格:
<form (ngSubmit)="updateFirstName(firstNameForm)" #firstNameForm="ngForm" novalidate>
<div class="form-group" ng-class="getCssClasses(formCtrl, formCtrl.firstName)">
<div class="input-group">
<input type="text"
ngControl="firstName"
#firstName="ngForm"
required
minlength="2"
maxlength="35"
pattern_="FIRST_NAME_PATTERN"
[ngModel]="currentUserAccount?.firstName"
(ngModelChange)="currentUserAccount ? currentUserAccount.firstName = $event : null"
placeholder="{{'FIRST_NAME_FORM.NEW_FIRST_NAME'| translate }}"
class="form-control"/>
</div>
<div [hidden]="firstName.valid">
<div *ngIf="firstName?.errors?.minlength" class="control-label">{{'FIRST_NAME_FORM.MIN_LENGTH'| translate}}</div>
</div>
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary pull-right" [disabled]="buttonDisabled">{{'FIRST_NAME_FORM.SUBMIT'| translate}}</button>
<a [routerLink]="['/dashboard/useraccount']" class="btn btn-link pull-right text-right">{{'FORM_CANCEL' | translate}}</a>
</div>
</form>
Run Code Online (Sandbox Code Playgroud)
但是,当我提交无效表单时,我在控制台中注意到有效属性NgForm
是true
...
updateFirstName(firstNameForm) {
console.log(firstNameForm);//the valid attribute of firstNameForm is true...
}
Run Code Online (Sandbox Code Playgroud)
任何人都可以让我知道为什么会这样吗?
我的问题涉及ngrx 效应和减速器.
在将它放入ngrx存储之前,我需要转换从后端检索的数据.从后端检索的数据是一个普通数组Message
(Message
在我的应用程序中是一个自定义类型):
Message[]
Run Code Online (Sandbox Code Playgroud)
我需要将数组转换为以下内容:
Map<string, Message[]>
Run Code Online (Sandbox Code Playgroud)
基本上我是按对方(收件人或发件人)ID(密钥)对用户的邮件进行分组.
我不知道从哪里执行转换Message[]
到Map<string, Message[]>
:我应该把转型业务逻辑到@Effect或进入减速功能?
在我的Android设备上调用时,以下方法系统地抛出IOException,而互联网连接是活的(我可以使用我的Android设备检索电子邮件或连接到gmail).
有人可以帮忙吗?
private void performAuthentication() {
Log.d("GAWidget", "performAuthentication");
GoogleCredential credential = new GoogleCredential();
GoogleAccountManager accountManager = new GoogleAccountManager(this);
Log.d("GAWidget", "after getting accountManager");
Account account = accountManager.getAccountByName("balteo@gmail.com");
Log.d("GAWidget", "after getting account"+"account.name: "+account.name);
accountManager.getAccountManager().getAuthToken(account, "oauth2:https://www.googleapis.com/auth/??analytics.readonly",
true, new AccountManagerCallback<Bundle>() {
public void run(AccountManagerFuture<Bundle> future) {
try {
String token = future.getResult(15, TimeUnit.SECONDS).getString(AccountManager.KEY_AUTHTOKEN);
Log.d("GAWidget", "token: "+token);
useToken(token);
} catch (OperationCanceledException e) {
Log.e("GAWidget", "OperationCanceledException", e);
} catch (AuthenticatorException e) {
Log.e("GAWidget", "AuthenticatorException", e);
} catch (IOException e) {
Log.e("GAWidget", "IOException", e);
}
}
}, …
Run Code Online (Sandbox Code Playgroud) 我已经配置了我的H2数据库,如下所示:
@Configuration
@Profile({ Profiles.DEV })
public class DevDataSourceConfiguration {
@Bean(initMethod = "start", destroyMethod = "stop")
public Server h2WebServer() throws SQLException {
return Server.createWebServer("-web", "-webAllowOthers", "-webPort", "8082");
}
@Bean(initMethod = "start", destroyMethod = "stop")
@DependsOn("h2WebServer")
public Server h2Server() throws SQLException {
return Server.createTcpServer("-tcp", "-tcpAllowOthers", "-tcpPort", "9092");
}
@Bean
@DependsOn("h2Server")
public DataSource datasource() {
HikariDataSource ds = new HikariDataSource();
ds.setDriverClassName("org.h2.Driver");
ds.setJdbcUrl("jdbc:h2:tcp://localhost/~/bignibou");
return ds;
}
}
Run Code Online (Sandbox Code Playgroud)
我现在尝试使用以下jdbc URL从DBVisualizer访问我的数据库:jdbc:h2:tcp://localhost/~/bignibou
我在dbvis日志中收到以下错误:
2015-05-17 17:02:24.544 WARN 595 [ExecutorRunner-pool-3-thread-11 - G.??] Could not setAutoCommit(true) for: bignibou
org.h2.jdbc.JdbcSQLException: …
Run Code Online (Sandbox Code Playgroud) angular ×3
access-token ×1
amazon-ses ×1
android ×1
chunks ×1
commit ×1
converter ×1
dbvisualizer ×1
formatter ×1
h2 ×1
java ×1
javascript ×1
jquery ×1
karma-runner ×1
ngrx ×1
ngrx-effects ×1
oauth-2.0 ×1
redux ×1
smtp ×1
spring ×1
spring-batch ×1
spring-mvc ×1
ssl ×1
systemjs ×1
transactions ×1
typescript ×1