List of usage examples for org.springframework.util ClassUtils getPackageName
public static String getPackageName(String fqClassName)
From source file:org.cloudfoundry.identity.uaa.scim.test.TestUtils.java
public static void runScript(DataSource dataSource, String stem) throws Exception { ResourceDatabasePopulator populator = new ResourceDatabasePopulator(); String packageName = ClassUtils.getPackageName(TestUtils.class).replace(".", "/"); populator.addScript(new ClassPathResource( packageName.substring(0, packageName.lastIndexOf("/")) + "/" + stem + "-" + platform + ".sql")); Connection connection = dataSource.getConnection(); try {//from ww w.j a v a 2s . co m populator.populate(connection); } catch (ScriptStatementFailedException e) { // ignore } finally { DataSourceUtils.releaseConnection(connection, dataSource); } }
From source file:org.beast.project.template.config.WebServiceConfig.java
@Bean public Jaxb2Marshaller payloadMarshaller() { Jaxb2Marshaller marshaller = new Jaxb2Marshaller(); marshaller.setContextPath(ClassUtils.getPackageName(org.beast.project.template.model.ObjectFactory.class)); marshaller.setSchemas(schemaResources()); return marshaller; }
From source file:cn.ifast.oauth2server.config.ServletInitializer.java
@Override protected WebApplicationContext createServletApplicationContext() { AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext(); context.scan(ClassUtils.getPackageName(getClass())); return context; }
From source file:org.glytoucan.api.soap.ApplicationTests.java
@Before public void init() throws Exception { marshaller.setPackagesToScan(ClassUtils.getPackageName(AliasRegisterRequest.class)); marshaller.afterPropertiesSet();//from ww w.j a v a2s .c om }
From source file:service.ApplicationTests.java
@Before public void init() throws Exception { marshaller.setPackagesToScan(ClassUtils.getPackageName(GetCountryRequest.class)); marshaller.afterPropertiesSet();// w ww. j a v a2 s. c o m }
From source file:com.github.eddumelendez.autoconfigure.TestAutoConfigurationPackageRegistrar.java
@Override public void registerBeanDefinitions(AnnotationMetadata metadata, BeanDefinitionRegistry registry) { AnnotationAttributes attributes = AnnotationAttributes .fromMap(metadata.getAnnotationAttributes(TestAutoConfigurationPackage.class.getName(), true)); AutoConfigurationPackages.register(registry, ClassUtils.getPackageName(attributes.getString("value"))); }
From source file:org.shaigor.rest.retro.security.gateway.config.SecureWebAppInitializer.java
@Override protected WebApplicationContext createServletApplicationContext() { AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext(); context.getEnvironment().setActiveProfiles("prod"); context.scan(ClassUtils.getPackageName(getClass())); return context; }
From source file:org.unidle.web.BuildTimestampInterceptor.java
@Override public void postHandle(final HttpServletRequest request, final HttpServletResponse response, final Object handler, final ModelAndView modelAndView) throws Exception { if (modelAndView.getView() instanceof RedirectView) { return;/* w ww. jav a2 s .c o m*/ } if (modelAndView.getViewName() != null && modelAndView.getViewName().startsWith(REDIRECT_URL_PREFIX)) { return; } String packageName = ""; if (handler instanceof HandlerMethod) { packageName = ClassUtils.getPackageName(((HandlerMethod) handler).getBean().getClass()); } if (packageName.startsWith("org.unidle")) { modelAndView.addObject(BUILD_TIMESTAMP.getName(), timestamp); } }
From source file:org.unidle.web.SegmentIoApiKeyInterceptor.java
@Override public void postHandle(final HttpServletRequest request, final HttpServletResponse response, final Object handler, final ModelAndView modelAndView) throws Exception { if (modelAndView.getView() instanceof RedirectView) { return;// w w w . j a va 2s . c om } if (modelAndView.getViewName() != null && modelAndView.getViewName().startsWith(REDIRECT_URL_PREFIX)) { return; } String packageName = ""; if (handler instanceof HandlerMethod) { packageName = ClassUtils.getPackageName(((HandlerMethod) handler).getBean().getClass()); } if (packageName.startsWith("org.unidle")) { modelAndView.addObject(SEGMENT_IO_API_KEY.getName(), segmentIoApiKey); } }
From source file:org.unidle.web.CurrentUserInterceptor.java
@Override public void postHandle(final HttpServletRequest request, final HttpServletResponse response, final Object handler, final ModelAndView modelAndView) throws Exception { if (modelAndView.getView() instanceof RedirectView) { return;/*from w w w. j a v a 2 s . c o m*/ } if (modelAndView.getViewName() != null && modelAndView.getViewName().startsWith(REDIRECT_URL_PREFIX)) { return; } String packageName = ""; if (handler instanceof HandlerMethod) { packageName = ClassUtils.getPackageName(((HandlerMethod) handler).getBean().getClass()); } if (packageName.startsWith("org.unidle")) { modelAndView.addObject(CURRENT_USER.getName(), userService.currentUser()); } }