Tag: config

我可以为Spring Boot应用创建多个入口点吗?

在Spring Boot中 ,需要指定一个主类,它是应用程序的入口点。 通常,这是一个带有标准主方法的简单类,如下所示; @SpringBootApplication public class MySpringApplication { public static void main(String [] args) { SpringApplication.run(MySpringApplication.class, args); } } 然后,在运行应用程序时,将此类指定为主入口点。 但是,我想使用config来运行我的代码,使用config来定义它,而不使用不同的jar ! (我知道重建jar会让我指定一个替代的主类,但这实际上给了我两个应用程序,而不是一个!所以,我怎么能这样做来利用一个带有两个主类的jar并选择一个通过Spring application.yml文件?

NetBeans配置文件(netbeans.conf)位于何处?

我的NetBeans在界面中有丑陋的字体。 我要为它做抗锯齿。 在互联网上,我看到应该有 -J-Dswing.aatext = true -J-Dawt.useSystemAAFontSettings = on 在netbeans_default_options中 。 该文件应位于/etc/netbeans.conf中。 但是没有这个文件。 我有NetBeans 6.8。 请帮忙。 UPD : [ockonal @ wincode~] $ cd~ / .netbeans / 6.8 / [ockonal @ wincode 6.8] $ ls ant build.properties docs lib modules sources update_tracking bin config jsstubs lock native update var UPD2使用utilite find我做了: find / -name’netbeans.conf’ 这给了我: /usr/share/netbeans/etc/netbeans.conf

Java Config @Bean未在其他@Configuration类中自动assembly

尝试使用Java Config设置Spring 4 Web应用程序时遇到了将配置类中创建的bean自动assembly到另一个配置类的问题。 ‘dataSource’bean在MyBatisConfig类中具有空值。 这似乎是配置中唯一没有正确连接的bean。 查看Spring调试日志(请参阅下面最后一个代码块中的日志的最后一部分),它看起来正确实例化,但似乎也被破坏了? 我的配置有什么问题? PropertySourcesPlaceholderConfigurerConfig类: package nl.somesite.teamshot.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; import org.springframework.core.io.ClassPathResource; @Configuration public class PropertySourcesPlaceholderConfigurerConfig { @Bean public PropertySourcesPlaceholderConfigurer propertyConfigurer() { PropertySourcesPlaceholderConfigurer propertyConfigurer = new PropertySourcesPlaceholderConfigurer(); propertyConfigurer.setLocation(new ClassPathResource(“application.properties”)); /*propertyConfigurer.setLocation(new ClassPathResource(“file:${catalina.home}/conf/application.properties”)); propertyConfigurer.setLocation(new ClassPathResource(“/var/lib/openshift/517874b8e0b8cd218e000391/app-root/data/apache-tomcat-7.0.39/conf/application.properties”));*/ propertyConfigurer.setIgnoreUnresolvablePlaceholders(false); propertyConfigurer.setIgnoreResourceNotFound(true); return propertyConfigurer; } } DbConfig类: package nl.somesite.teamshot.config; import org.apache.commons.dbcp.BasicDataSource; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; […]

@PropertySource中的classpath通配符

我正在使用Spring Java配置来创建我的bean。 但是这个bean在2个应用程序中很常见。 两者都有一个属性文件abc.properties但具有不同的类路径位置。 当我把类似的显式类路径 @PropertySource(“classpath:/app1/abc.properties”) 然后它工作,但当我尝试使用通配符时 @PropertySource(“classpath:/**/abc.properties”) 然后它不起作用。 我尝试了许多通配符的组合,但它仍然无法正常工作。 通配符是否在@ProeprtySource是否有任何其他方法可以读取标记为@Configurations @ProeprtySource中的属性。

在Spring Security Java Config中创建多个HTTP部分

使用Spring Security XML配置,您可以定义多个HTTP元素,以便为应用程序的不同部分指定不同的访问规则。 8.6高级命名空间配置中给出的示例定义了应用程序的单独的有状态和无状态部分,前者使用会话和表单登录,后者不使用会话和BASIC身份validation: 我无法弄清楚如何使用Java Config做同样的事情。 重要的是我禁用会话并为我的Web服务使用不同的入口点。 现在我有以下内容: @Override public void configure(WebSecurity security) { security.ignoring().antMatchers(“/resource/**”, “/favicon.ico”); } @Override protected void configure(HttpSecurity security) throws Exception { security .authorizeRequests() .anyRequest().authenticated() .and().formLogin() .loginPage(“/login”).failureUrl(“/login?loginFailed”) .defaultSuccessUrl(“/ticket/list”) .usernameParameter(“username”) .passwordParameter(“password”) .permitAll() .and().logout() .logoutUrl(“/logout”).logoutSuccessUrl(“/login?loggedOut”) .invalidateHttpSession(true).deleteCookies(“JSESSIONID”) .permitAll() .and().sessionManagement() .sessionFixation().changeSessionId() .maximumSessions(1).maxSessionsPreventsLogin(true) .sessionRegistry(this.sessionRegistryImpl()) .and().and().csrf() .requireCsrfProtectionMatcher((r) -> { String m = r.getMethod(); return !r.getServletPath().startsWith(“/services/”) && (“POST”.equals(m) || […]

Spring Java Config vs Jboss 7

我试图在jboss上运行一个基于spring java的配置的简单应用程序,但没有成功。 这个应用程序在jetty和tomcat上都可以正常工作。 jboss日志看起来不错,因为它向我展示了一些成功的映射等,但我得到404试图访问该URL。 这是我的代码: 初始化 @Order(1) public class Initializer extends AbstractAnnotationConfigDispatcherServletInitializer { @Override protected Class[] getRootConfigClasses() { return new Class[] {RootConfig.class}; } @Override protected Class[] getServletConfigClasses() { return new Class[] {WebAppConfig.class}; } @Override protected String[] getServletMappings() { return new String[] {“/”}; } @Override protected void customizeRegistration(ServletRegistration.Dynamic registration) { registration.setInitParameter(“dispatchOptionsRequest”, “true”); } } RootConfig @Configuration […]