我有一个Next.js应用,正在使用apollo-server-micro和apollo-client。当用户遇到登录突变时,我无法设置cookie会话。这是我的server.js设置(从npm开始)
const express = require('express');
const next = require('next');
const { apolloServer } = require('pages/api/graphql');
const cookieSession = require('cookie-session');
const dev = process.env.NODE_ENV !== 'production';
const app = nextApp({ dev });
const handle = app.getRequestHandler();
app.prepare().then(() => {
const server = express();
server.use(express.static('./public'));
server.use(
'/api',
cookieSession({
httpOnly: false,
keys: ['super-secret-key'],
maxAge: 24 * 60 * 60 * 1000,
name: 'xyz',
})
);
server.get('*', handle);
server.listen(8000, () => {
console.log('Server running on port 8000');
})
})
在pages/api/graphql.js
中,我有以下代码(直接来自Next.js文档)
import { ApolloServer } from 'apollo-server-micro'
import { schema } from '../../apollo/schema'
export const apolloServer = new ApolloServer({
schema,
context: (ctx) => {
return ctx.req;
}
})
export const config = {
api: {
bodyParser: false
}
}
export default apolloServer.createHandler({ path: '/api/graphql' })
这是登录的突变
const jobs = require('../data/jobs');
const users = require('../data/users');
const getUserByEmail = email => users.find(user => user.email === email);
export const resolvers = {
Query: {
viewer (_parent, _args, _context, _info) {
return { id: 1, name: 'John Smith', status: 'cached' }
},
jobs: (parent, args, context, info) => {
return jobs;
}
},
Mutation: {
login: (parent, args, context, info) => {
const { email } = args;
const user = getUserByEmail(email);
console.log(context.headers);
if (user) {
context.req = {
...context.req,
session: user
}
return user;
}
}
}
}
目前还没有加密功能,我只想暂时启动并运行它。我将如何设置会话(以便Cookie出现在Chrome中,并可用于以后的传入请求)
更新:Apollo客户端配置
import React from 'react'
import Head from 'next/head'
import { ApolloProvider } from '@apollo/react-hooks'
import { ApolloClient } from 'apollo-client'
import { InMemoryCache } from 'apollo-cache-inmemory'
let apolloClient = null
/**
* Creates and provides the apolloContext
* to a next.js PageTree. Use it by wrapping
* your PageComponent via HOC pattern.
* @param {Function|Class} PageComponent
* @param {Object} [config]
* @param {Boolean} [config.ssr=true]
*/
export function withApollo (PageComponent, { ssr = true } = {}) {
const WithApollo = ({ apolloClient, apolloState, ...pageProps }) => {
const client = apolloClient || initApolloClient(apolloState)
return (
<ApolloProvider client={client}>
<PageComponent {...pageProps} />
</ApolloProvider>
)
}
// Set the correct displayName in development
if (process.env.NODE_ENV !== 'production') {
const displayName =
PageComponent.displayName || PageComponent.name || 'Component'
if (displayName === 'App') {
console.warn('This withApollo HOC only works with PageComponents.')
}
WithApollo.displayName = `withApollo(${displayName})`
}
if (ssr || PageComponent.getInitialProps) {
WithApollo.getInitialProps = async ctx => {
const { AppTree } = ctx
// Initialize ApolloClient, add it to the ctx object so
// we can use it in `PageComponent.getInitialProp`.
const apolloClient = (ctx.apolloClient = initApolloClient())
// Run wrapped getInitialProps methods
let pageProps = {}
if (PageComponent.getInitialProps) {
pageProps = await PageComponent.getInitialProps(ctx)
}
// Only on the server:
if (typeof window === 'undefined') {
// When redirecting, the response is finished.
// No point in continuing to render
if (ctx.res && ctx.res.finished) {
return pageProps
}
// Only if ssr is enabled
if (ssr) {
try {
// Run all GraphQL queries
const { getDataFromTree } = await import('@apollo/react-ssr')
await getDataFromTree(
<AppTree
pageProps={{
...pageProps,
apolloClient
}}
/>
)
} catch (error) {
// Prevent Apollo Client GraphQL errors from crashing SSR.
// Handle them in components via the data.error prop:
// https://www.apollographql.com/docs/react/api/react-apollo.html#graphql-query-data-error
console.error('Error while running `getDataFromTree`', error)
}
// getDataFromTree does not call componentWillUnmount
// head side effect therefore need to be cleared manually
Head.rewind()
}
}
// Extract query data from the Apollo store
const apolloState = apolloClient.cache.extract()
return {
...pageProps,
apolloState
}
}
}
return WithApollo
}
/**
* Always creates a new apollo client on the server
* Creates or reuses apollo client in the browser.
* @param {Object} initialState
*/
function initApolloClient (initialState) {
// Make sure to create a new client for every server-side request so that data
// isn't shared between connections (which would be bad)
if (typeof window === 'undefined') {
return createApolloClient(initialState)
}
// Reuse client on the client-side
if (!apolloClient) {
apolloClient = createApolloClient(initialState)
}
return apolloClient
}
/**
* Creates and configures the ApolloClient
* @param {Object} [initialState={}]
*/
function createApolloClient (initialState = {}) {
const ssrMode = typeof window === 'undefined'
const cache = new InMemoryCache().restore(initialState)
// Check out https://github.com/zeit/next.js/pull/4611 if you want to use the AWSAppSyncClient
return new ApolloClient({
ssrMode,
link: createIsomorphLink(),
cache
})
}
function createIsomorphLink () {
if (typeof window === 'undefined') {
const { SchemaLink } = require('apollo-link-schema')
const { schema } = require('./schema')
return new SchemaLink({ schema })
} else {
const { HttpLink } = require('apollo-link-http')
return new HttpLink({
uri: '/apii/graphql',
credentials: 'same-origin'
})
}
}
更新:使用apollo micro的Apollo服务器配置
import { ApolloServer } from 'apollo-server-micro'
import { schema } from '../../apollo/schema'
export const apolloServer = new ApolloServer({
schema,
context: (ctx) => {
return ctx.req;
}
})
export const config = {
api: {
bodyParser: false
}
}
export default apolloServer.createHandler({ path: '/api/graphql' })
答案 0 :(得分:1)
如果您使用的是SchemaLink,我认为,您只需从req
获取PageContext
对象,然后使用它来重构GraphQL上下文对象。
const { AppTree, req } = ctx
// elsewhere
new SchemaLink({ schema, context: { req } })
这是一个不使用SchemaLink的示例,您可以将其用于项目。关键是从PageContext
中提取cookie值。然后,您可以使用它创建一个填充Cookie标头的自定义fetch
实现,然后将此获取函数传递给您的HttpLink
构造函数。
let apolloClient: ApolloClient<any>
export const getClient = (
initialState: NormalizedCacheObject = {},
cookie?: string,
): ApolloClient<any> => {
const fetch: WindowOrWorkerGlobalScope['fetch'] = async (url, init = {}) => {
const headers = { ...init.headers } as Record<string, string>
if (cookie) {
headers.Cookie = cookie
}
const response = await unfetch(url, {
...init,
headers,
})
return response
}
return new ApolloClient<any>({
ssrMode: typeof window === 'undefined',
link: new HttpLink({
uri: 'http://localhost:3000/graphql',
credentials: 'same-origin',
fetch,
}),
cache: new InMemoryCache().restore(initialState),
})
}
export const initApollo = (
initialState?: NormalizedCacheObject,
cookie?: string,
): ApolloClient<any> => {
if (typeof window === 'undefined') {
return getClient(initialState, cookie)
}
if (!apolloClient) {
apolloClient = getClient(initialState, cookie)
}
return apolloClient
}
export const withApollo = (PageComponent: NextPage, { ssr = true } = {}) => {
const WithApollo = ({ apolloState, ...pageProps }: WithApolloProps) => {
const client = apolloClient || initApollo(apolloState)
return (
<ApolloProvider client={client} >
<PageComponent {...pageProps} />
</ApolloProvider>
)
}
if (ssr || PageComponent.getInitialProps) {
WithApollo.getInitialProps = async (ctx: PageContext) => {
const { AppTree } = ctx
const cookie = (ctx.req && ctx.req.headers.cookie) || undefined
const apolloClient = (ctx.apolloClient = initApollo({}, cookie))
let pageProps = {}
if (PageComponent.getInitialProps) {
pageProps = await PageComponent.getInitialProps(ctx)
}
if (typeof window === 'undefined') {
if (ctx.res && ctx.res.finished) {
return pageProps
}
if (ssr) {
try {
const { getDataFromTree } = await import('@apollo/react-ssr')
await getDataFromTree(
<AppTree
pageProps={{
...pageProps,
apolloClient,
}}
/>,
)
} catch (error) {
console.error('Error while running `getDataFromTree`', error)
}
Head.rewind()
}
}
const apolloState = apolloClient.cache.extract()
return {
...pageProps,
apolloState,
}
}
}
return WithApollo
}
顺便说一句,您要确保在初始化Apollo Server时正确设置了上下文。不要只返回req
对象,因为这会将您的上下文设置为req对象。而是:
context: ({ req }) => {
return { req };
}
,然后确保您正确解析了解析器中的会话:
context.req.session.user = user
照原样,您的代码正在覆盖与用户的会话对象,这不是您想要执行的操作。在会话上设置用户属性意味着您可以在代码中的其他地方context.req.session.user
进行访问。
答案 1 :(得分:0)
这是本文https://www.rockyourcode.com/nextjs-with-apollo-ssr-cookies-and-typescript/
的解决方案ERROR 2021-06-28 15:14:42,543 [main] org.mule.runtime.module.deployment.internal.DefaultArchiveDeployer: Failed to deploy artifact [hello-world-2.1.4-mule-application-example]
org.mule.runtime.deployment.model.api.DeploymentException: Failed to deploy artifact [hello-world-2.1.4-mule-application-example]
Caused by: org.mule.runtime.api.exception.MuleRuntimeException: org.mule.runtime.deployment.model.api.DeploymentInitException: NoSuchBeanDefinitionException: No qualifying bean of type 'org.mule.runtime.api.scheduler.SchedulerService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
Caused by: org.mule.runtime.deployment.model.api.DeploymentInitException: NoSuchBeanDefinitionException: No qualifying bean of type 'org.mule.runtime.api.scheduler.SchedulerService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
Caused by: org.mule.runtime.core.api.config.ConfigurationException: Error creating bean with name '_muleMetadataService': Unsatisfied dependency expressed through field 'cacheManager'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name '_metadataCacheManager': Unsatisfied dependency expressed through field 'objectStoreManager'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name '_muleObjectStoreManager': Unsatisfied dependency expressed through method 'setSchedulerService' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.mule.runtime.api.scheduler.SchedulerService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
Caused by: org.mule.runtime.api.lifecycle.InitialisationException: Error creating bean with name '_muleMetadataService': Unsatisfied dependency expressed through field 'cacheManager'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name '_metadataCacheManager': Unsatisfied dependency expressed through field 'objectStoreManager'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name '_muleObjectStoreManager': Unsatisfied dependency expressed through method 'setSchedulerService' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.mule.runtime.api.scheduler.SchedulerService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name '_muleMetadataService': Unsatisfied dependency expressed through field 'cacheManager'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name '_metadataCacheManager': Unsatisfied dependency expressed through field 'objectStoreManager'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name '_muleObjectStoreManager': Unsatisfied dependency expressed through method 'setSchedulerService' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.mule.runtime.api.scheduler.SchedulerService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:596) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:374) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1411) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.mule.runtime.config.internal.ObjectProviderAwareBeanFactory.getBean(ObjectProviderAwareBeanFactory.java:78) ~[classes/:?]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:849) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.mule.runtime.config.internal.SpringRegistry.doInitialise(SpringRegistry.java:101) ~[classes/:?]
at org.mule.runtime.core.internal.registry.AbstractRegistry.initialise(AbstractRegistry.java:94) ~[classes/:?]
at org.mule.runtime.core.internal.registry.MuleRegistryHelper.fireLifecycle(MuleRegistryHelper.java:111) ~[classes/:?]
at org.mule.runtime.core.internal.lifecycle.MuleContextLifecycleManager$MuleContextLifecycleCallback.onTransition(MuleContextLifecycleManager.java:73) ~[classes/:?]
at org.mule.runtime.core.internal.lifecycle.MuleContextLifecycleManager$MuleContextLifecycleCallback.onTransition(MuleContextLifecycleManager.java:1) ~[classes/:?]
at org.mule.runtime.core.privileged.lifecycle.AbstractLifecycleManager.invokePhase(AbstractLifecycleManager.java:132) ~[classes/:?]
at org.mule.runtime.core.internal.lifecycle.MuleContextLifecycleManager.fireLifecycle(MuleContextLifecycleManager.java:61) ~[classes/:?]
at org.mule.runtime.core.internal.context.DefaultMuleContext.initialise(DefaultMuleContext.java:321) ~[classes/:?]
at org.mule.runtime.core.api.context.DefaultMuleContextFactory.doCreateMuleContext(DefaultMuleContextFactory.java:177) ~[classes/:?]
at org.mule.runtime.core.api.context.DefaultMuleContextFactory.createMuleContext(DefaultMuleContextFactory.java:60) ~[classes/:?]
at org.mule.runtime.module.deployment.impl.internal.artifact.ArtifactContextBuilder.lambda$2(ArtifactContextBuilder.java:485) ~[classes/:?]
at org.mule.runtime.core.api.util.ExceptionUtils.tryExpecting(ExceptionUtils.java:224) ~[classes/:?]
at org.mule.runtime.core.api.util.ClassUtils.withContextClassLoader(ClassUtils.java:967) ~[classes/:?]
at org.mule.runtime.core.api.util.ClassUtils.withContextClassLoader(ClassUtils.java:885) ~[classes/:?]
at org.mule.runtime.module.deployment.impl.internal.artifact.ArtifactContextBuilder.build(ArtifactContextBuilder.java:397) ~[classes/:?]
at org.mule.runtime.module.deployment.impl.internal.application.DefaultMuleApplication.doInit(DefaultMuleApplication.java:235) ~[classes/:?]
at org.mule.runtime.module.deployment.impl.internal.application.DefaultMuleApplication.init(DefaultMuleApplication.java:204) ~[classes/:?]
at org.mule.runtime.core.api.util.ExceptionUtils.tryExpecting(ExceptionUtils.java:265) ~[classes/:?]
at org.mule.runtime.core.api.util.ClassUtils.withContextClassLoader(ClassUtils.java:924) ~[classes/:?]
at org.mule.runtime.core.api.util.ClassUtils.withContextClassLoader(ClassUtils.java:862) ~[classes/:?]
at org.mule.runtime.module.deployment.impl.internal.artifact.DeployableArtifactWrapper.executeWithinArtifactClassLoader(DeployableArtifactWrapper.java:146) ~[classes/:?]
at org.mule.runtime.module.deployment.impl.internal.artifact.DeployableArtifactWrapper.init(DeployableArtifactWrapper.java:89) ~[classes/:?]
at org.mule.runtime.module.deployment.internal.DefaultArtifactDeployer.doInit(DefaultArtifactDeployer.java:141) ~[classes/:?]
at org.mule.runtime.module.deployment.internal.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:60) ~[classes/:?]
at org.mule.runtime.module.deployment.internal.DefaultArchiveDeployer.deployArtifact(DefaultArchiveDeployer.java:466) [classes/:?]
at org.mule.runtime.module.deployment.internal.DefaultArchiveDeployer.deployExplodedApp(DefaultArchiveDeployer.java:237) [classes/:?]
at org.mule.runtime.module.deployment.internal.DefaultArchiveDeployer.deployExplodedArtifact(DefaultArchiveDeployer.java:569) [classes/:?]
at org.mule.runtime.module.deployment.internal.DefaultArchiveDeployer.deployExplodedArtifact(DefaultArchiveDeployer.java:1) [classes/:?]
at org.mule.runtime.module.deployment.internal.DeploymentDirectoryWatcher.deployExplodedApps(DeploymentDirectoryWatcher.java:251) [classes/:?]
at org.mule.runtime.module.deployment.internal.DeploymentDirectoryWatcher.run(DeploymentDirectoryWatcher.java:321) [classes/:?]
at org.mule.runtime.module.deployment.internal.DeploymentDirectoryWatcher.start(DeploymentDirectoryWatcher.java:151) [classes/:?]
at org.mule.runtime.module.deployment.internal.MuleDeploymentService.start(MuleDeploymentService.java:156) [classes/:?]
at org.mule.runtime.module.launcher.MuleContainer.start(MuleContainer.java:256) [classes/:?]
at org.mule.runtime.module.launcher.MuleContainer.main(MuleContainer.java:125) [classes/:?]
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name '_metadataCacheManager': Unsatisfied dependency expressed through field 'objectStoreManager'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name '_muleObjectStoreManager': Unsatisfied dependency expressed through method 'setSchedulerService' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.mule.runtime.api.scheduler.SchedulerService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:596) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:374) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1411) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.mule.runtime.config.internal.ObjectProviderAwareBeanFactory.getBean(ObjectProviderAwareBeanFactory.java:78) ~[classes/:?]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:277) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1247) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1167) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:593) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:374) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1411) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.mule.runtime.config.internal.ObjectProviderAwareBeanFactory.getBean(ObjectProviderAwareBeanFactory.java:78) ~[classes/:?]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:849) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.mule.runtime.config.internal.SpringRegistry.doInitialise(SpringRegistry.java:101) ~[classes/:?]
at org.mule.runtime.core.internal.registry.AbstractRegistry.initialise(AbstractRegistry.java:94) ~[classes/:?]
at org.mule.runtime.core.internal.registry.MuleRegistryHelper.fireLifecycle(MuleRegistryHelper.java:111) ~[classes/:?]
at org.mule.runtime.core.internal.lifecycle.MuleContextLifecycleManager$MuleContextLifecycleCallback.onTransition(MuleContextLifecycleManager.java:73) ~[classes/:?]
at org.mule.runtime.core.internal.lifecycle.MuleContextLifecycleManager$MuleContextLifecycleCallback.onTransition(MuleContextLifecycleManager.java:1) ~[classes/:?]
at org.mule.runtime.core.privileged.lifecycle.AbstractLifecycleManager.invokePhase(AbstractLifecycleManager.java:132) ~[classes/:?]
at org.mule.runtime.core.internal.lifecycle.MuleContextLifecycleManager.fireLifecycle(MuleContextLifecycleManager.java:61) ~[classes/:?]
at org.mule.runtime.core.internal.context.DefaultMuleContext.initialise(DefaultMuleContext.java:321) ~[classes/:?]
at org.mule.runtime.core.api.context.DefaultMuleContextFactory.doCreateMuleContext(DefaultMuleContextFactory.java:177) ~[classes/:?]
at org.mule.runtime.core.api.context.DefaultMuleContextFactory.createMuleContext(DefaultMuleContextFactory.java:60) ~[classes/:?]
at org.mule.runtime.module.deployment.impl.internal.artifact.ArtifactContextBuilder.lambda$2(ArtifactContextBuilder.java:485) ~[classes/:?]
at org.mule.runtime.core.api.util.ExceptionUtils.tryExpecting(ExceptionUtils.java:224) ~[classes/:?]
at org.mule.runtime.core.api.util.ClassUtils.withContextClassLoader(ClassUtils.java:967) ~[classes/:?]
at org.mule.runtime.core.api.util.ClassUtils.withContextClassLoader(ClassUtils.java:885) ~[classes/:?]
at org.mule.runtime.module.deployment.impl.internal.artifact.ArtifactContextBuilder.build(ArtifactContextBuilder.java:397) ~[classes/:?]
at org.mule.runtime.module.deployment.impl.internal.application.DefaultMuleApplication.doInit(DefaultMuleApplication.java:235) ~[classes/:?]
at org.mule.runtime.module.deployment.impl.internal.application.DefaultMuleApplication.init(DefaultMuleApplication.java:204) ~[classes/:?]
at org.mule.runtime.core.api.util.ExceptionUtils.tryExpecting(ExceptionUtils.java:265) ~[classes/:?]
at org.mule.runtime.core.api.util.ClassUtils.withContextClassLoader(ClassUtils.java:924) ~[classes/:?]
at org.mule.runtime.core.api.util.ClassUtils.withContextClassLoader(ClassUtils.java:862) ~[classes/:?]
at org.mule.runtime.module.deployment.impl.internal.artifact.DeployableArtifactWrapper.executeWithinArtifactClassLoader(DeployableArtifactWrapper.java:146) ~[classes/:?]
at org.mule.runtime.module.deployment.impl.internal.artifact.DeployableArtifactWrapper.init(DeployableArtifactWrapper.java:89) ~[classes/:?]
at org.mule.runtime.module.deployment.internal.DefaultArtifactDeployer.doInit(DefaultArtifactDeployer.java:141) ~[classes/:?]
at org.mule.runtime.module.deployment.internal.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:60) ~[classes/:?]
at org.mule.runtime.module.deployment.internal.DefaultArchiveDeployer.deployArtifact(DefaultArchiveDeployer.java:466) ~[classes/:?]
at org.mule.runtime.module.deployment.internal.DefaultArchiveDeployer.deployExplodedApp(DefaultArchiveDeployer.java:237) ~[classes/:?]
at org.mule.runtime.module.deployment.internal.DefaultArchiveDeployer.deployExplodedArtifact(DefaultArchiveDeployer.java:569) ~[classes/:?]
at org.mule.runtime.module.deployment.internal.DefaultArchiveDeployer.deployExplodedArtifact(DefaultArchiveDeployer.java:1) ~[classes/:?]
at org.mule.runtime.module.deployment.internal.DeploymentDirectoryWatcher.deployExplodedApps(DeploymentDirectoryWatcher.java:251) ~[classes/:?]
at org.mule.runtime.module.deployment.internal.DeploymentDirectoryWatcher.run(DeploymentDirectoryWatcher.java:321) ~[classes/:?]
at org.mule.runtime.module.deployment.internal.DeploymentDirectoryWatcher.start(DeploymentDirectoryWatcher.java:151) ~[classes/:?]
at org.mule.runtime.module.deployment.internal.MuleDeploymentService.start(MuleDeploymentService.java:156) ~[classes/:?]
at org.mule.runtime.module.launcher.MuleContainer.start(MuleContainer.java:256) ~[classes/:?]
at org.mule.runtime.module.launcher.MuleContainer.main(MuleContainer.java:125) ~[classes/:?]