Tag: 配置

没有为行动和结果定义结果

默认结果不是仅使用我的包的结果进行渲染。 Flow转到我的n0result方法然后它抛出Exception 。 请更正我错误的配置。 输出: Hello How are you noresult() method got called….. Dec 26, 2013 12:48:04 PM org.apache.struts2.dispatcher.Dispatcher serviceAction SEVERE: Could not find action or result No result defined for action leo.struts.HelloWorldAction and result noresult – action – file:/D:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Strut2Examples/WEB-INF/classes/struts.xml:99:93 at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:350) 形成: 在struts.xml /noresultend.jsp /noresultdefaultdispatcher.jsp 行动: public String noresult() throws Exception { System.out.println(“Hello How […]

Spring Boot:从数据库中检索配置

任何人都可以为我提供一些指导,帮助我实现这一目标。 我想扩展Spring Boot Externalized Configuration,以便我有一个方法可以在我的应用程序的任何地方调用。 此方法将使用键检索属性值。 此方法将首先询问数据库表,如果找不到指定的键,则它将回退到1中描述的PropertySource顺序。 所以我有一个类似的服务: @Service public class ConfigurationService { private final ConfigurationRepository configurationRepository; @Autowired public ConfigurationService(ConfigurationRepository configurationRepository) { this.configurationRepository = configurationRepository; } public String getValue(String key) { Configuration configuration = configurationRepository.findOne(key); // Add something here to get the property from application.properties if the key does not exist in the db return […]

tomcat中特定页面/ url-patterns的SSL

我最近使用SSL和客户端身份validation配置了tomcat 6,但我能做到的唯一方法是修改服务器配置文件(web.xml,server.xml)。 但由于我没有对部署服务器的完全控制,我想在不修改主配置文件的情况下为我的应用程序的某些页面或url-patterns配置所有内容。 例如:主服务器: Application1 – > HTTP Application2 – > HTTP MyApplication – > HTTPS 如果有人知道怎么做,请告诉我。

如何在设置新配置后更新所有弹簧对象?

在动态配置更改后,如何刷新以前的@Autowired弹簧对象? // Here is my updateConfig method GenericApplicationContext context = new GenericApplicationContext(); XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(context); reader.loadBeanDefinitions(new ClassPathResource(“applicationContext.xml”)); context.refresh(); myApplicationContextAware.setApplicationContext(context); 使用myApplicationContextAware.applicationContext.getBean(MyClass.class)我可以通过新配置获取新实例,但所有@Autowired对象仍包含旧值 有没有解决弹簧对象的解决方案?

我可以在Java Properties文件中的多行属性之间或之后放置注释吗?

我有一个属性配置文件,其属性有许多以逗号分隔的值。 我想在其中一些旁边放置评论,但似乎这不可能吗? 我希望能够做到这样的事情: property: value1,\ value2,\ … value44,\ value45,\ # value45 comment … value89,\ # another comment value90 澄清:我将配置提供给我不拥有的Web服务,因此我不能使用属性格式的扩展之一,如bracket-properties

使用log4j2的多个线程的不同日志文件

我正在运行一个Java应用程序,我在其中调用多个线程,每个线程都有一些唯一的名称。 现在我想为每个日志文件创建多个日志文件,日志文件的名称应该作为线程名称。 这可能是使用log4j2。 请帮我写log4j2配置文件。 先谢谢你。

如何在运行时更新SpringBoot应用程序的配置,而无需重新加载整个ApplicationContext

我试图找出如何在Spring Boot应用程序中动态更新/重新加载外部化配置,而无需重新启动整个应用程序。 大多数建议涉及在更改外部化配置后重新加载ApplicationContext,但这相当于重新启动整个应用程序,因此这并非真正有用。 通过阅读SpringBoot参考文档,我找到了第23.7章Typesafe配置属性 。 如果我理解正确,这允许定义简单的POJO类,它将您的应用程序(外部化)配置值保存为属性。 至少在理论上,此方案可用于仅将bean绑定到所需的配置POJO,并且在配置更改时只更新POJO中的值。 组件可以在下次访问POJO上的getter时轻松获取更改… 但是,我还没有设法弄清楚如何启用这种行为。 当相关配置发生变化时,是否有一些明显的方法可以动态更新使用@ConfigurationProperties注释的组件?

开发和生产的属性

我有一个GlassFish / j2ee应用程序,我在一个盒子上开发,生产是一个远程盒子。 我有一个制作文件的function,我需要根据我的开发盒或制作文件的位置不同。 什么是自动切换方式,因此我不必根据部署位置编辑源文件?

在Hadoop中传播自定义配置值

在Map / Reduce期间,有没有办法设置和(稍后)在Hadoop中获取自定义配置对象? 例如,假设一个应用程序预处理一个大文件并动态确定与该文件相关的一些特征。 此外,假设这些特征保存在自定义Java对象中(例如, Properties对象,但不是唯一的,因为一些可能不是字符串),并且随后对于每个映射和减少作业都是必需的。 应用程序如何“传播”此配置,以便每个映射器和reducerfunction可以在需要时访问它? 一种方法可能是使用JobConf类的set(String, String)方法,例如,通过第二个参数传递序列化为JSON字符串的配置对象,但这可能是太多的黑客然后适当无论如何,每个Mapper和Reducer都必须访问JobConf实例(例如,遵循前面问题中建议的方法)。

将基于Spring的Spring转换为基于Java的配置

我尽量不使用任何xml。 像这样:转换为@Bean @Bean public RestTemplate restTemplate() { RestTemplate restTemplate = new RestTemplate(); List<HttpMessageConverter> converters = new ArrayList<HttpMessageConverter>(); converters.add(marshallingMessageConverter()); restTemplate.setMessageConverters(converters); return restTemplate; } 问题在这里。 com.cloudlb.domain.User 尝试将“com.cloudlb.domain.User”转换为Class []而不是工作。 @Bean public MarshallingHttpMessageConverter marshallingMessageConverter() { Jaxb2Marshaller marshaller = new Jaxb2Marshaller(); // List<Class> listClass = new ArrayList<Class>(); listClass.add(User.class); marshaller.setClassesToBeBound((Class[])listClass.toArray()); // ——————————– return new MarshallingHttpMessageConverter(marshaller, marshaller); } 错误:投射问题。 先谢谢你。