我正在使用Spring MVC 3.1.0M2并尝试将我的配置移动到java bean.但我遇到以下错误:
2011-09-14 18:43:42.301:警告:/:不可用org.springframework.beans.factory.BeanCreationException:创建名为'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration#0'的bean时出错:注入自动连接的依赖项失败; 嵌套异常是org.springframework.beans.factory.BeanCreationException:无法自动装配方法:void org.springframework.transaction.annotation.AbstractTransactionManagementConfiguration.setConfigurers(java.util.Collection); 嵌套异常是org.springframework.beans.factory.BeanCreationException:在类ru.mystamps.web.config.DbConfig中定义名为'entityManagerFactory'的bean时出错:bean的实例化失败; 嵌套异常是org.springframework.beans.factory.BeanDefinitionStoreException:工厂方法[public org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean ru.mystamps.web.config.DbConfig.entityManagerFactory()]引发异常; 嵌套异常是java.lang.IllegalArgumentException:DataSource不能为null
映射来自web.xml:
<context-param>
<param-name>spring.profiles.default</param-name>
<param-value>dev</param-value>
</context-param>
<servlet>
<servlet-name>spring</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<init-param>
<param-name>contextClass</param-name>
<param-value>
org.springframework.web.context.support.AnnotationConfigWebApplicationContext
</param-value>
</init-param>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>
ru.mystamps.web.config.MvcConfig,
ru.mystamps.web.config.DbConfig
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
Run Code Online (Sandbox Code Playgroud)
DbConfig.java:
@Configuration
@EnableTransactionManagement
@ImportResource("classpath:spring/datasource.xml")
public class DbConfig {
@Autowired
private DataSource dataSource;
@Bean
public JpaVendorAdapter jpaVendorAdapter() {
final HibernateJpaVendorAdapter jpaVendorAdapter =
new HibernateJpaVendorAdapter();
jpaVendorAdapter.setDatabasePlatform(dialectClassName);
jpaVendorAdapter.setShowSql(showSql);
return jpaVendorAdapter;
}
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
final LocalContainerEntityManagerFactoryBean entityManagerFactory =
new LocalContainerEntityManagerFactoryBean(); …Run Code Online (Sandbox Code Playgroud) 有谁知道在taskwarrior过滤器中是否可以应用条件(例如'not').
我想列出除了与一个项目相关的任务之外的所有任务.
假设我有项目A到F,我想要除项目C之外的所有任务.看起来这可能是标签(使用负号),但我不能让它为项目工作.
将 Togglz 与我的 Spring MVC 应用程序集成时出现异常。
例外
java.lang.IllegalStateException: Could not find the FeatureManager. For web applications please verify that the TogglzFilter starts up correctly. In other deployment scenarios you will typically have to implement a FeatureManagerProvider as described in the 'Advanced Configuration' chapter of the documentation.
org.togglz.core.context.FeatureContext.getFeatureManager(FeatureContext.java:53)
org.togglz.core.manager.LazyResolvingFeatureManager.getDelegate(LazyResolvingFeatureManager.java:24)
org.togglz.core.manager.LazyResolvingFeatureManager.getCurrentFeatureUser(LazyResolvingFeatureManager.java:49)
org.togglz.console.TogglzConsoleServlet.isFeatureAdmin(TogglzConsoleServlet.java:75)
org.togglz.console.TogglzConsoleServlet.service(TogglzConsoleServlet.java:62)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.togglz.servlet.TogglzFilter.doFilter(TogglzFilter.java:100)
Run Code Online (Sandbox Code Playgroud)
以下依赖项在 maven 中定义 -
<dependency>
<groupId>org.togglz</groupId>
<artifactId>togglz-core</artifactId>
<version>2.3.0.Final</version>
</dependency>
<!-- Spring integration (optional) -->
<dependency>
<groupId>org.togglz</groupId>
<artifactId>togglz-spring-web</artifactId>
<version>2.3.0.Final</version>
</dependency>
<!-- Togglz Admin Console -->
<dependency>
<groupId>org.togglz</groupId> …Run Code Online (Sandbox Code Playgroud) 使用OpenShift聚合日志记录时,我将日志很好地输入到elasticsearch中.但是,apache记录的行最终会出现在message字段中.
我想在Kibana中创建查询,我可以单独访问URL,状态代码和其他字段.为此,需要完成特殊的apache访问日志解析.
我怎样才能做到这一点?
这是kibana中的示例条目:
{
"_index": "42-steinbruchsteiner-staging.3af0bedd-eebc-11e6-af4b-005056a62fa6.2017.03.29",
"_type": "fluentd",
"_id": "AVsY3aSK190OXhxv4GIF",
"_score": null,
"_source": {
"time": "2017-03-29T07:00:25.595959397Z",
"docker_container_id": "9f4fa85a626d2f5197f0028c05e8e42271db7a4c674cc145204b67b6578f3378",
"kubernetes_namespace_name": "42-steinbruchsteiner-staging",
"kubernetes_pod_id": "56c61b65-0b0e-11e7-82e9-005056a62fa6",
"kubernetes_pod_name": "php-app-3-weice",
"kubernetes_container_name": "php-app",
"kubernetes_labels_deployment": "php-app-3",
"kubernetes_labels_deploymentconfig": "php-app",
"kubernetes_labels_name": "php-app",
"kubernetes_host": "itsrv1564.esrv.local",
"kubernetes_namespace_id": "3af0bedd-eebc-11e6-af4b-005056a62fa6",
"hostname": "itsrv1564.esrv.local",
"message": "10.1.3.1 - - [29/Mar/2017:01:59:21 +0200] "GET /kwf/status/health HTTP/1.1" 200 2 "-" "Go-http-client/1.1"\n",
"version": "1.3.0"
},
"fields": {
"time": [
1490770825595
]
},
"sort": [
1490770825595
]
}
Run Code Online (Sandbox Code Playgroud) 我使用Apache CXF 2.4.2,当我从数据库向用户返回一些对象时,我想要排除一些属性(例如,密码).如何在不创建临时课的情况下做到这一点?这有注释吗?
我最近使用INTELLIJ IDE完成了一个简单的spring boot应用程序。这些应用程序可以作为Spring应用程序在本地运行,也可以在Tomcat中运行。
对于我的下一步,我希望能够在线托管该应用程序,但是我所做的每一次尝试似乎都失败了,它甚至没有在Xampp的Tomcat上运行。
这是我的等级制度:
application.properties:
spring.datasource.driver-class-name = com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://xxx.xxx.xxx.xxx:3306/db_digitrainer
spring.datasource.username=test
spring.datasource.password=test
server.context-path=/digitrainer
management.context-path=/manage
Run Code Online (Sandbox Code Playgroud)
Application.java:
@SpringBootApplication
@Configuration
@EnableAutoConfiguration
@EnableWebMvc
@ComponentScan
public class Application extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(Application.class);
}
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
Run Code Online (Sandbox Code Playgroud)
我一直无法找到有关如何执行此操作的任何明确信息,所以我很想知道我做错了什么,以及spring boot是否是开发rest API的方法。
我正在使用有状态集在Kubernetes上创建一个MongoDB集群.我在我的有状态集中配置了3个mongo副本.
现在我只使用一个命令创建有状态集和服务
kubectl create -f mongo-stateful.yaml
然后我使用mongo客户端启动mongo副本集成员.
rs.initiate(
{
_id: "replicaset1",
version: 1,
members: [
{ _id: 0, host:port1 },
{ _id: 1, host : host:port1 },
{ _id: 2, host : host:port1 }
]
}
)
Run Code Online (Sandbox Code Playgroud)
所有这些都有效,除了我想自动配置副本集成员的这一步骤.
我的问题是这个步骤是否可以自动化,是否可以将其添加到yaml文件中?
我似乎在理解这2个注释时遇到问题。我已经尝试阅读javadocs,但仍然无法弄清楚。谁能用简单的代码来帮助解释这两个问题?提前非常感谢。
我的控制器里有这样的东西:
model.attribute("hiringManagerMap",hiringManagerMap);
Run Code Online (Sandbox Code Playgroud)
我hiringManagerMap在我的jsp中访问它并在选项中显示字符串值.
我只有在Map不为null时才需要显示该字段.
我试过了<c:if test=${!hiringManagerMap['empty']}>.但是,它不起作用.即使Map不为空,它也不起作用.
请帮忙!!
java ×5
spring ×4
spring-mvc ×3
conditional ×1
cxf ×1
filtering ×1
fluentd ×1
hashmap ×1
hibernate ×1
jpa ×1
jsp ×1
jstl ×1
kubernetes ×1
mongodb ×1
replicaset ×1
taskwarrior ×1
togglz ×1
tomcat ×1