小编ale*_*oid的帖子

我可以使用Corona sdk制作非游戏应用程序吗?

我可以使用Corona http://www.coronalabs.com/products/corona-sdk/制作非游戏应用程序吗?我的意思是非游戏应用程序,有很多按钮,表格,图表,报告,选择等等.

我需要它来创建跨平台的移动应用程序.

mobile android ios coronasdk

7
推荐指数
1
解决办法
6262
查看次数

Spring引导非致命错误ClassNotFoundException

我正在尝试创建Spring Boot应用程序以与Apache ActiveMQ进行协作.

在启动期间,我收到以下"非致命"错误:

java.lang.ClassNotFoundException: org.springframework.data.web.config.EnableSpringDataWebSupport
    at java.net.URLClassLoader$1.run(Unknown Source) ~[na:1.8.0_25]
    at java.net.URLClassLoader$1.run(Unknown Source) ~[na:1.8.0_25]
    at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_25]
    at java.net.URLClassLoader.findClass(Unknown Source) ~[na:1.8.0_25]
    at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_25]
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) ~[na:1.8.0_25]
    at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_25]

java.lang.ClassNotFoundException: org.springframework.security.config.annotation.web.configuration.EnableWebSecurity
    at java.net.URLClassLoader$1.run(Unknown Source) ~[na:1.8.0_25]
    at java.net.URLClassLoader$1.run(Unknown Source) ~[na:1.8.0_25]
    at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_25]
    at java.net.URLClassLoader.findClass(Unknown Source) ~[na:1.8.0_25]
    at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_25]
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) ~[na:1.8.0_25]
    at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_25]
Run Code Online (Sandbox Code Playgroud)

这是我的文件:

@Configuration
@EnableJms
public class ActiveMQTestConfig {

    @Bean
    // Strictly speaking this bean is not necessary …
Run Code Online (Sandbox Code Playgroud)

spring activemq-classic spring-boot

7
推荐指数
1
解决办法
9769
查看次数

通过REST端点进行Spring Security身份验证/授权

在我使用RESTful webservices的Spring Boot应用程序中,我已将Spring Security与Spring Social和SpringSocialConfigurer.

现在我有两种身份验证/授权方式 - 通过用户名/密码和社交网络,例如Twitter.

为了在我的Spring MVC REST控制器中通过我自己的RESTful端点实现身份验证/授权,我添加了以下方法:

@RequestMapping(value = "/login", method = RequestMethod.POST)
public Authentication login(@RequestBody LoginUserRequest userRequest) {
    Authentication authentication = authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(userRequest.getUsername(), userRequest.getPassword()));
    boolean isAuthenticated = isAuthenticated(authentication);
    if (isAuthenticated) {
        SecurityContextHolder.getContext().setAuthentication(authentication);
    }
    return authentication;
}

private boolean isAuthenticated(Authentication authentication) {
    return authentication != null && !(authentication instanceof AnonymousAuthenticationToken) && authentication.isAuthenticated();
}
Run Code Online (Sandbox Code Playgroud)

但是我不确定在成功的/login 端点调用之后必须返回到客户端的确切内容.我认为返回完整的身份验证对象是多余的.

在成功验证的情况下应该返回给客户什么?

你能告诉我如何正确实现这个登录方法吗?

此外,在RESTfull登录的情况下,我将有,UsernamePasswordAuthenticationToken并且如果通过Twitter登录我将有SocialAuthenticationToken 可能在同一个应用程序中有不同的令牌吗?

authentication spring spring-mvc spring-security spring-social

7
推荐指数
1
解决办法
5906
查看次数

使用Google OAuth2授权服务器保护Spring RESTful API

我计划在AngularJS上使用Spring RESTful API后端和客户端创建应用程序.

我想通过Google OAuth2授权服务器保护我的Spring RESTful API.

我有一个架构问题:

在Google成功授权后,我会从Google OAuth2授权服务器收到accessToken.我是否需要将此accessToken传输到我的客户端应用程序(AngularJS),或者我需要在我的后端应用程序中引入一些自己的安全层(例如使用JWT)并基于Google accessToken发布自己的jwtToken并仅将此令牌传输到我的客户端应用?

换句话说 - 将Google的accessToken显示给我的客户端AngularJS应用并将其用于我自己的RESTful API中的身份验证是否安全?

另外,在我的RESTful API的情况下,我是否需要在从客户端应用程序(AngularJS)到我的安全RESTful API的每次调用之后使用Google Auth服务器验证Google accessToken?

java rest angularjs spring-security-oauth2 oauth2

7
推荐指数
1
解决办法
3972
查看次数

Spring Boot JSR-303/349配置

在我的Spring Boot 1.5.1应用程序中,我正在尝试配置对JSR-303/JSR-349验证的支持.

@NotNull @Size(min = 1)在我的方法中添加了以下注释:

@Service
@Transactional
public class DecisionDaoImpl extends BaseDao implements DecisionDao {

    @Override
    public Decision create(@NotNull @Size(min = 1) String name, String description, String url, String imageUrl, Decision parentDecision, Tenant tenant, User user) {
        ...
    }

}
Run Code Online (Sandbox Code Playgroud)

我试图从我的测试中调用此方法,但它不会在验证约束上失败.

这是我的测试和配置:

@SpringBootTest(classes = { TestConfig.class, Neo4jTestConfig.class })
@RunWith(SpringRunner.class)
@Transactional
public class TenantTest {

    @Test
    public void testCreateDecision() {
        User user1 = userService.createUser("test1", "test1", "test1@test.com", null, null);
        Tenant tenant1 = tenantDao.create("Tenant 1", "Tenant 1 …
Run Code Online (Sandbox Code Playgroud)

java spring jsr bean-validation spring-boot

7
推荐指数
1
解决办法
7108
查看次数

Java 8泛型兼容性

我有以下方法声明:

public <T extends Serializable,
        Method extends BotApiMethod<T>,
        Callback extends SentCallback<T>>
    void executeAsync(Method method, Callback callback)
Run Code Online (Sandbox Code Playgroud)

当我以下列方式使用它时:

executeAsync(editMessage, new SentCallback() {
Run Code Online (Sandbox Code Playgroud)

它工作正常,但显示类型安全警告.

但是当我提供泛型类型时SentCallback,例如:

executeAsync(editMessage, new SentCallback<Message>()
Run Code Online (Sandbox Code Playgroud)

它显示以下编译错误:

AbsSender类型中的方法executeAsync(Method,Callback)不适用于参数(EditMessageReplyMarkup,new SentCallback(){})

为什么我不能用它new SentCallback<Message>

java java-8

7
推荐指数
1
解决办法
167
查看次数

Spring Kafka该类不在受信任的软件包中

在库更新之前的我的Spring Boot / Kafka应用程序中,我使用以下类org.telegram.telegrambots.api.objects.Update将消息发布到Kafka主题。现在,我使用以下内容org.telegram.telegrambots.meta.api.objects.Update。如您所见-它们具有不同的软件包。

重新启动应用程序后,我遇到了以下问题:

[org.springframework.kafka.KafkaListenerEndpointContainer#1-0-C-1] o.s.kafka.listener.LoggingErrorHandler : Error while processing: null

org.apache.kafka.common.errors.SerializationException: Error deserializing key/value for partition telegram.fenix.bot.update-0 at offset 4223. If needed, please seek past the record to continue consumption.
Caused by: java.lang.IllegalArgumentException: The class 'org.telegram.telegrambots.api.objects.Update' is not in the trusted packages: [java.util, java.lang, org.telegram.telegrambots.meta.api.objects]. If you believe this class is safe to deserialize, please provide its name. If the serialization is only done by a trusted source, you can also enable trust all …
Run Code Online (Sandbox Code Playgroud)

java apache-kafka spring-boot spring-kafka

7
推荐指数
6
解决办法
7040
查看次数

Google oauth子域

我已经在网站(example.com)上实现了Google oAuth。除了我站点上子域的auth(我有成千上万个子域)的授权外,其他一切都正常。例如,当用户尝试通过子域进行授权时

fr.example.com
product1.example.com
product2.de.example.com
Run Code Online (Sandbox Code Playgroud)

我收到来自Google的错误-

The redirect URI in the request did not match a registered redirect URI
Run Code Online (Sandbox Code Playgroud)

如何解决?

oauth oauth-2.0 google-oauth

6
推荐指数
2
解决办法
8937
查看次数

无法移动到Neo4j 2.2.0和Spring Data Neo4j 3.3.0.RELEASE

我使用Spring 4.1.6.RELEASE和Spring Boot 1.2.3.RELEASE.现在,我无法顺利地从Neo4j 2.1.7和SDN 3.2.2.RELEASE迁移到Neo4j 2.2.0和SDN 3.3.0.RELEASE

首先,Neo4jHelper课程缺席......那么应该使用什么呢?

此外,我的测试崩溃,但有以下例外:

org.springframework.dao.InvalidDataAccessApiUsageException: nested exception is org.neo4j.graphdb.NotInTransactionException
    at org.springframework.data.neo4j.support.Neo4jExceptionTranslator.translateExceptionIfPossible(Neo4jExceptionTranslator.java:51)
    at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:59)
    at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:213)
    at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:147)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
Run Code Online (Sandbox Code Playgroud)

但在以前的版本中一切正常(我的DAO和服务都注释了@Transactional).

如何在我的Spring Boot应用程序中为Neo4j配置适当的TX管理器?

现在NullTransactionManager使用,我认为这是问题的原因:

2015-04-03 11:40:36 [main] INFO  o.s.c.a.AnnotationConfigApplicationContext - Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@12db5286: startup date [Fri Apr 03 11:40:36 EEST 2015]; root of context hierarchy
2015-04-03 11:40:37 [main] INFO  o.s.b.f.a.AutowiredAnnotationBeanPostProcessor - JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2015-04-03 11:40:38 [main] INFO  o.s.t.jta.JtaTransactionManager - Using JTA UserTransaction: …
Run Code Online (Sandbox Code Playgroud)

neo4j spring-data-neo4j spring-boot

6
推荐指数
1
解决办法
510
查看次数

PostgreSQL 存储 ID 列表的有效方法

在我的 PostgreSQL 中,我有两个表board和它们之间cardsOneToMany关系的表(一个board可以有多个cards)。

用户可以在板上放置几张卡片。为了实现这个功能,我通常会创建另一个表,例如cards_on_holdOneToMany关系调用,并将卡放在这个表中。为了获取板的这些数据,我会在board和之间使用 JOIN cards_on_hold

PostgreSQL 中是否有更有效的方法来存储卡的 ID?例如,也许某些功能可以将此列表内联存储在board表中?稍后我将需要在INSQL 子句中使用此 ID 列表来过滤卡片集。

postgresql

6
推荐指数
1
解决办法
1万
查看次数